Issue2709

classification
Title: test_chdir shortname failures on some later Windows filesystems
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: pending Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: adamburke, jamesmudd, jeff.allen
Priority: normal Keywords:

Created on 2018-10-18.03:32:18 by adamburke, last changed 2018-11-03.13:02:16 by jeff.allen.

Messages
msg12140 (view) Author: Adam Burke (adamburke) Date: 2018-10-18.03:32:16
Am seeing failures of test_chdir.test_windows_chdir_dos_path on my Windows machine. Reproducible from Windows 10, using windows cmd and cygwin command lines on JDK 8 and 10. 

JDK 8 example:

c:\working\working>%JY%\dist\bin\jython.exe -m test.regrtest -v test_chdir
== 2.7.2a1+ (, Oct 16 2018, 11:40:48)
== [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]
== platform: java1.8.0_111
== encodings: stdin=cp850, stdout=cp850, FS=utf-8
== locale: default=('en_AU', 'windows-1252'), actual=(None, None)
test_chdir
test_chdir (test.test_chdir.ChdirTestCase) ... ok
...
======================================================================
ERROR: test_windows_chdir_dos_path (test.test_chdir.WindowsChdirTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Adam\jython\jython\dist\Lib\test\test_chdir.py", line 193, in test_windows_chdir_dos_path
    os.chdir(dos_name)
OSError: [Errno 2] No such file or directory: 'C:\\Users\\Adam\\AppData\\Local\\Temp\\tmpbd0rjl\\progra~1'

----------------------------------------------------------------------
Ran 42 tests in 0.778s

FAILED (errors=1)
test test_chdir failed -- Traceback (most recent call last):
  File "C:\Users\Adam\jython\jython\dist\Lib\test\test_chdir.py", line 193, in test_windows_chdir_dos_path
    os.chdir(dos_name)
OSError: [Errno 2] No such file or directory: 'C:\\Users\\Adam\\AppData\\Local\\Temp\\tmpbd0rjl\\progra~1'

1 test failed:
    test_chdir
1 fail unexpected:
    test_chdir
 
The immediate cause seems to be the otherwise reasonable re-inclusion of this test for windows in the fix for http://bugs.jython.org/issue2646

That seems to be failing because, as I have learned, it is no longer universal for all windows files and directories to have equivalent short DOS ("8dot3") names.

https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-8dot3name

The setting lives at a filesystem level, and can be read from the command line with the fsutil command

C:\Users\Adam\jython\jython>fsutil 8dot3name query
The registry state is: 1 (Disable 8dot3 name creation on all volumes).

I have a potential fix which basically involves some checks for validity in the unit test itself. I will raise a github PR.
msg12141 (view) Author: Adam Burke (adamburke) Date: 2018-10-18.03:33:09
Raised under 2.7 as it seems there is a 2.7.3 and 2.7.4 version in the bugtracker but not 2.7.1 or 2.7.2
msg12142 (view) Author: Adam Burke (adamburke) Date: 2018-10-18.04:36:46
https://github.com/jythontools/jython/pull/116

Am rerunning the full regrtest suite against some different JDK versions / cygwin etc.
msg12168 (view) Author: Jeff Allen (jeff.allen) Date: 2018-11-03.13:02:16
Now in at https://hg.python.org/jython/rev/3dbf6da78abf

Thanks Adam.
History
Date User Action Args
2018-11-03 13:02:16jeff.allensetpriority: normal
status: open -> pending
resolution: accepted
messages: + msg12168
2018-10-18 04:36:47adamburkesetmessages: + msg12142
2018-10-18 03:33:09adamburkesetmessages: + msg12141
2018-10-18 03:32:18adamburkecreate