Skip to content
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

opts/envfile: trim all leading whitespace in a line #15762

Merged
merged 1 commit into from Aug 24, 2015

Conversation

mattrobenolt
Copy link
Contributor

Rather than just trimming before a variable, we should trim the line first.

This prevents a line with whitespace only to not break docker.

@GordonTheTurtle GordonTheTurtle added status/0-triage dco/no Automatically set by a bot when one of the commits lacks proper signature labels Aug 21, 2015
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Aug 21, 2015
@duglin
Copy link
Contributor

duglin commented Aug 21, 2015

testcases?

@mattrobenolt
Copy link
Contributor Author

Yeah, adding now. :)

@mattrobenolt
Copy link
Contributor Author

@duglin test added, which fails before this patch, but passes after patch.

@calavera
Copy link
Contributor

LGTM

// because it's common for editors to trim trailing whitespace
// from lines, which becomes annoying since that's the
// exact thing we need to test.
content += "\n "
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a similar test, using a tab as whitespace?

Also, this looks to be adding trailing whitespace (the whitespace is appended to the content), not leading whitespace, is that correct?

Copy link
Member

Choose a reason for hiding this comment

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

think I misread the description of the PR, got confused because of the "trim the first line" in your PR description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see the misunderstanding, but it says "trim the line first" NOT "trim the first line". ;)

tl;dr, if there's a line with only whitespace, docker would error before.

Do we need a similar test, using a tab as whitespace?

I could just add a \t into this line as well to cover both.

Copy link
Member

Choose a reason for hiding this comment

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

Doh! You're right, probably combined with the "trim leading" title of the PR, I got completely lost LOL

I could just add a \t into this line as well to cover both

Saw you added it, thanks!

@mattrobenolt mattrobenolt changed the title opt/envfile: trim all leading whitespace in a line opts/envfile: trim all leading whitespace in a line Aug 22, 2015
Signed-off-by: Matt Robenolt <matt@ydekproductions.com>
@cpuguy83
Copy link
Member

LGTM

cpuguy83 added a commit that referenced this pull request Aug 24, 2015
opts/envfile: trim all leading whitespace in a line
@cpuguy83 cpuguy83 merged commit c0a48a6 into moby:master Aug 24, 2015
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.

None yet

7 participants