Skip to content

Fix cleanup of empty directories under read-only parents - #15343

Open
obaseyi2 wants to merge 3 commits into
pytest-dev:mainfrom
obaseyi2:fix/rm-rf-readonly-parent-15341
Open

obaseyi2 wants to merge 3 commits into
pytest-dev:mainfrom
obaseyi2:fix/rm-rf-readonly-parent-15341

Conversation

@obaseyi2

@obaseyi2 obaseyi2 commented Nov 5, 2026

Copy link
Copy Markdown

Summary

When rm_rf encounters an empty directory beneath a read-only parent, its os.rmdir retry needs to restore write access on the parent chain. Extend the existing permission recovery path for files to cover directory removal as well.

Add regression coverage for cleanup of an empty directory beneath a read-only parent and for the parent permission retry.

Fixes #15341

Testing

  • python -m pytest testing/test_tmpdir.py -q -k rm_rf (8 passed, 5 skipped on Windows)

@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rm_rf: empty directory under a read-only parent aborts removal; whole session basetemp left as garbage-*

1 participant