Print illegal references when failing a fod because illegal paths are present #530

Open
opened 2024-09-22 09:16:00 +00:00 by tom-hubrecht · 1 comment
Member

When building a fixed output derivation, sometimes references are kept, adn the build fails with illegal path references in fixed-output derivation, with only the name of the derivation at fault shown.

Describe the solution you'd like

I would like to see what illegal references exist to be able to debug the issue more efficiently.

Describe alternatives you've considered

Poke around at random, with ls calls during builds, trying to rebuild endlessly

Additional context

I patched locally my Lix version with

diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 1571627d6..5a77f16a3 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -2203,10 +2204,16 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
                             wanted.to_string(Base::SRI, true),
                             got.to_string(Base::SRI, true)));
                 }
-                if (!newInfo0.references.empty())
+                if (!newInfo0.references.empty()) {
+                    std::string refs;
+                    for (auto r: newInfo0.references) {
+                        refs += "\t" + r.to_string() + "\n";
+                    }
+
                     delayedException = std::make_exception_ptr(
-                        BuildError("illegal path references in fixed-output derivation '%s'",
-                            worker.store.printStorePath(drvPath)));
+                        BuildError("illegal path references in fixed-output derivation '%s':\n%s",
+                            worker.store.printStorePath(drvPath), refs));
+                }
 
                 return newInfo0;
             },

which prints the illegal references, but it is very crude.

## Is your feature request related to a problem? Please describe. When building a fixed output derivation, sometimes references are kept, adn the build fails with `illegal path references in fixed-output derivation`, with only the name of the derivation at fault shown. ## Describe the solution you'd like I would like to see what illegal references exist to be able to debug the issue more efficiently. ## Describe alternatives you've considered Poke around at random, with `ls` calls during builds, trying to rebuild endlessly ## Additional context I patched locally my Lix version with ```diff diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc index 1571627d6..5a77f16a3 100644 --- a/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc @@ -2203,10 +2204,16 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs() wanted.to_string(Base::SRI, true), got.to_string(Base::SRI, true))); } - if (!newInfo0.references.empty()) + if (!newInfo0.references.empty()) { + std::string refs; + for (auto r: newInfo0.references) { + refs += "\t" + r.to_string() + "\n"; + } + delayedException = std::make_exception_ptr( - BuildError("illegal path references in fixed-output derivation '%s'", - worker.store.printStorePath(drvPath))); + BuildError("illegal path references in fixed-output derivation '%s':\n%s", + worker.store.printStorePath(drvPath), refs)); + } return newInfo0; }, ``` which prints the illegal references, but it is very crude.
Owner

feel free to submit this as a CL. there is not really anything terribly wrong with that code.

feel free to submit this as a CL. there is not really anything terribly wrong with that code.
jade added the
ux
label 2024-10-15 22:28:16 +00:00
jade added this to the Error reporting project 2024-10-15 22:28:18 +00:00
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#530
No description provided.