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

invalid memory address or nil pointer dereference when trying to delete with --version-id AND --dry-run #4539

Closed
haraldkubota opened this issue Apr 7, 2023 · 1 comment · Fixed by #4546

Comments

@haraldkubota
Copy link

haraldkubota commented Apr 7, 2023

Expected behavior

Not throwing a nil pointer dereference error

Actual behavior

Throwing a nil pointer dereference error:

mc rm --version-id 2890fbb8-c435-4336-bcef --dry-run "os2/downloads/Fun with spaces.txt"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xf8c519]

goroutine 1 [running]:
github.com/minio/mc/cmd.printDryRunMsg(0x0?, 0x0?)
        github.com/minio/mc/cmd/rm-main.go:392 +0x179
github.com/minio/mc/cmd.removeSingle({0x7ffd849494e3, 0x21}, {0x7ffd849494c1, 0x17}, {{0x0, 0x0, 0x0}, 0x0, 0x0, 0x0, ...})
        github.com/minio/mc/cmd/rm-main.go:364 +0x58a
github.com/minio/mc/cmd.mainRm(0xc0003c6d00)
        github.com/minio/mc/cmd/rm-main.go:724 +0x7a5
github.com/minio/cli.HandleAction({0x10bb6a0?, 0x132ae08?}, 0x2?)
        github.com/minio/cli@v1.24.2/app.go:490 +0x5a
github.com/minio/cli.Command.Run({{0x1274c3e, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1287f55, 0x10}, {0x0, ...}, ...}, ...)
        github.com/minio/cli@v1.24.2/command.go:242 +0x997
github.com/minio/cli.(*App).Run(0xc00022ec40, {0xc00003e1e0, 0x6, 0x6})
        github.com/minio/cli@v1.24.2/app.go:260 +0xb07
github.com/minio/mc/cmd.Main({0xc00003e1e0?, 0x6, 0x6})
        github.com/minio/mc/cmd/main.go:141 +0x3ec
main.main()
        github.com/minio/mc/main.go:28 +0x32

Steps to reproduce the behavior

mc rm --version-id v2 --dry-run os2/downloads/TheRegister.pdf

If the version-id is valid (exists), then no nil pointer deref error is thrown, with or without --dry-run.
If the version-id looks valid (e.g. take any version-id and modify a digit), then no nil pointer deref error either.
If the version-id is totally wrong (e.g. "v2") or missing the last section (e.g. missing the "-e77fd4616826" in "2890fbb8-c435-4336-bcef-e77fd4616826"), then an error is thrown when the --dry-run option is used. Without "--dry-run" it simply outputs nothing (but it also does nothing since the version-id does not exist). No nil pointer deref error.

mc --version

mc version RELEASE.2023-04-06T16-51-10Z (commit-id=1c6f4f48aba72b4c9770d911e95225f9de6e9488)
Runtime: go1.20.3 linux/amd64
Copyright (c) 2015-2023 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

System information

Linux m75q 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@harshavardhana
Copy link
Member

Please paste the entire crash @haraldkubota output..

klauspost added a commit to klauspost/mc that referenced this issue Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants