-
Notifications
You must be signed in to change notification settings - Fork 68
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
Adjust argument slice size in builder #164
Adjust argument slice size in builder #164
Conversation
@@ -332,7 +332,7 @@ func ParseFile(path string) (*parser.Node, error) { | |||
|
|||
// Step creates a new step from the current state. | |||
func (b *Builder) Step() *Step { | |||
dst := make([]string, len(b.Env)+len(b.RunConfig.Env)) | |||
dst := make([]string, len(b.Env)+len(b.RunConfig.Env)+len(b.Arguments())) | |||
copy(dst, makeUserArgs(b)) | |||
dst = append(dst, b.RunConfig.Env...) |
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.
Some of the values from b.Args
won't be used if they conflict with environment values, so the size count being used here for allocating dst
can be off, and if it is, it can leave a gap with empty strings in the final slice.
A recent update to the argument handling didn't increase the argument slice to take into the account the values from b.Args() that were now being added. The created unpredicatble results. After addressing a comment from @nalind, I realized that the value from b.Arguments should be used in the steps as it keeps the ordering of when the ARGS and ENV were defined in the Dockerfile. Changed makeUserArgs in internals.go to take two variables rather than just a builder. Adddresses the Buildah bug: containers/buildah#2345 Signed-off-by: TomSweeneyRedHat <[email protected]>
68ded6b
to
3ccf1b9
Compare
LGTM |
@nalind PTAL |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind, TomSweeneyRedHat The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
A recent update to the argument handling didn't increase
the argument slice size to take into account the values
from b.Args() that were now being added. This created
unpredictable results.
After addressing a comment from @nalind, I realized that
the value from b.Arguments should be used in the steps
as it keeps the ordering of when the ARGS and ENV were
defined in the Dockerfile. Changed makeUserArgs
in internals.go to take two variables rather than just
a builder.
Addresses the Buildah bug: containers/buildah#2345
Signed-off-by: TomSweeneyRedHat [email protected]