RFR: 8251466: test/java/io/File/GetXSpace.java fails on Windows with mapped network drives.
Andrey Turbanov
aturbanov at openjdk.java.net
Thu Jan 20 21:18:13 UTC 2022
Test `test/java/io/File/GetXSpace.java` always failed on my machine with this output:
----------System.out:(12/489)----------
--- Testing df
C:/Programs/cygwin64 292848636 49695320 243153316 17% /
D: 59672 59672 0 100% /cygdrive/d
SecurityManager = null
C:/Programs/cygwin64:
df total= 299877003264 free = 0 usable = 248988995584
getX total= 299877003264 free = 248988995584 usable = 248988995584
::
df total= 61104128 free = 0 usable = 0
getX total= 0 free = 0 usable = 0
----------System.err:(23/1617)----------
java.nio.file.InvalidPathException: Illegal char <:> at index 0: :
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
at java.base/java.io.File.toPath(File.java:2396)
at GetXSpace.compare(GetXSpace.java:223)
at GetXSpace.testDF(GetXSpace.java:403)
at GetXSpace.main(GetXSpace.java:437)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:833)
Parsing of df output is incorrect. It skips first symbols after matching of line.
https://github.com/openjdk/jdk/blob/293fb46f7cd28f2a08055e3eb8ec9459d64e9688/test/jdk/java/io/File/GetXSpace.java#L160
It means that after matching first line:
C:/Programs/cygwin64 292848636 49695320 243153316 17% /
It skips first symbols of next line - symbol `D` and then proceeds to match _corrupted_ line:
: 59672 59672 0 100% /cygdrive/d
Problems affects only Windows, because only in Windows case first group of matcher is used:
https://github.com/openjdk/jdk/blob/293fb46f7cd28f2a08055e3eb8ec9459d64e9688/test/jdk/java/io/File/GetXSpace.java#L155-L156
Testing:
* Windows x64 - always failed before. No errors after fix
* Linux x64
-------------
Commit messages:
- 8251466: test/java/io/File/GetXSpace.java fails on Windows with mapped network drives.
Changes: https://git.openjdk.java.net/jdk/pull/7170/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7170&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8251466
Stats: 6 lines in 1 file changed: 0 ins; 1 del; 5 mod
Patch: https://git.openjdk.java.net/jdk/pull/7170.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7170/head:pull/7170
PR: https://git.openjdk.java.net/jdk/pull/7170
More information about the core-libs-dev
mailing list