Skip to content
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

Fix considering base path when ignoring known bad unix paths #2644

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Feb 14, 2024

Fixes #2627

This updates the logic when considering paths to ignore/filter out during the indexing phase of the directory file resolver. Currently we ignore known common paths that mount to filesystems that provide no packages (e.g. /dev and /proc). This currently doesn't consider cases when the filesystem being scanned isn't mounted at root (when there is a base-path to consider). For example, when scanning /some/mount/path and there is a path /some/mount/path/dev, we should be considering that latter path during indexing to be /dev. Ultimately the index value is correct, but filter functions do not have the option to observe the value of base-path (i.e. /some/mount/path) to calculate the relative path of the target.

This PR changes the behavior to allow filter functions to have access to base-path. We currently have some filter functions that need to consider the relative path and some that need to consider the real path, so a further-upstream-change of this function could not be made (that is, pass down the relative path into the filter functions).

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman requested a review from a team February 14, 2024 18:56
@wagoodman wagoodman merged commit a909e3c into main Feb 14, 2024
11 checks passed
@wagoodman wagoodman deleted the fix-indexing-missing-files branch February 14, 2024 20:57
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
…#2644)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
jpalermo added a commit to jpalermo/syft that referenced this pull request Feb 24, 2024
…nchore#2644)"

This change caused the skipping of any paths including "/proc", "/dev" and "/sys" which
was not the intended change and excludes many things that should be scanned.

anchore#2667

This reverts commit a909e3c.
jpalermo added a commit to jpalermo/syft that referenced this pull request Feb 24, 2024
…nchore#2644)"

This change caused the skipping of any paths including "/proc", "/dev" and "/sys" which
was not the intended change and excludes many things that should be scanned.

anchore#2667

This reverts commit a909e3c.

Signed-off-by: Joseph Palermo <joseph.palermo@broadcom.com>
@jpalermo
Copy link
Contributor

FYI, I just submitted a PR to revert this. This causes any path starting with /proc, /sys or /dev to be skipped.

@mrsufgi
Copy link

mrsufgi commented Feb 27, 2024

In conjunction with the / (abs/rel path) issue: #2093
This breaks catalogers, specifically python-package-cataloger.

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

Successfully merging this pull request may close these issues.

unable to index filesystem for amazonlinux images
4 participants