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

There will be extra characters when podman run with --tty #195

Closed
zhangguanzhang opened this issue Aug 5, 2020 · 5 comments
Closed

There will be extra characters when podman run with --tty #195

zhangguanzhang opened this issue Aug 5, 2020 · 5 comments

Comments

@zhangguanzhang
Copy link

zhangguanzhang commented Aug 5, 2020

containers/podman#7196 (comment)

[root@sz-test ~]# podman run --rm  alpine echo 1 | cat -A
1$
[root@sz-test ~]# podman run --rm --tty alpine echo 1 | cat -A
1^M$
    [root@sz-test ~]# 

The problem seems to be here
https://github.com/containers/conmon/blob/master/src/ctr_logging.c#L355-L360
@rhatdan PTAL

@haircommander
Copy link
Collaborator

thanks for opening the issue @zhangguanzhang! I am not so sure it's that line in particular. if you look at the log line:

[root@sz-test overlay-containers]# cat -A 62189eb5a343e7d14e90df0f5a6d03a00fae3120fccc097ac4a5f3d47cbb9689/userdata/ctr.log
2020-08-05T13:34:22.891045849+08:00 stdout F hello^M$

we see it's a full log line (signified by the F after stdout). if it was a partial line, it would be P

If you look at that line, it checks if (partial) which means we only append the newline if it's a partial line.

I believe this line is from interpreting the terminal pipe as one. I do not think conmon can or should drop these characters. instead, could podman drop these characters if printing the logs @mheon ?

@psakar
Copy link

psakar commented Aug 5, 2020

It happens only for one liner, it is gone in case two lines are printed

[psakar@localhost podman]$ podman run --rm --tty busybox echo 1 | cat -A
1^M$
    [psakar@localhost podman]$ podman run --rm --tty busybox echo 1 ; echo 2 | cat -A
1
2$
[psakar@localhost podman]$ 

@psakar
Copy link

psakar commented Aug 5, 2020

podman run --rm --tty busybox echo -n 1 | cat -A also works as expected. Seems only the case when output is single line (can be empty) with new line at the end is wrong

@mheon
Copy link
Member

mheon commented Aug 5, 2020

Hm. Tend to agree this is Podman reading the log line incorrectly.

@giuseppe
Copy link
Member

I think it works as expected. It is the same behavior I get with docker:

$ podman run --rm --tty busybox echo  1 | cat -A 
1^M$
# docker run --rm --tty alpine echo 1 | cat -A
1^M$

# docker run --rm --tty alpine echo -n 1 | cat -A
1
$ podman run --rm --tty busybox echo  -n 1 | cat -A 
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants