[Pkg-golang-commits] [golang] 01/04: replace my initial patches with the versions i sent upstream

Michael Hudson-Doyle mwhudson-guest at moszumanska.debian.org
Wed Jan 31 01:49:46 UTC 2018


This is an automated email from the git hooks/post-receive script.

mwhudson-guest pushed a commit to branch golang-1.10
in repository golang.

commit 4a85e42b460b8cbcb7d831284d8efbb90a3ea6dd
Author: Michael Hudson-Doyle <michael.hudson at canonical.com>
Date:   Wed Jan 31 11:26:12 2018 +1300

    replace my initial patches with the versions i sent upstream
---
 debian/changelog                                   |  6 +-
 debian/patches/0001-fix-pprof-tests.patch          | 17 -----
 ...kip-TestTerminalSignal-if-posix_openpt-fa.patch | 81 ++++++++++++++++++++++
 ...github.com-google-pprof-cherry-pick-fix-t.patch | 35 ++++++++++
 debian/patches/0003-fix-signal-tests.patch         | 24 -------
 debian/patches/series                              |  4 +-
 6 files changed, 122 insertions(+), 45 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 513aea4..87f5552 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,10 @@ golang-1.10 (1.10~rc1-1) UNRELEASED; urgency=medium
   * New upstream version 1.10~rc1
   * Disable 0002-reproducible-BUILD_PATH_PREFIX_MAP.patch for now. Remove all
     other patches.
-  * d/patches/{0001-fix-pprof-tests.patch, 0003-fix-signal-tests.patch}: add
-    to fix test failures running in a chroot.
+  * d/patches/0001-os-signal-skip-TestTerminalSignal-if-posix_openpt-fa.patch:
+    Add to fix test failure in chroot.
+  * d/patches/0003-cmd-vendor-github.com-google-pprof-cherry-pick-fix-t.patch:
+    Add to fix test failure when $HOME is not writable.
 
  -- Michael Hudson-Doyle <mwhudson at debian.org>  Fri, 08 Dec 2017 14:35:16 +1300
 
diff --git a/debian/patches/0001-fix-pprof-tests.patch b/debian/patches/0001-fix-pprof-tests.patch
deleted file mode 100644
index b784a0b..0000000
--- a/debian/patches/0001-fix-pprof-tests.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
-+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
-@@ -362,6 +362,14 @@
- 	if runtime.GOOS == "nacl" {
- 		t.Skip("test assumes tcp available")
- 	}
-+	saveHome := os.Getenv(homeEnv())
-+	tempdir, err := ioutil.TempDir("", "home")
-+	if err != nil {
-+		t.Fatal("creating temp dir: ", err)
-+	}
-+	defer os.RemoveAll(tempdir)
-+	os.Setenv(homeEnv(), tempdir)
-+	defer os.Setenv(homeEnv(), saveHome)
- 
- 	baseVars := pprofVariables
- 	pprofVariables = baseVars.makeCopy()
diff --git a/debian/patches/0001-os-signal-skip-TestTerminalSignal-if-posix_openpt-fa.patch b/debian/patches/0001-os-signal-skip-TestTerminalSignal-if-posix_openpt-fa.patch
new file mode 100644
index 0000000..935646c
--- /dev/null
+++ b/debian/patches/0001-os-signal-skip-TestTerminalSignal-if-posix_openpt-fa.patch
@@ -0,0 +1,81 @@
+From 7a71efa01fb8486b879b3abee8364a7aa4e401fe Mon Sep 17 00:00:00 2001
+From: Michael Hudson-Doyle <michael.hudson at canonical.com>
+Date: Wed, 31 Jan 2018 10:27:49 +1300
+Subject: [PATCH] os/signal: skip TestTerminalSignal if posix_openpt fails with
+ EACCES
+
+This happens in a chroot and so causes failures when packaging Go 1.10 for
+Debian/Ubuntu.
+
+Change-Id: I817038c237e584ce185b2168f8c7a10b9ef27b43
+---
+ src/os/signal/internal/pty/pty.go | 21 ++++++++++++++++++---
+ src/os/signal/signal_cgo_test.go  |  4 ++++
+ 2 files changed, 22 insertions(+), 3 deletions(-)
+
+--- a/src/os/signal/internal/pty/pty.go
++++ b/src/os/signal/internal/pty/pty.go
+@@ -21,21 +21,36 @@
+ import (
+ 	"fmt"
+ 	"os"
++	"syscall"
+ )
+ 
++type PtyError struct {
++	FuncName    string
++	ErrorString string
++	Errno       syscall.Errno
++}
++
++func ptyError(name string, err error) *PtyError {
++	return &PtyError{name, err.Error(), err.(syscall.Errno)}
++}
++
++func (e *PtyError) Error() string {
++	return fmt.Sprintf("%s: %s", e.FuncName, e.ErrorString)
++}
++
+ // Open returns a master pty and the name of the linked slave tty.
+ func Open() (master *os.File, slave string, err error) {
+ 	m, err := C.posix_openpt(C.O_RDWR)
+ 	if err != nil {
+-		return nil, "", fmt.Errorf("posix_openpt: %v", err)
++		return nil, "", ptyError("posix_openpt", err)
+ 	}
+ 	if _, err := C.grantpt(m); err != nil {
+ 		C.close(m)
+-		return nil, "", fmt.Errorf("grantpt: %v", err)
++		return nil, "", ptyError("grantpt", err)
+ 	}
+ 	if _, err := C.unlockpt(m); err != nil {
+ 		C.close(m)
+-		return nil, "", fmt.Errorf("unlockpt: %v", err)
++		return nil, "", ptyError("unlockpt", err)
+ 	}
+ 	slave = C.GoString(C.ptsname(m))
+ 	return os.NewFile(uintptr(m), "pty-master"), slave, nil
+--- a/src/os/signal/signal_cgo_test.go
++++ b/src/os/signal/signal_cgo_test.go
+@@ -72,6 +72,10 @@
+ 
+ 	master, sname, err := pty.Open()
+ 	if err != nil {
++		ptyErr := err.(*pty.PtyError)
++		if ptyErr.FuncName == "posix_openpt" && ptyErr.Errno == syscall.EACCES {
++			t.Skip("posix_openpt failed with EACCES, assuming chroot and skipping")
++		}
+ 		t.Fatal(err)
+ 	}
+ 	defer master.Close()
+--- a/src/go/build/deps_test.go
++++ b/src/go/build/deps_test.go
+@@ -301,7 +301,7 @@
+ 	"os/user": {"L4", "CGO", "io/ioutil", "os", "syscall"},
+ 
+ 	// Internal package used only for testing.
+-	"os/signal/internal/pty": {"CGO", "fmt", "os"},
++	"os/signal/internal/pty": {"CGO", "fmt", "os", "syscall"},
+ 
+ 	// Basic networking.
+ 	// Because net must be used by any package that wants to
diff --git a/debian/patches/0003-cmd-vendor-github.com-google-pprof-cherry-pick-fix-t.patch b/debian/patches/0003-cmd-vendor-github.com-google-pprof-cherry-pick-fix-t.patch
new file mode 100644
index 0000000..0856ea0
--- /dev/null
+++ b/debian/patches/0003-cmd-vendor-github.com-google-pprof-cherry-pick-fix-t.patch
@@ -0,0 +1,35 @@
+From 52644d69a77492707bcc89bfeb775aa336f1dcdb Mon Sep 17 00:00:00 2001
+From: Michael Hudson-Doyle <michael.hudson at canonical.com>
+Date: Wed, 31 Jan 2018 11:11:39 +1300
+Subject: [PATCH] cmd/vendor/github.com/google/pprof: cherry-pick fix to cope
+ with $HOME not being writable
+
+Upstream PRs: https://github.com/google/pprof/pull/305,
+https://github.com/google/pprof/pull/306.
+
+Change-Id: I28969118f52ee08fcaf3572ad5da015ae756fd7a
+---
+ .../github.com/google/pprof/internal/driver/fetch_test.go    | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
++++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
+@@ -362,6 +362,18 @@
+ 	if runtime.GOOS == "nacl" {
+ 		t.Skip("test assumes tcp available")
+ 	}
++	saveHome := os.Getenv(homeEnv())
++	tempdir, err := ioutil.TempDir("", "home")
++	if err != nil {
++		t.Fatal("creating temp dir: ", err)
++	}
++	defer os.RemoveAll(tempdir)
++
++	// pprof writes to $HOME/pprof by default which is not necessarily
++	// writeable (e.g. on a Debian buildd) so set $HOME to something we
++	// know we can write to for the duration of the test.
++	os.Setenv(homeEnv(), tempdir)
++	defer os.Setenv(homeEnv(), saveHome)
+ 
+ 	baseVars := pprofVariables
+ 	pprofVariables = baseVars.makeCopy()
diff --git a/debian/patches/0003-fix-signal-tests.patch b/debian/patches/0003-fix-signal-tests.patch
deleted file mode 100644
index 7f359f4..0000000
--- a/debian/patches/0003-fix-signal-tests.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/src/os/signal/signal_cgo_test.go
-+++ b/src/os/signal/signal_cgo_test.go
-@@ -27,7 +27,21 @@
- 	"time"
- )
- 
-+// Check if we are in a chroot by checking if the inode of / is
-+// different from 2 (there is no better test available to non-root on
-+// linux).
-+func isChrooted(t *testing.T) bool {
-+	root, err := os.Stat("/")
-+	if err != nil {
-+		t.Fatalf("cannot stat /: %v", err)
-+	}
-+	return root.Sys().(*syscall.Stat_t).Ino != 2
-+}
-+
- func TestTerminalSignal(t *testing.T) {
-+	if isChrooted(t) {
-+		t.Skip("test cannot run in a chroot")
-+	}
- 	const enteringRead = "test program entering read"
- 	if os.Getenv("GO_TEST_TERMINAL_SIGNALS") != "" {
- 		var b [1]byte
diff --git a/debian/patches/series b/debian/patches/series
index 14b7cf6..850d72d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,3 @@
+0001-os-signal-skip-TestTerminalSignal-if-posix_openpt-fa.patch
 #0002-reproducible-BUILD_PATH_PREFIX_MAP.patch
-0001-fix-pprof-tests.patch
-0003-fix-signal-tests.patch
+0003-cmd-vendor-github.com-google-pprof-cherry-pick-fix-t.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-golang/golang.git



More information about the pkg-golang-commits mailing list