Fix breeze docker version parsing #19182
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After this recent change: 18902, docker version parsing no longer works in all cases:
This is specifically due to the whitespace being removed from this line:
printfis expecting at least 3%darguments which it parses as integers to 3 decimal places. But the missing whitespace in the bash expansion causes the version to not be split into multiple inputs intoprintfas expected, but rather one string:With whitespace in expansion:
Without whitespace in expansion:
As you can see in the latter case the entire version is used as the first argument to
printfand thenprintfdefaults the second and third%dwith zeros since input is not provided, which is why 6 trailing zeros are seen in the output.This defaulting allowed the code to pass undetected when it was tested originally, since the
<=version comparison still passes with this input. It is not until a community edition docker version is used which includes '-ce' in the version that this breaks:docker community edition version output:
When run through the breeze version extraction logic yields:
When this input is run through the
printflogic, with whitespace, you can see the input version is properly split into separate inputs forprintf, which uses the first three arguments and the last argument (theceportion) is unused. Yielding a useable version:However when the version of the code without the whitespace,
printfis given one large input which it uses as the first arg. Which includescewhich is not parseable as a number. Which yields the original error message:This change re-adds the whitespace to the expansion which correctly handles both usecases.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.