Repository navigation
Watch linked directories through their links - #4
Merged
Merged
Conversation
Bazel records a watched path that resolves to a directory as only that: a directory. A link moved from one directory to another therefore looks unchanged, and the key went stale in two places: - A search path directory named by a link was listed, and its entries were watched, under the resolved path. Pointing the link at other tools changed nothing Bazel watched, so the key kept the old tools, in a running server and in a new one. - The xcode-select selection is a link to the developer directory. Its watch recorded only "directory", and the version file watched was the old selection's, so selecting another Xcode left the key on the old one. Search path listings and entries are now watched through the directory as named, so they follow the link. The selection is watched through usr/bin/xcodebuild under it, whose bytes differ between Xcode builds and which the Command Line Tools lack. Bazel still cannot see a link moved to a copy with the same names and bytes; the README says so. What the key digests is unchanged, so every host keeps its key. Only watch paths move: on a Linux host where /bin links to usr/bin, the same files are now watched through /bin. tests/check_platform.py now names its scratch tools through a link and moves the link in a running server; the previous host_key.py reuses the old result at that step, and this one executes.
Merged
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.
Bazel 9.2.0 records a watched
FILEinput that resolves to a directory as theliteral
DIR(RepoRecordedInput.File.fileValueToMarkerValue). It records notarget, so a link moved to another directory looks unchanged and the key goes
stale.
Reproduced with 0.0.2. A search path of
["<scratch>/tools"]withtools -> a, wherea/tholdsone, gave key1be3bef7de01. Runningln -sfn b tools, whereb/tholdstwo, left the key unchanged in therunning server and after a restart. Changing the bytes of
a/tdid re-key.Change
search_path_identitywatches listings and entries through the directory asnamed, not its resolved path, so the watches follow a linked directory.
macos_fieldsalso watches/var/db/xcode_select_link/usr/bin/xcodebuild.The selection link itself only ever records
DIR, and theversion.plistwatch is the old selection's.
xcodebuildreached through the link differsbetween Xcode builds: 17F113 and 27A266a on one Mac. The Command Line Tools
have no
xcodebuild, so moving between them and Xcode flips the watch to orfrom absent.
moved to a copy with the same names and bytes leaves the key naming the old
path until something else recomputes it; the tools that run are the same.
The key's digest input is unchanged, so no host gets a new key. On a Linux CI
host the key stays
76a1aef1...with the same 1,305 watched files, which are nowwatched through
/bin, a link tousr/bin. On macOS 26.7 the key staysd2cf2921..., with one more watched file.Verification
tests/check_platform.pynames its scratch tools through a link to theirdirectory, and moves the link in a running server as a new last step. It
passes. With main's
host_key.pyit fails at that step:expected executed, got reused.and on macOS the selection is watched through its
xcodebuild. Removingeither watch fails its test. Python 3.14 and Xcode's 3.9.6.
--strictpass.