Bug 689794 - ctrl+c does not work during python getpass.getpass() (was: Unable to terminate sss_obfuscate)
ctrl+c does not work during python getpass.getpass() (was: Unable to terminat...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python (Show other bugs)
6.1
Unspecified Linux
medium Severity unspecified
: rc
: ---
Assigned To: Dave Malcolm
Petr Šplíchal
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-22 09:26 EDT by Kaushik Banerjee
Modified: 2011-12-06 05:24 EST (History)
7 users (show)

See Also:
Fixed In Version: python-2.6.6-21.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 05:24:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Kaushik Banerjee 2011-03-22 09:26:36 EDT
Description of problem:
ctrl+c doesn't terminate sss_obfuscate and traceback messages appear on using ctrl+d

Version-Release number of selected component (if applicable):
sssd-tools-1.5.1-15.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Run the command "sss_obfuscate -d AD"
2. Try to interrupt with ctrl+c or ctrl+d
3.
  
Actual results:
1. ctrl+c doesn't interrupt sss_obfuscate.
2. ctrl+d interrupts sss_obfuscate with traceback messages.
# sss_obfuscate -d AD
Enter password: Traceback (most recent call last):
  File "/usr/sbin/sss_obfuscate", line 101, in <module>
    ret = main()
  File "/usr/sbin/sss_obfuscate", line 45, in main
    p1, p2 = pprompt()
  File "/usr/sbin/sss_obfuscate", line 44, in <lambda>
    pprompt = lambda: (getpass.getpass("Enter password: "), getpass.getpass("Re-enter password: "))
  File "/usr/lib64/python2.6/getpass.py", line 71, in unix_getpass
    passwd = _raw_input(prompt, stream, input=input)
  File "/usr/lib64/python2.6/getpass.py", line 135, in _raw_input
    raise EOFError
EOFError


Expected results:
1. ctrl+c should interrupt sss_obfuscate.
2. ctrl+d should stop sss_obfuscate without any traceback messages.

Additional info:
Comment 2 Stephen Gallagher 2011-03-22 09:41:00 EDT
The ctrl+c issue is a python bug being tracked here:
http://bugs.python.org/issue11236

Also, I don't know whether I consider the traceback from ctrl+d to be a bug. You're not supposed to force an EOF in that function. It triggers completion based on a newline. Throwing a traceback seems like an appropriate behavior.

Please suggest an appropriate error message if you want me to at least override this.
Comment 3 Kaushik Banerjee 2011-03-22 10:30:05 EDT
The basic issue here is that, at the moment, user cannot interrupt the sss_obfuscate command and only ctrl+d with traceback messages work.
Maybe we can add a exception with the message "Password change aborted"?

Also, there is no limit on maximum retries either. We should set a limit of maximum 3 retries on mis-matched passwords.
Comment 4 Kaushik Banerjee 2011-03-23 08:17:04 EDT
Logged a second bug https://bugzilla.redhat.com/show_bug.cgi?id=690131 to track the issue related to ctrl+d and leave this bug to track the ctrl+c issue.
Comment 5 Stephen Gallagher 2011-03-23 08:27:51 EDT
The ctrl+c issue is a python bug as mentioned in the above comments. It is the same issue as reported in http://bugs.python.org/issue11236

Reassigning to the Python maintainer.
Comment 6 RHEL Product and Program Management 2011-04-03 22:13:08 EDT
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.
Comment 7 Dave Malcolm 2011-06-09 16:29:52 EDT
Patch is upstream, albeit not for 2.6; 2.7 version is here:
   http://hg.python.org/cpython/rev/a3b4887edba4/

Easy manual reproducer:
  python -c"import getpass; print(repr(getpass.getpass('-> ')))"
and try to press either ctrl-Z or ctrl-C.  Currently, nothing happens, and you need to press "return" to finish; the returned string contains '\x03' or '\x1a'  (or press Ctrl-D, which raises a EOFError exception).

Upon applying the patch, Ctrl-C raises a KeyboardInterupt, and Ctrl-Z backgrounds the task.
Comment 13 errata-xmlrpc 2011-12-06 05:24:06 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1564.html

Note You need to log in before you can comment on or make changes to this bug.