Skip to content
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

build: only skip hash rewriting for sandboxing on linux #2775

Merged
merged 1 commit into from Apr 24, 2019

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Apr 17, 2019

The sandbox on darwin, and possibly other future platforms, doesn't have
enough isolation to redirect outputs without hash rewriting.

This fixes nix-build --check when sandboxing is enabled on darwin as well as builds with multiple outputs where one of the outputs is already valid.

/cc @edolstra

The sandbox on darwin, and possibly other future platforms, doesn't have
enough isolation to redirect outputs without hash rewriting.
@edolstra edolstra merged commit f225404 into NixOS:master Apr 24, 2019
@LnL7 LnL7 deleted the darwin-sandbox-hash-rewrite branch April 24, 2019 16:38
@LnL7
Copy link
Member Author

LnL7 commented Apr 24, 2019

Thanks!

@grahamc
Copy link
Member

grahamc commented May 12, 2019

Interestingly this has broken --check on Linux with sandboxing:

[nix-shell:~/projects/github.com/NixOS/nix]$ nix-build ./test.nix -A stable ; nix-build ./test.nix -A stable --check; nix-build ./test.nix -A unstable; nix-build ./test.nix -A unstable --check
these derivations will be built:
  /nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv
building '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable
checking outputs of '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv'...
builder for '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv' failed to produce output path '/nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable'
error: build of '/nix/store/z98fasz2jqy9gs0xbvdj939p27jwda38-stable.drv' failed
/nix/store/a61slian4dhzajxviv1gfix29gadif3b-unstable
checking outputs of '/nix/store/dysl2dkqa8fw1f7p5b4dah6nyzr3pk9n-unstable.drv'...
builder for '/nix/store/dysl2dkqa8fw1f7p5b4dah6nyzr3pk9n-unstable.drv' failed to produce output path '/nix/store/a61slian4dhzajxviv1gfix29gadif3b-unstable'
error: build of '/nix/store/dysl2dkqa8fw1f7p5b4dah6nyzr3pk9n-unstable.drv' failed

with:

let
  inherit (import <nixpkgs> {}) runCommand;
in {
  stable = runCommand "stable" {} ''

    touch $out
  '';

  unstable = runCommand "unstable" {} ''
    echo $RANDOM > $out
  '';
}

@grahamc
Copy link
Member

grahamc commented May 12, 2019

(I'm heading out for several hours, but can look in to this later today.)

@LnL7
Copy link
Member Author

LnL7 commented May 12, 2019

Hmm, I see both /nix/store/yyxlzw3vqaas7wfp04g0b1xg51f2czgq-stable and /nix/store/a61slian4dhzajxviv1gfix29gadif3b-unstable which means needsHashRewrite is true?

@grahamc
Copy link
Member

grahamc commented May 12, 2019

@LnL7 ^ just opened up a new issue to track the regression (with an experiment's patch, which I think confirms what you say here.) - #2801.

@LnL7
Copy link
Member Author

LnL7 commented May 12, 2019

Oh I see what's going on, it's set in the constructor but useChroot is filled in later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants