conftest: fix rmtree cleanup crash on Linux (os.lchflags does not exist) - #10124
Merged
ThomasWaldmann merged 1 commit intoAug 16, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10124 +/- ##
=======================================
Coverage 87.05% 87.05%
=======================================
Files 101 101
Lines 17848 17849 +1
Branches 2705 2705
=======================================
+ Hits 15537 15539 +2
+ Misses 1609 1608 -1
Partials 702 702 ☔ View full report in Codecov by Harness. |
The archiver fixture's rmtree onerror handler called os.lchflags(path, 0) when has_lchflags was True. But has_lchflags is also True on Linux (flags are cleared via ioctl there), where os.lchflags does not exist, raising an uncaught AttributeError and turning teardown into an ERROR. Use borg's cross-platform platform.set_flags instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ThomasWaldmann
force-pushed
the
fix-conftest-rmtree-linux
branch
from
August 16, 2026 10:10
f350a99 to
54b1b3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
archiverfixture cleans up withshutil.rmtree(..., onerror=maybe_clear_flags_and_retry). That handler callsos.lchflags(path, 0)whenhas_lchflagsis true, and retries the removal.But
has_lchflagsis defined as:so it is also true on Linux, where flags are cleared via ioctl and
os.lchflagsdoes not exist. The resultingAttributeErroris not anOSError, so it escapes the surroundingtry/except OSErrorand turns teardown into an ERROR - the handler that exists to recover from a failed removal is itself broken on Linux.Use borg's cross-platform
platform.set_flagsinstead, which is the intended API and works on both BSD and Linux.Split out of #9602 - the bug is independent of that PR and is present in master today.