-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Syft should log warnings even when no TTY is present #3081
Comments
I have the same problem with Grype. Adding |
Thanks @devfbe for filing the issue! When we have some cycles we can take a look and see where the creation of the logger is failing/dependent on the presence of the tty. We do agree that this should just work sans tty detection. PRs are also welcome and we can help get those merged if you happen to find where this might be failing in syft. Thanks! |
Ok, I reproduced on both Docker on my M3 Mac and in Podman Ubuntu on my X86 ThinkPad. Lots of testing here. But the tl;dr is that I think it's working as designed. Even if you suppress the WARN messages (which result through having a non-posix or 'very stripped down' container with no The error I show at the bottom is because the scratch container has no ca certs and so cannot validate the SSL cert on the update server. We consider that a non-blocking error, and continue with the scan anyway. M3 Mac - Docker
LinuxLet's also repeat on my Ubuntu laptop using Podman, to make sure it's not a docker<->podman thing.
ConclusionWith the Docker (with tty)
Podman (with tty)
Docker (no tty)
Podman (no tty)
The assumption that animations are preventing things appearing is unfounded in my opinion. |
I did a little more work understanding what's happening over on the related Grype issue: anchore/grype#2180 (comment) I think it might be a clio fix, but I think, in general, when we have a noUI setup in clio, we should still make a stderr logger set at WARN. |
I did some experiments and proved a couple for things:
https://github.com/anchore/clio/blob/f538a9016e10cb9563c9fb40f0d3345ba12e6c70/logging.go#L44 is incorrect, because it assumes that there's nothing to log if there's verbosity=0, but verbosity=0 is |
What happened:
Important WARN logs like
Are not visible / not logged, when no TTY is present. This happens especially in my GitLab pipelines where jobs do not have a tty.
What you expected to happen:
I expect that all logs, especially with Level >= WARN are being logged when
/dev/stdout
and/dev/stderr
are present. A missing (pseudo)tty should not cause missing logs.Steps to reproduce the issue:
Build a container with a broken environment where no temp dir exists and try to scan a test artifact (in my case
containerimage.tar
) in this container. 1 Try with a pseudo tty and one time without a tty. You'll see the warnings only, when a pseudo tty has been allocated. I verified, that even without the pseudo tty,/dev/stdout
and/dev/stderr
are there and work as intended.Test container:
Run without tty:
Run with pseudo tty:
Anything else we need to know?:
I assume that the logs are missing, because when no TTY is there some special terminal tricks like animations don't work.
Environment:
The text was updated successfully, but these errors were encountered: