This libgo patch changes some tests in the syscall package to append
to the environment in tests rather than clobbering the environment.
In particular, this preserves LD_LIBRARY_PATH.

This is a partial backport of https://golang.org/cl/233318 from the
master sources.  It's only a partial backport because part of the
change was already applied to libgo in https://golang.org/cl/193497 as
part of the update to the Go 1.13beta1 release.  This additional parts
weren't applied then because they only show up when running the test
as root, and I didn't do that.

This fixes GCC PR 95061.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to master and GCC 10 branch.

Ian
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 428b329382b..939ba7c8929 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-41019d50ae519328dd3cf200815a2a2b0b64674e
+8645632618262d1661ece0c9e6fe9e04c6e3a878
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/syscall/syscall_linux_test.go 
b/libgo/go/syscall/syscall_linux_test.go
index 97059c87d3d..c12df4cf5c7 100644
--- a/libgo/go/syscall/syscall_linux_test.go
+++ b/libgo/go/syscall/syscall_linux_test.go
@@ -187,7 +187,7 @@ func TestLinuxDeathSignal(t *testing.T) {
        }
 
        cmd := exec.Command(tmpBinary)
-       cmd.Env = []string{"GO_DEATHSIG_PARENT=1"}
+       cmd.Env = append(os.Environ(), "GO_DEATHSIG_PARENT=1")
        chldStdin, err := cmd.StdinPipe()
        if err != nil {
                t.Fatalf("failed to create new stdin pipe: %v", err)
@@ -225,7 +225,10 @@ func TestLinuxDeathSignal(t *testing.T) {
 
 func deathSignalParent() {
        cmd := exec.Command(os.Args[0])
-       cmd.Env = []string{"GO_DEATHSIG_CHILD=1"}
+       cmd.Env = append(os.Environ(),
+               "GO_DEATHSIG_PARENT=",
+               "GO_DEATHSIG_CHILD=1",
+       )
        cmd.Stdin = os.Stdin
        cmd.Stdout = os.Stdout
        attrs := syscall.SysProcAttr{
@@ -360,7 +363,7 @@ func TestSyscallNoError(t *testing.T) {
        }
 
        cmd := exec.Command(tmpBinary)
-       cmd.Env = []string{"GO_SYSCALL_NOERROR=1"}
+       cmd.Env = append(os.Environ(), "GO_SYSCALL_NOERROR=1")
 
        out, err := cmd.CombinedOutput()
        if err != nil {

Reply via email to