Skip to content

mutate: a run's temporary directory is removed when a killed test left it read-only - #102

Merged
aledbf merged 1 commit into
mainfrom
mutate-remove-readonly-tmp
Nov 12, 2026
Merged

aledbf merged 1 commit into
mainfrom
mutate-remove-readonly-tmp

Conversation

@aledbf

@aledbf aledbf commented Nov 12, 2026

Copy link
Copy Markdown
Member

spin's mutate lane failed at its cleanup after every edit was refused:
mutate: removing the temporary directory of ...'s tests: unlinkat /tmp/m2060458/TestAnArtifactIsShownPublishingWhileItIsbase1715224689/002/mkfs.ext4: permission denied.
spin's platformimages test makes a 0o500 directory of 0o400 files and restores it in t.Cleanup; when an edit hangs that test, mutate kills the binary at its timeout, the cleanup never runs, and os.RemoveAll cannot unlink the files.

removeAll (internal/mutate/tree.go) walks the run's temporary directory making each directory 0o700 before removing it, as the go command's own removeAll does for a read-only module cache. filepath.WalkDir does not follow links, so nothing outside the directory changes mode. A removal that still fails is still an error.

Test: TestATemporaryDirectoryAKilledTestLeftReadOnlyIsRemoved - a read-only tree is removed; a link to a read-only directory outside keeps its target's files and 0500 mode; a directory already gone is no error. Planted: no chmod (red with the same unlinkat error spin saw); chmod through links (red: the target became 0700).

🤖 Generated with Claude Code

…t it read-only

A test that makes a directory read-only restores it in t.Cleanup, which never runs when an
edit hangs the test and mutate kills the binary at its timeout. os.RemoveAll then could not
unlink the files, and the whole run failed at its cleanup after every edit was answered
(spin's platformimages test: unlinkat .../002/mkfs.ext4: permission denied). Each directory
is made its owner's to write and search before the removal, as the go command's removeAll
does for a read-only module cache; WalkDir does not follow links, so nothing outside the
temporary directory changes mode. A removal that still fails is still an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf force-pushed the mutate-remove-readonly-tmp branch from 284721a to 63a8f12 Compare November 12, 2026 18:20
@aledbf
aledbf merged commit 210af04 into main Nov 12, 2026
3 checks passed
@aledbf
aledbf deleted the mutate-remove-readonly-tmp branch November 12, 2026 18:25
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