Repository navigation
Description
Summary
fbuild build -c creates a stray 0-byte file literally named -r in the process's current working directory. It appears only when zccache-fp is resolvable on PATH.
Reproduced deterministically with fbuild 2.5.14 and zccache 1.13.0 on Windows 10 / Git Bash.
Minimal reproduction — no FastLED Python involved
Run fbuild.exe directly from an arbitrary empty directory:
$ cd /some/empty/dir
$ rm -f -- ./-r
$ PATH="<venv>/Scripts;$PATH" fbuild.exe "<project-dir>" build -e teensy41 -c
build succeeded in 37.8s (flash: 72704 bytes, ram: 81984 bytes)
$ ls -la -- ./-r
-rw-r--r-- 1 ... 0 Aug 6 19:20 ./-r # <-- strayNow put only zccache.exe and zccache-daemon.exe on PATH (i.e. withhold zccache-fp.exe), everything else identical:
$ PATH="<dir with only zccache.exe + zccache-daemon.exe>;$PATH" fbuild.exe "<project-dir>" build -e teensy41 -c
build succeeded in 45.9s (flash: 72704 bytes, ram: 81984 bytes)
$ ls -la -- ./-r
ls: cannot access './-r': No such file or directoryBoth runs did real work (37.8s / 45.9s, identical flash+ram output), so this is not a no-op-build artifact — I specifically re-ran with timings visible because a cached no-op build produces a false negative here.
Characterisation
- Name: literally
-r. The leading dash makes it hostile to clean up —rm -ris a very different command; you needrm -- -r. - Size: always 0 bytes.
- Location: the process CWD, not the project dir. Running fbuild from a scratch directory drops it there instead.
- Timing: created during the
Linking firmware.elfstage (caught by polling a watcher at 20 ms and snapshotting the verbose log at that instant). - Trigger: only on builds that do real work. A no-op rebuild never produces it;
-creproduces every time. - Requires:
zccache-fp.exeresolvable onPATH. Withzccache.exe+zccache-daemon.exealone it never appears. - Failure is swallowed: pre-creating a directory named
-rblocks the write, and the build still succeeds with no diagnostic at all. Whatever creates it ignores the error.
Notes toward a root cause
- Direct invocations of
zccache-fp.exe(check,check --root .,check -r .,mark-success) do not create the file, so it does not look like zccache-fp writing it of its own accord. zccache-fp checkexposes--rootwith no-rshort form, so a-rtoken in a generated command line would be a parse error rather than a path.fbuild.execontains embedded zccache fingerprint strings (embedded fingerprint check failed for,embedded fingerprint mark-success failed for,.zccache_fp.json,stamp_cache.json) and the project build dir gets a.project.zccache_fp.stamp_cache.json. So fbuild appears to use an embedded fingerprint path whose enablement is gated onzccache-fpbeing present on PATH.fbuild.execontains no--root/--ext/--exclude/--cache-typestrings, so it does not appear to shell out tozccache-fpwith those flags.- The 0-byte size plus swallowed error is consistent with a
File::create()on a path variable that ended up holding the string-r— e.g. a flag token mistaken for a path while parsing a tool invocation. Thearoperation string (-rcs/r) around archive creation, immediately before linking, is where I would look first, especially withlib_archive = true.
I could not confirm the exact call site from the stripped binary; the above is where the evidence points, not a diagnosis.
Impact
The CWD is typically the consuming repo's root, so every clean build dirties a clean working tree with an untracked -r. That breaks any workflow (human or agent) that asserts a clean tree before committing, and the leading dash makes accidental rm -r mistakes easy.
Downstream report: FastLED/FastLED#3867.
Acceptance criteria
- A clean
fbuild build -cwithzccache-fponPATHleaves the CWD unchanged. - Whatever performs the write either uses a correct path or fails loudly instead of silently swallowing the error.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Aug 7, 2026
Root cause found — and a correction to this report
Correction first: I filed this saying
zccache-fponPATHwas the gate, based on it reproducing with all three zccache binaries present and not reproducing twice withoutzccache-fp.exe. That was a red herring. This bug is intermittent — assweep_stray_dash_files' own comment incrates/fbuild-deploy/src/teensy/flash.rsalready noted ("intermittently drop a 0-byte-r") — and two clean negatives were luck, not causation. zccache is not involved. Apologies for sending anyone down that path.Actual cause:
crates/fbuild-build-arm/src/teensy/teensy_linker.rspassesNoneas the working directory torun_command, on both the response-file and direct-args branches. Soarm-none-eabi-gcc— and the collect2 / lto-wrapper processes it spawns under-flto=auto -fuse-linker-plugin— run in the cwd the daemon inherited, normally the user's project root. Those helpers write scratch files relative to the process cwd.That explains every observation cleanly, including the ones that confused me:
Linking firmware.elf— caught with a 20 ms watcher snapshotting the verbose log.zccache-fpcorrelation.Notably
flash.rsalready fixed this exact thing for the deploy path, and its comment states the remedy plainly: "Run the loader in the firmware's own build directory rather than inheriting the daemon's working directory (which is typically the user's project/repo root)." The build path simply never got the same treatment. It also completes #261, which redirected the env-based LTO temp dir but left cwd inherited.Fix in #1268. Verified before/after on a real FastLED teensy41 clean build: control (2.5.14) drops
./-rin the repo root; with the fix the repo root stays clean and the stray lands at.fbuild/build/release/-rinside the gitignored tree, with byte-identical artifacts.ci: fail board builds that leave stray files in the working tree (#1272)