Skip to content

Commit

Permalink
Merge pull request #1200 from chainguard-dev/revert-1188-symlinks-are…
Browse files Browse the repository at this point in the history
…-cmd-too

Revert "Allow symlinks to provide cmd:"
  • Loading branch information
joshrwolf authored May 10, 2024
2 parents 2e6bd0f + b0278fb commit 801d514
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/sca/sca.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func generateCmdProviders(ctx context.Context, hdl SCAHandle, generated *config.
}

mode := fi.Mode()
if !mode.IsRegular() {
return nil
}

if mode.Perm()&0555 == 0555 {
if isInDir(path, pathBinDirs) {
basename := filepath.Base(path)
Expand Down Expand Up @@ -578,10 +582,8 @@ func sonameLibver(soname string) string {
}

func getShbang(fp fs.File) (string, error) {
// Lots of programs have shbangs with python3 or sh which are symlinks.
// generateCmdProviders did not previously add a provides for symlinks
// that means we cannot let packages *depend* on python3, python or sh
// until we have packages that *provide* them.
// python3 and sh are symlinks and generateCmdProviders currently only considers
// regular files. Since nothing will fulfill such a depend, do not generate one.
ignores := map[string]bool{"python3": true, "python": true, "sh": true}

buf := make([]byte, 80)
Expand Down

0 comments on commit 801d514

Please sign in to comment.