Commit 4428c5f3 authored by Trung Lê's avatar Trung Lê Committed by Ariadne Conill
Browse files

community/go: upgrade to 1.15

parent 74ab74e9
From: "Bryan C. Mills" <bcmills@google.com>
Date: Fri, 13 Mar 2020 12:51:09 -0400
Subject: Fix FTBFS on $HOME managed with git.
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
This is a cherry-pick of
https://github.com/golang/go/commit/e2a9ea035d73df84c813132417366e8e01777c8d
cmd/go/internal/modload: suppress the 'go mod init' hint for GOROOT more aggressively
Previously, we suppressed a `to create a module there, run: … go mod
init' warning only if the config file itself (such as .git/config) was
found in GOROOT. However, our release tarballs don't include the
.git/config, so that case was not encountered, and the warning could
occur based on a config file found in some parent directory (outside
of GOROOT entirely).
Instead, skip the directory walk completely if the working directory
is anywhere in GOROOT.
Fixes #34191
Change-Id: I9f774901bfbb53b700407c4882f37d6339d023fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/223340
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
---
src/cmd/go/internal/modload/init.go | 9 +++++----
src/cmd/go/testdata/script/mod_convert_git.txt | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index 61cbdf2..a73d858 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -740,13 +740,14 @@ func findAltConfig(dir string) (root, name string) {
panic("dir not set")
}
dir = filepath.Clean(dir)
+ if rel := search.InDir(dir, cfg.BuildContext.GOROOT); rel != "" {
+ // Don't suggest creating a module from $GOROOT/.git/config
+ // or a config file found in any parent of $GOROOT (see #34191).
+ return "", ""
+ }
for {
for _, name := range altConfigs {
if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !fi.IsDir() {
- if rel := search.InDir(dir, cfg.BuildContext.GOROOT); rel == "." {
- // Don't suggest creating a module from $GOROOT/.git/config.
- return "", ""
- }
return dir, name
}
}
diff --git a/src/cmd/go/testdata/script/mod_convert_git.txt b/src/cmd/go/testdata/script/mod_convert_git.txt
index ece505a..6ff1eb5 100644
--- a/src/cmd/go/testdata/script/mod_convert_git.txt
+++ b/src/cmd/go/testdata/script/mod_convert_git.txt
@@ -18,6 +18,23 @@ cd $GOROOT
! go list .
! stderr 'go mod init'
+# We should also not suggest creating a go.mod file in $GOROOT if its own
+# .git/config has been stripped away and we find one in a parent directory.
+# (https://golang.org/issue/34191)
+env GOROOT=$WORK/parent/goroot
+cd $GOROOT
+! go list .
+! stderr 'go mod init'
+
+cd $GOROOT/doc
+! go list .
+! stderr 'go mod init'
+
-- $WORK/test/.git/config --
-- $WORK/test/x/x.go --
package x // import "m/x"
+-- $WORK/parent/.git/config --
+-- $WORK/parent/goroot/README --
+This directory isn't really a GOROOT, but let's pretend that it is.
+-- $WORK/parent/goroot/doc/README --
+This is a subdirectory of our fake GOROOT.
......@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=go
# go binaries are statically linked, security updates require rebuilds
pkgver=1.14.6
pkgver=1.15
pkgrel=0
pkgdesc="Go programming language compiler"
url="https://golang.org/"
......@@ -16,8 +16,6 @@ subpackages="$pkgname-doc"
source="https://golang.org/dl/go${pkgver/_/}.src.tar.gz
disable-flaky-sync-test.patch
disable-flaky-gc-test.patch
0001-Fix-FTBFS-on-HOME-managed-with-git.patch
fix-rlimit-syscall-aarch64-armv7.patch
fix-setrlimit-hang.patch
"
case "$CARCH" in
......@@ -25,6 +23,8 @@ case "$CARCH" in
esac
# secfixes:
# 1.15-r0:
# - CVE-2020-16845
# 1.14.5-r0:
# - CVE-2020-15586
# 1.13.7-r0:
......@@ -145,9 +145,7 @@ package() {
-exec rm -rf \{\} \+
}
sha512sums="5c865c8272fb0dc8eab1514732b0200dbc867276512714dd30afc658a0d2afac6bd758e00c6f576d8d254e411418a52a564c895399b56cfe06c2b1785271a8fd go1.14.6.src.tar.gz
sha512sums="7d85382bcc6a0625dfa3d07196ab364860846367ed67697a7b1516b0af551a72bc4873882141fc3c7a60d39f2e27b33f6693e8b18b608de76fc9a55b5eac55ea go1.15.src.tar.gz
988a436727aefc5124702bd70cb01bb457a921affcdd03e17f78937685482e899080d95baf125e054d1f634dae5c747d05a3662f1f4f462b87965b06270c788f disable-flaky-sync-test.patch
ab4aa83d8a9bf10bbb93ad029095b47c6eea7d5532703d84449884039116e07897871649feb1df8128f10257cbdb5d7eb03820ab0f1a3f60315e195302f6e516 disable-flaky-gc-test.patch
dc255153a3c09766c10e613fa5ec90e870382dc24129c96c69e0adbeb46383b7dafc72b68376dcb7250fc34f44da26bfbb329d255d744f2f6ab09f5fdb278d40 0001-Fix-FTBFS-on-HOME-managed-with-git.patch
bdc3c25c9138d0c01bc2493fcb8395f8e8c40970328c22915f8008fcc093abb5d6184ee24b7a3b78fb164ebc55bff3174c0bca1ac767467d9244498a0e52760c fix-rlimit-syscall-aarch64-armv7.patch
c20c126ce12f9a5190784f2a772a47658f375e44fb67884a0450ec3bbd0db61a978388b4c862bd80234e579bab58fd55b6306f3953acda11fd58603799b2e3b3 fix-setrlimit-hang.patch"
Upstream: Yes
Url: https://github.com/golang/go/issues/38604
This fixes the tests on the aarch64 CI builder.
From a6895a6a52aa5e865b8ee055a8bf85982c91b555 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <iant@golang.org>
Date: Mon, 27 Apr 2020 17:43:35 -0700
Subject: [PATCH] syscall: on linux-arm64, prefer prlimit to {g,s}etrlimit
Reportedly some Docker images accept the prlimit64 system call,
used by syscall.prlimit, but prohibit the getrlimit and setrlimit
system calls.
Fixes #38604
Change-Id: I91ff9370450b4869098cc8e335bbb7b863060508
---
diff --git a/src/syscall/syscall_linux_arm64.go b/src/syscall/syscall_linux_arm64.go
index 6d3b3df..1ad9dd8 100644
--- a/src/syscall/syscall_linux_arm64.go
+++ b/src/syscall/syscall_linux_arm64.go
@@ -28,7 +28,7 @@
//sysnb Getegid() (egid int)
//sysnb Geteuid() (euid int)
//sysnb Getgid() (gid int)
-//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb getrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Getuid() (uid int)
//sys Listen(s int, n int) (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
@@ -41,7 +41,7 @@
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
@@ -171,6 +171,24 @@
return
}
+// Getrlimit prefers the prlimit64 system call. See issue 38604.
+func Getrlimit(resource int, rlim *Rlimit) error {
+ err := prlimit(0, resource, nil, rlim)
+ if err != ENOSYS {
+ return err
+ }
+ return getrlimit(resource, rlim)
+}
+
+// Setrlimit prefers the prlimit64 system call. See issue 38604.
+func Setrlimit(resource int, rlim *Rlimit) error {
+ err := prlimit(0, resource, rlim, nil)
+ if err != ENOSYS {
+ return err
+ }
+ return setrlimit(resource, rlim)
+}
+
func (r *PtraceRegs) PC() uint64 { return r.Pc }
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
diff --git a/src/syscall/zsyscall_linux_arm64.go b/src/syscall/zsyscall_linux_arm64.go
index b62383e..f20f05e 100644
--- a/src/syscall/zsyscall_linux_arm64.go
+++ b/src/syscall/zsyscall_linux_arm64.go
@@ -1158,7 +1158,7 @@
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
+func getrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1312,7 +1312,7 @@
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment