-
-
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
__unsafeDiscardOutputDependency
used with exportReferencesGraph
does not work
#7330
Comments
I was wrong about this. The code in Instead, as I think @edolstra was saying, we probably need to reconsider 2897286 or otherwise disambiguate these cases. |
So
I can see two reproducibility-preserving ways forward. I'm leaning towards (b). a. Extend data model, conserve interfaceThis assumes that we want to keep the user interface the same as it is today. We have two kinds of derivation string contexts that can be converted back and forth (given In order to preserve composition, the boolean decision to be deep or not should be local, and it should be preserved as long as necessary. This will involve opt-in improvements to the derivation format, and new fields in the references database as well as in narinfo. For instance a derivation variable All in all this requires a lot of change throughout the data model, but the user interface remains mostly unchanged. Certainly if Nixpkgs enables b. Soft-deprecate DrvDeep and fix
|
Describe the bug
__unsafeDiscardOutputDependency
used withexportReferencesGraph
cause a build failure when the output paths of the drv File used with cannot be found in the sandbox because they are not yet built.Steps To Reproduce
TODO make exact example; it can be used as a test.
Expected behavior
drv outputs are ignored, only the drv file itself matters.
Additional context
__unsafeDiscardOutputDependency
is not unsafe at all, it is just used to make a derivation depend on a drv file itself and not its outputs. (Just depending on the drv itself should probably be the default, but isn't for historical reasons.) How does it work? It removes any=
the string context starts with. Implemented innix/src/libexpr/primops/context.cc
Lines 34 to 44 in 62960f3
In
nix/src/libexpr/primops.cc
Lines 1202 to 1211 in 62960f3
=
is handled. It causes the newly-built derivation to have far more dependencies -- in addition to the drv file itself, all its drv file dependencies and all their outputs are depended upon.exportReferencesGraph
is implemented in large part byStore::exportReferences
innix/src/libstore/store-api.cc
Lines 823 to 836 in 62960f3
It seems that the export references code is wrong:
It is assuming all drv paths got the
=
treatmeant but this is not necessarily the case. For ones that didn't (using__unsafeDiscoardOutputDependency
), we cannot start processing their outputs because those are not necessarily dependencies of the derivation.The code is unnecessary, because the treatment of
=
in the evaluator will already ensure all those paths are ininputPaths
/inputDrvs
, andnix/src/libstore/build/derivation-goal.cc
Lines 532 to 560 in 62960f3
inputPaths
As such we should be able to do this:
Write test confirming the current failure in
tests/export-graph.nix
. See there is one for adrvPath
without__unsafeDiscardOutputDependency
aready.Delete the code in
Store::exportReferences
that seems pointless, and confirm the bug is fixed.See 2897286 for what I think introduced the bug.
The text was updated successfully, but these errors were encountered: