Skip to content

builder: Make builtin arg pruning work with > 1 arg#32763

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
dave-tucker:fix-32744
Apr 28, 2017
Merged

builder: Make builtin arg pruning work with > 1 arg#32763
cpuguy83 merged 1 commit intomoby:masterfrom
dave-tucker:fix-32744

Conversation

@dave-tucker
Copy link
Contributor

The previous implementation would error out with "Unexpected EOF" which
was caused by an underlying "array index out-of-bounds" error.
The root cause was deleting items from the same array that was being
iterated over. The iteration was unaware that the array size had
changed, resulting in an error.

The new implementation builds a new array instead of mutating a copy of
the old one.

Fixes: #32744

Signed-off-by: Dave Tucker [email protected]

@dave-tucker
Copy link
Contributor Author

/cc @thaJeztah - this will need cherry picking in to the next RC for 17.05

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the case change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh we're appending to a new slice instead of removing from the slice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An integration test that has to compile the entire daemon, start a daemon and run a full build is somewhat overkill for testing an array out of bounds error.

Could this be a unit test for run() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could argue that it's not just testing the oob error but that it's testing the use case...
If you are against having a dedicated test for it, I can collapse it in to the previous build-arg exclusions test.
As for adding a unit test, I'll take a look and see how easy that'll be...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is definitely a test for that use case, but we can't write a slow integration test for every possible input. The test suite would take multiple years to run.

Unfortunately I don't think a unit test is going to be possible right now. I wrote one in #32773 after I refactored a lot of this code. Currently this code relies on runConfig being shared with the container config of a conatiner that was already created. It's effectively modifying the config of a container post-create, which to me is a huge violation of the boundaries between components.

After #32773 the updated cmd is passed as an argument to commit.

For now updating the existing test sounds good.

The previous implementation would error out with "Unexpected EOF" which
was caused by an underlying "array index out-of-bounds" error.
The root cause was deleting items from the same array that was being
iterated over. The iteration was unaware that the array size had
changed, resulting in an error.

The new implementation builds a new array instead of mutating a copy of
the old one.

Fixes: moby#32744

Signed-off-by: Dave Tucker <[email protected]>
@dave-tucker
Copy link
Contributor Author

@dnephin @cpuguy83 changes made and now all green.
Can we get this merged? It really needs cherry-picking for the next release otherwise anyone who uses > 1 builtin --build-arg will the dreaded Unexpected EOF error!

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpuguy83 cpuguy83 merged commit 9f0ebea into moby:master Apr 28, 2017
@GordonTheTurtle GordonTheTurtle added this to the 17.06.0 milestone Apr 28, 2017
@alexellis
Copy link
Contributor

LGTM - I have a few comments (for readability) that I'll add later, but nothing blocking.

@hellojukay
Copy link

image
On mac 10.12.6

has the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants