Skip to content

cmdline: warn instead of recursing when invoked as a non-sccache name that is sccache itself#2754

Open
sylvestre wants to merge 1 commit into
mozilla:mainfrom
sylvestre:self
Open

cmdline: warn instead of recursing when invoked as a non-sccache name that is sccache itself#2754
sylvestre wants to merge 1 commit into
mozilla:mainfrom
sylvestre:self

Conversation

@sylvestre

Copy link
Copy Markdown
Collaborator

When sccache is run under a name other than sccache, it acts as a compiler masquerade and prepends sccache to argv. If that name resolves back to the sccache binary itself (no real compiler of that name on PATH), the prepend made sccache wrap itself, and the <compiler> -vV rustc-detection probe re-entered the same path under the same name -- recursing forever and spawning a server-side process per core (a fork bomb that just hangs). Seen when an sccache binary was installed at a path whose filename was not sccache.

Detect that case and warn, running as a normal sccache invocation instead of prepending the name. Add an integration test that runs the binary under a non-sccache, non-PATH name and asserts it warns and behaves as sccache rather than hanging.

… that is sccache itself

When sccache is run under a name other than `sccache`, it acts as a compiler
masquerade and prepends `sccache` to argv. If that name resolves back to the
sccache binary itself (no real compiler of that name on PATH), the prepend made
sccache wrap itself, and the `<compiler> -vV` rustc-detection probe re-entered
the same path under the same name -- recursing forever and spawning a
server-side process per core (a fork bomb that just hangs). Seen when an sccache
binary was installed at a path whose filename was not `sccache`.

Detect that case and warn, running as a normal sccache invocation instead of
prepending the name. Add an integration test that runs the binary under a
non-sccache, non-PATH name and asserts it warns and behaves as sccache rather
than hanging.
@codecov-commenter

codecov-commenter commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.20%. Comparing base (68cd330) to head (39d01f8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2754      +/-   ##
==========================================
+ Coverage   74.18%   74.20%   +0.02%     
==========================================
  Files          71       71              
  Lines       40491    40515      +24     
==========================================
+ Hits        30037    30063      +26     
+ Misses      10454    10452       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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