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

Progress bars should not show up if stderr is not a TTY #3772

Closed
matthew-nichols opened this issue Dec 17, 2024 · 4 comments · Fixed by #3773
Closed

Progress bars should not show up if stderr is not a TTY #3772

matthew-nichols opened this issue Dec 17, 2024 · 4 comments · Fixed by #3773
Labels
bug Something isn't working

Comments

@matthew-nichols
Copy link

Description

Running any command with a progress bar (nerdctl pull, nerdctl run, etc) in a script (in e.g., systemd) and/or attempting to record the output of such a script (e.g. setup_dev_env.sh |& tee output.txt) leads to a lot of redundant output and unexpected control codes that makes it hard to read.

Steps to reproduce the issue

1.nerdctl pull debian 2> stderr.txt (may need to nerdctl rmi debian first if already pulled)
2.Read stderr.txt
3.See that stderr.txt is filled with control codes, redundant output, etc

Describe the results you received and expected

Expect: that stderr.txt be clean

Received: stderr.txt is filled with control characters/other output that makes it hard to read

What version of nerdctl are you using?

$ nerdctl version
Client:
 Version:	v2.0.2
 OS/Arch:	linux/amd64
 Git commit:	1220ce7ec2701d485a9b1beeea63dae3da134fb5
 buildctl:
  Version:	v0.18.1
  GitCommit:	eb68885955169461d72dc2b7e6d084100fcaba86

Server:
 containerd:
  Version:	v2.0.0
  GitCommit:	207ad711eabd375a01713109a8a197d197ff6542
 runc:
  Version:	1.2.2
  GitCommit:	v1.2.2-0-g7cb36325

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

$ nerdctl info
Client:
 Namespace:	default
 Debug Mode:	false

Server:
 Server Version: v2.0.0
 Storage Driver: overlayfs
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Log:     fluentd journald json-file none syslog
  Storage: native overlayfs
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
  rootless
 Kernel Version:   6.9.3-76060903-generic
 Operating System: Pop!_OS 22.04 LTS
 OSType:           linux
 Architecture:     x86_64
 CPUs:             32
 Total Memory:     94.14GiB
 Name:             REDACTED
 ID:               REDACTED_UUID

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
@matthew-nichols matthew-nichols added the kind/unconfirmed-bug-claim Unconfirmed bug claim label Dec 17, 2024
@apostasie
Copy link
Contributor

Not sure what's different here - looks decent to me:

dmp@lima-v2:/tmp$ cat stderr.txt
docker.io/library/debian:latest:                                                  resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:17122fe3d66916e55c0cbd5bbf54bb3f87b3582f4d86a755a0fd3498d360f91b:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:ff0233119a3e5078551835d116fe762ebd4ddd0200ba1deeca396ada01875bf8: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:995ceb661097ac10281468f88801933ceb73d602c5be83322f015a4a131a759b:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:82312fccb35f18983647c1ea71154b98ae9893fb61ca4febe12d584a3ea9ad6d:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 3.6 s                                                                    total:  46.1 M (12.8 MiB/s)

Anyhow, I am pretty sure this should not go to stderr, but instead to stdout, as docker does.
This needs to be fixed.

Meanwhile, you may want to use the --quiet flag to silence the noise?

@matthew-nichols
Copy link
Author

cat is not an editor, open it in an editor (such as less):
Image
or gedit:
Image

(cat is just throwing the control characters back at the TTY, which is reinterpreting them, which is why it looks nice when you cat into a TTY)

@apostasie
Copy link
Contributor

(cat is just throwing the control characters back at the TTY,

Of course...

Anyhow, needs to be fixed.

@apostasie
Copy link
Contributor

Duplicate of #3395

@yankay yankay added bug Something isn't working and removed kind/unconfirmed-bug-claim Unconfirmed bug claim labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants