RFR: 8343342: java/io/File/GetXSpace.java fails on Windows with CD-ROM drive [v8]
Brian Burkhalter
bpb at openjdk.org
Fri Dec 13 21:13:41 UTC 2024
On Fri, 13 Dec 2024 10:10:16 GMT, Taizo Kurashige <duke at openjdk.org> wrote:
>> To resolve java/io/File/GetXSpace.java failure, I fix libGetXSpace.c to use Cygwin’s `df` to get the size for comparison if the test target drive is a CD-ROM drive.
>>
>> As described in JDK-8343342, GetDiskSpaceInformationW can't get information about the size of the CD-ROM drive.
>> GetDiskFreeSpaceExW can also get information about the size of the CD-ROM drive. However, because GetDiskFreeSpaceExW is called by the File.get-X-Space methods, it seems more reasonable to compare the size got by other way than GetDiskFreeSpaceExW as a test. For this reason, I use Cygwin's `df`.
>> In JDK-8298619, GetDiskSpaceInformationW was adopted instead of `df` because the size got by File.get-X-Space methods may not match the size got by `df` when per-user quotas are used. I don't think this problem applies to CD-ROM drive, so I think we can use Cygwin's `df` for CD-ROM drive.
>>
>> After fix, I ran a test on Windows Server 2019 where drive C is a normal local disk, drive D is an unmounted iso CD-ROM drive, and drive F is an iso mounted CD-ROM drive and confirmed that it passes.
>>
>> I think this fix may also resolves the similar failure reported at https://github.com/openjdk/jdk/pull/12397#issuecomment-1705164515.
>>
>> Thanks
>
> Taizo Kurashige has updated the pull request incrementally with two additional commits since the last revision:
>
> - Fix getCDDriveSpace()
> - Fix macro for unix
It fails for me on a Windows 11 laptop with an external CD drive with a CD inserted. On Cygwin the `df` command gives:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
C:/Users/bpb/dev/tools/cygwin 496752636 166105620 252373420 40% /
D: 493658 493658 0 100% /cygdrive/d
The test prints (omitting the `C:` drive):
D:\ (0):
getCDDriveSpace total = 0 free = 0 usable = 0
getXSpace total = 505505792 free = 0 usable = 0
and fails with:
FAILED: 'D:\ total space': 505505792 > 0
FAILED: 'D:\ size': 505505792 > 0
24 tests: 2 failure(s); first: java.lang.RuntimeException: 'D:\ total space': 505505792 > 0
Perhaps the output of `df` is not being parsed correctly?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21799#issuecomment-2542388045
More information about the core-libs-dev
mailing list