Skip to content

structuredAttrs $NIX_ATTRS_JSON_FILE points to the wrong location in sandbox #6736

@Artturin

Description

@Artturin

Describe the bug

it points to /comp-temp/nix-build-bison-3.8.2.drv-2/.attrs.json

++++ realpath /build
/build

++++ ls -la /build
total 13
drwx------  3  1000 100  120 Jun 29 00:21 .
drwxr-x---  9 65534 100    9 Jun 29 00:21 ..
-rw-r--r--  1  1000 100 1510 Jun 29 00:21 .attrs.json
-rw-r--r--  1  1000 100 1662 Jun 29 00:21 .attrs.sh
drwxr-xr-x 14  1000 100  760 Sep 25  2021 bison-3.8.2
-rw-r--r--  1  1000 100 2796 Jun 29 00:21 env-vars

++++ cat /build/.attrs.json
<attrs here>

++++ echo /comp-temp/nix-build-bison-3.8.2.drv-4/.attrs.json
/comp-temp/nix-build-bison-3.8.2.drv-4/.attrs.json

++++ cat /comp-temp/nix-build-bison-3.8.2.drv-4/.attrs.json
cat: /comp-temp/nix-build-bison-3.8.2.drv-4/.attrs.json: No such file or directory

Steps To Reproduce

these commands were run in postPatch of bison on the NixOS/nixpkgs#175649 branch

    realpath $NIX_BUILD_TOP
    ls -la $NIX_BUILD_TOP
    cat $NIX_BUILD_TOP/.attrs.json

    echo $NIX_ATTRS_JSON_FILE
    cat $NIX_ATTRS_JSON_FILE

auto jsonSh = writeStructuredAttrsShell(json);
writeFile(tmpDir + "/.attrs.sh", rewriteStrings(jsonSh, inputRewrites));
chownToBuilder(tmpDir + "/.attrs.sh");
env["NIX_ATTRS_SH_FILE"] = tmpDir + "/.attrs.sh";
writeFile(tmpDir + "/.attrs.json", rewriteStrings(json.dump(), inputRewrites));
chownToBuilder(tmpDir + "/.attrs.json");
env["NIX_ATTRS_JSON_FILE"] = tmpDir + "/.attrs.json";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions