Skip to content

IO-879: Restore read-only state after failed deletion - #881

Open
efegokdemir wants to merge 1 commit into
apache:masterfrom
efegokdemir:codex/IO-879-restore-readonly-on-delete-failure
Open

efegokdemir wants to merge 1 commit into
apache:masterfrom
efegokdemir:codex/IO-879-restore-readonly-on-delete-failure

Conversation

@efegokdemir

Copy link
Copy Markdown

Summary

Fixes IO-879 by restoring a file's read-only state when an override-enabled deletion attempt fails.

Changes

  • Restore the read-only attribute in PathUtils.deleteFile when the file remains after a failed deletion.
  • Apply the same fail-safe behavior to DeletingPathVisitor and CleaningPathVisitor.
  • Add a Windows-focused regression test covering a read-only file in a read-only parent directory.

Testing

  • mvn -pl . -Dtest=PathUtilsDeleteFileTest -Dsurefire.failIfNoSpecifiedTests=false test -q — passed locally: 8 tests, 1 skipped (Windows-only regression skipped on macOS).
  • mvn -DskipTests compile -q — passed.
  • git diff --check — passed.
  • Full mvn test — not completed: the suite continued running without producing new reports for several minutes on macOS/JDK 27, so the local process was stopped rather than reported as passing.
  • The Windows-specific regression requires Windows CI and was not runnable on this Mac.

Notes

The change preserves the original deletion exception and only restores the attribute when the path still exists. AI assistance was used during investigation and implementation; the submitter reviewed the changed lines and test results.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant