Skip to content

gh-154307: Fix TemporaryDirectory cleanup on DragonFly BSD#154309

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:tempfile-cleanup-nounlink
Jul 20, 2026
Merged

gh-154307: Fix TemporaryDirectory cleanup on DragonFly BSD#154309
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:tempfile-cleanup-nounlink

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 20, 2026

Copy link
Copy Markdown
Member

On DragonFly BSD, removing a file or directory with the UF_NOUNLINK flag fails with EISDIR (IsADirectoryError) instead of EPERM, so TemporaryDirectory.cleanup()'s onexc handler did not reset the flags. Handle IsADirectoryError the same as PermissionError.

… BSD

On DragonFly BSD, removing a file or directory with the UF_NOUNLINK flag
fails with EISDIR (IsADirectoryError) instead of EPERM, so the cleanup did
not reset the flags.  Handle IsADirectoryError the same as PermissionError.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 20, 2026
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) July 20, 2026 22:15
@serhiy-storchaka
serhiy-storchaka merged commit 1c1088b into python:main Jul 20, 2026
58 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

GH-154311 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 20, 2026
@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

GH-154312 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 20, 2026
@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

GH-154313 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 20, 2026
serhiy-storchaka added a commit that referenced this pull request Jul 21, 2026
…-154309) (GH-154313)

On DragonFly BSD, removing a file or directory with the UF_NOUNLINK flag
fails with EISDIR (IsADirectoryError) instead of EPERM, so the cleanup did
not reset the flags.  Handle IsADirectoryError the same as PermissionError.
(cherry picked from commit 1c1088b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Jul 21, 2026
…-154309) (GH-154312)

On DragonFly BSD, removing a file or directory with the UF_NOUNLINK flag
fails with EISDIR (IsADirectoryError) instead of EPERM, so the cleanup did
not reset the flags.  Handle IsADirectoryError the same as PermissionError.
(cherry picked from commit 1c1088b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Jul 21, 2026
…-154309) (GH-154311)

On DragonFly BSD, removing a file or directory with the UF_NOUNLINK flag
fails with EISDIR (IsADirectoryError) instead of EPERM, so the cleanup did
not reset the flags.  Handle IsADirectoryError the same as PermissionError.
(cherry picked from commit 1c1088b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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