fix(build-remote): hash slot-lock filename on ENAMETOOLONG#15512
Draft
lovesegfault wants to merge 1 commit into
Draft
fix(build-remote): hash slot-lock filename on ENAMETOOLONG#15512lovesegfault wants to merge 1 commit into
lovesegfault wants to merge 1 commit into
Conversation
openSlotLock constructs the lock filename from the full rendered store URI. When the remote builder URI contains a long path (e.g. the functional tests use `ssh://localhost?remote-store=$TEST_ROOT/machineN`, and on CI runners with ~60-char tmpdir components the escaped URI alone exceeds NAME_MAX), openLockFile fails with "File name too long". Apply the same fallback that the upload-lock already has (e92dd06): catch filename_too_long, hash the store URI with MD5, and retry. The slot suffix is preserved so different slots for the same machine still get distinct lock files.
xokdvium
reviewed
Mar 18, 2026
| throw; | ||
| // Try again hashing the store URL so we have a shorter path | ||
| auto h = hashString(HashAlgorithm::MD5, storeUri); | ||
| return open(h.to_string(HashFormat::Base64, false)); |
Contributor
There was a problem hiding this comment.
Won't work on case-insensitive filesystems. base32 would work better
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.
Motivation
openSlotLockconstructs its lock filename from the full rendered store URI:When the remote builder URI contains a long path — e.g. the functional tests use
ssh://localhost?remote-store=$TEST_ROOT/machineN?system-features=..., and on CI runners with ~60-char tmpdir components the escaped URI alone pushes the filename pastNAME_MAX—openLockFilefails withFile name too long. This is what breaksbuild-remote-trustless-should-pass-{2,3}on nixbuild.net.The upload-lock a few lines down already handles this (e92dd06):
https://github.com/NixOS/nix/blob/f2d4cc70726244f9fdea0ca9e4d3c76c4d635573/src/nix/build-remote/build-remote.cc#L278-L291
Fix
Apply the same fallback to
openSlotLock: catchfilename_too_long, hash the store URI with MD5, retry. The-<slot>suffix is preserved so different slots for the same machine still get distinct lock files.