-
Couldn't load subscription status.
- Fork 727
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened:
running go test -race using test below results in failure
func TestRace(t *testing.T) {
// using path to git binary as an example
src, _ := source.NewFromFile("/opt/homebrew/Cellar/git/2.39.2/bin/git")
syft.CatalogPackages(&src, cataloger.DefaultConfig())
}❯ go test -race
==================
WARNING: DATA RACE
Read at 0x00c0004cab80 by goroutine 17:
github.com/wagoodman/go-progress.(*Manual).SetCompleted()
/Users/jamespickett/go/pkg/mod/github.com/wagoodman/[email protected]/manual.go:31 +0x90c
github.com/anchore/syft/syft/pkg/cataloger.Catalog()
/Users/jamespickett/go/pkg/mod/github.com/anchore/[email protected]/syft/pkg/cataloger/catalog.go:176 +0x898
github.com/anchore/syft/syft.CatalogPackages()
/Users/jamespickett/go/pkg/mod/github.com/anchore/[email protected]/syft/lib.go:72 +0x7ac
github.com/kolide/launcher/pkg/osquery/tables/syft.TestRace()
/Users/jamespickett/Documents/repos/james-launcher/pkg/osquery/tables/syft/table_test.go:13 +0x190
testing.tRunner()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1446 +0x188
testing.(*T).Run.func1()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1493 +0x40
Previous write at 0x00c0004cab80 by goroutine 19:
github.com/anchore/syft/syft/pkg/cataloger.Catalog.func2()
/Users/jamespickett/go/pkg/mod/github.com/anchore/[email protected]/syft/pkg/cataloger/catalog.go:142 +0x58
Goroutine 17 (running) created at:
testing.(*T).Run()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1493 +0x55c
testing.runTests.func1()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1846 +0x90
testing.tRunner()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1446 +0x188
testing.runTests()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1844 +0x6c0
testing.(*M).Run()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1726 +0x870
main.main()
_testmain.go:47 +0x2fc
Goroutine 19 (finished) created at:
github.com/anchore/syft/syft/pkg/cataloger.Catalog()
/Users/jamespickett/go/pkg/mod/github.com/anchore/[email protected]/syft/pkg/cataloger/catalog.go:140 +0x548
github.com/anchore/syft/syft.CatalogPackages()
/Users/jamespickett/go/pkg/mod/github.com/anchore/[email protected]/syft/lib.go:72 +0x7ac
github.com/kolide/launcher/pkg/osquery/tables/syft.TestRace()
/Users/jamespickett/Documents/repos/james-launcher/pkg/osquery/tables/syft/table_test.go:13 +0x190
testing.tRunner()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1446 +0x188
testing.(*T).Run.func1()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/testing/testing.go:1493 +0x40
==================
--- FAIL: TestRace (0.04s)
testing.go:1319: race detected during execution of test
FAIL
exit status 1
FAIL github.com/kolide/launcher/pkg/osquery/tables/syft 0.344s
What you expected to happen:
No race to be detected, tests pass
Steps to reproduce the issue:
Run the test code above using go test -race
Anything else we need to know?:
It does not race for all paths. A complied go executable does not race.
Also, thank you for creating this awesome tool!
Environment:
- Output of
syft version:
// go mod
github.com/anchore/syft v0.73.0
❯ syft version
Application: syft
Version: 0.73.0
JsonSchemaVersion: 7.0.0
BuildDate: 2023-02-22T19:08:35Z
GitCommit: aa151da5fe2a1b11502c852fd2d3ad462c1d245f
GitDescription: [not provided]
Platform: darwin/arm64
GoVersion: go1.20.1
Compiler: gc
- OS (e.g:
cat /etc/os-releaseor similar):
MacBook Pro
Apple M1 Pro
Ventura 13.2.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done