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

walk: log error instead of returning an error #538

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

tstromberg
Copy link
Collaborator

Previously, if walk was unable to traverse a directory, it would exit without scanning any files:

🔎 Scanning "/etc"
error: scan: find: walk: open /etc/credstore: permission denied
exit status 2

With this PR, it just logs noisy error messages and keeps on trucking:

🔎 Scanning "/etc"
time=2024-10-23T20:53:27.491-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:57 msg="error: /etc/credstore: open /etc/credst
ore: permission denied"
time=2024-10-23T20:53:27.491-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:57 msg="error: /etc/credstore.encrypted: open /
etc/credstore.encrypted: permission denied"
time=2024-10-23T20:53:27.492-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:57 msg="error: /etc/multipath: open /etc/multip
ath: permission denied"
time=2024-10-23T20:53:27.492-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:57 msg="error: /etc/polkit-1/rules.d: open /etc
/polkit-1/rules.d: permission denied"
time=2024-10-23T20:53:27.493-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:57 msg="error: /etc/ssl/private: open /etc/ssl/
private: permission denied"
time=2024-10-23T20:53:27.493-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:57 msg="error: /etc/sudoers.d: open /etc/sudoer
s.d: permission denied"
time=2024-10-23T20:53:27.494-04:00 level=ERROR source=/Users/t/src/bincapz/pkg/action/scan.go:100 msg="file type failure: /etc/.pwd.lock: ope
n: open /etc/.pwd.lock: permission denied" path=/etc/.pwd.lock

@tstromberg tstromberg requested a review from egibs October 24, 2024 01:09
@tstromberg tstromberg enabled auto-merge (squash) October 24, 2024 12:09
@tstromberg tstromberg merged commit cf0c89a into chainguard-dev:main Oct 24, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants