Skip to content

Reproducible panic (segfault) using sshed at #20

@AI0867

Description

@AI0867

While executing sshed at on multiple servers with a command like su - -c echo foo:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x190 pc=0x53872d]

goroutine 16 [running]:
github.com/boltdb/bolt.(*DB).beginTx(0x0, 0x0, 0x7f8b2b2c5490, 0x18)
        pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:470 +0x2d
github.com/boltdb/bolt.(*DB).Begin(0x0, 0xc00017a700, 0x0, 0xc000036800, 0x0)
        pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:463 +0x6f
github.com/boltdb/bolt.(*DB).View(0x0, 0xc00005ec98, 0x0, 0x0)
        pkg/mod/github.com/boltdb/bolt@v1.3.1/db.go:613 +0x49
github.com/trntv/sshed/keychain.Get(0xc00018e8b8, 0x14, 0xc00017a720, 0x0, 0x0)
        /home/runner/work/sshed/sshed/keychain/keychain.go:75 +0xdd
github.com/trntv/sshed/host.(*Host).readKeychain(...)
        /home/runner/work/sshed/sshed/host/host.go:68
github.com/trntv/sshed/host.(*Host).Password(0xc0001788a0, 0x0, 0x0)
        /home/runner/work/sshed/sshed/host/host.go:48 +0x6c
github.com/trntv/sshed/commands.(*Commands).createCommand(0xc00010e0d0, 0xc0000b2420, 0xc0001788a0, 0xc00005ef47, 0xc0000173b0, 0x15, 0x0, 0x0, 0x0)
        /home/runner/work/sshed/sshed/commands/commands.go:149 +0x9a
github.com/trntv/sshed/commands.(*Commands).atAction.func1(0xc0001677f0, 0xc00010e0d0, 0xc0000b2420, 0xc0001788a0, 0xc000226ad0)
        /home/runner/work/sshed/sshed/commands/at.go:66 +0xbb
created by github.com/trntv/sshed/commands.(*Commands).atAction
        /home/runner/work/sshed/sshed/commands/at.go:63 +0x22c

Running on a single server gives a slightly different panic:

su: user foo does not exist or the user entry does not contain all the required fields
2026/04/07 15:10:33 exit status 1
panic: exit status 1


goroutine 19 [running]:
log.Panicln(0xc0000c3f88, 0x1, 0x1)
        /opt/hostedtoolcache/go/1.16.0/x64/src/log/log.go:368 +0xae
github.com/trntv/sshed/commands.(*Commands).atAction.func1(0xc0001adcc0, 0xc00010a0d0, 0xc0001d2000, 0xc0001ec840, 0xc000187c10)
        /home/runner/work/sshed/sshed/commands/at.go:77 +0x1be
created by github.com/trntv/sshed/commands.(*Commands).atAction
        /home/runner/work/sshed/sshed/commands/at.go:63 +0x22c

The complaint about user foo not existing still happens when quoting part of the command like: su - -c "echo foo".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions