-
Notifications
You must be signed in to change notification settings - Fork 755
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened:
Syft fails to compute file digests (checksums) for any files. The file digest cataloger processes 0 files instead of the expected count, resulting in missing digests fields in the output.
What you expected to happen:
Files should have digests computed when using --base-path
Steps to reproduce the issue:
- Create a test directory and file:
mkdir -p /tmp/syft-bug-test
echo "Hello World" > /tmp/syft-bug-test/test.txt- Create a config file to enable file digests:
cat > /tmp/syft-config.yaml << 'EOF'
file:
metadata:
selection: all
digests:
- sha256
EOF- Run Syft with
--base-path:
syft scan --config /tmp/syft-config.yaml --base-path /tmp /tmp/syft-bug-test -o syft-json- Run Syft without
--base-path:
syft scan --config /tmp/syft-config.yaml /tmp/syft-bug-test -o syft-jsonAnything else we need to know?:
AI Generated fix (worked for this specific example above)
all_regular_files.go:
func AllRegularFiles(ctx context.Context, resolver file.Resolver) (locations []file.Location) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
for location := range resolver.AllLocations(ctx) {
metadata, err := resolver.FileMetadataByLocation(location)
if err != nil {
log.Debugf("unable to get metadata for %+v: %+v", location, err)
continue
}
if metadata.Type != stereoscopeFile.TypeRegular {
continue
}
locations = append(locations, location)
}
return locations
}- Uses locations directly from
AllLocations()which already contain valid references - Eliminates the redundant
FilesByPath()lookup that fails with--base-path - Works correctly both with and without
--base-path
Environment:
- Output of
syft version: syft 1.38.0-SNAPSHOT-a033ae52 - OS (e.g:
cat /etc/os-releaseor similar): Ubuntu 22.04.5 LTS
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done