slim icon indicating copy to clipboard operation
slim copied to clipboard

Nil pointer dereference in xray/handler.go:891 (mintoolkit v1.41.7 - linux/amd64)

Open DianaLyM opened this issue 7 months ago • 8 comments

Crash in github.com/mintoolkit/mint/pkg/app/master/command/xray, line 891

Command run: $ docker-slim xray docker.io/elyra/kernel-py:3.2.2 --target-type image --platform linux/amd64 --http-probe=false --report report.json

Stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x104fcd5d0]

goroutine 1 [running]:
github.com/mintoolkit/mint/pkg/docker/dockerimage.TopObjects.Less(...)
	github.com/mintoolkit/mint/pkg/docker/dockerimage/topobjects.go:20
container/heap.down({0x1073e5f00, 0x1400a880138}, 0x0, 0x3)
	container/heap/heap.go:108 +0xa4
container/heap.Pop({0x1073e5f00, 0x1400a880138})
	container/heap/heap.go:62 +0x60
github.com/mintoolkit/mint/pkg/docker/dockerimage.TopObjects.List({0x1400053e790, 0x4, 0x15})
	github.com/mintoolkit/mint/pkg/docker/dockerimage/topobjects.go:44 +0xe8
github.com/mintoolkit/mint/pkg/app/master/command/xray.printImagePackage(0x14000431920, 0x14000764820, {0x0?, 0x140004305a8?}, {0x0?, 0x1400042ee30?}, 0x140004313d8, 0x140004312e0, 0x1400022b8c0, 0xffffffffffffffff, ...)
	github.com/mintoolkit/mint/pkg/app/master/command/xray/handler.go:891 +0x1b1c
github.com/mintoolkit/mint/pkg/app/master/command/xray.OnCommand(0x14000431920, 0x14000528500, 0x14000431408, {0x16b66b669, 0x1f}, 0x1, {0x0, 0x0}, {0x0, 0x0}, ...)
	github.com/mintoolkit/mint/pkg/app/master/command/xray/handler.go:605 +0x357c
github.com/mintoolkit/mint/pkg/app/master/command/xray.init.func1(0x14000714740)
	github.com/mintoolkit/mint/pkg/app/master/command/xray/cli.go:343 +0x1868
github.com/urfave/cli/v2.(*Command).Run(0x1089e8b60, 0x14000714740, {0x140001dc360, 0x9, 0x9})
	github.com/urfave/cli/[email protected]/command.go:279 +0x5f0
github.com/urfave/cli/v2.(*Command).Run(0x140004b5ce0, 0x14000714180, {0x14000206140, 0xa, 0xa})
	github.com/urfave/cli/[email protected]/command.go:272 +0x828
github.com/urfave/cli/v2.(*App).RunContext(0x14000655000, {0x1073e0ec8, 0x108c455a8}, {0x14000206140, 0xa, 0xa})
	github.com/urfave/cli/[email protected]/app.go:337 +0x514
github.com/urfave/cli/v2.(*App).Run(...)
	github.com/urfave/cli/[email protected]/app.go:311
github.com/mintoolkit/mint/pkg/app/master.Run()
	github.com/mintoolkit/mint/pkg/app/master/app.go:15 +0x4c
main.main()
	github.com/mintoolkit/mint/cmd/mint/main.go:15 +0x194

Specs: $ docker-slim --version mint version darwin/arm64|Aurora|1.41.7|latest|latest

DianaLyM avatar May 07 '25 02:05 DianaLyM

@DianaLyM investigating

kcq avatar May 07 '25 07:05 kcq

@kcq can I take it off your hand, if you're not looking into it anymore ?

shashank-netapp avatar Sep 28 '25 15:09 shashank-netapp

@kcq can I take it off your hand, if you're not looking into it anymore ?

Feel free to double check the current state and if it's still possible to trigger. It should be fixed though with this PR. You can get the latest release binaries here or build from source to double check.

Thank you for your interesting in spending cycles on this. Let me know if you are interested in exploring and improving other parts of the app.

kcq avatar Sep 28 '25 17:09 kcq

Sure, will verify it before jumping into it. Thanks @kcq And, yeah I'm interested in looking into other things too, please lemme know from where to start ?

shashank-netapp avatar Sep 29 '25 05:09 shashank-netapp

Sure, will verify it before jumping into it. Thanks @kcq And, yeah I'm interested in looking into other things too, please lemme know from where to start ?

XRAY can be improved and extended in many different ways. One example is the deleted file and directory tracking logic. It needs to be improved to correct count the deleted number of files when directory level white outs are used.

kcq avatar Oct 03 '25 05:10 kcq

Yep this has been resolved in the mintoolkit repo and this can be closed. I didn't know that both slim and mint are one and the same thing. In the meanwhile I'll look into xray command over at mint repository.

shashank-netapp avatar Oct 04 '25 16:10 shashank-netapp

@shashank-netapp @kcq I noticed that you haven’t released a new version recently. I’d like to confirm, after you’ve fixed the issue, how can I use the latest version of the tool with the fix? Thanks!

DianaLyM avatar Dec 02 '25 09:12 DianaLyM

@shashank-netapp @kcq I noticed that you haven’t released a new version recently. I’d like to confirm, after you’ve fixed the issue, how can I use the latest version of the tool with the fix? Thanks!

I'll publish an updated set of binaries, but in the meantime you can build the latest from the repo

kcq avatar Dec 03 '25 01:12 kcq