diff -Nru apport-2.20.7/bin/apport-cli apport-2.20.7/bin/apport-cli --- apport-2.20.7/bin/apport-cli 2017-10-24 15:21:16.000000000 +0000 +++ apport-2.20.7/bin/apport-cli 2017-11-08 20:54:28.000000000 +0000 @@ -34,8 +34,12 @@ self.buttons = [] self.visible = False - def raw_input_char(self, prompt): - '''raw_input, but read only one character''' + def raw_input_char(self, prompt, multi_char=False): + '''raw_input, but read a single character unless multi_char is True. + + @param: prompt: the text presented to the user to solict a response. + @param: multi_char: Boolean True if we need to read until . + ''' sys.stdout.write(prompt) sys.stdout.write(' ') @@ -48,14 +52,16 @@ attributes[6][termios.VMIN] = 1 attributes[6][termios.VTIME] = 0 termios.tcsetattr(file, termios.TCSANOW, attributes) - try: - ch = str(sys.stdin.read(1)) + if multi_char: + response = str(sys.stdin.readline()).strip() + else: + response = str(sys.stdin.read(1)) finally: termios.tcsetattr(file, termios.TCSANOW, saved_attributes) sys.stdout.write('\n') - return ch + return response def show(self): self.visible = True @@ -82,9 +88,19 @@ for index, button in enumerate(self.buttons): print(' %s: %s' % (self.keys[index], button)) - response = self.raw_input_char(_('Please choose (%s):') % ('/'.join(self.keys))) + if len(self.keys) <= 10: + # A 10 option prompt would can still be a single character + # response because the 10 options listed will be 1-9 and C. + # Therefore there are 10 unique responses which can be + # given. + multi_char = False + else: + multi_char = True + response = self.raw_input_char( + _('Please choose (%s):') % ('/'.join(self.keys)), + multi_char) try: - return self.keys.index(response[0].upper()) + 1 + return self.keys.index(response.upper()) + 1 except ValueError: pass except KeyboardInterrupt: diff -Nru apport-2.20.7/debian/changelog apport-2.20.7/debian/changelog --- apport-2.20.7/debian/changelog 2017-10-24 15:22:21.000000000 +0000 +++ apport-2.20.7/debian/changelog 2017-11-08 20:54:35.000000000 +0000 @@ -1,3 +1,11 @@ +apport (2.20.7-0ubuntu3.2) artful; urgency=medium + + * bin/apport-cli: read until 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 Wed, 08 Nov 2017 12:54:35 -0800 + apport (2.20.7-0ubuntu3.1) artful; urgency=medium * etc/apport/crashdb.conf: Disable Launchpad crash reports for 17.10