JDK-8251466 : test/java/io/File/GetXSpace.java fails on Windows with mapped network drives.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 11,17
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2020-08-12
  • Updated: 2022-10-13
  • Resolved: 2022-01-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 19
17.0.6Fixed 19 b08Fixed
Related Reports
Relates :  
Description
After submit of JDK-6501010 we see the test/java/io/File/GetXSpace.java failing on our Windows test machines. The issue seems to be that the 'df' call produces several lines of output on this machines. The group 1 of the matcher misses the first character in all lines except for the first one.

In a short test I changed the regex to match $ instead of  \n in the end and added the MULTILINE flag. 

Pattern.compile("([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s].*)$", Pattern.MULTILINE);

This let the test pass in our infrastructure.


Output of a failing test:
----------System.out:(24/869)----------
--- Testing df
C:/cygwin64      998257472 664791328 333466144      67% /
K:               262144000 129993392 132150608      50% /cygdrive/k
O:               734003200 641218112  92785088      88% /cygdrive/o


SecurityManager = null
C:/cygwin64:
  df   total= 1022215651328 free =            0 usable = 341469331456
  getX total= 1022215651328 free = 341469323264 usable = 341469323264
::
  df   total= 268435456000 free =            0 usable = 135322222592
  getX total=            0 free =            0 usable =            0
FAILED

The drives K: and O: are mapped network drives.

Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/781 Date: 2022-10-12 08:00:25 +0000
12-10-2022

jdk17 backport request I would like to have the patch in jdk17 as well, because the issue is present there too and shows up in our tests. Risk is low, the patch applies cleanly.
12-10-2022

Changeset: 178ac746 Author: Andrey Turbanov <aturbanov@openjdk.org> Date: 2022-01-28 07:01:21 +0000 URL: https://git.openjdk.java.net/jdk/commit/178ac7465360729628521a0d555253b9fb2ad7bf
28-01-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7170 Date: 2022-01-20 21:10:39 +0000
20-01-2022

Always fails for me too: ----------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) I wonder why tests always skip one symbol of {{df}} matching https://github.com/openjdk/jdk/blob/master/test/jdk/java/io/File/GetXSpace.java#L160 It leads to skipping 'D' symbol in 'D: ' line and to this exception.
20-01-2022