Skip to content

test: keep executable fixtures off noexec temp roots - #706

Merged
yyjeqhc merged 1 commit into
yyjeqhc:mainfrom
skygunner:contrib/noexec-fixtures
Sep 27, 2026
Merged

yyjeqhc merged 1 commit into
yyjeqhc:mainfrom
skygunner:contrib/noexec-fixtures

Conversation

@skygunner

Copy link
Copy Markdown
Contributor

Problem

Some Unix tests in the root webcodex crate create executable helper files
inside tempfile::tempdir() directories, including fake
npm/cloudflared/rg/grep/head commands, external-diff helpers, and a
wrapping git executable.

On hardened systems where the ambient temporary filesystem is mounted
noexec, creating these files and setting their executable bit can succeed
while executing them fails with Permission denied, causing otherwise
unrelated Server tests to fail.

Fix

Add a test-only executable_tempdir() helper backed by the repository's
git-ignored target/test-executables directory and use it only for fixtures
that actually execute generated files.

Ordinary data-only fixtures continue using tempfile::tempdir(), and no
global TMPDIR override is introduced.

Migrated fixtures include:

  • fake npm config queries and managed cloudflared binaries;
  • the share-tunnel fake cloudflared;
  • fake rg/grep/head search backends;
  • external-diff helper scripts and the wrapping git executable.

Symlink-to-host-command fixtures and data-only temporary directories are left
unchanged.

Validation

The validation host's /tmp was executable, so the noexec condition was
not 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.

  • Git 2.55.0, rustc 1.98.1, Linux x86_64.
  • 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 isolated
    runs passed.
  • cargo fmt --all -- --check: passed.
  • git diff --check: passed.
  • cargo check --locked -p webcodex: passed.
  • cargo test --locked -p webcodex with default concurrency: 2986 passed,
    0 failed, 3 ignored.
  • bash scripts/test_server.sh: 2986 passed, 0 failed, 3 ignored.

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.
@yyjeqhc
yyjeqhc merged commit 455c452 into yyjeqhc:main Sep 27, 2026
18 checks passed
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.

2 participants