-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: Add missing context to builtins.{match,split} results #12500
base: master
Are you sure you want to change the base?
Conversation
Without this, it is easy to accidentally generate, e.g., a config file referencing a store path without recording proper dependency information.
Cc: @tomberek. |
Important to note that this is a behaviour change that can result in different evaluation results. See for instance the failing
Probably it was a mistake not to use |
Should we scan the resulting chunks for hashes? I suppose that could fail to mark a piece of hash, when it's not the full hash, but it seems acceptable to assume that a piece of a hash does not constitute a reference. Off-topic: |
There is some precedent for creating safer versions of the primops in Nixpkgs lib. That could be another approach, lib.strings.{match,split} that re-add the context back. That would avoid a behavior change in evaluation of historical Nixpkgs. |
@edolstra wrote:
Argh. Of course. @roberth wrote:
This may work in practice, but it feels a bit too magic/foreign given that e.g. even a zero-length substring preserves its parent's context. @tomberek wrote:
Good idea! In the meantime, I suppose I should just close this PR and create a new one documenting the caveat? |
I'm not 100% sure that not fixing the bug is the best approach.
I don't know if we have good data for the possible hash scanning. You may need to use I'd support a fix in either project. |
Motivation
Without this, it is easy to accidentally generate, e.g., a config file referencing a store path without recording proper dependency information.
P.-S. — This patch does not backport effortlessly to some older branches, but I have another one that applies there. I can open another PR once/if this is handled in
master
.