chainguard-dev/melange

Linting segmentation violation

Closed this issue · 2 comments

hbh7 commented

Encountered this while trying to build elasticsearch-7 in enterprise-packages. It may happen in other situations but I haven't run into any others yet. There was some internal speculation that it may have to do with this code section: https://github.com/chainguard-dev/melange/blob/20a8b52707cda4c05f47454d1d56ef2866c525e7/pkg/linter/linter.go#L66C7-L66C13

Error log:
Image

hbh7 commented

Interestingly, this doesn't happen with MELANGE_EXTRA_OPTS=--runner=bubblewrap added after make. MELANGE_EXTRA_OPTS=--runner=docker runs into the segfault, and is the default on my setup.

I also ran into this crash when trying to build datadog-agent-nvml (after having added a build-dep on python).

2024/12/11 23:53:33 INFO pod 04f9b5d6ef40a6b00352ebc0c92c76a5239597487352c34e351b7371c07c1fa1 terminated
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x15f67ba]

goroutine 43 [running]:
chainguard.dev/melange/pkg/linter.init.allPaths.func4.1({0x203d8b8, 0x1}, {0x0, 0x0}, {0x162282d?, 0xc009ba7f80?})
        chainguard.dev/melange/pkg/linter/linter.go:66 +0x7a
io/fs.WalkDir({0x204a1e0, 0xc0078432b0}, {0x203d8b8, 0x1}, 0xc008afe490)
        io/fs/walk.go:120 +0xc3
chainguard.dev/melange/pkg/linter.init.allPaths.func4({0x2072d28?, 0xc0006ce2a0?}, {0x1d9c616?, 0x6?}, {0x204a1e0?, 0xc0078432b0?})
        chainguard.dev/melange/pkg/linter/linter.go:62 +0x72
chainguard.dev/melange/pkg/linter.lintPackageFS({0x2072d28, 0xc0006ce2a0}, {0xc0000586f0, 0x12}, {0x204a1e0, 0xc0078432b0}, {0xc0005b8480?, 0xa?, 0x89e36d?})
        chainguard.dev/melange/pkg/linter/linter.go:549 +0x1f7
chainguard.dev/melange/pkg/linter.LintBuild({0x2072d28, 0xc0006ce2a0}, {0xc0000586f0, 0x12}, {0xc009b9c1e0, 0x4a}, {0xc0005b8360, 0x4, 0x11}, {0xc0005b8480, ...})
        chainguard.dev/melange/pkg/linter/linter.go:576 +0x185
chainguard.dev/melange/pkg/build.(*Build).BuildPackage(0xc000682708, {0x2072d28, 0xc0007842a0})
        chainguard.dev/melange/pkg/build/build.go:946 +0x3157
chainguard.dev/melange/pkg/cli.BuildCmd.func1()
        chainguard.dev/melange/pkg/cli/build.go:371 +0x594
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.10.0/errgroup/errgroup.go:78 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
        golang.org/x/sync@v0.10.0/errgroup/errgroup.go:75 +0x96
make[1]: *** [Makefile:98: packages/x86_64/datadog-agent-nvml-1.0.9-r2.apk] Error 2
make[1]: Leaving directory '/home/user/src/wolfi-os'
make: *** [Makefile:88: package/datadog-agent-nvml] Error 2