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

remote + build + RUN: emits spurious CR (^M) #8342

Closed
edsantiago opened this issue Nov 14, 2020 · 7 comments
Closed

remote + build + RUN: emits spurious CR (^M) #8342

edsantiago opened this issue Nov 14, 2020 · 7 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote stale-issue

Comments

@edsantiago
Copy link
Member

edsantiago commented Nov 14, 2020

Another variant of #7942 : RUN commands within a podman build are emitting an unwanted ^M.

In window 1:

$ bin/podman system service --timeout=0

In window 2:

$ printf "FROM alpine\nRUN echo hi\n" | bin/podman-remote build -t foo - | cat -vET

Output is below, contrasting podman (left) to podman-remote (right):

STEP 1: FROM alpine$                | STEP 1: FROM alpine$
STEP 2: RUN echo hi$                | STEP 2: RUN echo hi$
hi$                                 | hi^M$   <---- unwanted ^M
STEP 3: COMMIT foo$                 | STEP 3: COMMIT foo$

master @ 4eb9c28; also present in podman-2.1.1-7.fc32

If/when this is fixed, please update test:

# FIXME: podman-remote output differs from local: #8342 (spurious ^M)
# FIXME: podman-remote output differs from local: #8343 (extra SHA output)
remote_extra=""
if is_remote; then remote_extra=".*";fi
expect="${random1}
.*
STEP 1: FROM $IMAGE
STEP 2: RUN echo x${random2}y
x${random2}y${remote_extra}
STEP 3: COMMIT build_test${remote_extra}

@edsantiago edsantiago added the remote Problem is in podman-remote label Nov 14, 2020
edsantiago added a commit to edsantiago/libpod that referenced this issue Nov 14, 2020
- images: confirm that 'podman images' emits headings
  even if there are no images present. Intended to
  replace e2e test which is difficult to get working
  under podman-remote.

- build: add test for containers#8092, podman-build gobbling stdin.
  Workaround needed for issues containers#8342 and containers#8343, in which
  podman-remote output differs from podman local.

- volumes: add test for containers#8307, double-lock on same volume.

Signed-off-by: Ed Santiago <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Nov 17, 2020

@nalind Any ideas what is causing this?

@nalind
Copy link
Member

nalind commented Nov 17, 2020

Is there a pseudo-terminal involved? If so, does it have the "ONLCR" flag set on its output? Running "stty -a" in that context would tell us, either with "onlcr" (set) or "-onlcr" (not set).

@edsantiago
Copy link
Member Author

The terminal from which I'm running has onlcr; if I try stty -onlcr life is too horrible to contemplate.

The ^M happens even if I s/|/|&/, which presumably removes ptys completely out of the equation:

$ printf "FROM alpine\nRUN echo hi\n" | bin/podman-remote build -t foo - |&  cat -vET
...
hi^M$

@nalind
Copy link
Member

nalind commented Nov 17, 2020

Is the command indicated in the RUN instruction being executed with a pseudo-terminal, and if so, is "onlcr" set in it?

Experimentally, it looks like docker build always disables use of pseudo-terminals for RUN, and I'm thinking we should switch to doing the same. That would also make containers/buildah#2577 viable.

@edsantiago
Copy link
Member Author

Duh, sorry, I misunderstood.

$ printf "FROM alpine\nRUN stty -a\n" | bin/podman-remote build -t foo - |& cat -vET
STEP 1: FROM alpine$
STEP 2: RUN stty -a$
speed 38400 baud;stty: standard input^M$
 line = 0;^M$
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;^M$
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;^M$
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;^M$
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts^M$
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff^M$
-iuclc -ixany -imaxbel -iutf8^M$
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0^M$
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt^M$
echoctl echoke -flusho -extproc^M$
STEP 3: COMMIT foo$
...
$ printf "FROM alpine\nRUN stty -onlcr && echo hi\n" | bin/podman-remote build -t foo - |& cat -vET 
STEP 1: FROM alpine$
STEP 2: RUN stty -onlcr && echo hi$
hi$     <--- yippee!
STEP 3: COMMIT foo$
...

podman-non-remote for comparison:

$ printf "FROM alpine\nRUN stty -a\n" | bin/podman build -t foo - |& cat -vET
STEP 1: FROM alpine$
STEP 2: RUN stty -a$
stty: standard input: Not a tty$
Error: error building at STEP "RUN stty -a": error while running runtime: exit status 1$

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Dec 18, 2020

This is fixed in the main branch.

@rhatdan rhatdan closed this as completed Dec 18, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote stale-issue
Projects
None yet
Development

No branches or pull requests

3 participants