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 plan build regression in 0.76.0 release #6257
Conversation
Thanks for the pull request! Here is what will happen next:
Thank you for contributing! |
…limited This change was originally from #6240 Signed-off-by: Jon Bauman <5906042+baumanj@users.noreply.github.com>
- Don't output anything in the case of an empty or missing [T]DEPS file, since mapfile interprets a single newline as a 1-element array: ("") - Only cat [T]DEPS if it has nonzero size - Abort if pkg_path argument is missing - Remove superfluous, unconditional return Signed-off-by: Jon Bauman <5906042+baumanj@users.noreply.github.com>
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.
Looks good to me, though I'll defer ultimately to @smacfarlane @eeyun and @fnichol for their validation.
Nice work @baumanj
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.
Nice work
Signed-off-by: Jon Bauman <5906042+baumanj@users.noreply.github.com>
Discussion on whether to merge this now or wait until we have some scripted tests is taking place in slack. As a note on the issue, the cases we were testing on Friday that were failing appear to be fine in this PR branch but as @smacfarlane pointed out there's still some concern around moving forward with reverting the reversion without some tests that can tell us that there aren't any other unforseen ripples from the change. |
The decision here is to merge this, thaw the merge-freeze and backfill tests while this is in acceptance before the next release! Great work on these fixes @baumanj. |
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.
scaff_build_deps_resolved+=("$resolved") | ||
# Add each (fully qualified) direct run dependency of the scaffolding | ||
# package. | ||
mapfile -t sdeps < <(_get_deps_for "$resolved") |
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.
@baumanj Could you provide a brief comment inline describing what the < <()
syntax means? I'm having a little trouble understanding it. I see in your pr you link to the shellcheck page that describes that this is the preferred style, but didn't see an explanation of the syntax. Is it a particular bash idiom we could link to?
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.
Added d60e521
Signed-off-by: Jon Bauman <5906042+baumanj@users.noreply.github.com>
Obvious fix; these changes are the result of automation not creative thinking.
tl;dr see the fix in 05d3623
Full Details
Reverts #6248
Resolves #6250
Now that we understand the nature of this error, we can re-implement that shellcheck fixes that we previously reverted and add the necessary fix to the problem they uncovered.
The Bugs
In
_resolve_scaffolding_dependencies
(and other similar usages), changing the code that collects the transitive dependencies fromsdeps=($(_get_deps_for "$resolved"))
to
as part of Enable clippy and shellcheck linting #6160 to address
shellcheck
lint SC2207. This resulted in a defect where because only the first dependency from_get_deps_for
was added tosdeps
, scaffolding-based builds failed. [plan-build] Avoid reading a newline delimited value to array #6240 was submitted to fix the issue.The fix in [plan-build] Avoid reading a newline delimited value to array #6240 was correct. It changed
to
The first command is for populating an array from a single line of input, with entries separated by whitespace. The second command is for populating an array from multiple lines of input, with entries separate by newlines (which is what
_get_deps_for
does).However, a different bug was discovered: unexpected newlines were appearing at the beginning of the
TDEPS
files for some packages, causing breakages. Eventually, the difference in behavior betweensdeps=($(_get_deps_for "$resolved"))
and
was traced back to
_get_deps_for
:Because
_get_tdeps_for
returned a newline (rather than nothing) in the case of an absentTDEPS
file (which is normal, some packages have no transitive dependencies), themapfile
version of the code interpreted this as a single element array, containing an empty string. This was eventually rendered into the subsequentTDEPS
file as an empty line.Essentially, the previous code depended upon "the shell's sloppy word splitting and glob expansion" that
shellcheck
warns against. Updating_get_tdeps_for
(and similarly_get_deps_for
) to output nothing in the case of an empty set (and omitting the superfluousreturn
):fixes the issue.
This PR makes some additional improvements to
_get_[t]deps_for
; see 05d3623.