Skip to content

Comments

Fix #7655#7657

Merged
roberth merged 2 commits intoNixOS:masterfrom
obsidiansystems:fix-7655
Jan 23, 2023
Merged

Fix #7655#7657
roberth merged 2 commits intoNixOS:masterfrom
obsidiansystems:fix-7655

Conversation

@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jan 22, 2023

Motivation

Fixing a bug. Here's how:

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.

The first commit fixes the test, reproducing the bug. The second commit fixes the bug, with the now-passing test as proof.

Context

Fix #7655

Here is why this wasn't caught before, despite having a test for these functions:

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.

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests
  • documentation in the manual
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or bug fix: updated release notes

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.
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.
@roberth roberth merged commit 0a9acef into NixOS:master Jan 23, 2023
@github-actions
Copy link

Successfully created backport PR #7666 for 2.13-maintenance.

@Ericson2314 Ericson2314 deleted the fix-7655 branch January 23, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Regression builtins.getContext / outputs = [ "" ]

2 participants