Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package terragrunt for openSUSE:Factory checked in at 2023-05-11 12:33:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/terragrunt (Old) and /work/SRC/openSUSE:Factory/.terragrunt.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "terragrunt" Thu May 11 12:33:50 2023 rev:44 rq:1086150 version:0.45.11 Changes: -------- --- /work/SRC/openSUSE:Factory/terragrunt/terragrunt.changes 2023-05-09 13:08:55.949590459 +0200 +++ /work/SRC/openSUSE:Factory/.terragrunt.new.1533/terragrunt.changes 2023-05-11 12:34:15.150929042 +0200 @@ -1,0 +2,7 @@ +Thu May 11 04:51:07 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.45.11: + * fix: disable sending a second interrupt signal to `terraform` + (#2559) + +------------------------------------------------------------------- Old: ---- terragrunt-0.45.10.obscpio New: ---- terragrunt-0.45.11.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ terragrunt.spec ++++++ --- /var/tmp/diff_new_pack.K3DSKc/_old 2023-05-11 12:34:17.034938302 +0200 +++ /var/tmp/diff_new_pack.K3DSKc/_new 2023-05-11 12:34:17.038938321 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: terragrunt -Version: 0.45.10 +Version: 0.45.11 Release: 0 Summary: Thin wrapper for Terraform for working with multiple Terraform modules License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.K3DSKc/_old 2023-05-11 12:34:17.098938616 +0200 +++ /var/tmp/diff_new_pack.K3DSKc/_new 2023-05-11 12:34:17.102938636 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/gruntwork-io/terragrunt</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.45.10</param> + <param name="revision">v0.45.11</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.K3DSKc/_old 2023-05-11 12:34:17.138938813 +0200 +++ /var/tmp/diff_new_pack.K3DSKc/_new 2023-05-11 12:34:17.142938832 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/gruntwork-io/terragrunt</param> - <param name="changesrevision">be4aac786bf155e57e22f7ae3ce5a631c52b1708</param></service></servicedata> + <param name="changesrevision">fcfb391b5be91c67e9c0fb66ce41a4cc507c6c53</param></service></servicedata> (No newline at EOF) ++++++ terragrunt-0.45.10.obscpio -> terragrunt-0.45.11.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.45.10/shell/run_shell_cmd.go new/terragrunt-0.45.11/shell/run_shell_cmd.go --- old/terragrunt-0.45.10/shell/run_shell_cmd.go 2023-05-08 19:34:38.000000000 +0200 +++ new/terragrunt-0.45.11/shell/run_shell_cmd.go 2023-05-10 20:59:43.000000000 +0200 @@ -10,6 +10,7 @@ "reflect" "strings" "syscall" + "time" "github.com/gruntwork-io/terragrunt/errors" "github.com/gruntwork-io/terragrunt/options" @@ -18,6 +19,12 @@ "github.com/sirupsen/logrus" ) +// The signal can be sent to the main process (only `terragrunt`) as well as the process group (`terragrunt` and `terraform`), for example: +// kill -INT <pid> # sends SIGINT only to the main process +// kill -INT -<pid> # sends SIGINT to the process group +// Since we cannot know how the signal is sent, we should give `terraform` time to gracefully exit if it receives the signal directly from the shell, to avoid sending the second interrupt signal to `terraform`. +const signalForwardingDelay = time.Second * 30 + // Commands that implement a REPL need a pseudo TTY when run as a subprocess in order for the readline properties to be // preserved. This is a list of terraform commands that have this property, which is used to determine if terragrunt // should allocate a ptty when running that terraform command. @@ -195,14 +202,22 @@ for { select { case s := <-signalChannel: - logger.Debugf("Forward signal %v to terraform.", s) - err := c.Process.Signal(s) - if err != nil { - logger.Errorf("Error forwarding signal: %v", err) + logger.Debugf("%s signal received. Gracefully shutting down... (it can take up to %v)", strings.Title(s.String()), signalForwardingDelay) + + select { + case <-time.After(signalForwardingDelay): + logger.Debugf("Forward signal %v to terraform.", s) + err := c.Process.Signal(s) + if err != nil { + logger.Errorf("Error forwarding signal: %v", err) + } + case <-cmdChannel: + return } case <-cmdChannel: return } + } }() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.45.10/shell/run_shell_cmd_unix_test.go new/terragrunt-0.45.11/shell/run_shell_cmd_unix_test.go --- old/terragrunt-0.45.10/shell/run_shell_cmd_unix_test.go 2023-05-08 19:34:38.000000000 +0200 +++ new/terragrunt-0.45.11/shell/run_shell_cmd_unix_test.go 2023-05-10 20:59:43.000000000 +0200 @@ -5,9 +5,11 @@ import ( goerrors "errors" + "fmt" "os" "os/exec" "strconv" + "syscall" "testing" "time" @@ -119,3 +121,25 @@ assert.True(t, retCode <= interrupts, "Subprocess received wrong number of signals") assert.Equal(t, retCode, expectedInterrupts, "Subprocess didn't receive multiple signals") } + +func TestRunShellCommandWithOutputInterrupt(t *testing.T) { + t.Parallel() + + terragruntOptions, err := options.NewTerragruntOptionsForTest("") + assert.Nil(t, err, "Unexpected error creating NewTerragruntOptionsForTest: %v", err) + + errCh := make(chan error) + expectedWait := 5 + + go func() { + _, err := RunShellCommandWithOutput(terragruntOptions, "", false, false, "../testdata/test_sigint_wait.sh", strconv.Itoa(expectedWait)) + errCh <- err + }() + + time.AfterFunc(3*time.Second, func() { + syscall.Kill(os.Getpid(), syscall.SIGINT) + }) + + expectedErr := fmt.Sprintf("exit status %d", expectedWait) + assert.EqualError(t, <-errCh, expectedErr) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/terragrunt-0.45.10/shell/run_shell_cmd_windows_test.go new/terragrunt-0.45.11/shell/run_shell_cmd_windows_test.go --- old/terragrunt-0.45.10/shell/run_shell_cmd_windows_test.go 2023-05-08 19:34:38.000000000 +0200 +++ new/terragrunt-0.45.11/shell/run_shell_cmd_windows_test.go 2023-05-10 20:59:43.000000000 +0200 @@ -5,6 +5,7 @@ import ( goerrors "errors" + "fmt" "os" "os/exec" "strconv" @@ -76,3 +77,28 @@ // assert.WithinDuration(t, start.Add(time.Duration(expectedWait)*time.Second), time.Now(), time.Second, // "Expected to wait 5 (+/-1) seconds after SIGINT") } + +func TestRunShellCommandWithOutputInterrupt(t *testing.T) { + t.Parallel() + + terragruntOptions, err := options.NewTerragruntOptionsForTest("") + assert.Nil(t, err, "Unexpected error creating NewTerragruntOptionsForTest: %v", err) + + errCh := make(chan error) + expectedWait := 5 + + go func() { + _, err := RunShellCommandWithOutput(terragruntOptions, "", false, false, "../testdata/test_sigint_wait.bat", strconv.Itoa(expectedWait)) + errCh <- err + }() + + time.AfterFunc(3*time.Second, func() { + process, err := os.FindProcess(os.Getpid()) + assert.NoError(t, err) + + process.Signal(os.Kill) + }) + + expectedErr := fmt.Sprintf("exit status %d", expectedWait) + assert.EqualError(t, <-errCh, expectedErr) +} ++++++ terragrunt.obsinfo ++++++ --- /var/tmp/diff_new_pack.K3DSKc/_old 2023-05-11 12:34:17.974942921 +0200 +++ /var/tmp/diff_new_pack.K3DSKc/_new 2023-05-11 12:34:17.978942941 +0200 @@ -1,5 +1,5 @@ name: terragrunt -version: 0.45.10 -mtime: 1683567278 -commit: be4aac786bf155e57e22f7ae3ce5a631c52b1708 +version: 0.45.11 +mtime: 1683745183 +commit: fcfb391b5be91c67e9c0fb66ce41a4cc507c6c53 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/terragrunt/vendor.tar.gz /work/SRC/openSUSE:Factory/.terragrunt.new.1533/vendor.tar.gz differ: char 5, line 1