expect-failure.sh: fix variabl existence check#355953
Closed
teto wants to merge 1 commit intoNixOS:masterfrom
Closed
expect-failure.sh: fix variabl existence check#355953teto wants to merge 1 commit intoNixOS:masterfrom
teto wants to merge 1 commit intoNixOS:masterfrom
Conversation
Trying to use pkgs.testers.testBuildFailure on the neovim wrapper I got: > testBuildFailure: Original builder produced exit code: 1 > /nix/store/ms79njxnpys354nc5n9v27qh4i5g1gjj-expect-failure.sh: line 37: __structuredAttrs: unbound variable -v seems a safer choice ?
13 tasks
Comment on lines
38
to
43
| # # from stdenv setup.sh | ||
| getAllOutputNames() { | ||
| if [ -n "$__structuredAttrs" ]; then | ||
| if [ -v "__structuredAttrs" ]; then | ||
| echo "${!outputs[*]}" | ||
| else | ||
| echo "$outputs" |
Contributor
There was a problem hiding this comment.
Hm, as the comment says this is copied as-is from pkgs/stdenv/generic/setup.sh. Why is it a problem here, but not there?
Contributor
There was a problem hiding this comment.
Or put differently: Will this ever work? I.e. will $__structuredAttrs be set here at all, even in the case when it's enabled?
Contributor
There was a problem hiding this comment.
It seems odd that defining __structuredAttrs is what causes it to be unbound in the buildscript... Implying it is bound when not defined.
I agree it doesn't look like this PR fixes the underlying issue.
Contributor
|
I just ran into this issue myself, I'm surprised it hasn't come up sooner. Here's a minimal reproducible example: {
nixpkgs ? <nixpkgs>,
system ? builtins.currentSystem,
pkgs ? import nixpkgs { inherit system; },
}:
pkgs.testers.testBuildFailure (
pkgs.runCommandLocal "example" { __structuredAttrs = true; } ''
exit 1
''
)$ nix-build test.nix
these 2 derivations will be built:
/nix/store/ws92j8crllvn2rqvcm5ivk4lf9hwgq7n-expect-failure.sh.drv
/nix/store/z6kan4jnriiizyzcimr6x5xkg4f5s0l4-example.drv
building '/nix/store/ws92j8crllvn2rqvcm5ivk4lf9hwgq7n-expect-failure.sh.drv'...
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
Running phase: checkPhase
Running phase: installPhase
no Makefile or custom installPhase, doing nothing
Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/h003mggvqn1hjc3lm8k2i7pn7awqkpsz-expect-failure.sh
checking for references to /build/ in /nix/store/h003mggvqn1hjc3lm8k2i7pn7awqkpsz-expect-failure.sh...
patching script interpreter paths in /nix/store/h003mggvqn1hjc3lm8k2i7pn7awqkpsz-expect-failure.sh
building '/nix/store/z6kan4jnriiizyzcimr6x5xkg4f5s0l4-example.drv'...
testBuildFailure: Expecting non-zero exit from builder and args: '/nix/store/5mh7kaj2fyv8mk4sfq1brwxgc02884wi-bash-5.2p37/bin/bash' '-e' '/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh'
original builder: structuredAttrs is enabled
testBuildFailure: Original builder produced exit code: 1
/nix/store/h003mggvqn1hjc3lm8k2i7pn7awqkpsz-expect-failure.sh: line 37: __structuredAttrs: unbound variable
error: builder for '/nix/store/z6kan4jnriiizyzcimr6x5xkg4f5s0l4-example.drv' failed with exit code 1;
last 4 log lines:
> testBuildFailure: Expecting non-zero exit from builder and args: '/nix/store/5mh7kaj2fyv8mk4sfq1brwxgc02884wi-bash-5.2p37/bin/bash' '-e' '/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh'
> original builder: structuredAttrs is enabled
> testBuildFailure: Original builder produced exit code: 1
> /nix/store/h003mggvqn1hjc3lm8k2i7pn7awqkpsz-expect-failure.sh: line 37: __structuredAttrs: unbound variable
For full logs, run 'nix log /nix/store/z6kan4jnriiizyzcimr6x5xkg4f5s0l4-example.drv'. |
13 tasks
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to use pkgs.testers.testBuildFailure on the neovim wrapper I got:
-v seems a safer choice ?
this will be ready when I can uncomment #352727
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.