[issue2413] os.strerror does not check for out of range argument
Georg Brandl [EMAIL PROTECTED] added the comment: IMO, the current behavior is the least problematic. It also mirrors the rest of Python's posix-wrapping calls: if something usable is returned, use it; if NULL is returned, raise an error. For most people, Unknown error XXX or Value error: strerror() argument out of range won't be much different in terms of user experience. Rejecting this patch. -- nosy: +georg.brandl resolution: - rejected status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Ralf Schmitt [EMAIL PROTECTED] added the comment: The current behaviour (without your patch) seems ok to me. I just wanted to point out that the patch in its current form could break on some platforms. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Ralf Schmitt [EMAIL PROTECTED] added the comment: my manpage (debian testing) states: POSIX.1-2001 permits strerror() to set errno if the call encounters an error, but does not specify what value should be returned as the func‐ tion result in the event of an error. On some systems, strerror() returns NULL if the error number is unknown. On other systems, str‐ error() returns a string something like Error nnn occurred and sets errno to EINVAL if the error number is unknown. So, I think this patch should be rejected. -- nosy: +schmir __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Alexander Belopolsky [EMAIL PROTECTED] added the comment: And on some system Unknown error: nnn is returned with no error indication. Your concern that the patch is invalid on some unidentified system. This concern can easily be addressed by checking for NULL return *in addition* to the errno check. The real question is whether it is desirable to raise ValueError from strerror() when error code is out of bound. I would say the existing code intends to do exactly that, but th error check is incorrect on at least one popular platform. I believe it is better to raise an error because as a user, seeing unknown error has occurred message, is one of the worst experiences. On the other hand, if the consensus is that strerror() should always (short of out of memory condition) return a string, then (assuming null return is a possibility) the code needs to be changed to return Unknown error: nnn instead of raising an error. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Changes by Terry J. Reedy [EMAIL PROTECTED]: -- nosy: -tjreedy __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Changes by Alexander Belopolsky [EMAIL PROTECTED]: -- components: +Extension Modules __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Changes by Alexander Belopolsky [EMAIL PROTECTED]: Added file: http://bugs.python.org/file9755/posix-strerror.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
New submission from Alexander Belopolsky [EMAIL PROTECTED]: ISO/ANSI C strerror indicates out of range error by setting errno, but existing code incorrectly checks for NULL return value. Attached patch (tested n Mac OS X) makes os.strerror raise ValueError for out of range argument. -- files: posix-strerror.diff keywords: patch messages: 64023 nosy: belopolsky severity: normal status: open title: os.strerror does not check for out of range argument type: behavior versions: Python 2.5, Python 2.6, Python 3.0 Added file: http://bugs.python.org/file9754/posix-strerror.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Changes by Terry J. Reedy [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file9754/posix-strerror.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2413] os.strerror does not check for out of range argument
Terry J. Reedy [EMAIL PROTECTED] added the comment: Removed earlier version -- nosy: +tjreedy __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com