[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Roundup Robot devnull@devnull added the comment: New changeset 154b323e0e7f by Senthil Kumaran in branch '3.1': Fix for issue11236 getpass.getpass to respond ctrl-c or ctrl-z http://hg.python.org/cpython/rev/154b323e0e7f -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Roundup Robot devnull@devnull added the comment: New changeset a3b4887edba4 by Senthil Kumaran in branch '2.7': issue11236 getpass.getpass to respond ctrl-c or ctrl-z http://hg.python.org/cpython/rev/a3b4887edba4 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Senthil Kumaran sent...@uthcode.com added the comment: I have made the changes in 3.3,3.2,3.1 and 2.7 codeline. The behavior is aligned with the 2.5 (and earlier) behaviors. I cannot change this 2.6 because this is not a security issue to be back-ported. (rather it was misinterpreted problem and resulted in changed behavior in 2.6). I shall update this in README file just that people note this change -- resolution: - fixed stage: test needed - committed/rejected type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Roundup Robot devnull@devnull added the comment: New changeset f799530dbde7 by Senthil Kumaran in branch '3.1': Update News entry for Issue11236 http://hg.python.org/cpython/rev/f799530dbde7 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Roundup Robot devnull@devnull added the comment: New changeset 1b261f3bef09 by Senthil Kumaran in branch '2.7': Update NEWS for Issue11236. http://hg.python.org/cpython/rev/1b261f3bef09 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Senthil Kumaran sent...@uthcode.com added the comment: Updated the NEWS entry. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Martin v. Löwis mar...@v.loewis.de added the comment: Greg: Can you please comment what the original motivation was for removing ISIG from the flags? This is your change, from issue 7208, AFAICT. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Changes by Antoine Pitrou pit...@free.fr: -- nosy: -pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Guido van Rossum gu...@python.org added the comment: Is there any reason to assume this is not a bug? I think it should be fixed in all versions. -- nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: By the way, in another thread i've seen a link to issue960406, where Guido van Rossum states (in msg46074): Ideally, ^C should always cause the signal handler for SIGINT to be called, and the KeyboardInterrupt should be generated by the default SIGINT handler Thus removing ISIG contradicts approaches Python has chosen to use a long time ago (tracks get lost, as always). Just in case anybody is not convinced yet that ISIG has to go. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Senthil Kumaran orsent...@gmail.com added the comment: Agree to removing of termios.ISIG so that we get a KeyBoardInterrupt exception raised when CNTL-C is pressed. Looking at discussion more carefully, it does not present any security risk. Should this be fixed in 3.3 only with NEWS detailing the change in behavior (back to old 2.5 behavior) or should be this be backported? Close similarity with getpass.c 's behavior had lent some to support to this change in 2.6. Changing now in older codeline has some chances of breaking others code. Someone who has been affected by this change in behavior should provide some insights if back-porting would make sense. -- assignee: - orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Roundup Robot devnull@devnull added the comment: New changeset c177faafec51 by Senthil Kumaran in branch 'default': issue11236 getpass.getpass to respond ctrl-c or ctrl-z http://hg.python.org/cpython/rev/c177faafec51 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Merlijn van Deen valhall...@gmail.com added the comment: @orsenthil Close similarity with getpass.c 's behavior had lent some to support to this change in 2.6. Changing now in older codeline has some chances of breaking others code. Someone who has been affected by this change in behavior should provide some insights if back-porting would make sense. Most code will probably have been updated their getpass code with a line like if '\x03' in text: raise KeyboardInterrupt() ( http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8978 ) However, people might have changed their code from try: pass = getpass.getpass() except KeyboardInterrupt: print Ctrl-C! to: pass = getpass.getpass() if \x03' in pass: print Ctrl-C! which will break with this change. The first workaround makes more sense, though, so I suspect very little code will be broken by reverting the ISIG flag. Overall, I think most people are not aware of the removal, either because they still use python 2.5 or because they don't press ctrl-c. They are still in for a surprise if the ISIG flag is not removed (although it will probably stay in the 2.6 branch, anyway?). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Changes by Éric Araujo mer...@netwok.org: -- Removed message: http://bugs.python.org/msg130613 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Éric Araujo mer...@netwok.org added the comment: If this bugs needs to be solved before #11466 can be fixed, let’s mark it as a dependency. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: The attached 11236.depend.patch updates Merlijn's patch so that it applies cleanly just in case the #11466.5.patch is used in the end. -- Added file: http://bugs.python.org/file21298/11236.depend.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___diff --git a/Lib/getpass.py b/Lib/getpass.py --- a/Lib/getpass.py +++ b/Lib/getpass.py @@ -60,7 +60,7 @@ try: old = termios.tcgetattr(fd) # a copy to save new = old[:] -new[3] = ~(termios.ECHO|termios.ISIG) # 3 == 'lflags' +new[3] = ~termios.ECHO # 3 == 'lflags' tcsetattr_flags = termios.TCSAFLUSH if hasattr(termios, 'TCSASOFT'): tcsetattr_flags |= termios.TCSASOFT ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Steffen Daode Nurpmeso sdao...@googlemail.com added the comment: I do consider this as a bug, too (you hit ^C - and it doesn't help!)! I've opened #11466 due to a different problem, but since raising (the expected) KeyboardInterrupt would trigger that problem, too, i've included stripping termios.ISIG in file21081. -- nosy: +sdaoden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Éric Araujo mer...@netwok.org added the comment: Please do not mix issues. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Senthil Kumaran orsent...@gmail.com added the comment: I fail to see the bug here. Python's getpass.py is mimicing the behavior of getpass.c Your patch tries to remove, termios.ISIG , but it was specifically added so that getpass.py is closer to the POSIX's getpass http://mail.python.org/pipermail/python-dev/2003-December/040579.html Also, try an example program which uses getpass.c http://www.koders.com/c/fidFB8B9443522DCC3CC53ECCC0FFED861FE898F3A1.aspx?s=%22unknown%22 And try ctrl-c and ctrl-z for those, the behavior is same what you decribe in this bug-report. So, having the function behavior sames as POSIX one is really not a bug and just a change from the previous behavior. Would you agree to this stance and shall we close the bug? -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Merlijn van Deen valhall...@gmail.com added the comment: No, I do not, for several reasons. First of all, this is not a change *from* previous behaviour, but a change *back to* previous behaviour. And sensible behaviour, too. Secondly, I have tested what getpass does on windows (Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32). There, I get a KeyboardInterrupt when pressing ctrl-c. So for the simple reason of having consistend cross-platform behaviour, either the linux or the windows implementation should change. Thirdly, the reason for adding the ISIG flag was that it is 'a possible security hole' - but no-one actually mentions *what* that hole would be. As Guido notes (in that same thread!): Sorry, but this just doesn't make sense. There are so many differences between C and Python that you can't just compare a C and a Python version of a function and pointing at the differences as possible security holes or bugs.. Lastly, I see no reason to mimic POSIX behaviour per se. Why not use the POSIX getpass function in the first place, then? By the way - even with ISIG on, it should be possible to support KeyboardInterrupts - just read per-character instead of per-line (cf. the windows getpass). [1] http://mail.python.org/pipermail/python-dev/2003-December/040583.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Éric Araujo mer...@netwok.org added the comment: Thanks for the report. Would you like to contribute a patch? If so, guidelines are found at http://docs.python.org/devguide/ -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Merlijn van Deen valhall...@gmail.com added the comment: Sorry, I'm not going to run my patch through the entire test suite, I've got better things to do with my time than setting up a working python-development-test-bench. Especially for a one-line-revert. The result now is: valhallasw@dorthonion:~/src/pythonpatch$ python -c import getpass; print getpass.getpass().__repr__() Password: Traceback (most recent call last): File string, line 1, in module File getpass.py, line 71, in unix_getpass passwd = _raw_input(prompt, stream, input=input) File getpass.py, line 133, in _raw_input line = input.readline() KeyboardInterrupt As for a patch - see attachment. It reverts one change from r76000 http://svn.python.org/view/python/trunk/Lib/getpass.py?r1=74860r2=76000pathrev=76000 line 65 The ISIG flag is copied from getpass.c (http://www.koders.com/c/fid3C9D79A0C31256E7875CB8930CF8B9E49BDA8C12.aspx line 122). According to the r76000 commit message: This change also incorporates some additional getpass implementation suggestions for security based on an analysis of getpass.c linked to from the issue. 'The issue' should probably be issue7208, but I cannot find any reference to getpass.c there. -- keywords: +patch Added file: http://bugs.python.org/file20789/issue11236.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Éric Araujo mer...@netwok.org added the comment: Thanks for the patch. Someone will write a test and we’ll check that it works correctly on all supported platforms. -- keywords: +needs review nosy: +belopolsky, gregory.p.smith, p...@fodder.org.uk, pitrou stage: needs patch - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Éric Araujo mer...@netwok.org added the comment: BTW, on which platforms did you notice the bug? (python -m platform) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Merlijn van Deen valhall...@gmail.com added the comment: Linux-2.6.22.18-co-0.7.4-i686-with-Ubuntu-10.04-lucid (the 'on linux2' versions) and Solaris-2.10-i86pc-i386-32bit-ELF (the 'on sunos5'). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Éric Araujo mer...@netwok.org added the comment: Patch fixes the bug for 3.2 on my Debian (Linux-2.6.32-5-amd64-x86_64-with-debian-wheezy-sid). getpass currently has no unit tests. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Merlijn van Deen valhall...@gmail.com added the comment: To allow people to cancel at the password prompt, we added a manual post-check. Although this check runs after return is pressed, it's better than nothing. Index: branches/rewrite/pywikibot/userinterfaces/terminal_interface.py === --- branches/rewrite/pywikibot/userinterfaces/terminal_interface.py (revision 8977) +++ branches/rewrite/pywikibot/userinterfaces/terminal_interface.py (revision 8978) @@ -175,6 +175,11 @@ if password: import getpass text = getpass.getpass('') +# See PYWP-13 / http://bugs.python.org/issue11236 +# getpass does not always raise an KeyboardInterrupt when ^C +# is pressed. +if '\x03' in text: +raise KeyboardInterrupt() else: text = raw_input() finally: http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8978 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Changes by Éric Araujo mer...@netwok.org: -- stage: - needs patch versions: +Python 3.2, Python 3.3 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11236] getpass.getpass does not respond to ctrl-c or ctrl-z
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11236 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com