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

Regression builtins.getContext / outputs = [ "" ] #7655

Closed
roberth opened this issue Jan 21, 2023 · 4 comments · Fixed by #7657
Closed

Regression builtins.getContext / outputs = [ "" ] #7655

roberth opened this issue Jan 21, 2023 · 4 comments · Fixed by #7657
Assignees
Labels
bug regression Something doesn't work anymore

Comments

@roberth
Copy link
Member

roberth commented Jan 21, 2023

Describe the bug

builtins.getContext always returns { outputs = [ "" ]; } for build outputs.

Steps To Reproduce

cd nixpkgs; nix repl .

Expected:

Actual:

nix-repl> :p builtins.getContext (writeText "hi" "hi").outPath
{ "/nix/store/axry75xwlchnnrqp263d05yhr89cv3d0-hi.drv" = { outputs = [ "" ]; }; }

nix-repl> :p builtins.getContext nix.doc.outPath
{ "/nix/store/56n2kf5pha0m8cs19vgzhv5j0d7mr96n-nix-2.12.0.drv" = { outputs = [ "" ]; }; }

Expected behavior

nix-repl> :p builtins.getContext (writeText "hi" "hi").outPath
{ "/nix/store/axry75xwlchnnrqp263d05yhr89cv3d0-hi.drv" = { outputs = [ "out" ]; }; }

nix-repl> :p builtins.getContext nix.doc.outPath                    
{ "/nix/store/56n2kf5pha0m8cs19vgzhv5j0d7mr96n-nix-2.12.0.drv" = { outputs = [ "doc" ]; }; }

nix-env --version output

master, 2.13.1

Additional context

Priorities

Add 👍 to issues you find important.

@Ericson2314
Copy link
Member

Have fix, just writing tests.

@Ericson2314
Copy link
Member

tests/lang/eval-okay-context-introspection.nix is already a test, I am confused why it is passing.

@Ericson2314
Copy link
Member

Ericson2314 commented Jan 22, 2023

Oh nevermind, I see now.

Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Jan 22, 2023
The original `builtins.getContext` test from
1d75729 would have caught this. The
problem is that b30be6b adding
`builtins.appendContext` modified that test to make it test too much at
once, rather than adding a separate test.

We now have isolated tests for both functions, and also a property test
showing everything put together (in the form of an eta rule for strings
with context). This is better coverage and properly reproduces the bug.
Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Jan 22, 2023
We had some local variables left over from the older (more
complicated) implementation of this function. They should all be unused,
but one wasn't by mistake.

Delete them all, and replace the one that was still in use as intended.
@Ericson2314 Ericson2314 mentioned this issue Jan 23, 2023
7 tasks
github-actions bot pushed a commit that referenced this issue Jan 23, 2023
The original `builtins.getContext` test from
1d75729 would have caught this. The
problem is that b30be6b adding
`builtins.appendContext` modified that test to make it test too much at
once, rather than adding a separate test.

We now have isolated tests for both functions, and also a property test
showing everything put together (in the form of an eta rule for strings
with context). This is better coverage and properly reproduces the bug.

(cherry picked from commit 88d8f6a)
github-actions bot pushed a commit that referenced this issue Jan 23, 2023
We had some local variables left over from the older (more
complicated) implementation of this function. They should all be unused,
but one wasn't by mistake.

Delete them all, and replace the one that was still in use as intended.

(cherry picked from commit 0afdf40)
roberth added a commit that referenced this issue Jan 23, 2023
@roberth
Copy link
Member Author

roberth commented Jan 26, 2023

The fix has been released in 2.13.2.

iFreilicht pushed a commit to iFreilicht/nix that referenced this issue Jan 28, 2023
The original `builtins.getContext` test from
1d75729 would have caught this. The
problem is that b30be6b adding
`builtins.appendContext` modified that test to make it test too much at
once, rather than adding a separate test.

We now have isolated tests for both functions, and also a property test
showing everything put together (in the form of an eta rule for strings
with context). This is better coverage and properly reproduces the bug.
iFreilicht pushed a commit to iFreilicht/nix that referenced this issue Jan 28, 2023
We had some local variables left over from the older (more
complicated) implementation of this function. They should all be unused,
but one wasn't by mistake.

Delete them all, and replace the one that was still in use as intended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug regression Something doesn't work anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants