golang update to 1.10.2
Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>master
parent
29740cf74a
commit
5e646d2524
|
@ -0,0 +1,87 @@
|
|||
From edce31a2904846ae74e3c011f2cf5fddc963459e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||
Date: Thu, 22 Mar 2018 12:07:32 +0100
|
||||
Subject: [PATCH 1/3] Don't use the bundled tzdata at runtime, except for the
|
||||
internal test suite
|
||||
|
||||
---
|
||||
src/time/internal_test.go | 7 +++++--
|
||||
src/time/zoneinfo_test.go | 3 ++-
|
||||
src/time/zoneinfo_unix.go | 2 --
|
||||
3 files changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
|
||||
index 76d5524124..e81ace5f64 100644
|
||||
--- a/src/time/internal_test.go
|
||||
+++ b/src/time/internal_test.go
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
package time
|
||||
|
||||
+import "runtime"
|
||||
+
|
||||
func init() {
|
||||
// force US/Pacific for time zone tests
|
||||
ForceUSPacificForTesting()
|
||||
}
|
||||
|
||||
func initTestingZone() {
|
||||
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
|
||||
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
|
||||
if err != nil {
|
||||
panic("cannot load America/Los_Angeles for testing: " + err.Error())
|
||||
}
|
||||
@@ -21,8 +23,9 @@ func initTestingZone() {
|
||||
var OrigZoneSources = zoneSources
|
||||
|
||||
func forceZipFileForTesting(zipOnly bool) {
|
||||
- zoneSources = make([]string, len(OrigZoneSources))
|
||||
+ zoneSources = make([]string, len(OrigZoneSources)+1)
|
||||
copy(zoneSources, OrigZoneSources)
|
||||
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
||||
if zipOnly {
|
||||
zoneSources = zoneSources[len(zoneSources)-1:]
|
||||
}
|
||||
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
|
||||
index 7a55d4f618..6063ca1195 100644
|
||||
--- a/src/time/zoneinfo_test.go
|
||||
+++ b/src/time/zoneinfo_test.go
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
+ "runtime"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
|
||||
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
|
||||
index 88313aa0ed..d9596115ef 100644
|
||||
--- a/src/time/zoneinfo_unix.go
|
||||
+++ b/src/time/zoneinfo_unix.go
|
||||
@@ -12,7 +12,6 @@
|
||||
package time
|
||||
|
||||
import (
|
||||
- "runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -22,7 +21,6 @@ var zoneSources = []string{
|
||||
"/usr/share/zoneinfo/",
|
||||
"/usr/share/lib/zoneinfo/",
|
||||
"/usr/lib/locale/TZ/",
|
||||
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
|
||||
}
|
||||
|
||||
func initLocal() {
|
||||
--
|
||||
2.14.3
|
|
@ -0,0 +1,40 @@
|
|||
From 817407fc2d6a861e65086388766f58082d38bc0b Mon Sep 17 00:00:00 2001
|
||||
From: Michael Munday <munday@ca.ibm.com>
|
||||
Date: Tue, 17 Jan 2017 11:33:38 -0500
|
||||
Subject: [PATCH 2/3] syscall: expose IfInfomsg.X__ifi_pad on s390x
|
||||
|
||||
Exposing this field on s390x improves compatibility with the other
|
||||
linux architectures, all of which already expose it.
|
||||
|
||||
Fixes #18628 and updates #18632.
|
||||
|
||||
Change-Id: I08e8e1eb705f898cd8822f8bee0d61ce11d514b5
|
||||
---
|
||||
src/syscall/ztypes_linux_s390x.go | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go
|
||||
index 63c4a83b19..b5894255df 100644
|
||||
--- a/src/syscall/ztypes_linux_s390x.go
|
||||
+++ b/src/syscall/ztypes_linux_s390x.go
|
||||
@@ -449,12 +449,12 @@ type RtAttr struct {
|
||||
}
|
||||
|
||||
type IfInfomsg struct {
|
||||
- Family uint8
|
||||
- _ uint8
|
||||
- Type uint16
|
||||
- Index int32
|
||||
- Flags uint32
|
||||
- Change uint32
|
||||
+ Family uint8
|
||||
+ X__ifi_pad uint8
|
||||
+ Type uint16
|
||||
+ Index int32
|
||||
+ Flags uint32
|
||||
+ Change uint32
|
||||
}
|
||||
|
||||
type IfAddrmsg struct {
|
||||
--
|
||||
2.14.3
|
|
@ -0,0 +1,176 @@
|
|||
From 18385565374c36eda8306c57715332d5ae6eb9a6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||
Date: Fri, 5 Jan 2018 13:38:55 +0100
|
||||
Subject: [PATCH 3/3] cmd/go/internal/work : improve pkgconfig support to work
|
||||
with latest(1.4+) pkgconf
|
||||
|
||||
Fixes #23373
|
||||
|
||||
Fix interfacing with latest(1.4+) pkgconf versions, as they have change the output format, by extending parsing function splitPkgConfigOutput to accommodate more possible fragment escaping formats. Function is based on pkgconfigs own implementation at https://github.com/pkgconf/pkgconf/blob/master/libpkgconf/argvsplit.c. Along with this change test case TestSplitPkgConfigOutput have been expanded. Thanks to ignatenko for help on test cases and insights in to the pkgconfig.
|
||||
|
||||
Change-Id: I55301bb564b07128d5564ec1454dd247f84a95c3
|
||||
---
|
||||
src/cmd/go/internal/work/build_test.go | 44 +++++++++++++++++---
|
||||
src/cmd/go/internal/work/exec.go | 75 +++++++++++++++++++++++-----------
|
||||
2 files changed, 90 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/cmd/go/internal/work/build_test.go b/src/cmd/go/internal/work/build_test.go
|
||||
index 3f5ba37c64..c3c63a97a4 100644
|
||||
--- a/src/cmd/go/internal/work/build_test.go
|
||||
+++ b/src/cmd/go/internal/work/build_test.go
|
||||
@@ -39,14 +39,46 @@ func TestSplitPkgConfigOutput(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in []byte
|
||||
want []string
|
||||
+ pass bool
|
||||
}{
|
||||
- {[]byte(`-r:foo -L/usr/white\ space/lib -lfoo\ bar -lbar\ baz`), []string{"-r:foo", "-L/usr/white space/lib", "-lfoo bar", "-lbar baz"}},
|
||||
- {[]byte(`-lextra\ fun\ arg\\`), []string{`-lextra fun arg\`}},
|
||||
- {[]byte(`broken flag\`), []string{"broken", "flag"}},
|
||||
- {[]byte("\textra whitespace\r\n"), []string{"extra", "whitespace"}},
|
||||
- {[]byte(" \r\n "), nil},
|
||||
+ {[]byte(`-r:foo -L/usr/white\ space/lib -lfoo\ bar -lbar\ baz`), []string{"-r:foo", "-L/usr/white space/lib", "-lfoo bar", "-lbar baz"}, true},
|
||||
+ {[]byte(`-lextra\ fun\ arg\\`), []string{`-lextra fun arg\`}, true},
|
||||
+ {[]byte(`broken flag\`), []string{"broken", "flag"}, true},
|
||||
+ {[]byte(`extra broken flag \`), []string{"extra", "broken", "flag"}, true},
|
||||
+ {[]byte(`\`), nil, true},
|
||||
+ {[]byte("\textra whitespace\r\n"), []string{"extra", "whitespace"}, true},
|
||||
+ {[]byte(" \r\n "), nil, true},
|
||||
+ {[]byte(`"-r:foo" "-L/usr/white space/lib" "-lfoo bar" "-lbar baz"`), []string{"-r:foo", "-L/usr/white space/lib", "-lfoo bar", "-lbar baz"}, true},
|
||||
+ {[]byte(`"-lextra fun arg\\"`), []string{`-lextra fun arg\`}, true},
|
||||
+ {[]byte(`" \r\n\ "`), []string{` \r\n\ `}, true},
|
||||
+ {[]byte(`""`), nil, true},
|
||||
+ {[]byte(``), nil, true},
|
||||
+ {[]byte(`"\\"`), []string{`\`}, true},
|
||||
+ {[]byte(`"\x"`), []string{`\x`}, true},
|
||||
+ {[]byte(`"\\x"`), []string{`\x`}, true},
|
||||
+ {[]byte(`'\\'`), []string{`\`}, true},
|
||||
+ {[]byte(`'\x'`), []string{`\x`}, true},
|
||||
+ {[]byte(`"\\x"`), []string{`\x`}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED='"/test/share/doc"'`), []string{"-fPIC", "-I/test/include/foo", `-DQUOTED="/test/share/doc"`}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED="/test/share/doc"`), []string{"-fPIC", "-I/test/include/foo", "-DQUOTED=/test/share/doc"}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED=\"/test/share/doc\"`), []string{"-fPIC", "-I/test/include/foo", `-DQUOTED="/test/share/doc"`}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED='/test/share/doc'`), []string{"-fPIC", "-I/test/include/foo", "-DQUOTED=/test/share/doc"}, true},
|
||||
+ {[]byte(`-DQUOTED='/te\st/share/d\oc'`), []string{`-DQUOTED=/te\st/share/d\oc`}, true},
|
||||
+ {[]byte(`-Dhello=10 -Dworld=+32 -DDEFINED_FROM_PKG_CONFIG=hello\ world`), []string{"-Dhello=10", "-Dworld=+32", "-DDEFINED_FROM_PKG_CONFIG=hello world"}, true},
|
||||
+ {[]byte(`" \r\n `), nil, false},
|
||||
+ {[]byte(`"-r:foo" "-L/usr/white space/lib "-lfoo bar" "-lbar baz"`), nil, false},
|
||||
+ {[]byte(`"-lextra fun arg\\`), nil, false},
|
||||
} {
|
||||
- got := splitPkgConfigOutput(test.in)
|
||||
+ got, err := splitPkgConfigOutput(test.in)
|
||||
+ if err != nil {
|
||||
+ if test.pass {
|
||||
+ t.Errorf("splitPkgConfigOutput(%v) = %v; function returned error %v", test.in, got, err)
|
||||
+ }
|
||||
+ if got != nil {
|
||||
+ t.Errorf("splitPkgConfigOutput failed with error %v and output has been non nil %v", err, got)
|
||||
+ }
|
||||
+ continue
|
||||
+ }
|
||||
if !reflect.DeepEqual(got, test.want) {
|
||||
t.Errorf("splitPkgConfigOutput(%v) = %v; want %v", test.in, got, test.want)
|
||||
}
|
||||
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
|
||||
index a50c996041..5596638e48 100644
|
||||
--- a/src/cmd/go/internal/work/exec.go
|
||||
+++ b/src/cmd/go/internal/work/exec.go
|
||||
@@ -900,36 +900,62 @@ func (b *Builder) PkgconfigCmd() string {
|
||||
}
|
||||
|
||||
// splitPkgConfigOutput parses the pkg-config output into a slice of
|
||||
-// flags. pkg-config always uses \ to escape special characters.
|
||||
-func splitPkgConfigOutput(out []byte) []string {
|
||||
+// flags. This implements the algorithm from pkgconf/libpkgconf/argvsplit.c
|
||||
+func splitPkgConfigOutput(out []byte) ([]string, error) {
|
||||
if len(out) == 0 {
|
||||
- return nil
|
||||
+ return nil, nil
|
||||
}
|
||||
var flags []string
|
||||
- flag := make([]byte, len(out))
|
||||
- r, w := 0, 0
|
||||
- for r < len(out) {
|
||||
- switch out[r] {
|
||||
- case ' ', '\t', '\r', '\n':
|
||||
- if w > 0 {
|
||||
- flags = append(flags, string(flag[:w]))
|
||||
+ flag := make([]byte, 0, len(out))
|
||||
+ escaped := false
|
||||
+ quote := byte(0)
|
||||
+
|
||||
+ for _, c := range out {
|
||||
+ if escaped {
|
||||
+ if quote == '"' || quote == '\'' {
|
||||
+ switch c {
|
||||
+ case '$', '`', '"', '\\':
|
||||
+ default:
|
||||
+ flag = append(flag, '\\')
|
||||
+ }
|
||||
+ flag = append(flag, c)
|
||||
+ } else {
|
||||
+ flag = append(flag, c)
|
||||
}
|
||||
- w = 0
|
||||
- case '\\':
|
||||
- r++
|
||||
- fallthrough
|
||||
- default:
|
||||
- if r < len(out) {
|
||||
- flag[w] = out[r]
|
||||
- w++
|
||||
+ escaped = false
|
||||
+ } else if quote != 0 {
|
||||
+ if c == quote {
|
||||
+ quote = 0
|
||||
+ } else {
|
||||
+ switch c {
|
||||
+ case '\\':
|
||||
+ escaped = true
|
||||
+ default:
|
||||
+ flag = append(flag, c)
|
||||
+ }
|
||||
}
|
||||
+ } else if strings.IndexByte(" \t\n\v\f\r", c) < 0 {
|
||||
+ switch c {
|
||||
+ case '\\':
|
||||
+ escaped = true
|
||||
+ case '\'', '"':
|
||||
+ quote = c
|
||||
+ default:
|
||||
+ flag = append(flag, c)
|
||||
+ }
|
||||
+ } else if len(flag) != 0 {
|
||||
+ flags = append(flags, string(flag))
|
||||
+ flag = flag[:0]
|
||||
}
|
||||
- r++
|
||||
}
|
||||
- if w > 0 {
|
||||
- flags = append(flags, string(flag[:w]))
|
||||
+
|
||||
+ if quote != 0 {
|
||||
+ return nil, errors.New("unterminated quoted string in pkgconf output ")
|
||||
+ } else if len(flag) != 0 {
|
||||
+ flags = append(flags, string(flag))
|
||||
}
|
||||
- return flags
|
||||
+
|
||||
+ return flags, nil
|
||||
}
|
||||
|
||||
// Calls pkg-config if needed and returns the cflags/ldflags needed to build the package.
|
||||
@@ -961,7 +987,10 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
|
||||
return nil, nil, errPrintedOutput
|
||||
}
|
||||
if len(out) > 0 {
|
||||
- cflags = splitPkgConfigOutput(out)
|
||||
+ cflags, err = splitPkgConfigOutput(out)
|
||||
+ if err != nil {
|
||||
+ return nil, nil, err
|
||||
+ }
|
||||
if err := checkCompilerFlags("CFLAGS", "pkg-config --cflags", cflags); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
--
|
||||
2.14.3
|
|
@ -102,11 +102,11 @@
|
|||
%endif
|
||||
|
||||
%global go_api 1.10
|
||||
%global go_version 1.10
|
||||
%global go_version 1.10.2
|
||||
|
||||
Name: golang
|
||||
Version: 1.10
|
||||
Release: 2%{?dist}
|
||||
Version: 1.10.2
|
||||
Release: 1%{?dist}
|
||||
Summary: The Go Programming Language
|
||||
# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
|
||||
License: BSD and Public Domain
|
||||
|
@ -175,17 +175,9 @@ Requires: %{name}-bin = %{version}-%{release}
|
|||
Requires: %{name}-src = %{version}-%{release}
|
||||
Requires: go-srpm-macros
|
||||
|
||||
# we had been just removing the zoneinfo.zip, but that caused tests to fail for users that
|
||||
# later run `go test -a std`. This makes it only use the zoneinfo.zip where needed in tests.
|
||||
Patch215: ./go1.5-zoneinfo_testing_only.patch
|
||||
|
||||
# Proposed patch by mmunday https://golang.org/cl/35262
|
||||
Patch219: s390x-expose-IfInfomsg-X__ifi_pad.patch
|
||||
|
||||
# Proposed patch by jcajka https://golang.org/cl/86541
|
||||
Patch221: golang-1.10-pkgconfig-fix.patch
|
||||
|
||||
Patch222: CVE-2018-7187.patch
|
||||
Patch1: 0001-Don-t-use-the-bundled-tzdata-at-runtime-except-for-t.patch
|
||||
Patch2: 0002-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch
|
||||
Patch3: 0003-cmd-go-internal-work-improve-pkgconfig-support-to-wo.patch
|
||||
|
||||
# Having documentation separate was broken
|
||||
Obsoletes: %{name}-docs < 1.1-4
|
||||
|
@ -309,13 +301,9 @@ Requires: %{name} = %{version}-%{release}
|
|||
%prep
|
||||
%setup -q -n go
|
||||
|
||||
%patch215 -p1
|
||||
|
||||
%patch219 -p1
|
||||
|
||||
%patch221 -p1
|
||||
|
||||
%patch222 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
cp %{SOURCE1} ./src/runtime/
|
||||
|
||||
|
@ -552,6 +540,13 @@ fi
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed May 02 2018 Jakub Čajka <jcajka@redhat.com> - 1.10.2-1
|
||||
- Rebase to 1.10.2
|
||||
|
||||
* Wed Apr 04 2018 Jakub Čajka <jcajka@redhat.com> - 1.10.1-1
|
||||
- Rebase to 1.10.1
|
||||
- Resolves: BZ#1562270
|
||||
|
||||
* Sat Mar 03 2018 Jakub Čajka <jcajka@redhat.com> - 1.10-2
|
||||
- Fix CVE-2018-7187
|
||||
- Resolves: BZ#1546386, BZ#1546388
|
||||
|
|
Loading…
Reference in New Issue