Red Hat Bugzilla – Bug 689794
ctrl+c does not work during python getpass.getpass() (was: Unable to terminate sss_obfuscate)
Last modified: 2011-12-06 05:24:06 EST
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):
Steps to Reproduce:
1. Run the command "sss_obfuscate -d AD"
2. Try to interrupt with ctrl+c or ctrl+d
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
1. ctrl+c should interrupt sss_obfuscate.
2. ctrl+d should stop sss_obfuscate without any traceback messages.
The ctrl+c issue is a python bug being tracked here:
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.
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.
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.
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.
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.
Patch is upstream, albeit not for 2.6; 2.7 version is here:
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.
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.