Skip to content

panic while using --stdin-from-command #4975

@textaligncenter

Description

@textaligncenter

Output of restic version

restic 0.17.0 compiled with go1.22.5 on linux/amd64

What backend/service did you use to store the repository?

local file system

Problem description / Steps to reproduce

restic init -r /tmp/test
restic backup -r /tmp/test --stdin-from-command

Expected behavior

no panic, a nice error message instead

Actual behavior

enter password for repository:
repository 5a50c088 opened (version 2, compression level auto)
created new cache in /home/xxx/.cache/restic
found 1 old cache directories in /home/xxx/.cache/restic, run restic cache --cleanup to remove them
no parent snapshot found, will read all files
[0:00] 0 index files loaded
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/restic/restic/internal/fs.NewCommandReader({0x1468450?, 0xc00003e550?}, {0xc0004020c0?, 0x0?, 0x0?}, {0x7b38a7fd9f38?, 0xc0004021e0?})
/restic/internal/fs/fs_reader_command.go:33 +0x26a
main.runBackup({_, _}, {{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...}, ...)
/restic/cmd/restic/cmd_backup.go:585 +0xa73
main.init.func3(0x1cac9e0, {0xc0004020c0, 0x0, 0x3})
/restic/cmd/restic/cmd_backup.go:61 +0x116
github.com/spf13/cobra.(*Command).execute(0x1cac9e0, {0xc000402060, 0x3, 0x3})
/home/build/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x1cb2300)
/home/build/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/build/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
/home/build/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1034
main.main()
/restic/cmd/restic/main.go:125 +0x265

Do you have any idea what may have caused this?

I didn't specify any command after the --stdin-from-command flag

Did restic help you today? Did it make you happy in any way?

restic is an pretty stable piece of software - it's awesome

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions