syft
syft copied to clipboard
Syft does not log warnings when no tty is present
What happened: Important WARN logs like
[0000] WARN file could not be unarchived: unable to create tempdir for archive processing: stat /tmp: no such file or directory
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:
FROM scratch
COPY syft /
COPY containerimage.tar /
ENTRYPOINT ["/syft"]
Run without tty:
❯ podman run -i syft scan /containerimage.tar
No packages discovered
Run with pseudo tty:
❯ podman run -ti syft scan /containerimage.tar
✔ Indexed file system /
✔ Cataloged contents ccf875aa8af6073319964e9d36823bf7337a7ca8caf5c386c818452a7307c45f
├── ✔ Packages [0 packages]
└── ✔ Executables [0 executables]
[0000] WARN file could not be unarchived: unable to create tempdir for archive processing: stat /tmp: no such file or directory
[0001] WARN unable to determine GOPATH or user home dir: %!w(string=exec: "getent": executable file not found in $PATH)
[0001] WARN unable to determine GOPATH or user home dir: %!w(string=exec: "getent": executable file not found in $PATH)
No packages discovered
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:
- Syft 1.9.0
- OCI-Container of all kind