anchore / anchore/syft

Excluding a directory does not work on Windows

Open
#1,024 9 comments 0 reactions 1 assignee Assigned to @kzantow View on GitHub
bug windows
Dominant language
Go
Stars
9.6k
Forks
954
Avg merge
1d 5h
Merged PRs (30d)
42

Description

When I use syft with option packages, the --exclude argument seems to be ignored.
The output tells me that there is a problem to access a zip file in %APPDATA%/Local/Temp/2/syft-archive-contents-... (not a valid zip file) or (the process cannot access the file because it is being used by another process).
So it seems that syft is analyzing its own temporal archive.

[0012] WARN cataloger 'java-cataloger' failed to parse entries at location=Location: unable to read files from java archive: unable to open zip archive (C:\Users\asd\AppData\Local\Temp\2\syft-archive-contents-2300921872\archive-archive-archive-a
rchive-archive-archive-archive-archive-archive-archive-archive-archive-python-3.8.zip): cannot find beginning of zip archive="C:\\Users\\asd\\AppData\\Local\\Temp\\2\\syft-archive-contents-2300921872\\archive-archive-archi
ve-archive-archive-archive-archive-archive-archive-archive-archive-archive-python-3.8.zip" : zip: not a valid zip file
[0012] ERROR unable to cleanup archive tempdir: remove C:\Users\asd\AppData\Local\Temp\2\syft-archive-contents-3815765297\archive-archive-archive-archive-archive-archive-archive-archive-archive-archive-archive-python-3.8.z
ip: The process cannot access the file because it is being used by another process.

Hence I tried to add the Temp directory to the exclusion list, but no success.

from powershell
cd /
.\syft\syft.exe packages --exclude '**/Temp' dir:c:\\

Also when I try '**/* everything will be checked, too.

BTW: When I try to specify an absolute directory, it tells me that I need to use one of ./, */ or **/. But I just want to use c:\ or /c/Users/*/AppData/Local/Temp or similar.

Second question:
It seems that the output does not contain any exe file or program-name of an installed application. Is this correct? It only finds some python files at c:\cygwin64 for example.

Thank you very much for your help.

**Environment**:

Application: syft
Version: 0.46.3
JsonSchemaVersion: 3.2.3
BuildDate: 2022-05-26T06:46:34Z
GitCommit: 7cb8e1fc14a278ec5afce379623a47577aba9917
GitDescription: v0.46.3
Platform: windows/amd64
GoVersion: go1.18.2
Compiler: gc

Windows Server 2019 Datacenter Evaluation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.