Skip to content

Warn on empty continuation lines only, not on comment-only lines #35004

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

Merged
merged 1 commit into from
Sep 28, 2017

Conversation

thaJeztah
Copy link
Member

Alternative approach to #34333

Commit 8d1ae76 added deprecation warnings for empty continuation lines, but also treated comment-only lines as empty.

This patch distinguishes empty continuation lines from comment-only lines, and only outputs warnings for the former.

ping @dnephin @tianon

@@ -331,8 +335,12 @@ func trimWhitespace(src []byte) []byte {
return bytes.TrimLeftFunc(src, unicode.IsSpace)
}

func isComment(line []byte) bool {
return bytes.HasPrefix(trimWhitespace(line), []byte("#"))
Copy link
Member

Choose a reason for hiding this comment

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

Do you think this ought to re-use tokenComment to keep a single-source-of-truth, or maybe it doesn't matter?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, good one, yes, can do

Commit 8d1ae76 added
deprecation warnings for empty continuation lines,
but also treated comment-only lines as empty.

This patch distinguishes empty continuation lines
from comment-only lines, and only outputs warnings
for the former.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the dont-warn-for-comment-only-lines branch from 8ae6836 to 2fd736a Compare September 27, 2017 22:11
@thaJeztah
Copy link
Member Author

@tianon done 👍

Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

😍

@coredumperror
Copy link

Looks like a much better solution than mine. It's much clearer what the patch is changing, and why.

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member Author

For future reference; this patch was included in docker 17.10 docker-archive/docker-ce@f6d296e

@tianon
Copy link
Member

tianon commented Nov 3, 2017

Since 17.09 is a "stable" release, would it make sense to add this to the pile of potential-backport-candidates for a future 17.09.1? 😇

@thaJeztah
Copy link
Member Author

@tianon I'll add it to the pile for consideration, but it may be considered "non-critical" as the issue doesn't break the build (but, yes, it's confusing/annoying)

@tianon
Copy link
Member

tianon commented Nov 3, 2017

Thanks! Definitely agree with that assessment -- I just want to make sure it's in the pile of things being considered if something critical enough to warrant a 17.09.1 does come up. 👍

@coredumperror
Copy link

Hurray! I just updated to the latest docker-for-mac edge build, and can confirm that I no longer get giant sees of red text in my docker build output!

AlexGoico added a commit to AlexGoico/docker-pygit2 that referenced this pull request Nov 15, 2017
There are warnings that would be emitted because of empty line continuation characters. This commit should eliminate the warnings in the next release of docker. See: moby/moby#35004
mrled added a commit to mrled/psyops that referenced this pull request Jan 7, 2018
dcarley added a commit to CircleCI-Archived/docker-coreos-toolbox-ubuntu that referenced this pull request Mar 29, 2019
This was appearing in the build output:

    [WARNING]: Empty continuation line found in:
        RUN     apt-get update && apt-get upgrade -y &&     addgroup --gid 500 core &&     adduser --home /home/core --shell /bin/bash --uid 500 --gid 500 --disabled-password --system core &&     addgroup --gid 253 fleet &&     adduser core fleet &&     addgroup --gid 233 coredocker &&     adduser core coredocker &&     addgroup --gid 248 core-systemd-journal &&     adduser core core-systemd-journal &&     DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata sudo net-tools inetutils-ping bash-completion mc tmux openssh-client &&     apt-get clean &&     ln -s /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 /lib/x86_64-linux-gnu/libdevmapper.so.1.02 &&     sed -i "s/%!s(MISSING)udo\s*ALL=(ALL:ALL)\s*ALL/%!s(MISSING)udo ALL=(ALL:ALL) NOPASSWD:ALL/" /etc/sudoers &&     adduser core sudo &&     mv /etc/bash.bashrc /etc/bash.basrc.coreos &&     echo ". /etc/bash.bashrc.coreos\nPS1=\"\\[\\033[01;35m\\]toolbox\\[\\033[01;34m\\] \$PS1\"" >/etc/bash.bashrc
    [WARNING]: Empty continuation lines will become errors in a future release.

This should be fixed by using a later version of Docker to build per
moby/moby#35004
dcarley added a commit to CircleCI-Archived/docker-coreos-toolbox-ubuntu that referenced this pull request Mar 29, 2019
This was appearing in the build output:

    [WARNING]: Empty continuation line found in:
        RUN     apt-get update && apt-get upgrade -y &&     addgroup --gid 500 core &&     adduser --home /home/core --shell /bin/bash --uid 500 --gid 500 --disabled-password --system core &&     addgroup --gid 253 fleet &&     adduser core fleet &&     addgroup --gid 233 coredocker &&     adduser core coredocker &&     addgroup --gid 248 core-systemd-journal &&     adduser core core-systemd-journal &&     DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata sudo net-tools inetutils-ping bash-completion mc tmux openssh-client &&     apt-get clean &&     ln -s /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 /lib/x86_64-linux-gnu/libdevmapper.so.1.02 &&     sed -i "s/%!s(MISSING)udo\s*ALL=(ALL:ALL)\s*ALL/%!s(MISSING)udo ALL=(ALL:ALL) NOPASSWD:ALL/" /etc/sudoers &&     adduser core sudo &&     mv /etc/bash.bashrc /etc/bash.basrc.coreos &&     echo ". /etc/bash.bashrc.coreos\nPS1=\"\\[\\033[01;35m\\]toolbox\\[\\033[01;34m\\] \$PS1\"" >/etc/bash.bashrc
    [WARNING]: Empty continuation lines will become errors in a future release.

This should be fixed by using a later version of Docker to build per
moby/moby#35004
phred added a commit to phred/smolboi that referenced this pull request Aug 26, 2023
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.

6 participants