Issue1944

classification
Title: Opening of /dev/null or /dev/zero with "w" mode fails in non-English locales
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: Arfrever, fwierzbicki, yecril71pl, zyasoft
Priority: urgent Keywords:

Created on 2012-07-02.00:08:58 by Arfrever, last changed 2015-02-11.22:09:16 by zyasoft.

Messages
msg7304 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-07-02.00:08:57
Opening of e.g. /dev/null or /dev/zero with "w" mode fails in non-English locales.
("Argument invalide" is "Bad argument" in English locale.)

$ LC_ALL="en_US.UTF-8" jython2.5 -c 'open("/dev/null", "w")'
$ LC_ALL="en_US.UTF-8" jython2.7 -c 'open("/dev/null", "w")'
$ LC_ALL="fr_FR.UTF-8" jython2.5 -c 'open("/dev/null", "w")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IOError: Argument invalide
$ LC_ALL="fr_FR.UTF-8" jython2.7 -c 'open("/dev/null", "w")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IOError: Argument invalide
msg7848 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-27.18:23:11
Arfrever: does this still fail for you? I know we've made some locale fixes so maybe this has been addressed?
msg7859 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2013-02-27.20:11:09
Bug is still present.
msg9188 (view) Author: Christopher Yeleighton (yecril71pl) Date: 2014-10-31.13:20:25
This bug causes test_os (test_devnull) to fail.
msg9203 (view) Author: Christopher Yeleighton (yecril71pl) Date: 2014-11-11.18:17:35
The following codintion fails:

Errno .EINVAL .description() .equals (ioe .getMessage()))

where ioe is an IOException caused by the fact that you cannot truncate a device.  The condition is used to suppress the exception.

Now, (Errno .EINVAL .description()) is in English and (IOError .getMessage()) is in Polish so they cannot be equal.  I think the code is overzealous here and the additional check should be removed.

File: FileIO.java, Line 217

Please fix :-) please please please <:-(
msg9205 (view) Author: Christopher Yeleighton (yecril71pl) Date: 2014-11-11.21:50:41
Note that the Errno class used is not a standard Java construct and the descriptions returned do not come from the system; they are strings embedded into the source code of the fake Errno.
msg9455 (view) Author: Jim Baker (zyasoft) Date: 2015-01-26.04:20:22
Problem doesn't seem to occur on OSX, but I can reproduce on Ubuntu 14.10
msg9462 (view) Author: Jim Baker (zyasoft) Date: 2015-01-28.19:11:27
Blocker for beta 4
msg9483 (view) Author: Jim Baker (zyasoft) Date: 2015-02-03.05:53:22
Fixed as of https://hg.python.org/jython/rev/31b98240dcf1
History
Date User Action Args
2015-02-11 22:09:16zyasoftsetstatus: pending -> closed
2015-02-03 05:53:22zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg9483
2015-01-28 19:11:27zyasoftsetpriority: high -> urgent
messages: + msg9462
2015-01-26 04:20:23zyasoftsetpriority: high
assignee: zyasoft
resolution: accepted
messages: + msg9455
nosy: + zyasoft
2014-11-11 21:50:41yecril71plsetmessages: + msg9205
2014-11-11 18:17:35yecril71plsetmessages: + msg9203
2014-10-31 13:20:25yecril71plsetmessages: + msg9188
2014-10-30 21:41:17yecril71plsetnosy: + yecril71pl
components: + Core
versions: + Jython 2.7
2013-02-27 20:11:09Arfreversetmessages: + msg7859
2013-02-27 18:23:11fwierzbickisetmessages: + msg7848
2012-07-02 00:08:58Arfrevercreate