nix-instantiate --eval ambigously fails to create -source storepath #271

Open
opened 2024-05-06 00:36:00 +00:00 by ckiee · 1 comment
Member

Describe the bug

nix-instantiate --eval sets settings.readOnlyMode too opportunistically,
and this makes lix sad because here
we silently noop fetchToStore if readOnlyMode instead of
telling the user if we computed path and it isn't already there.

with --read-write-mode, readOnlyMode is not set, and everything is happy (:

there are two bugs here: (1) silent fetchToStore noop in r/o mode (2) --read-write-mode is annoying to write

Steps To Reproduce

git clone git@git.lix.systems:ckiee/lix-reprod-niv-override.git
cd […]
# bork:
echo '"'$RANDOM'"' > awa/meow.nix ; NIV_OVERRIDE_ckiesite="$(realpath ~/git/lix-reprod-niv-override/awa)" nix-instantiate --eval reprod.nix ; cat result
       error: path '/nix/store/qi25lcmspv49g52sbzhk614d0fnw0nmd-awa' is not valid
# awawa happy:
echo '"'$RANDOM'"' > awa/meow.nix ; NIV_OVERRIDE_ckiesite="$(realpath ~/git/lix-reprod-niv-override/awa)" nix-instantiate --eval --read-write-mode reprod.nix ; cat result

nix --version output

nix (Lix, like Nix) 2.90.0-lixpre20240504-8dfb30a

Additional context

cppnix also has (some?) of this bug.

previous: #270

## Describe the bug `nix-instantiate --eval` sets `settings.readOnlyMode` too opportunistically, and this makes lix sad because [here](https://git.lix.systems/lix-project/lix/src/commit/7cffd7a3b550deb3b2780780fd0226cbc649da9b/src/libfetchers/fetch-to-store.cc#L21) we silently noop `fetchToStore` if `readOnlyMode` instead of telling the user if we computed path and it isn't already there. with `--read-write-mode`, `readOnlyMode` is not set, and everything is happy (: there are two bugs here: (1) silent fetchToStore noop in r/o mode (2) `--read-write-mode` is annoying to write ## Steps To Reproduce ``` git clone git@git.lix.systems:ckiee/lix-reprod-niv-override.git cd […] # bork: echo '"'$RANDOM'"' > awa/meow.nix ; NIV_OVERRIDE_ckiesite="$(realpath ~/git/lix-reprod-niv-override/awa)" nix-instantiate --eval reprod.nix ; cat result error: path '/nix/store/qi25lcmspv49g52sbzhk614d0fnw0nmd-awa' is not valid # awawa happy: echo '"'$RANDOM'"' > awa/meow.nix ; NIV_OVERRIDE_ckiesite="$(realpath ~/git/lix-reprod-niv-override/awa)" nix-instantiate --eval --read-write-mode reprod.nix ; cat result ``` ## `nix --version` output `nix (Lix, like Nix) 2.90.0-lixpre20240504-8dfb30a` ## Additional context cppnix also has (some?) of this bug. previous: https://git.lix.systems/lix-project/lix/issues/270
ckiee added the
ux
bug
labels 2024-05-06 00:36:00 +00:00
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/1160 ("Add a clearer error message for InvalidPathError during evaluation")
  • comment in cl/1160 ("Add a clearer error message for InvalidPathError during evaluation")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/1160", "number": 1160, "kind": "commit message"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/1160", "number": 1160, "kind": "comment"}], "cl_meta": {"1160": {"change_title": "Add a clearer error message for InvalidPathError during evaluation"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/1160](https://gerrit.lix.systems/c/lix/+/1160) ("Add a clearer error message for InvalidPathError during evaluation") * comment in [cl/1160](https://gerrit.lix.systems/c/lix/+/1160) ("Add a clearer error message for InvalidPathError during evaluation")
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#271
No description provided.