Merge lp:~rbalint/ubuntu-release-upgrader/ubuntu-release-upgrader-screen into lp:ubuntu-release-upgrader

Proposed by Balint Reczey
Status: Merged
Merged at revision: 3050
Proposed branch: lp:~rbalint/ubuntu-release-upgrader/ubuntu-release-upgrader-screen
Merge into: lp:ubuntu-release-upgrader
Diff against target: 37 lines (+9/-1)
3 files modified
DistUpgrade/DistUpgradeMain.py (+0/-1)
DistUpgrade/screenrc (+2/-0)
debian/changelog (+7/-0)
To merge this branch: bzr merge lp:~rbalint/ubuntu-release-upgrader/ubuntu-release-upgrader-screen
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+323395@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Balint Reczey (rbalint) wrote :

Testing this is a bit tricky since on Zesty the upgrade process downloads a tarball from Artful and uses the code from there.
After Artful has this code the test can be added to Zesty, too.

Revision history for this message
Brian Murray (brian-murray) wrote :

One manual way to test release upgrades is to put the dist_upgrader tarball, from the package build, on a system you want to upgrade. Then you can extract the tarball which will contain a file named after the release to which you are upgrading and run that file with the appropriate arguments e.g.

./artful --frontend DistUpgradeViewText

That's just from memory though so I may be slightly wrong.

Revision history for this message
Balint Reczey (rbalint) wrote :

I used this dirty patch to build a test package:

--- a/DistUpgrade/DistUpgradeFetcherCore.py
+++ b/DistUpgrade/DistUpgradeFetcherCore.py
@@ -106,6 +106,8 @@ class DistUpgradeFetcherCore(object):
         except tarfile.ReadError as e:
             logging.error("failed to open tarfile (%s)" % e)
             return False
+ print("fix screen usage")
+ subprocess.call(["cp","/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeMain.py",self.tmpdir])
         return True

     def verifyDistUprader(self):

Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for working on this! The bug report indicates that the argument to "-L" is optional, if that is the case wouldn't it be simpler to just make "-L" the last argument to screen? This way screen would just use whatever the default log file name is and we'd be consistent across releases.

Revision history for this message
Balint Reczey (rbalint) wrote :

The last arguments are the original cmd line args, thus IMO we can't really do that.

This could have worked but it did not:
$ screen -S fdsfa -L -- top -d 1
-L: logfile name can not start with "-" symbol

Revision history for this message
Brian Murray (brian-murray) wrote :

Okay, I was just trying to find a way that would reduce the amount of changes necessary to resolve the issue. Given that we are distributing and using our own screenrc file I thought we might get it to work by modifying it. I added the following lines to screenrc:

deflog on
log on

I also removed the passing of the -L switch to screen and that seemed to work i.e. /var/log/dist-upgrade/screenlog.0 was written to. What do you think about that instead?

It's also worth noting that the apport package hooks collects the screenlog and expects the log file name to be screenlog.0 so we should keep that log file name the same.

Revision history for this message
Balint Reczey (rbalint) wrote :

I would not like screen logging by default. There can be sensitive information in the terminal from remote systems for example.

I have updated the patch to use screenlog.0, but there seems to be an even better option, updating screen in Zesty :-):

I'm glad to announce that the new version of GNU Screen (4.5.1) has been released today!

https://savannah.gnu.org/forum/forum.php?forum_id=8807 :

 ...
 4.5.1 is a bugfix/security release.
 We fixed few crashes and, of course, problem with privilege escalation.
 We also changed behavior of '-L' option: now you can set new logfile name using '-Logfile' option and '-L' just tells screen to turn on logging.
 ...

Revision history for this message
Balint Reczey (rbalint) wrote :

Since is it not clear when the screen package gets updated for Zesty and also not clear whether the update bumps the version number the fix checked in the original version I've updated the fix to check the actual behavior, not the version.

Revision history for this message
Brian Murray (brian-murray) wrote :

On Tue, May 02, 2017 at 08:33:33AM -0000, Balint Reczey wrote:
> I would not like screen logging by default. There can be sensitive information in the terminal from remote systems for example.

I'm not sure I understand this point, the screenrc file in the
dist-upgrader tarball is only used when the distribution upgrade process
calls screen and it logged whenever it called screen anyway so whether
we try and use -L or set the log options in the screenrc file the
results are the same.

> I have updated the patch to use screenlog.0, but there seems to be an even better option, updating screen in Zesty :-):

Fixing screen does seem like the best idea though.

--
Brian Murray

3049. By Launchpad Translations on behalf of ubuntu-core-dev <Unknown>

Launchpad automatic translations update.

3050. By Balint Reczey

Turn on screen's logging in screenrc instead of via command line because
the command line syntax is changed in screen 4.5.0 (LP: #1686117)

Revision history for this message
Balint Reczey (rbalint) wrote :

> On Tue, May 02, 2017 at 08:33:33AM -0000, Balint Reczey wrote:
> > I would not like screen logging by default. There can be sensitive
> information in the terminal from remote systems for example.
>
> I'm not sure I understand this point, the screenrc file in the
> dist-upgrader tarball is only used when the distribution upgrade process
> calls screen and it logged whenever it called screen anyway so whether
> we try and use -L or set the log options in the screenrc file the
> results are the same.

I thought you were referring to screen package's screenrc not the one we use here.
I think using the screenrc in the downloaded tarball is the best option indeed and
even if screen gets fixed in Zesty it is cleaner.

I have updated the patch to use screenrc and dropped the autopkgtest because it is
not really worth it to run it only for this small change.

>
> > I have updated the patch to use screenlog.0, but there seems to be an even
> better option, updating screen in Zesty :-):
>
> Fixing screen does seem like the best idea though.
>
> --
> Brian Murray

Revision history for this message
Brian Murray (brian-murray) wrote :

Alright, thanks! I'll go ahead and get this merged and uploaded.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DistUpgrade/DistUpgradeMain.py'
2--- DistUpgrade/DistUpgradeMain.py 2016-01-13 17:53:27 +0000
3+++ DistUpgrade/DistUpgradeMain.py 2017-05-03 11:02:55 +0000
4@@ -193,7 +193,6 @@
5 # unset escape key with -e, enable log with -L, set name with -S
6 cmd = ["screen",
7 "-e", "\\0\\0",
8- "-L",
9 "-c", "screenrc",
10 "-S", SCREENNAME]+sys.argv
11 logging.info("re-exec inside screen: '%s'" % cmd)
12
13=== modified file 'DistUpgrade/screenrc'
14--- DistUpgrade/screenrc 2010-11-29 09:23:24 +0000
15+++ DistUpgrade/screenrc 2017-05-03 11:02:55 +0000
16@@ -1,3 +1,5 @@
17+deflog on
18+log on
19 logfile /var/log/dist-upgrade/screenlog.%n
20 logtstamp on
21 zombie xr
22\ No newline at end of file
23
24=== modified file 'debian/changelog'
25--- debian/changelog 2017-04-24 22:08:48 +0000
26+++ debian/changelog 2017-05-03 11:02:55 +0000
27@@ -1,3 +1,10 @@
28+ubuntu-release-upgrader (1:17.10.2) UNRELEASED; urgency=medium
29+
30+ * Turn on screen's logging in screenrc instead of via command line because
31+ the command line syntax is changed in screen 4.5.0 (LP: #1686117)
32+
33+ -- Balint Reczey <rbalint@ubuntu.com> Thu, 27 Apr 2017 18:33:00 +0200
34+
35 ubuntu-release-upgrader (1:17.10.1) artful; urgency=medium
36
37 * DistUpgrade/{EOL,Devel}ReleaseAnnouncement,

Subscribers

People subscribed via source and target branches