-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ca-derivations breaks some nix-side store paths manipulations #4764
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-11/12886/1 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881/80 |
|
Step to reproduce the bug with { ca ? false }:
with import <nixpkgs> {};
let
foo = runCommand "foo" { __contentAddressed = ca; } ''
cat > $out <<EOF
#/bin/sh
echo '"foo"'
EOF
chmod +x $out
'';
in
runCommand "bar" {} ''
set -x
[[ "${builtins.exec [ foo ]}" != '"foo"' ]] || exit 1
touch $out
'' $ nix-build nix-builtins-exec.nix --arg ca false --option allow-unsafe-native-code-during-evaluation true
# => ok
$ nix-build nix-builtins-exec.nix --arg ca true --option allow-unsafe-native-code-during-evaluation true
# => fails |
I marked this as stale due to inactivity. → More info |
As stated below, I don’t think this can be solved in a reasonable way. I’m just logging it here for reference
Describe the bug
If
foo
is a content-addressed derivation (or depends on one), with/nix/store/abc-foo
as output path, thenbuiltins.replaceStrings ["-"] ["+"] foo.outPath
will be/nix/store/abc-foo
rather than/nix/store/abc+foo
.This is because as far as the Nix evaluator is concerned,
foo.outPath
is a placeholder of the form/123
rather than the actual/nix/store/abc-foo
. So the Nix evaluator actually runsbuiltins.replaceStrings ["-"] ["+"] /123
(which is equal to/123
).Steps To Reproduce
With a
default.nix
like:The same derivation
Expected behavior
Both derivations should build successfully
Additional context
openjfx15
has a snippet of the formopenjdk11_headless
is content-addressed (because its output path contains a+
, which isn’t properly escaped and thus is interpreted by sed as a regex meta-character rather than a litteral+
)baseName
Nix function,baseName foo.outPath
will return123
, which won’t be replaced by/nix/store/abc-foo
at build-timeThe text was updated successfully, but these errors were encountered: