The GitHub Actions job "Java CI" on commons-io.git/fix/file-delete has failed.
Run started by GitHub user ppkarwasz (triggered by ppkarwasz).

Head commit for run:
1308bbc633dc1f23811fec76df44e1c24335dd07 / Piotr P. Karwasz 
<[email protected]>
Improve `FileUtils.forceDelete()` tests on Windows

On Windows, the `DeleteFile` Win32 API has a little quirk: it refuses to delete 
files with the legacy **DOS read-only attribute** set. (Because apparently 99% 
of Windows users don’t realize that “deleting a file” is actually an operation 
on the *directory*, not the file itself 😉).

So the usual drill is: clear the read-only flag first, then delete.

* Until JDK 25, `File.delete()` did this for you behind the scenes: it quietly 
stripped the flag before calling into `DeleteFile`. That meant your file might 
be left behind (with the flag missing) if the *real* ACLs didn’t allow deletion.
* From JDK 25 onward, `File.delete()` doesn’t touch the flag anymore. If the 
bit is set, `DeleteFile` fails, end of story.
* `FileUtils.forceDelete()` already knows how to juggle the flag itself, so its 
behavior didn’t change.

This PR:

* Updates two tests that were (unfairly) comparing `File.delete` with 
`FileUtils.forceDelete`. With JDK 25, their expectations diverged.
* Adds a new test to confirm that `FileUtils.forceDelete` restores the 
read-only flag if the actual deletion fails.

> [!WARNING]
> I didn’t develop this on a Windows box, so I couldn’t test it locally. 
> Leaving this as a **draft PR** until CI tells us whether Windows agrees with 
> me.

Report URL: https://github.com/apache/commons-io/actions/runs/18187179520

With regards,
GitHub Actions via GitBox

Reply via email to