libstore check for changed target URI may be overzealous #822
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#822
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
While serving
jhk2qycb2gl5xjmp3fdp3fhdcni08k9q.narinfo, the garnix cache issued a 302 Found/"Moved Temporarily" redirect fromhttps://cache.garnix.io/jhk2qycb2gl5xjmp3fdp3fhdcni08k9q.narinfotohttps://old-cache.garnix.io/jhk2qycb2gl5xjmp3fdp3fhdcni08k9q.narinfo, which subsequently 404'd.This triggered the check for changed URLs here, which was originally added by this commit.
The intention of the original commit: "immutable url changing implies that the immutable url we got previously was wrong, which is probably a server bug" is correct for the hash in the path changing, but I don't think it should consider the other URI components. It might not even need to consider anything but the final path segment containing the hash, but I'm not sure how easy parsing that out would be.
Steps To Reproduce
I originally encountered this issue resolving
/nix/store/jhk2qycb2gl5xjmp3fdp3fhdcni08k9q-nautilus-47.2. Runningnix path-info --json /nix/store/jhk2qycb2gl5xjmp3fdp3fhdcni08k9q-nautilus-47.2 | jqyields:but I'm not sure how to cause the check to trigger again. I tried running
nix path-info --json /nix/store/jhk2qycb2gl5xjmp3fdp3fhdcni08k9q-nautilus-47.2 --store https://cache.garnix.io/ | jq, but that only yieldedExpected behavior
Ideally, the changed target check should be as specific as possible to allow cache providers to redirect to equivalent hashes in different locations.
nix --versionoutputAdditional context
Thanks to Sönke Hahn and Alex David for helping figure out what was going on from the garnix side!
that's working exactly as intended. immutable urls are supposed to be immutable, and you are breaking that contract. moving a cache is a good reason to break the contract, but it's still no less broken.
perhaps more importantly though: immutable urls aren't intended for caches, but for flake inputs. cache contents are already immutably identified by their content hash (as you noted), but flake inputs referring to eg a tarball export of the
mainbranch of some git repo are not (and the (completely broken) immutable url protocol extension allows us to get a stable url for such an unstable revision specification anyway)