tern-tools / tern

Tern is a software composition analysis tool and Python library that generates a Software Bill of Materials for container images and Dockerfiles. The SBOM that Tern generates will give you a layer-by-layer view of what's inside your container in a variety of formats including human-readable, JSON, HTML, SPDX and more.
BSD 2-Clause "Simplified" License
960 stars 188 forks source link

Fix error executing in chroot in Ubuntu container #1169

Closed rnjudge closed 2 years ago

rnjudge commented 2 years ago

When Tern ran in a Ubuntu container for images with an apk package manager, there was an issue finding the shell which led to a failed package metadata command using chroot.

This commit adds a workaround to make sure Tern can find a shell when running in a Ubuntu container, specifically when the shell is symlinked to busybox for the container being analyzed. A more detailed description of the problem can be found in the bug report[1].

It's unclear exactly why the realpath fails to resolve to the correct utility location when Tern runs in a Ubuntu container while analyzing apk-based container images. For now, this commit is meant as a workaround for this exceptional case that is blocking several users.

[1]https://github.com/tern-tools/tern/issues/1161

Resolves #1161

Signed-off-by: Rose Judge rjudge@vmware.com

rnjudge commented 2 years ago

Tested by @jeeppler in https://github.com/tern-tools/tern/issues/1161. Merging.