[go: up one dir, main page]

Skip to content

Regression: Panic on `path rename` with empty string as second argument

reposurgeon built from current master ( 02ae4b3a) crashes/panics when using path rename with an empty string as second argument, e.g. when trying to move files from a subdirectory to root.

In reposurgeon 4.38 this worked as expected and did not crash.

Steps to reproduce

Example using one of the test files from within this git repository:

reposurgeon% read <test/branchreplace.svn

reposurgeon% path list
.gitignore
data/cmdvartab
data/driver.list
drivers/Makefile.drvbuild
drivers/libusb.c
drivers/serial.c

# try to move all files fron data/ to root
reposurgeon% path rename @data/@ ""

panic: runtime error: index out of range [2] with length 2 [recovered]
        panic: runtime error: index out of range [2] with length 2 [recovered]
        panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
main.main.func1()
        /home/florian/projects/3rdparty/reposurgeon/surgeon/reposurgeon.go:7949 +0x11c
panic({0x8edb00?, 0xc0002980f0?})
        /usr/local/go1.21.3.linux-amd64/src/runtime/panic.go:914 +0x21f
main.catch({0x918c23?, 0x0?}, {0x8edb00, 0xc0002980f0?})
        /home/florian/projects/3rdparty/reposurgeon/surgeon/inner.go:128 +0x12c
main.(*Reposurgeon).SetCore.func1.1(0xc0001cbc4e)
        /home/florian/projects/3rdparty/reposurgeon/surgeon/reposurgeon.go:521 +0x3c
panic({0x8edb00?, 0xc0002980f0?})
        /usr/local/go1.21.3.linux-amd64/src/runtime/panic.go:914 +0x21f
main.(*Reposurgeon).DoPath(0xc0000a0000, {0xc0002ae005, 0x11})
        /home/florian/projects/3rdparty/reposurgeon/surgeon/reposurgeon.go:4624 +0xaa6
gitlab.com/ianbruene/kommandant.(*Kmdt).bind.func1({0xa06320?, 0xc0001d4420?}, {0xc0002ae005, 0x11})
        /home/florian/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.2/kommandant.go:296 +0x4f
gitlab.com/ianbruene/kommandant.(*Kmdt).OneCmd_core(0xc0000a62c0, {0xa06320, 0xc0001d4420}, {0xc0002ae000?, 0x0?})
        /home/florian/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.2/kommandant.go:711 +0x369
main.(*Reposurgeon).SetCore.func1({0xa06320?, 0xc0001d4420?}, {0xc0002ae000?, 0xc0002ae000?})
        /home/florian/projects/3rdparty/reposurgeon/surgeon/reposurgeon.go:526 +0x8a
gitlab.com/ianbruene/kommandant.(*Kmdt).OneCmd(0xc0000a62c0, {0xa06320, 0xc0001d4420}, {0xc0002ae000, 0x16})
        /home/florian/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.2/kommandant.go:251 +0x109
gitlab.com/ianbruene/kommandant.(*Kmdt).CmdLoop(0xc0000a62c0, {0xa06320, 0xc0001d4420}, {0x0, 0x0})
        /home/florian/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.2/kommandant.go:636 +0x7c5
main.main()
        /home/florian/projects/3rdparty/reposurgeon/surgeon/reposurgeon.go:7980 +0x525

The crashing line reposurgeon.go:4624 was last modified 3 days ago in 25ff8552

Probably caused by fix for #426 (closed)

(Related: latest commit on NEWS.md 5cfe96ea needs some spell checking.)

Edited by Florian Karuhtz