apport question will not accept multi-character responses

Bug #1722564 reported by Scott Moser on 2017-10-10
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Apport
Undecided
Unassigned
apport (Ubuntu)
Medium
Brian Murray
Xenial
Medium
Brian Murray
Zesty
Medium
Brian Murray
Artful
Medium
Brian Murray

Bug Description

=== Begin SRU Template ===
[Impact]
Packages which provide apport integration with more than 9 options in a choice will not be able to select options numbered >= 10 on the commandline using 'ubuntu-bug <package-name>'

[Test Case]
Overview:
 1. Update to proposed versions of cloud-init v. 17.1 and apport v. <X>
 2. Run 'ubuntu-bug cloud-init' attempt to report a bug on a cloud choice greater than 9
 3. View report and make sure the proper cloud is reported

Script:
if [ ! -f './lxc-proposed-snapshot' ]; then
  wget https://raw.githubusercontent.com/cloud-init/ubuntu-sru/master/bin/lxc-proposed-snapshot;
  chmod 755 lxc-proposed-snapshot;
fi

for release in xenial artful; do
        ref=$release-proposed;
        echo "$release START --------------";
        lxc-proposed-snapshot --proposed --publish $release $ref;
        lxc init $ref test-$release;
        lxc start test-$release;
        lxc exec test-$release -- apt install apport;
        lxc exec test-$release -- dpkg-query --show apport;
        lxc exec test-$release -- ubuntu-bug cloud-init;
done

[Regression Potential]
Minimal. This bug only affects packages with >9 bug filing options for a given choice. Worst case, is bugs filed would incorrectly represent option 1 of a selection instead of option 1X.

=== End SRU Template ===

=== original description ===
the newly added cloud-init apport support shows a list of cloud providers and asks the user to select one. There are currently 18 options. For any option > 10, apport will just take the '1' that is typed as the answer.

It should obviously wait for more than one character or a carriage return.

*** Please select the cloud vendor or environment in which this instance is running

Choices:
  1: Amazon - Ec2
  2: AliYun
  3: AltCloud
  4: Azure
  5: Bigstep
  6: CloudSigma
  7: CloudStack
  8: DigitalOcean
  9: GCE - Google Compute Engine
  10: MAAS
  11: NoCloud
  12: OpenNebula
  13: OpenStack
  14: OVF
  15: Scaleway
  16: SmartOS
  17: VMware
  18: Other
  C: Cancel
Please choose (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/C): 1

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: apport 2.20.7-0ubuntu2
ProcVersionSignature: Ubuntu 4.13.0-12.13-generic 4.13.3
Uname: Linux 4.13.0-12-generic x86_64
ApportVersion: 2.20.7-0ubuntu2
Architecture: amd64
Date: Tue Oct 10 15:21:48 2017
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
SourcePackage: apport
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Scott Moser (smoser) wrote :
Brian Murray (brian-murray) wrote :

For reasons unknown to me apport-cli only reads one character.

 37 def raw_input_char(self, prompt):
 38 '''raw_input, but read only one character'''
 39
 40 sys.stdout.write(prompt)
 41 sys.stdout.write(' ')
 42 sys.stdout.flush()
 43
 44 file = sys.stdin.fileno()
 45 saved_attributes = termios.tcgetattr(file)
 46 attributes = termios.tcgetattr(file)
 47 attributes[3] = attributes[3] & ~(termios.ICANON)
 48 attributes[6][termios.VMIN] = 1
 49 attributes[6][termios.VTIME] = 0
 50 termios.tcsetattr(file, termios.TCSANOW, attributes)
 51
 52 try:
 53 ch = str(sys.stdin.read(1))
 54 finally:
 55 termios.tcsetattr(file, termios.TCSANOW, saved_attributes)
 56
 57 sys.stdout.write('\n')
 58 return ch

Changed in apport (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Scott Moser (smoser) on 2017-10-18
Changed in apport:
status: New → Confirmed
Chad Smith (chad.smith) wrote :

This quick fix worked on my side http://paste.ubuntu.com/25715415/
allows for two char reading if choices> 10

Brian Murray (brian-murray) wrote :

Thanks for looking at this Chad. Are the variable name changes, l to s, just to make things work better with ipdb?

Brian Murray (brian-murray) wrote :

Is the cloud-init apport hook being SRU'ed? If so then I'll also get an SRU for apport started.

Changed in apport (Ubuntu Artful):
status: Triaged → In Progress
assignee: nobody → Brian Murray (brian-murray)

An upload of apport to artful-proposed has been rejected from the upload queue for the following reason: "Could we, I dunno, have consistent behaviour regardless of input length and number of choices? This is about as user-friendly as something that's not very user-friendly.".

Chad Smith (chad.smith) wrote :

Ahh brian, sorry for this delay here, I forgot to subscribe to the bug. So those variable changes where actually because I had update apport on a zesty machine but accidentally diffed against xenial source. I'll put up an official upstream apport merge proposal and link it here so we can proceed with a discussion.

On Tue, Oct 24, 2017 at 03:35:57PM -0000, Chad Smith wrote:
> Ahh brian, sorry for this delay here, I forgot to subscribe to the bug.
> So those variable changes where actually because I had update apport on
> a zesty machine but accidentally diffed against xenial source. I'll put
> up an official upstream apport merge proposal and link it here so we can
> proceed with a discussion.

I hope to get back to this soon, but the SRU team rejected the change
because sometimes you'd have to enter just one character and sometimes
you'd have to enter a character and a space e.g. '3 ' if there were more
than 9 choices.

I've still no idea why the initial decision was made to accept only one
character.

--
Brian Murray

Chad Smith (chad.smith) wrote :

Yeah that feels like a premature optomization as that limits your interface options significantly (to only 9 valid choices). I'm suprised there haven't been any other bugs related to this, but maybe there aren't a lot of cli use-cases out there with complex bug-reporting choices.
I've attached a branch that now readlines instance or read(1) for prompts which contain a large set of choices (> 10).

This merge proposal a bit more flexible as it'd also permit options where > 99 choices are presented. I would think that > 99 choices would be a usability issues as I can't fathom people reading through 100+ separate options to actually choose the one that best applies to them.

I'm not sure the SRU team understood the impact of the branch. Per the pastebin that I provided originally, the user wouldn't have to input "3 " they would input "3<enter>" or "1<enter>" or "11".

I've since changes this branch to read until <enter> for all choices if the # or choices are > 10. This means that all existing apport use-cases retain the optimized 1 character choice selection if their provided choices are <= 9. For any lists larger than that (which is currently broken in apport) the user will have to hit enter after their choice.

Chad Smith (chad.smith) wrote :

Just tested on artful both above and below the prompt choice threshold of 10 and bug reporting works. Input of "9<enter>" for single digits choices versus "13<enter>" for multi-digit choices both work now for choice prompts with long lists. Short choice list prompts retain their single character responses.

tags: added: id-59ef68f44b84c4117299967c
Scott Moser (smoser) on 2017-11-02
Changed in apport (Ubuntu Artful):
importance: Medium → Low
importance: Low → Medium
Chad Smith (chad.smith) on 2017-11-09
description: updated

Hello Scott, or anyone else affected,

Accepted apport into artful-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.7-0ubuntu3.2 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 on 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-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. 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 apport (Ubuntu Artful):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-artful
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.7-0ubuntu4

---------------
apport (2.20.7-0ubuntu4) bionic; urgency=medium

  * etc/apport/crashdb.conf: Enable Launchpad crash reports for bionic.
  * bin/apport-cli: read until <enter> instead of a single character when # of
    apport options is non-unique with a single character. Thanks to Chad Smith
    for the patch. (LP: #1722564)

 -- Brian Murray <email address hidden> Wed, 08 Nov 2017 12:18:04 -0800

Changed in apport (Ubuntu):
status: In Progress → Fix Released
Brian Murray (brian-murray) wrote :

The artful upload was superseded by a security upload. I'll get this SRU'ed shortly.

Changed in apport (Ubuntu Zesty):
assignee: nobody → Brian Murray (brian-murray)
Changed in apport (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
Brian Murray (brian-murray) wrote :

These are now in the SRU queue again and awaiting review by a team member of mine.

Adam Conrad (adconrad) wrote :

Hello Scott, or anyone else affected,

Accepted apport into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.1-0ubuntu2.14 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 on 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-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. 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 apport (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed-xenial
Changed in apport (Ubuntu Zesty):
status: New → Fix Committed
tags: added: verification-needed-zesty
Adam Conrad (adconrad) wrote :

Hello Scott, or anyone else affected,

Accepted apport into zesty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.4-0ubuntu4.9 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 on 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-zesty to verification-done-zesty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-zesty. 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!

Adam Conrad (adconrad) wrote :

Hello Scott, or anyone else affected,

Accepted apport into artful-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.7-0ubuntu3.6 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 on 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-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. 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!

Brian Murray (brian-murray) wrote :

I installed the version of apport from xenial-proposed and can confirm that choices greater than 9 now work.

*** Please select the cloud vendor or environment in which this instance is running

Choices:
  1: Amazon - Ec2
  2: AliYun
  3: AltCloud
  4: Azure
  5: Bigstep
  6: CloudSigma
  7: CloudStack
  8: DigitalOcean
  9: GCE - Google Compute Engine
  10: MAAS
  11: NoCloud
  12: OpenNebula
  13: OpenStack
  14: OVF
  15: Scaleway
  16: SmartOS
  17: VMware
  18: Other
  C: Cancel
Please choose (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/C): 18

Brian Murray (brian-murray) wrote :

I installed the version of apport from zesty-proposed and can confirm that choices greater than 9 now work.

*** Please select the cloud vendor or environment in which this instance is running

Choices:
  1: Amazon - Ec2
  2: AliYun
  3: AltCloud
  4: Azure
  5: Bigstep
  6: CloudSigma
  7: CloudStack
  8: DigitalOcean
  9: GCE - Google Compute Engine
  10: MAAS
  11: NoCloud
  12: OpenNebula
  13: OpenStack
  14: OVF
  15: Scaleway
  16: SmartOS
  17: VMware
  18: Other
  C: Cancel
Please choose (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/C): 17

Brian Murray (brian-murray) wrote :

I installed the version of apport from artful-proposed and can confirm that choices greater than 9 also work there.

*** Please select the cloud vendor or environment in which this instance is running

Choices:
  1: Amazon - Ec2
  2: AliYun
  3: AltCloud
  4: Azure
  5: Bigstep
  6: CloudSigma
  7: CloudStack
  8: DigitalOcean
  9: GCE - Google Compute Engine
  10: MAAS
  11: NoCloud
  12: OpenNebula
  13: OpenStack
  14: OVF
  15: Scaleway
  16: SmartOS
  17: VMware
  18: Other
  C: Cancel
Please choose (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/C): 16

tags: added: verification-done-artful verification-done-xenial verification-done-zesty
removed: verification-needed-artful verification-needed-xenial verification-needed-zesty
Robie Basak (racb) wrote :

Brian, when you verified these, did you also check that single digit choices can also be selected as expected? Seems to me that code path has regression potential here.

Scott Moser (smoser) wrote :
Download full text (14.5 KiB)

Robie, Brian,
I went ahead and did the reproduce in the test and selected '2' in the multi-select. Heres the full console log. My responses can be seen there alsol.

$ for release in xenial artful; do
> ref=$release-proposed;
> echo "$release START --------------";
> lxc-proposed-snapshot --proposed --publish $release $ref;
> lxc init $ref test-$release;
> lxc start test-$release;
> lxc exec test-$release -- apt install apport;
> lxc exec test-$release -- dpkg-query --show apport;
> lxc exec test-$release -- ubuntu-bug cloud-init;
> done
xenial START --------------
Creating xenial-proposed-744923888
--proposed --
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [397 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-proposed InRelease [253 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7532 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [183 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [96.5 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3212 B]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [1408 B]
Get:12 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4354 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [670 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [561 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [227 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.2 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8052 B]
Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4860 B]
Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [3220 B]
Get:22 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6616 B]
Get:23 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [3768 B]
Get:24 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 Packages [133 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-proposed/main Translation-en [52.4 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-proposed/universe amd64 Packages [59.7 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial-proposed/universe Translation-en [27.4 kB]
Fetched 15.2 MB in 9s (1521 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt ...

Scott Moser (smoser) wrote :

Full disclosure, As you can see, I ran with artful and xenial (just copied and pasted text from above). I didn't run with zesty.

Brian Murray (brian-murray) wrote :

The question regarding "cloud vendor or environment" is a couple of questions deep and I had to use single character responses to the preceding questions to get to it.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.1-0ubuntu2.14

---------------
apport (2.20.1-0ubuntu2.14) xenial; urgency=medium

  * bin/apport-cli: read until <enter> instead of a single character when # of
    apport options is non-unique with a single character. Thanks to Chad Smith
    for the patch. (LP: #1722564)

 -- Brian Murray <email address hidden> Mon, 27 Nov 2017 15:26:00 -0800

Changed in apport (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for apport has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.4-0ubuntu4.9

---------------
apport (2.20.4-0ubuntu4.9) zesty; urgency=medium

  * bin/apport-cli: read until <enter> instead of a single character when # of
    apport options is non-unique with a single character. Thanks to Chad Smith
    for the patch. (LP: #1722564)

 -- Brian Murray <email address hidden> Mon, 27 Nov 2017 15:24:59 -0800

Changed in apport (Ubuntu Zesty):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.7-0ubuntu3.6

---------------
apport (2.20.7-0ubuntu3.6) artful; urgency=medium

  * bin/apport-cli: read until <enter> instead of a single character when # of
    apport options is non-unique with a single character. Thanks to Chad Smith
    for the patch. (LP: #1722564)

 -- Brian Murray <email address hidden> Mon, 27 Nov 2017 15:22:40 -0800

Changed in apport (Ubuntu Artful):
status: Fix Committed → Fix Released
Scott Moser (smoser) on 2017-12-07
Changed in apport (Ubuntu Xenial):
importance: Undecided → Medium
Changed in apport (Ubuntu Zesty):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers