Skip to content

Commit

Permalink
Do not forward SIGURG to the child process
Browse files Browse the repository at this point in the history
Since go 1.14, SIGURG is emitted internally by the fo runtime, see:

- golang/go#37942
- https://go.googlesource.com/proposal/+/master/design/24543-non-cooperative-preemption.md#other-considerations "Choosing a signal"

This causes two problems:
- This will interfere with processes that use SIGURG for a real purpose (though this is unlikely)
- If SIGURG is emitted after the child process has exited but before secrets-init, there will be a spurious error message (see doitintl#16)
  • Loading branch information
n-e committed May 26, 2023
1 parent a134c43 commit 10faccf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ func run(ctx context.Context, provider secrets.Provider, commandSlice []string)
// Goroutine for signals forwarding
go func() {
for sig := range sigs {
// ignore SIGCHLD signals since these are only useful for secrets-init
if sig != syscall.SIGCHLD {
// ignore:
// - SIGCHLD signals, since these are only useful for secrets-init
// - SIGURG signals, since they are used internally by the secrets-init
// go runtime (see https://github.com/golang/go/issues/37942) and are of
// no interest to the child process
if sig != syscall.SIGCHLD && sig != syscall.SIGURG {
// forward signal to the main process and its children
e := syscall.Kill(-cmd.Process.Pid, sig.(syscall.Signal))
if e != nil {
Expand Down

0 comments on commit 10faccf

Please sign in to comment.