Commit 6fe7b02e37

6fe7b02e37e2056ab9993e220be601b9a71a09e7

parent: ac22431b2b

Verified · cmc ci/build: success ci/test: failure

cmc <hello@cleberg.net> · 2026-09-09 03:48 UTC

runner: clip sshOpts after prepending the identity

The prepend can leave spare capacity, and the later appends in the log
stream and ssh() run from concurrent workers, so with -jobs > 1 they
would write the same backing array.

Ref #184

Layout: unified · split

cmd/gitbay-runner/main.go +4 −1
@@ -19,6 +19,7 @@ import (
19 "os/exec" 19 "os/exec"
20 "os/signal" 20 "os/signal"
21 "path/filepath" 21 "path/filepath"
22 "slices"
22 "strings" 23 "strings"
23 "sync" 24 "sync"
24 "syscall" 25 "syscall"
@@ -149,7 +150,9 @@ func main() {
149 *identity = p 150 *identity = p
150 } 151 }
151 } 152 }
152 r.sshOpts = append(identityOpts(*identity), r.sshOpts...) 153 // Clipped: the later appends run from concurrent workers, and spare
154 // capacity here would have them writing the same backing array.
155 r.sshOpts = slices.Clip(append(identityOpts(*identity), r.sshOpts...))
153 r.untrusted = *untrusted 156 r.untrusted = *untrusted
154 for _, name := range strings.Split(*repos, ",") { 157 for _, name := range strings.Split(*repos, ",") {
155 if name = strings.TrimSpace(name); name != "" { 158 if name = strings.TrimSpace(name); name != "" {