Invisible prompts in do-release-upgrade

Bug #1417880 reported by Marius Gedminas on 2015-02-04
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-release-upgrader (Ubuntu)
Undecided
Unassigned
Trusty
Undecided
Unassigned
Utopic
Undecided
Unassigned

Bug Description

[Impact]

Users upgrading from 14.04 and 14.10 via the command line "do-release-upgrade" will not be able to do so unless they figure out that they need to press "y" and Enter (without the benefit of a prompt).

[Test Case]

On an affected system, run 'sudo do-release-upgrade'

When it asks if you want to continue doing this over SSH, the text ends with a blank line. If you press Enter at this point, only then will you get to see the prompt, which was

    Continue? [yN]

but by then it's too late and you already chose "no" by pressing Enter.

[Regression Potential]

The patch itself is quite small, just flushing output whenever we prompt the user. Should be safe.

[Original Report]

I'm upgrading an Ubuntu 14.04 LTS system to 14.10 over ssh with 'sudo do-release-upgrade'.

When it asks me if I want to continue doing this over SSH, the text ends with a blank line. If I press Enter at this point, only then I get to see the prompt, which was

    Continue? [yN]

but by then it's too late and I already chose "no".

The same thing happens if I restart, go past this prompt (without seeing it), then ask for details about package removals/upgrades/installs. I get a list of packages in a pager. When I quit (by pressing q) I should once more see the prompt asking me if it's okay and if I should proceed, or cancel, or see the details again. But the prompt isn't there and doesn't appear until after I input my answer.

I think there's a missing sys.stdout.flush() call somewhere in do-release-upgrade.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: ubuntu-release-upgrader-core 1:0.220.6
ProcVersionSignature: Ubuntu 3.13.0-39.66-generic 3.13.11.8
Uname: Linux 3.13.0-39-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.6
Architecture: amd64
CrashDB: ubuntu
Date: Wed Feb 4 08:16:03 2015
InstallationDate: Installed on 2012-11-02 (823 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
PackageArchitecture: all
SourcePackage: ubuntu-release-upgrader
UpgradeStatus: Upgraded to trusty on 2015-02-04 (0 days ago)

Marius Gedminas (mgedmin) wrote :
Marius Gedminas (mgedmin) wrote :

I was right. The code does print("Continue? [yN] ", end="") and then sys.stdin.readline() with no flush in between.

Here's a suggested patch for trusty's update-release-upgrader. I haven't tested it (since I already upgraded my 14.04 to 14.10). It also needs to be forward-ported to later versions so this bug won't regress.

I think this kind of UI glitch merits a SRU.

The attachment "suggested patch" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Michael Terry (mterry) wrote :

Thanks for the bug/patch! I've uploaded to vivid, will open a task for trusty

Changed in ubuntu-release-upgrader (Ubuntu):
status: New → Fix Committed
Michael Terry (mterry) wrote :

Uploaded fixes for trusty and utopic, will unsub sponsors and sub sru team.

description: updated
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-release-upgrader - 1:15.04.4

---------------
ubuntu-release-upgrader (1:15.04.4) vivid; urgency=medium

  * DistUpgrade/DistUpgradeViewText.py:
    - flush stdout before reading user input. (LP: #1417880)
 -- Marius Gedminas <email address hidden> Wed, 04 Feb 2015 09:45:06 -0500

Changed in ubuntu-release-upgrader (Ubuntu):
status: Fix Committed → Fix Released

Hello Marius, or anyone else affected,

Accepted ubuntu-release-upgrader into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/1:0.220.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in ubuntu-release-upgrader (Ubuntu Trusty):
status: New → Fix Committed
tags: added: verification-needed
Changed in ubuntu-release-upgrader (Ubuntu Utopic):
status: New → Fix Committed
Chris J Arges (arges) wrote :

Hello Marius, or anyone else affected,

Accepted ubuntu-release-upgrader into utopic-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/1:14.10.10 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Marius Gedminas (mgedmin) wrote :

I've verified do-release-upgrade on utopic (version 1:14.10.10). I haven't actually completed the upgrade, just checked that both prompts (the SSH continue prompt and the package detail prompt) show up before canceling.

Michael Terry (mterry) on 2015-02-05
tags: added: verification-done-utopic
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-release-upgrader - 1:14.10.10

---------------
ubuntu-release-upgrader (1:14.10.10) utopic; urgency=medium

  * DistUpgrade/DistUpgradeViewText.py:
    - flush stdout before reading user input. (LP: #1417880)
 -- Marius Gedminas <email address hidden> Wed, 04 Feb 2015 10:29:39 -0500

Changed in ubuntu-release-upgrader (Ubuntu Utopic):
status: Fix Committed → Fix Released
Marius Gedminas (mgedmin) wrote :

The updated package finally reached Rackspace's Ubuntu mirror and I tried to verify it on my 14.04 cloud VM. Unfortunately the bug is still present in ubuntu-release-upgrader 1:0.220.7 from trusty-proposed.

I can see that the new sys.stdout.flush() line is present in /usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeViewText.py of the updated package, so I'm baffled as to what's going on. Will try to investigate.

Marius Gedminas (mgedmin) wrote :

Any modifications I make to /usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeViewText.py (such as inserting debug print statements) do not take effect.

Is do-release-upgrade actually executing code downloaded from the Internet? Looks like it is.

'DEBUG_UPDATE_MANAGER=1 do-release-upgrade -d' shows me it's downloading a gpg-signed tarball from http://mirror.rackspace.com/ubuntu//dists/utopic/main/dist-upgrader-all/current/utopic.tar.gz, which has an older copy of DistUpgradeViewText.py, without my fix.

Modification times shown at http://archive.ubuntu.com/ubuntu//dists/utopic/main/dist-upgrader-all/current/ indicate that the main archive also lacks this fix.

Adam Conrad (adconrad) wrote :

Right, d-r-u in trusty uses utopic's, utopic uses vivid's, etc. (Well, more to the point, they use the tarball for the target series).

So, when you were testing utopic, you were actually testing vivid, and when testing trusty, you're testing pre-fix utopic.

In light of that general annoyance in reproducing and validating this, I think I'll just do a by-hand validation of the 1-line patch itself and release, and you can reopen the bug if it proves to still be broken after the tarballs are updated.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-release-upgrader - 1:0.220.7

---------------
ubuntu-release-upgrader (1:0.220.7) trusty; urgency=medium

  * DistUpgrade/DistUpgradeViewText.py:
    - flush stdout before reading user input. (LP: #1417880)
 -- Marius Gedminas <email address hidden> Wed, 04 Feb 2015 10:49:34 -0500

Changed in ubuntu-release-upgrader (Ubuntu Trusty):
status: Fix Committed → Fix Released
tags: removed: verification-needed
Marius Gedminas (mgedmin) wrote :

> you can reopen the bug if it proves to still be broken after the tarballs are updated.

When can I expect the tarballs to be updated? http://archive.ubuntu.com/ubuntu//dists/utopic/main/dist-upgrader-all/current/ still has timestamps from Oct 2014. Does this bug need an Utopic task?

(I suppose at some point Utopic will be retired and do-release-upgrade for 14.04 will start using vivid's dist-upgrader where this is fixed, so perhaps I should stop worrying about it.)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers