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

fix(scanner): parsing apt cache policy for nvidia-container-toolkit #1786

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scanner/debian.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ func (o *debian) parseAptCachePolicy(stdout, name string) (packCandidateVer, err

if isRepoline {
ss := strings.Split(strings.TrimSpace(line), " ")
if len(ss) == 5 {
if len(ss) == 5 || len(ss) == 4 {
ver.Repo = ss[2]
return ver, nil
}
Expand Down
23 changes: 23 additions & 0 deletions scanner/debian_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,29 @@ func TestParseAptCachePolicy(t *testing.T) {
Repo: "precise-updates/main",
},
},
{
// nvidia-container-toolkit
`nvidia-container-toolkit:
Installed: 1.14.2-1
Candidate: 1.14.3-1
Version table:
1.14.3-1 500
500 https://nvidia.github.io/libnvidia-container/stable/deb/amd64 Packages
*** 1.14.2-1 500
500 https://nvidia.github.io/libnvidia-container/stable/deb/amd64 Packages
100 /var/lib/dpkg/status
1.14.1-1 500
500 https://nvidia.github.io/libnvidia-container/stable/deb/amd64 Packages
1.14.0-1 500
500 https://nvidia.github.io/libnvidia-container/stable/deb/amd64 Packages`,
"nvidia-container-toolkit",
packCandidateVer{
Name: "nvidia-container-toolkit",
Installed: "1.14.2-1",
Candidate: "1.14.3-1",
Repo: "",
},
},
}

d := newDebian(config.ServerInfo{})
Expand Down
Loading