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
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, fwierzbicki, yecril71pl
Priority: Keywords:

Created on 2012-07-02.00:08:58 by Arfrever, last changed 2014-11-11.21:50:41 by yecril71pl.

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.
History
Date User Action Args
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