Repository navigation
test: keep executable fixtures off noexec temp roots - #706
Merged
Merged
Conversation
Some Unix test fixtures create executable helper files (fake npm/cloudflared/rg/grep/head scripts, external-diff helpers, and a wrapping git executable) inside tempfile::tempdir() directories. On hosts where the ambient temp filesystem is mounted noexec, creating the file and setting the executable bit succeed but executing it fails with Permission denied, so unrelated Server tests fail. Add a test-only executable_tempdir() helper backed by the repository's ignored target/test-executables directory and use it only for fixtures that actually execute generated files: the fake npm config query, the managed cloudflared install state exercised by post-download version verification, the share-tunnel fake cloudflared, the fake rg/grep/head search backends, and the git external-diff/wrapper fixtures. Ordinary data-only temp fixtures keep using tempfile::tempdir(), symlink-to-host fixtures stay on the system temp filesystem, and no global TMPDIR override is introduced.
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.
Problem
Some Unix tests in the root
webcodexcrate create executable helper filesinside
tempfile::tempdir()directories, including fakenpm/cloudflared/rg/grep/headcommands, external-diff helpers, and awrapping
gitexecutable.On hardened systems where the ambient temporary filesystem is mounted
noexec, creating these files and setting their executable bit can succeedwhile executing them fails with
Permission denied, causing otherwiseunrelated Server tests to fail.
Fix
Add a test-only
executable_tempdir()helper backed by the repository'sgit-ignored
target/test-executablesdirectory and use it only for fixturesthat actually execute generated files.
Ordinary data-only fixtures continue using
tempfile::tempdir(), and noglobal
TMPDIRoverride is introduced.Migrated fixtures include:
npmconfig queries and managedcloudflaredbinaries;cloudflared;rg/grep/headsearch backends;gitexecutable.Symlink-to-host-command fixtures and data-only temporary directories are left
unchanged.
Validation
The validation host's
/tmpwas executable, so thenoexeccondition wasnot reproduced locally during this run. The change instead keeps executable
fixtures on a repository-backed, git-ignored temp root while preserving
ordinary tempfile behavior for data-only fixtures.
cloudflared: 11 passed.tunnel: 19 passed.search_: 161 passed.show_changes_: 82 passed.git_diff_hunks_: 43 passed.tunnel_startup_timeout_kills_fake_process: 10/10 consecutive isolatedruns passed.
cargo fmt --all -- --check: passed.git diff --check: passed.cargo check --locked -p webcodex: passed.cargo test --locked -p webcodexwith default concurrency: 2986 passed,0 failed, 3 ignored.
bash scripts/test_server.sh: 2986 passed, 0 failed, 3 ignored.