-
Notifications
You must be signed in to change notification settings - Fork 206
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 potential subinclude lockup #3305
Fix potential subinclude lockup #3305
Conversation
@@ -1029,6 +1031,9 @@ func (state *BuildState) ActivateTarget(pkg *Package, label, dependent BuildLabe | |||
if state.ParsePackageOnly && !mode.IsForSubinclude() { | |||
return nil // Some kinds of query don't need a full recursive parse. | |||
} else if label.IsAllTargets() { | |||
if pkg == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we end up here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the condition in builtins.go
to allow it to continue to activate the target even if the pkg is nil. That happens when we subinclude from inside a subinclude; they don't have a package set when we're executing them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense. I wonder why pkg is nil in activate target though. Should it be set based on the context?
Think we have an issue in here where
isLocal == true
ands.pkg == nil
; we never activate the target and it never gets built. This happens in the attached test repo when going through//a
because of the double-subinclude; it works okay if the subinclude from//c
gets there first (because then we are specifically parsing for that target which gets handled elsewhere).I think this is a reasonably tactical fix; we don't really need the package in this case, it's only used for:
:all
targets which you can't subinclude anywaysubinclude()