From e27525030034a3ddaf0d269e63cbeecb8e5f57a7 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Tue, 27 Aug 2013 14:59:03 -0500 Subject: [PATCH 01/67] fix changelog in spec file for bad merge --- golang.spec | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/golang.spec b/golang.spec index 90262e4..663787e 100644 --- a/golang.spec +++ b/golang.spec @@ -18,7 +18,7 @@ Name: golang Version: 1.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Go Programming Language License: BSD @@ -250,15 +250,12 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Tue Aug 27 2013 Adam Miller - 1.1.2-2 +- Update spec to fix changelog entries from bad merge + * Tue Aug 20 2013 Adam Miller - 1.1.2-1 - Update to latest upstream -* Sat Aug 03 2013 Fedora Release Engineering - 1.1.1-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Wed Jul 17 2013 Petr Pisar - 1.1.1-6 -- Perl 5.18 rebuild - * Wed Jul 10 2013 Adam Goode - 1.1.1-5 - Blacklist testdata files from prelink - Again try to fix #973842 From 79fe1edc90f5894d5d77203827f45750f37fbe3e Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 30 Aug 2013 09:09:22 -0500 Subject: [PATCH 02/67] fix meta dependency on libc --- golang.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index 90262e4..6381cf7 100644 --- a/golang.spec +++ b/golang.spec @@ -16,9 +16,16 @@ # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata %global __strip /bin/true +# rpmbuild magic to keep from having meta dependency on libc.so.6 +%define _use_internal_dependency_generator 0 +%define __find_requires %{nil} +%global debug_package %{nil} +%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ + /usr/lib/rpm/brp-compress + Name: golang Version: 1.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Go Programming Language License: BSD @@ -250,6 +257,9 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Aug 30 2013 Adam Miller - 1.1.2-2 +- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) + * Tue Aug 20 2013 Adam Miller - 1.1.2-1 - Update to latest upstream From 75bcad53e94816eff0a70ea97104b0cd080a3e08 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 30 Aug 2013 09:09:22 -0500 Subject: [PATCH 03/67] fix meta dependency on libc --- golang.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index 663787e..539197c 100644 --- a/golang.spec +++ b/golang.spec @@ -16,9 +16,16 @@ # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata %global __strip /bin/true +# rpmbuild magic to keep from having meta dependency on libc.so.6 +%define _use_internal_dependency_generator 0 +%define __find_requires %{nil} +%global debug_package %{nil} +%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ + /usr/lib/rpm/brp-compress + Name: golang Version: 1.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Go Programming Language License: BSD @@ -250,6 +257,9 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Aug 30 2013 Adam Miller - 1.1.2-3 +- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) + * Tue Aug 27 2013 Adam Miller - 1.1.2-2 - Update spec to fix changelog entries from bad merge From 993b94291e72fb44b0067abd4473d88d5bf0929b Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Wed, 18 Sep 2013 16:34:52 -0500 Subject: [PATCH 04/67] add Requires glibc, because we require libc --- golang.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/golang.spec b/golang.spec index 539197c..ba360f6 100644 --- a/golang.spec +++ b/golang.spec @@ -35,6 +35,10 @@ Source0: https://go.googlecode.com/files/go%{version}.src.tar.gz BuildRequires: /bin/hostname BuildRequires: emacs xemacs xemacs-packages-extra +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc + Patch0: golang-1.1-verbose-build.patch # Having godoc and the documentation separate was broken From 76d86a9d1a4138e64efb2456e10fce6c136db240 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Thu, 19 Sep 2013 10:53:46 -0500 Subject: [PATCH 05/67] el6 edits --- golang.spec | 62 +++++++++-------------------------------------------- 1 file changed, 10 insertions(+), 52 deletions(-) diff --git a/golang.spec b/golang.spec index 8e71ec8..8c69ed4 100644 --- a/golang.spec +++ b/golang.spec @@ -16,16 +16,9 @@ # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata %global __strip /bin/true -# rpmbuild magic to keep from having meta dependency on libc.so.6 -%define _use_internal_dependency_generator 0 -%define __find_requires %{nil} -%global debug_package %{nil} -%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ - /usr/lib/rpm/brp-compress - Name: golang Version: 1.1.2 -Release: 4%{?dist} +Release: 2%{?dist} Summary: The Go Programming Language License: BSD @@ -33,7 +26,7 @@ URL: http://golang.org/ Source0: https://go.googlecode.com/files/go%{version}.src.tar.gz BuildRequires: /bin/hostname -BuildRequires: emacs xemacs xemacs-packages-extra +BuildRequires: emacs Patch0: golang-1.1-verbose-build.patch @@ -66,7 +59,6 @@ Source101: golang-prelink.conf %package vim Summary: Vim plugins for Go -Requires: vim-filesystem BuildArch: noarch %description vim @@ -82,16 +74,6 @@ BuildArch: noarch %{summary}. -%package -n xemacs-%{name} -Summary: XEmacs add-on package for Go -Requires: xemacs(bin) >= %{_xemacs_version} -Requires: xemacs-packages-extra -BuildArch: noarch - -%description -n xemacs-%{name} -%{summary}. - - # Workaround old RPM bug of symlink-replaced-with-dir failure %pretrans -p for _,d in pairs({"api", "doc", "include", "lib", "src"}) do @@ -109,9 +91,9 @@ end # increase verbosity of build %patch0 -p1 - %build # create a gcc wrapper to allow us to build with our own flags + mkdir zz cd zz echo -e "#!/bin/sh\n/usr/bin/gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS \"\$@\"" > mygcc @@ -128,6 +110,7 @@ export GOROOT_FINAL=%{_libdir}/%{name} # build cd src +rm *.rc ./make.bash cd .. @@ -138,15 +121,12 @@ cd doc make cd .. -# compile for emacs and xemacs +# compile for emacs cd misc mv emacs/go-mode-load.el emacs/%{name}-init.el -cp -av emacs xemacs %{_emacs_bytecompile} emacs/go-mode.el -%{_xemacs_bytecompile} xemacs/go-mode.el cd .. - %check export GOROOT=$(pwd -P) export PATH="$PATH":"$GOROOT"/bin @@ -154,7 +134,6 @@ cd src ./run.bash --no-rebuild cd .. - %install rm -rf $RPM_BUILD_ROOT @@ -193,12 +172,6 @@ mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} cp -av misc/emacs/go-mode.* $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name} cp -av misc/emacs/%{name}-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir} -# misc/xemacs -mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name} -mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitestartdir} -cp -av misc/xemacs/go-mode.* $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name} -cp -av misc/xemacs/%{name}-init.el $RPM_BUILD_ROOT%{_xemacs_sitestartdir} - # misc/vim mkdir -p $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles cp -av misc/vim/* $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles @@ -250,30 +223,15 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %{_emacs_sitestartdir}/*.el -%files -n xemacs-%{name} -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS -%{_xemacs_sitelispdir}/%{name} -%{_xemacs_sitestartdir}/*.el - - %changelog -* Fri Aug 30 2013 Adam Miller - 1.1.2-4 -- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) +* Fri Aug 16 2013 Adam Miller - 1.1.2-2 +- vim-filesystem only required for Fedora , vim-common owns those files in RHEL -* Tue Aug 27 2013 Adam Miller - 1.1.2-3 -- Revert incorrect merged changelog - -* Tue Aug 27 2013 Adam Miller - 1.1.2-2 -- This was reverted, just a placeholder changelog entry for bad merge - -* Tue Aug 20 2013 Adam Miller - 1.1.2-1 +* Fri Aug 16 2013 Adam Miller - 1.1.2-1 - Update to latest upstream -* Sat Aug 03 2013 Fedora Release Engineering - 1.1.1-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Wed Jul 17 2013 Petr Pisar - 1.1.1-6 -- Perl 5.18 rebuild +* Fri Aug 16 2013 Adam Miller - 1.1.1-6 +- Remove xemacs bits for RHEL build * Wed Jul 10 2013 Adam Goode - 1.1.1-5 - Blacklist testdata files from prelink From 666ac20aadeec2aa9be92706e1d96313426b8267 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Thu, 19 Sep 2013 12:12:54 -0500 Subject: [PATCH 06/67] fix glibc meta dep, fix from vbatts --- golang.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/golang.spec b/golang.spec index 8c69ed4..c04a2ec 100644 --- a/golang.spec +++ b/golang.spec @@ -16,6 +16,13 @@ # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata %global __strip /bin/true +# rpmbuild magic to keep from having meta dependency on libc.so.6 +%define _use_internal_dependency_generator 0 +%define __find_requires %{nil} +%global debug_package %{nil} +%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ + /usr/lib/rpm/brp-compress + Name: golang Version: 1.1.2 Release: 2%{?dist} @@ -224,6 +231,9 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Thu Sep 19 2013 Adam Miller - 1.2.2-3 +- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) + * Fri Aug 16 2013 Adam Miller - 1.1.2-2 - vim-filesystem only required for Fedora , vim-common owns those files in RHEL From e3f1c1568cd58c7567b673a513aa7b67e2d0a102 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Thu, 19 Sep 2013 12:17:04 -0500 Subject: [PATCH 07/67] no with release bump goodness --- golang.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index c04a2ec..9d96830 100644 --- a/golang.spec +++ b/golang.spec @@ -25,7 +25,7 @@ Name: golang Version: 1.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Go Programming Language License: BSD From a601655be19dda7a830d478ee4475a04a8dea111 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 20 Sep 2013 09:49:37 -0500 Subject: [PATCH 08/67] fix for BZ#1010271 --- golang-1.1.2-long-links.patch | 510 +++++++++++++++++++++++++++++++++ golang-1.1.2-ustar-split.patch | 62 ++++ golang.spec | 17 +- 3 files changed, 588 insertions(+), 1 deletion(-) create mode 100644 golang-1.1.2-long-links.patch create mode 100644 golang-1.1.2-ustar-split.patch diff --git a/golang-1.1.2-long-links.patch b/golang-1.1.2-long-links.patch new file mode 100644 index 0000000..85c3541 --- /dev/null +++ b/golang-1.1.2-long-links.patch @@ -0,0 +1,510 @@ +Index: src/pkg/archive/tar/common.go +=================================================================== +--- a/src/pkg/archive/tar/common.go ++++ b/src/pkg/archive/tar/common.go +@@ -13,6 +13,7 @@ + package tar + + import ( ++ "bytes" + "errors" + "fmt" + "os" +@@ -174,6 +175,23 @@ + c_ISSOCK = 0140000 // Socket + ) + ++// Keywords for the PAX Extended Header ++const ( ++ paxAtime = "atime" ++ paxCharset = "charset" ++ paxComment = "comment" ++ paxCtime = "ctime" // please note that ctime is not a valid pax header. ++ paxGid = "gid" ++ paxGname = "gname" ++ paxLinkpath = "linkpath" ++ paxMtime = "mtime" ++ paxPath = "path" ++ paxSize = "size" ++ paxUid = "uid" ++ paxUname = "uname" ++ paxNone = "" ++) ++ + // FileInfoHeader creates a partially-populated Header from fi. + // If fi describes a symlink, FileInfoHeader records link as the link target. + // If fi describes a directory, a slash is appended to the name. +@@ -257,3 +275,25 @@ + b, *sp = s[0:n], s[n:] + return + } ++ ++func isASCII(s string) bool { ++ for _, c := range s { ++ if c >= 0x80 { ++ return false ++ } ++ } ++ return true ++} ++ ++func toASCII(s string) string { ++ if isASCII(s) { ++ return s ++ } ++ var buf bytes.Buffer ++ for _, c := range s { ++ if c < 0x80 { ++ buf.WriteByte(byte(c)) ++ } ++ } ++ return buf.String() ++} +Index: src/pkg/archive/tar/reader.go +=================================================================== +--- a/src/pkg/archive/tar/reader.go ++++ b/src/pkg/archive/tar/reader.go +@@ -95,45 +95,45 @@ + func mergePAX(hdr *Header, headers map[string]string) error { + for k, v := range headers { + switch k { +- case "path": ++ case paxPath: + hdr.Name = v +- case "linkpath": ++ case paxLinkpath: + hdr.Linkname = v +- case "gname": ++ case paxGname: + hdr.Gname = v +- case "uname": ++ case paxUname: + hdr.Uname = v +- case "uid": ++ case paxUid: + uid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Uid = int(uid) +- case "gid": ++ case paxGid: + gid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Gid = int(gid) +- case "atime": ++ case paxAtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.AccessTime = t +- case "mtime": ++ case paxMtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ModTime = t +- case "ctime": ++ case paxCtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ChangeTime = t +- case "size": ++ case paxSize: + size, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -24,6 +24,7 @@ + ErrFieldTooLong = errors.New("archive/tar: header field too long") + ErrWriteAfterClose = errors.New("archive/tar: write after close") + errNameTooLong = errors.New("archive/tar: name too long") ++ errInvalidHeader = errors.New("archive/tar: header field too long or contains invalid values") + ) + + // A Writer provides sequential writing of a tar archive in POSIX.1 format. +@@ -37,6 +38,7 @@ + pad int64 // amount of padding to write after current file entry + closed bool + usedBinary bool // whether the binary numeric field extension was used ++ preferPax bool // use pax header instead of binary numeric header + } + + // NewWriter creates a new Writer writing to w. +@@ -65,16 +67,23 @@ + } + + // Write s into b, terminating it with a NUL if there is room. +-func (tw *Writer) cString(b []byte, s string) { ++// If the value is too long for the field and allowPax is true add a paxheader record instead ++func (tw *Writer) cString(b []byte, s string, allowPax bool, paxKeyword string, paxHeaders map[string]string) { ++ needsPaxHeader := allowPax && len(s) > len(b) || !isASCII(s) ++ if needsPaxHeader { ++ paxHeaders[paxKeyword] = s ++ return ++ } + if len(s) > len(b) { + if tw.err == nil { + tw.err = ErrFieldTooLong + } + return + } +- copy(b, s) +- if len(s) < len(b) { +- b[len(s)] = 0 ++ ascii := toASCII(s) ++ copy(b, ascii) ++ if len(ascii) < len(b) { ++ b[len(ascii)] = 0 + } + } + +@@ -85,17 +94,27 @@ + for len(s)+1 < len(b) { + s = "0" + s + } +- tw.cString(b, s) ++ tw.cString(b, s, false, paxNone, nil) + } + + // Write x into b, either as octal or as binary (GNUtar/star extension). +-func (tw *Writer) numeric(b []byte, x int64) { ++// If the value is too long for the field and writingPax is enabled both for the field and the add a paxheader record instead ++func (tw *Writer) numeric(b []byte, x int64, allowPax bool, paxKeyword string, paxHeaders map[string]string) { + // Try octal first. + s := strconv.FormatInt(x, 8) + if len(s) < len(b) { + tw.octal(b, x) + return + } ++ ++ // If it is too long for octal, and pax is preferred, use a pax header ++ if allowPax && tw.preferPax { ++ tw.octal(b, 0) ++ s := strconv.FormatInt(x, 10) ++ paxHeaders[paxKeyword] = s ++ return ++ } ++ + // Too big: use binary (big-endian). + tw.usedBinary = true + for i := len(b) - 1; x > 0 && i >= 0; i-- { +@@ -115,6 +134,15 @@ + // WriteHeader calls Flush if it is not the first header. + // Calling after a Close will return ErrWriteAfterClose. + func (tw *Writer) WriteHeader(hdr *Header) error { ++ return tw.writeHeader(hdr, true) ++} ++ ++// WriteHeader writes hdr and prepares to accept the file's contents. ++// WriteHeader calls Flush if it is not the first header. ++// Calling after a Close will return ErrWriteAfterClose. ++// As this method is called internally by writePax header to allow it to ++// suppress writing the pax header. ++func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error { + if tw.closed { + return ErrWriteAfterClose + } +@@ -124,31 +152,21 @@ + if tw.err != nil { + return tw.err + } +- // Decide whether or not to use PAX extensions ++ ++ // a map to hold pax header records, if any are needed ++ paxHeaders := make(map[string]string) ++ + // TODO(shanemhansen): we might want to use PAX headers for + // subsecond time resolution, but for now let's just capture +- // the long name/long symlink use case. +- suffix := hdr.Name +- prefix := "" +- if len(hdr.Name) > fileNameSize || len(hdr.Linkname) > fileNameSize { +- var err error +- prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) +- // Either we were unable to pack the long name into ustar format +- // or the link name is too long; use PAX headers. +- if err == errNameTooLong || len(hdr.Linkname) > fileNameSize { +- if err := tw.writePAXHeader(hdr); err != nil { +- return err +- } +- } else if err != nil { +- return err +- } +- } +- tw.nb = int64(hdr.Size) +- tw.pad = -tw.nb & (blockSize - 1) // blockSize is a power of two ++ // too long fields or non ascii characters + + header := make([]byte, blockSize) + s := slicer(header) +- tw.cString(s.next(fileNameSize), suffix) ++ ++ // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ pathHeaderBytes := s.next(fileNameSize) ++ ++ tw.cString(pathHeaderBytes, hdr.Name, true, paxPath, paxHeaders) + + // Handle out of range ModTime carefully. + var modTime int64 +@@ -156,27 +174,55 @@ + modTime = hdr.ModTime.Unix() + } + +- tw.octal(s.next(8), hdr.Mode) // 100:108 +- tw.numeric(s.next(8), int64(hdr.Uid)) // 108:116 +- tw.numeric(s.next(8), int64(hdr.Gid)) // 116:124 +- tw.numeric(s.next(12), hdr.Size) // 124:136 +- tw.numeric(s.next(12), modTime) // 136:148 +- s.next(8) // chksum (148:156) +- s.next(1)[0] = hdr.Typeflag // 156:157 +- tw.cString(s.next(100), hdr.Linkname) // linkname (157:257) +- copy(s.next(8), []byte("ustar\x0000")) // 257:265 +- tw.cString(s.next(32), hdr.Uname) // 265:297 +- tw.cString(s.next(32), hdr.Gname) // 297:329 +- tw.numeric(s.next(8), hdr.Devmajor) // 329:337 +- tw.numeric(s.next(8), hdr.Devminor) // 337:345 +- tw.cString(s.next(155), prefix) // 345:500 ++ tw.octal(s.next(8), hdr.Mode) // 100:108 ++ tw.numeric(s.next(8), int64(hdr.Uid), true, paxUid, paxHeaders) // 108:116 ++ tw.numeric(s.next(8), int64(hdr.Gid), true, paxGid, paxHeaders) // 116:124 ++ tw.numeric(s.next(12), hdr.Size, true, paxSize, paxHeaders) // 124:136 ++ tw.numeric(s.next(12), modTime, false, paxNone, nil) // 136:148 --- consider using pax for finer granularity ++ s.next(8) // chksum (148:156) ++ s.next(1)[0] = hdr.Typeflag // 156:157 ++ ++ tw.cString(s.next(100), hdr.Linkname, true, paxLinkpath, paxHeaders) ++ ++ copy(s.next(8), []byte("ustar\x0000")) // 257:265 ++ tw.cString(s.next(32), hdr.Uname, true, paxUname, paxHeaders) // 265:297 ++ tw.cString(s.next(32), hdr.Gname, true, paxGname, paxHeaders) // 297:329 ++ tw.numeric(s.next(8), hdr.Devmajor, false, paxNone, nil) // 329:337 ++ tw.numeric(s.next(8), hdr.Devminor, false, paxNone, nil) // 337:345 ++ ++ // keep a reference to the prefix to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ prefixHeaderBytes := s.next(155) ++ tw.cString(prefixHeaderBytes, "", false, paxNone, nil) // 345:500 prefix ++ + // Use the GNU magic instead of POSIX magic if we used any GNU extensions. + if tw.usedBinary { + copy(header[257:265], []byte("ustar \x00")) + } +- // Use the ustar magic if we used ustar long names. +- if len(prefix) > 0 { +- copy(header[257:265], []byte("ustar\000")) ++ ++ _, paxPathUsed := paxHeaders[paxPath] ++ // try to use a ustar header when only the name is too long ++ if !tw.preferPax && len(paxHeaders) == 1 && paxPathUsed { ++ suffix := hdr.Name ++ prefix := "" ++ if len(hdr.Name) > fileNameSize && isASCII(hdr.Name) { ++ var err error ++ prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) ++ if err == nil { ++ // ok we can use a ustar long name instead of pax, now correct the fields ++ ++ // remove the path field from the pax header. this will suppress the pax header ++ delete(paxHeaders, paxPath) ++ ++ // update the path fields ++ tw.cString(pathHeaderBytes, suffix, false, paxNone, nil) ++ tw.cString(prefixHeaderBytes, prefix, false, paxNone, nil) ++ ++ // Use the ustar magic if we used ustar long names. ++ if len(prefix) > 0 { ++ copy(header[257:265], []byte("ustar\000")) ++ } ++ } ++ } + } + + // The chksum field is terminated by a NUL and a space. +@@ -190,8 +236,18 @@ + return tw.err + } + ++ if len(paxHeaders) > 0 { ++ if !allowPax { ++ return errInvalidHeader ++ } ++ if err := tw.writePAXHeader(hdr, paxHeaders); err != nil { ++ return err ++ } ++ } ++ tw.nb = int64(hdr.Size) ++ tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize ++ + _, tw.err = tw.w.Write(header) +- + return tw.err + } + +@@ -218,7 +274,7 @@ + + // writePaxHeader writes an extended pax header to the + // archive. +-func (tw *Writer) writePAXHeader(hdr *Header) error { ++func (tw *Writer) writePAXHeader(hdr *Header, paxHeaders map[string]string) error { + // Prepare extended header + ext := new(Header) + ext.Typeflag = TypeXHeader +@@ -229,18 +285,23 @@ + // with the current pid. + pid := os.Getpid() + dir, file := path.Split(hdr.Name) +- ext.Name = path.Join(dir, +- fmt.Sprintf("PaxHeaders.%d", pid), file)[0:100] ++ fullName := path.Join(dir, ++ fmt.Sprintf("PaxHeaders.%d", pid), file) ++ ++ ascii := toASCII(fullName) ++ if len(ascii) > 100 { ++ ascii = ascii[:100] ++ } ++ ext.Name = ascii + // Construct the body + var buf bytes.Buffer +- if len(hdr.Name) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("path="+hdr.Name)) ++ ++ for k, v := range paxHeaders { ++ fmt.Fprint(&buf, paxHeader(k+"="+v)) + } +- if len(hdr.Linkname) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("linkpath="+hdr.Linkname)) +- } ++ + ext.Size = int64(len(buf.Bytes())) +- if err := tw.WriteHeader(ext); err != nil { ++ if err := tw.writeHeader(ext, false); err != nil { + return err + } + if _, err := tw.Write(buf.Bytes()); err != nil { +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -243,15 +243,110 @@ + } + } + ++func TestPaxSymlink(t *testing.T) { ++ // Create an archive with a large linkname ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeSymlink ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long linkname to be written ++ longLinkname := strings.Repeat("1234567890/1234567890", 10) ++ hdr.Linkname = longLinkname ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Linkname != longLinkname { ++ t.Fatal("Couldn't recover long link name") ++ } ++} ++ ++func TestPaxNonAscii(t *testing.T) { ++ // Create an archive with non ascii. These should trigger a pax header ++ // because pax headers have a defined utf-8 encoding. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ hdr, err := FileInfoHeader(fileinfo, "") ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ ++ // some sample data ++ chineseFilename := "文件名" ++ chineseGroupname := "組" ++ chineseUsername := "用戶名" ++ ++ hdr.Name = chineseFilename ++ hdr.Gname = chineseGroupname ++ hdr.Uname = chineseUsername ++ ++ contents := strings.Repeat(" ", int(hdr.Size)) ++ ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if _, err = writer.Write([]byte(contents)); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != chineseFilename { ++ t.Fatal("Couldn't recover unicode name") ++ } ++ if hdr.Gname != chineseGroupname { ++ t.Fatal("Couldn't recover unicode group") ++ } ++ if hdr.Uname != chineseUsername { ++ t.Fatal("Couldn't recover unicode user") ++ } ++} ++ + func TestPAXHeader(t *testing.T) { + medName := strings.Repeat("CD", 50) + longName := strings.Repeat("AB", 100) + paxTests := [][2]string{ +- {"name=/etc/hosts", "19 name=/etc/hosts\n"}, ++ {paxPath + "=/etc/hosts", "19 path=/etc/hosts\n"}, + {"a=b", "6 a=b\n"}, // Single digit length + {"a=names", "11 a=names\n"}, // Test case involving carries +- {"name=" + longName, fmt.Sprintf("210 name=%s\n", longName)}, +- {"name=" + medName, fmt.Sprintf("110 name=%s\n", medName)}} ++ {paxPath + "=" + longName, fmt.Sprintf("210 path=%s\n", longName)}, ++ {paxPath + "=" + medName, fmt.Sprintf("110 path=%s\n", medName)}} + + for _, test := range paxTests { + key, expected := test[0], test[1] diff --git a/golang-1.1.2-ustar-split.patch b/golang-1.1.2-ustar-split.patch new file mode 100644 index 0000000..9e97b38 --- /dev/null +++ b/golang-1.1.2-ustar-split.patch @@ -0,0 +1,62 @@ +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -263,8 +263,11 @@ + length-- + } + i := strings.LastIndex(name[:length], "/") +- nlen := length - i - 1 +- if i <= 0 || nlen > fileNameSize || nlen == 0 { ++ // nlen contains the resulting length in the name field. ++ // plen contains the resulting length in the prefix field. ++ nlen := len(name) - i - 1 ++ plen := i ++ if i <= 0 || nlen > fileNameSize || nlen == 0 || plen > fileNamePrefixSize { + err = errNameTooLong + return + } +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -355,3 +355,39 @@ + } + } + } ++ ++func TestUSTARLongName(t *testing.T) { ++ // Create an archive with a path that failed to split with USTAR extension in previous versions. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeDir ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long name to be written. The name was taken from a practical example ++ // that fails and replaced ever char through numbers to anonymize the sample. ++ longName := "/0000_0000000/00000-000000000/0000_0000000/00000-0000000000000/0000_0000000/00000-0000000-00000000/0000_0000000/00000000/0000_0000000/000/0000_0000000/00000000v00/0000_0000000/000000/0000_0000000/0000000/0000_0000000/00000y-00/0000/0000/00000000/0x000000/" ++ hdr.Name = longName ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != longName { ++ t.Fatal("Couldn't recover long name") ++ } ++} diff --git a/golang.spec b/golang.spec index 6381cf7..cde5a95 100644 --- a/golang.spec +++ b/golang.spec @@ -25,7 +25,7 @@ Name: golang Version: 1.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Go Programming Language License: BSD @@ -35,8 +35,16 @@ Source0: https://go.googlecode.com/files/go%{version}.src.tar.gz BuildRequires: /bin/hostname BuildRequires: emacs xemacs xemacs-packages-extra +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc + Patch0: golang-1.1-verbose-build.patch +Patch10: golang-1.1.2-long-links.patch +Patch11: golang-1.1.2-ustar-split.patch + + # Having godoc and the documentation separate was broken Obsoletes: %{name}-godoc < 1.1-4 Obsoletes: %{name}-docs < 1.1-4 @@ -109,6 +117,9 @@ end # increase verbosity of build %patch0 -p1 +# Fix BZ#1010271 +%patch10 -p1 +%patch11 -p1 %build # create a gcc wrapper to allow us to build with our own flags @@ -257,6 +268,10 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Sep 20 2013 Adam Miller - 1.1.2-3 +- Pull upstream patches for BZ#1010271 +- Add glibc requirement that got dropped because of meta dep fix + * Fri Aug 30 2013 Adam Miller - 1.1.2-2 - fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) From e6ff51995eb3572365b692a19686b102b95de8ac Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 20 Sep 2013 09:59:15 -0500 Subject: [PATCH 09/67] fix for BZ#1010271 --- golang-1.1.2-long-links.patch | 510 +++++++++++++++++++++++++++++++++ golang-1.1.2-ustar-split.patch | 62 ++++ golang.spec | 12 +- 3 files changed, 583 insertions(+), 1 deletion(-) create mode 100644 golang-1.1.2-long-links.patch create mode 100644 golang-1.1.2-ustar-split.patch diff --git a/golang-1.1.2-long-links.patch b/golang-1.1.2-long-links.patch new file mode 100644 index 0000000..85c3541 --- /dev/null +++ b/golang-1.1.2-long-links.patch @@ -0,0 +1,510 @@ +Index: src/pkg/archive/tar/common.go +=================================================================== +--- a/src/pkg/archive/tar/common.go ++++ b/src/pkg/archive/tar/common.go +@@ -13,6 +13,7 @@ + package tar + + import ( ++ "bytes" + "errors" + "fmt" + "os" +@@ -174,6 +175,23 @@ + c_ISSOCK = 0140000 // Socket + ) + ++// Keywords for the PAX Extended Header ++const ( ++ paxAtime = "atime" ++ paxCharset = "charset" ++ paxComment = "comment" ++ paxCtime = "ctime" // please note that ctime is not a valid pax header. ++ paxGid = "gid" ++ paxGname = "gname" ++ paxLinkpath = "linkpath" ++ paxMtime = "mtime" ++ paxPath = "path" ++ paxSize = "size" ++ paxUid = "uid" ++ paxUname = "uname" ++ paxNone = "" ++) ++ + // FileInfoHeader creates a partially-populated Header from fi. + // If fi describes a symlink, FileInfoHeader records link as the link target. + // If fi describes a directory, a slash is appended to the name. +@@ -257,3 +275,25 @@ + b, *sp = s[0:n], s[n:] + return + } ++ ++func isASCII(s string) bool { ++ for _, c := range s { ++ if c >= 0x80 { ++ return false ++ } ++ } ++ return true ++} ++ ++func toASCII(s string) string { ++ if isASCII(s) { ++ return s ++ } ++ var buf bytes.Buffer ++ for _, c := range s { ++ if c < 0x80 { ++ buf.WriteByte(byte(c)) ++ } ++ } ++ return buf.String() ++} +Index: src/pkg/archive/tar/reader.go +=================================================================== +--- a/src/pkg/archive/tar/reader.go ++++ b/src/pkg/archive/tar/reader.go +@@ -95,45 +95,45 @@ + func mergePAX(hdr *Header, headers map[string]string) error { + for k, v := range headers { + switch k { +- case "path": ++ case paxPath: + hdr.Name = v +- case "linkpath": ++ case paxLinkpath: + hdr.Linkname = v +- case "gname": ++ case paxGname: + hdr.Gname = v +- case "uname": ++ case paxUname: + hdr.Uname = v +- case "uid": ++ case paxUid: + uid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Uid = int(uid) +- case "gid": ++ case paxGid: + gid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Gid = int(gid) +- case "atime": ++ case paxAtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.AccessTime = t +- case "mtime": ++ case paxMtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ModTime = t +- case "ctime": ++ case paxCtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ChangeTime = t +- case "size": ++ case paxSize: + size, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -24,6 +24,7 @@ + ErrFieldTooLong = errors.New("archive/tar: header field too long") + ErrWriteAfterClose = errors.New("archive/tar: write after close") + errNameTooLong = errors.New("archive/tar: name too long") ++ errInvalidHeader = errors.New("archive/tar: header field too long or contains invalid values") + ) + + // A Writer provides sequential writing of a tar archive in POSIX.1 format. +@@ -37,6 +38,7 @@ + pad int64 // amount of padding to write after current file entry + closed bool + usedBinary bool // whether the binary numeric field extension was used ++ preferPax bool // use pax header instead of binary numeric header + } + + // NewWriter creates a new Writer writing to w. +@@ -65,16 +67,23 @@ + } + + // Write s into b, terminating it with a NUL if there is room. +-func (tw *Writer) cString(b []byte, s string) { ++// If the value is too long for the field and allowPax is true add a paxheader record instead ++func (tw *Writer) cString(b []byte, s string, allowPax bool, paxKeyword string, paxHeaders map[string]string) { ++ needsPaxHeader := allowPax && len(s) > len(b) || !isASCII(s) ++ if needsPaxHeader { ++ paxHeaders[paxKeyword] = s ++ return ++ } + if len(s) > len(b) { + if tw.err == nil { + tw.err = ErrFieldTooLong + } + return + } +- copy(b, s) +- if len(s) < len(b) { +- b[len(s)] = 0 ++ ascii := toASCII(s) ++ copy(b, ascii) ++ if len(ascii) < len(b) { ++ b[len(ascii)] = 0 + } + } + +@@ -85,17 +94,27 @@ + for len(s)+1 < len(b) { + s = "0" + s + } +- tw.cString(b, s) ++ tw.cString(b, s, false, paxNone, nil) + } + + // Write x into b, either as octal or as binary (GNUtar/star extension). +-func (tw *Writer) numeric(b []byte, x int64) { ++// If the value is too long for the field and writingPax is enabled both for the field and the add a paxheader record instead ++func (tw *Writer) numeric(b []byte, x int64, allowPax bool, paxKeyword string, paxHeaders map[string]string) { + // Try octal first. + s := strconv.FormatInt(x, 8) + if len(s) < len(b) { + tw.octal(b, x) + return + } ++ ++ // If it is too long for octal, and pax is preferred, use a pax header ++ if allowPax && tw.preferPax { ++ tw.octal(b, 0) ++ s := strconv.FormatInt(x, 10) ++ paxHeaders[paxKeyword] = s ++ return ++ } ++ + // Too big: use binary (big-endian). + tw.usedBinary = true + for i := len(b) - 1; x > 0 && i >= 0; i-- { +@@ -115,6 +134,15 @@ + // WriteHeader calls Flush if it is not the first header. + // Calling after a Close will return ErrWriteAfterClose. + func (tw *Writer) WriteHeader(hdr *Header) error { ++ return tw.writeHeader(hdr, true) ++} ++ ++// WriteHeader writes hdr and prepares to accept the file's contents. ++// WriteHeader calls Flush if it is not the first header. ++// Calling after a Close will return ErrWriteAfterClose. ++// As this method is called internally by writePax header to allow it to ++// suppress writing the pax header. ++func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error { + if tw.closed { + return ErrWriteAfterClose + } +@@ -124,31 +152,21 @@ + if tw.err != nil { + return tw.err + } +- // Decide whether or not to use PAX extensions ++ ++ // a map to hold pax header records, if any are needed ++ paxHeaders := make(map[string]string) ++ + // TODO(shanemhansen): we might want to use PAX headers for + // subsecond time resolution, but for now let's just capture +- // the long name/long symlink use case. +- suffix := hdr.Name +- prefix := "" +- if len(hdr.Name) > fileNameSize || len(hdr.Linkname) > fileNameSize { +- var err error +- prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) +- // Either we were unable to pack the long name into ustar format +- // or the link name is too long; use PAX headers. +- if err == errNameTooLong || len(hdr.Linkname) > fileNameSize { +- if err := tw.writePAXHeader(hdr); err != nil { +- return err +- } +- } else if err != nil { +- return err +- } +- } +- tw.nb = int64(hdr.Size) +- tw.pad = -tw.nb & (blockSize - 1) // blockSize is a power of two ++ // too long fields or non ascii characters + + header := make([]byte, blockSize) + s := slicer(header) +- tw.cString(s.next(fileNameSize), suffix) ++ ++ // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ pathHeaderBytes := s.next(fileNameSize) ++ ++ tw.cString(pathHeaderBytes, hdr.Name, true, paxPath, paxHeaders) + + // Handle out of range ModTime carefully. + var modTime int64 +@@ -156,27 +174,55 @@ + modTime = hdr.ModTime.Unix() + } + +- tw.octal(s.next(8), hdr.Mode) // 100:108 +- tw.numeric(s.next(8), int64(hdr.Uid)) // 108:116 +- tw.numeric(s.next(8), int64(hdr.Gid)) // 116:124 +- tw.numeric(s.next(12), hdr.Size) // 124:136 +- tw.numeric(s.next(12), modTime) // 136:148 +- s.next(8) // chksum (148:156) +- s.next(1)[0] = hdr.Typeflag // 156:157 +- tw.cString(s.next(100), hdr.Linkname) // linkname (157:257) +- copy(s.next(8), []byte("ustar\x0000")) // 257:265 +- tw.cString(s.next(32), hdr.Uname) // 265:297 +- tw.cString(s.next(32), hdr.Gname) // 297:329 +- tw.numeric(s.next(8), hdr.Devmajor) // 329:337 +- tw.numeric(s.next(8), hdr.Devminor) // 337:345 +- tw.cString(s.next(155), prefix) // 345:500 ++ tw.octal(s.next(8), hdr.Mode) // 100:108 ++ tw.numeric(s.next(8), int64(hdr.Uid), true, paxUid, paxHeaders) // 108:116 ++ tw.numeric(s.next(8), int64(hdr.Gid), true, paxGid, paxHeaders) // 116:124 ++ tw.numeric(s.next(12), hdr.Size, true, paxSize, paxHeaders) // 124:136 ++ tw.numeric(s.next(12), modTime, false, paxNone, nil) // 136:148 --- consider using pax for finer granularity ++ s.next(8) // chksum (148:156) ++ s.next(1)[0] = hdr.Typeflag // 156:157 ++ ++ tw.cString(s.next(100), hdr.Linkname, true, paxLinkpath, paxHeaders) ++ ++ copy(s.next(8), []byte("ustar\x0000")) // 257:265 ++ tw.cString(s.next(32), hdr.Uname, true, paxUname, paxHeaders) // 265:297 ++ tw.cString(s.next(32), hdr.Gname, true, paxGname, paxHeaders) // 297:329 ++ tw.numeric(s.next(8), hdr.Devmajor, false, paxNone, nil) // 329:337 ++ tw.numeric(s.next(8), hdr.Devminor, false, paxNone, nil) // 337:345 ++ ++ // keep a reference to the prefix to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ prefixHeaderBytes := s.next(155) ++ tw.cString(prefixHeaderBytes, "", false, paxNone, nil) // 345:500 prefix ++ + // Use the GNU magic instead of POSIX magic if we used any GNU extensions. + if tw.usedBinary { + copy(header[257:265], []byte("ustar \x00")) + } +- // Use the ustar magic if we used ustar long names. +- if len(prefix) > 0 { +- copy(header[257:265], []byte("ustar\000")) ++ ++ _, paxPathUsed := paxHeaders[paxPath] ++ // try to use a ustar header when only the name is too long ++ if !tw.preferPax && len(paxHeaders) == 1 && paxPathUsed { ++ suffix := hdr.Name ++ prefix := "" ++ if len(hdr.Name) > fileNameSize && isASCII(hdr.Name) { ++ var err error ++ prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) ++ if err == nil { ++ // ok we can use a ustar long name instead of pax, now correct the fields ++ ++ // remove the path field from the pax header. this will suppress the pax header ++ delete(paxHeaders, paxPath) ++ ++ // update the path fields ++ tw.cString(pathHeaderBytes, suffix, false, paxNone, nil) ++ tw.cString(prefixHeaderBytes, prefix, false, paxNone, nil) ++ ++ // Use the ustar magic if we used ustar long names. ++ if len(prefix) > 0 { ++ copy(header[257:265], []byte("ustar\000")) ++ } ++ } ++ } + } + + // The chksum field is terminated by a NUL and a space. +@@ -190,8 +236,18 @@ + return tw.err + } + ++ if len(paxHeaders) > 0 { ++ if !allowPax { ++ return errInvalidHeader ++ } ++ if err := tw.writePAXHeader(hdr, paxHeaders); err != nil { ++ return err ++ } ++ } ++ tw.nb = int64(hdr.Size) ++ tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize ++ + _, tw.err = tw.w.Write(header) +- + return tw.err + } + +@@ -218,7 +274,7 @@ + + // writePaxHeader writes an extended pax header to the + // archive. +-func (tw *Writer) writePAXHeader(hdr *Header) error { ++func (tw *Writer) writePAXHeader(hdr *Header, paxHeaders map[string]string) error { + // Prepare extended header + ext := new(Header) + ext.Typeflag = TypeXHeader +@@ -229,18 +285,23 @@ + // with the current pid. + pid := os.Getpid() + dir, file := path.Split(hdr.Name) +- ext.Name = path.Join(dir, +- fmt.Sprintf("PaxHeaders.%d", pid), file)[0:100] ++ fullName := path.Join(dir, ++ fmt.Sprintf("PaxHeaders.%d", pid), file) ++ ++ ascii := toASCII(fullName) ++ if len(ascii) > 100 { ++ ascii = ascii[:100] ++ } ++ ext.Name = ascii + // Construct the body + var buf bytes.Buffer +- if len(hdr.Name) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("path="+hdr.Name)) ++ ++ for k, v := range paxHeaders { ++ fmt.Fprint(&buf, paxHeader(k+"="+v)) + } +- if len(hdr.Linkname) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("linkpath="+hdr.Linkname)) +- } ++ + ext.Size = int64(len(buf.Bytes())) +- if err := tw.WriteHeader(ext); err != nil { ++ if err := tw.writeHeader(ext, false); err != nil { + return err + } + if _, err := tw.Write(buf.Bytes()); err != nil { +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -243,15 +243,110 @@ + } + } + ++func TestPaxSymlink(t *testing.T) { ++ // Create an archive with a large linkname ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeSymlink ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long linkname to be written ++ longLinkname := strings.Repeat("1234567890/1234567890", 10) ++ hdr.Linkname = longLinkname ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Linkname != longLinkname { ++ t.Fatal("Couldn't recover long link name") ++ } ++} ++ ++func TestPaxNonAscii(t *testing.T) { ++ // Create an archive with non ascii. These should trigger a pax header ++ // because pax headers have a defined utf-8 encoding. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ hdr, err := FileInfoHeader(fileinfo, "") ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ ++ // some sample data ++ chineseFilename := "文件名" ++ chineseGroupname := "組" ++ chineseUsername := "用戶名" ++ ++ hdr.Name = chineseFilename ++ hdr.Gname = chineseGroupname ++ hdr.Uname = chineseUsername ++ ++ contents := strings.Repeat(" ", int(hdr.Size)) ++ ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if _, err = writer.Write([]byte(contents)); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != chineseFilename { ++ t.Fatal("Couldn't recover unicode name") ++ } ++ if hdr.Gname != chineseGroupname { ++ t.Fatal("Couldn't recover unicode group") ++ } ++ if hdr.Uname != chineseUsername { ++ t.Fatal("Couldn't recover unicode user") ++ } ++} ++ + func TestPAXHeader(t *testing.T) { + medName := strings.Repeat("CD", 50) + longName := strings.Repeat("AB", 100) + paxTests := [][2]string{ +- {"name=/etc/hosts", "19 name=/etc/hosts\n"}, ++ {paxPath + "=/etc/hosts", "19 path=/etc/hosts\n"}, + {"a=b", "6 a=b\n"}, // Single digit length + {"a=names", "11 a=names\n"}, // Test case involving carries +- {"name=" + longName, fmt.Sprintf("210 name=%s\n", longName)}, +- {"name=" + medName, fmt.Sprintf("110 name=%s\n", medName)}} ++ {paxPath + "=" + longName, fmt.Sprintf("210 path=%s\n", longName)}, ++ {paxPath + "=" + medName, fmt.Sprintf("110 path=%s\n", medName)}} + + for _, test := range paxTests { + key, expected := test[0], test[1] diff --git a/golang-1.1.2-ustar-split.patch b/golang-1.1.2-ustar-split.patch new file mode 100644 index 0000000..9e97b38 --- /dev/null +++ b/golang-1.1.2-ustar-split.patch @@ -0,0 +1,62 @@ +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -263,8 +263,11 @@ + length-- + } + i := strings.LastIndex(name[:length], "/") +- nlen := length - i - 1 +- if i <= 0 || nlen > fileNameSize || nlen == 0 { ++ // nlen contains the resulting length in the name field. ++ // plen contains the resulting length in the prefix field. ++ nlen := len(name) - i - 1 ++ plen := i ++ if i <= 0 || nlen > fileNameSize || nlen == 0 || plen > fileNamePrefixSize { + err = errNameTooLong + return + } +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -355,3 +355,39 @@ + } + } + } ++ ++func TestUSTARLongName(t *testing.T) { ++ // Create an archive with a path that failed to split with USTAR extension in previous versions. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeDir ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long name to be written. The name was taken from a practical example ++ // that fails and replaced ever char through numbers to anonymize the sample. ++ longName := "/0000_0000000/00000-000000000/0000_0000000/00000-0000000000000/0000_0000000/00000-0000000-00000000/0000_0000000/00000000/0000_0000000/000/0000_0000000/00000000v00/0000_0000000/000000/0000_0000000/0000000/0000_0000000/00000y-00/0000/0000/00000000/0x000000/" ++ hdr.Name = longName ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != longName { ++ t.Fatal("Couldn't recover long name") ++ } ++} diff --git a/golang.spec b/golang.spec index ba360f6..0c8030e 100644 --- a/golang.spec +++ b/golang.spec @@ -25,7 +25,7 @@ Name: golang Version: 1.1.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: The Go Programming Language License: BSD @@ -41,6 +41,9 @@ Requires: glibc Patch0: golang-1.1-verbose-build.patch +Patch10: golang-1.1.2-long-links.patch +Patch11: golang-1.1.2-ustar-split.patch + # Having godoc and the documentation separate was broken Obsoletes: %{name}-godoc < 1.1-4 Obsoletes: %{name}-docs < 1.1-4 @@ -113,6 +116,9 @@ end # increase verbosity of build %patch0 -p1 +# Fix BZ#1010271 +%patch10 -p1 +%patch11 -p1 %build # create a gcc wrapper to allow us to build with our own flags @@ -261,6 +267,10 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Sep 20 2013 Adam Miller - 1.1.2-4 +- Pull upstream patches for BZ#1010271 +- Add glibc requirement that got dropped because of meta dep fix + * Fri Aug 30 2013 Adam Miller - 1.1.2-3 - fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) From f12359b27ef2cd713de56c2397ad9f6b446385c8 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 20 Sep 2013 10:10:13 -0500 Subject: [PATCH 10/67] fix for BZ#1010271 --- golang-1.1.2-long-links.patch | 510 +++++++++++++++++++++++++++++++++ golang-1.1.2-ustar-split.patch | 62 ++++ golang.spec | 17 +- 3 files changed, 588 insertions(+), 1 deletion(-) create mode 100644 golang-1.1.2-long-links.patch create mode 100644 golang-1.1.2-ustar-split.patch diff --git a/golang-1.1.2-long-links.patch b/golang-1.1.2-long-links.patch new file mode 100644 index 0000000..85c3541 --- /dev/null +++ b/golang-1.1.2-long-links.patch @@ -0,0 +1,510 @@ +Index: src/pkg/archive/tar/common.go +=================================================================== +--- a/src/pkg/archive/tar/common.go ++++ b/src/pkg/archive/tar/common.go +@@ -13,6 +13,7 @@ + package tar + + import ( ++ "bytes" + "errors" + "fmt" + "os" +@@ -174,6 +175,23 @@ + c_ISSOCK = 0140000 // Socket + ) + ++// Keywords for the PAX Extended Header ++const ( ++ paxAtime = "atime" ++ paxCharset = "charset" ++ paxComment = "comment" ++ paxCtime = "ctime" // please note that ctime is not a valid pax header. ++ paxGid = "gid" ++ paxGname = "gname" ++ paxLinkpath = "linkpath" ++ paxMtime = "mtime" ++ paxPath = "path" ++ paxSize = "size" ++ paxUid = "uid" ++ paxUname = "uname" ++ paxNone = "" ++) ++ + // FileInfoHeader creates a partially-populated Header from fi. + // If fi describes a symlink, FileInfoHeader records link as the link target. + // If fi describes a directory, a slash is appended to the name. +@@ -257,3 +275,25 @@ + b, *sp = s[0:n], s[n:] + return + } ++ ++func isASCII(s string) bool { ++ for _, c := range s { ++ if c >= 0x80 { ++ return false ++ } ++ } ++ return true ++} ++ ++func toASCII(s string) string { ++ if isASCII(s) { ++ return s ++ } ++ var buf bytes.Buffer ++ for _, c := range s { ++ if c < 0x80 { ++ buf.WriteByte(byte(c)) ++ } ++ } ++ return buf.String() ++} +Index: src/pkg/archive/tar/reader.go +=================================================================== +--- a/src/pkg/archive/tar/reader.go ++++ b/src/pkg/archive/tar/reader.go +@@ -95,45 +95,45 @@ + func mergePAX(hdr *Header, headers map[string]string) error { + for k, v := range headers { + switch k { +- case "path": ++ case paxPath: + hdr.Name = v +- case "linkpath": ++ case paxLinkpath: + hdr.Linkname = v +- case "gname": ++ case paxGname: + hdr.Gname = v +- case "uname": ++ case paxUname: + hdr.Uname = v +- case "uid": ++ case paxUid: + uid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Uid = int(uid) +- case "gid": ++ case paxGid: + gid, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err + } + hdr.Gid = int(gid) +- case "atime": ++ case paxAtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.AccessTime = t +- case "mtime": ++ case paxMtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ModTime = t +- case "ctime": ++ case paxCtime: + t, err := parsePAXTime(v) + if err != nil { + return err + } + hdr.ChangeTime = t +- case "size": ++ case paxSize: + size, err := strconv.ParseInt(v, 10, 0) + if err != nil { + return err +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -24,6 +24,7 @@ + ErrFieldTooLong = errors.New("archive/tar: header field too long") + ErrWriteAfterClose = errors.New("archive/tar: write after close") + errNameTooLong = errors.New("archive/tar: name too long") ++ errInvalidHeader = errors.New("archive/tar: header field too long or contains invalid values") + ) + + // A Writer provides sequential writing of a tar archive in POSIX.1 format. +@@ -37,6 +38,7 @@ + pad int64 // amount of padding to write after current file entry + closed bool + usedBinary bool // whether the binary numeric field extension was used ++ preferPax bool // use pax header instead of binary numeric header + } + + // NewWriter creates a new Writer writing to w. +@@ -65,16 +67,23 @@ + } + + // Write s into b, terminating it with a NUL if there is room. +-func (tw *Writer) cString(b []byte, s string) { ++// If the value is too long for the field and allowPax is true add a paxheader record instead ++func (tw *Writer) cString(b []byte, s string, allowPax bool, paxKeyword string, paxHeaders map[string]string) { ++ needsPaxHeader := allowPax && len(s) > len(b) || !isASCII(s) ++ if needsPaxHeader { ++ paxHeaders[paxKeyword] = s ++ return ++ } + if len(s) > len(b) { + if tw.err == nil { + tw.err = ErrFieldTooLong + } + return + } +- copy(b, s) +- if len(s) < len(b) { +- b[len(s)] = 0 ++ ascii := toASCII(s) ++ copy(b, ascii) ++ if len(ascii) < len(b) { ++ b[len(ascii)] = 0 + } + } + +@@ -85,17 +94,27 @@ + for len(s)+1 < len(b) { + s = "0" + s + } +- tw.cString(b, s) ++ tw.cString(b, s, false, paxNone, nil) + } + + // Write x into b, either as octal or as binary (GNUtar/star extension). +-func (tw *Writer) numeric(b []byte, x int64) { ++// If the value is too long for the field and writingPax is enabled both for the field and the add a paxheader record instead ++func (tw *Writer) numeric(b []byte, x int64, allowPax bool, paxKeyword string, paxHeaders map[string]string) { + // Try octal first. + s := strconv.FormatInt(x, 8) + if len(s) < len(b) { + tw.octal(b, x) + return + } ++ ++ // If it is too long for octal, and pax is preferred, use a pax header ++ if allowPax && tw.preferPax { ++ tw.octal(b, 0) ++ s := strconv.FormatInt(x, 10) ++ paxHeaders[paxKeyword] = s ++ return ++ } ++ + // Too big: use binary (big-endian). + tw.usedBinary = true + for i := len(b) - 1; x > 0 && i >= 0; i-- { +@@ -115,6 +134,15 @@ + // WriteHeader calls Flush if it is not the first header. + // Calling after a Close will return ErrWriteAfterClose. + func (tw *Writer) WriteHeader(hdr *Header) error { ++ return tw.writeHeader(hdr, true) ++} ++ ++// WriteHeader writes hdr and prepares to accept the file's contents. ++// WriteHeader calls Flush if it is not the first header. ++// Calling after a Close will return ErrWriteAfterClose. ++// As this method is called internally by writePax header to allow it to ++// suppress writing the pax header. ++func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error { + if tw.closed { + return ErrWriteAfterClose + } +@@ -124,31 +152,21 @@ + if tw.err != nil { + return tw.err + } +- // Decide whether or not to use PAX extensions ++ ++ // a map to hold pax header records, if any are needed ++ paxHeaders := make(map[string]string) ++ + // TODO(shanemhansen): we might want to use PAX headers for + // subsecond time resolution, but for now let's just capture +- // the long name/long symlink use case. +- suffix := hdr.Name +- prefix := "" +- if len(hdr.Name) > fileNameSize || len(hdr.Linkname) > fileNameSize { +- var err error +- prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) +- // Either we were unable to pack the long name into ustar format +- // or the link name is too long; use PAX headers. +- if err == errNameTooLong || len(hdr.Linkname) > fileNameSize { +- if err := tw.writePAXHeader(hdr); err != nil { +- return err +- } +- } else if err != nil { +- return err +- } +- } +- tw.nb = int64(hdr.Size) +- tw.pad = -tw.nb & (blockSize - 1) // blockSize is a power of two ++ // too long fields or non ascii characters + + header := make([]byte, blockSize) + s := slicer(header) +- tw.cString(s.next(fileNameSize), suffix) ++ ++ // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ pathHeaderBytes := s.next(fileNameSize) ++ ++ tw.cString(pathHeaderBytes, hdr.Name, true, paxPath, paxHeaders) + + // Handle out of range ModTime carefully. + var modTime int64 +@@ -156,27 +174,55 @@ + modTime = hdr.ModTime.Unix() + } + +- tw.octal(s.next(8), hdr.Mode) // 100:108 +- tw.numeric(s.next(8), int64(hdr.Uid)) // 108:116 +- tw.numeric(s.next(8), int64(hdr.Gid)) // 116:124 +- tw.numeric(s.next(12), hdr.Size) // 124:136 +- tw.numeric(s.next(12), modTime) // 136:148 +- s.next(8) // chksum (148:156) +- s.next(1)[0] = hdr.Typeflag // 156:157 +- tw.cString(s.next(100), hdr.Linkname) // linkname (157:257) +- copy(s.next(8), []byte("ustar\x0000")) // 257:265 +- tw.cString(s.next(32), hdr.Uname) // 265:297 +- tw.cString(s.next(32), hdr.Gname) // 297:329 +- tw.numeric(s.next(8), hdr.Devmajor) // 329:337 +- tw.numeric(s.next(8), hdr.Devminor) // 337:345 +- tw.cString(s.next(155), prefix) // 345:500 ++ tw.octal(s.next(8), hdr.Mode) // 100:108 ++ tw.numeric(s.next(8), int64(hdr.Uid), true, paxUid, paxHeaders) // 108:116 ++ tw.numeric(s.next(8), int64(hdr.Gid), true, paxGid, paxHeaders) // 116:124 ++ tw.numeric(s.next(12), hdr.Size, true, paxSize, paxHeaders) // 124:136 ++ tw.numeric(s.next(12), modTime, false, paxNone, nil) // 136:148 --- consider using pax for finer granularity ++ s.next(8) // chksum (148:156) ++ s.next(1)[0] = hdr.Typeflag // 156:157 ++ ++ tw.cString(s.next(100), hdr.Linkname, true, paxLinkpath, paxHeaders) ++ ++ copy(s.next(8), []byte("ustar\x0000")) // 257:265 ++ tw.cString(s.next(32), hdr.Uname, true, paxUname, paxHeaders) // 265:297 ++ tw.cString(s.next(32), hdr.Gname, true, paxGname, paxHeaders) // 297:329 ++ tw.numeric(s.next(8), hdr.Devmajor, false, paxNone, nil) // 329:337 ++ tw.numeric(s.next(8), hdr.Devminor, false, paxNone, nil) // 337:345 ++ ++ // keep a reference to the prefix to allow to overwrite it later if we detect that we can use ustar longnames instead of pax ++ prefixHeaderBytes := s.next(155) ++ tw.cString(prefixHeaderBytes, "", false, paxNone, nil) // 345:500 prefix ++ + // Use the GNU magic instead of POSIX magic if we used any GNU extensions. + if tw.usedBinary { + copy(header[257:265], []byte("ustar \x00")) + } +- // Use the ustar magic if we used ustar long names. +- if len(prefix) > 0 { +- copy(header[257:265], []byte("ustar\000")) ++ ++ _, paxPathUsed := paxHeaders[paxPath] ++ // try to use a ustar header when only the name is too long ++ if !tw.preferPax && len(paxHeaders) == 1 && paxPathUsed { ++ suffix := hdr.Name ++ prefix := "" ++ if len(hdr.Name) > fileNameSize && isASCII(hdr.Name) { ++ var err error ++ prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) ++ if err == nil { ++ // ok we can use a ustar long name instead of pax, now correct the fields ++ ++ // remove the path field from the pax header. this will suppress the pax header ++ delete(paxHeaders, paxPath) ++ ++ // update the path fields ++ tw.cString(pathHeaderBytes, suffix, false, paxNone, nil) ++ tw.cString(prefixHeaderBytes, prefix, false, paxNone, nil) ++ ++ // Use the ustar magic if we used ustar long names. ++ if len(prefix) > 0 { ++ copy(header[257:265], []byte("ustar\000")) ++ } ++ } ++ } + } + + // The chksum field is terminated by a NUL and a space. +@@ -190,8 +236,18 @@ + return tw.err + } + ++ if len(paxHeaders) > 0 { ++ if !allowPax { ++ return errInvalidHeader ++ } ++ if err := tw.writePAXHeader(hdr, paxHeaders); err != nil { ++ return err ++ } ++ } ++ tw.nb = int64(hdr.Size) ++ tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize ++ + _, tw.err = tw.w.Write(header) +- + return tw.err + } + +@@ -218,7 +274,7 @@ + + // writePaxHeader writes an extended pax header to the + // archive. +-func (tw *Writer) writePAXHeader(hdr *Header) error { ++func (tw *Writer) writePAXHeader(hdr *Header, paxHeaders map[string]string) error { + // Prepare extended header + ext := new(Header) + ext.Typeflag = TypeXHeader +@@ -229,18 +285,23 @@ + // with the current pid. + pid := os.Getpid() + dir, file := path.Split(hdr.Name) +- ext.Name = path.Join(dir, +- fmt.Sprintf("PaxHeaders.%d", pid), file)[0:100] ++ fullName := path.Join(dir, ++ fmt.Sprintf("PaxHeaders.%d", pid), file) ++ ++ ascii := toASCII(fullName) ++ if len(ascii) > 100 { ++ ascii = ascii[:100] ++ } ++ ext.Name = ascii + // Construct the body + var buf bytes.Buffer +- if len(hdr.Name) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("path="+hdr.Name)) ++ ++ for k, v := range paxHeaders { ++ fmt.Fprint(&buf, paxHeader(k+"="+v)) + } +- if len(hdr.Linkname) > fileNameSize { +- fmt.Fprint(&buf, paxHeader("linkpath="+hdr.Linkname)) +- } ++ + ext.Size = int64(len(buf.Bytes())) +- if err := tw.WriteHeader(ext); err != nil { ++ if err := tw.writeHeader(ext, false); err != nil { + return err + } + if _, err := tw.Write(buf.Bytes()); err != nil { +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -243,15 +243,110 @@ + } + } + ++func TestPaxSymlink(t *testing.T) { ++ // Create an archive with a large linkname ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeSymlink ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long linkname to be written ++ longLinkname := strings.Repeat("1234567890/1234567890", 10) ++ hdr.Linkname = longLinkname ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Linkname != longLinkname { ++ t.Fatal("Couldn't recover long link name") ++ } ++} ++ ++func TestPaxNonAscii(t *testing.T) { ++ // Create an archive with non ascii. These should trigger a pax header ++ // because pax headers have a defined utf-8 encoding. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ ++ hdr, err := FileInfoHeader(fileinfo, "") ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ ++ // some sample data ++ chineseFilename := "文件名" ++ chineseGroupname := "組" ++ chineseUsername := "用戶名" ++ ++ hdr.Name = chineseFilename ++ hdr.Gname = chineseGroupname ++ hdr.Uname = chineseUsername ++ ++ contents := strings.Repeat(" ", int(hdr.Size)) ++ ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if _, err = writer.Write([]byte(contents)); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Simple test to make sure PAX extensions are in effect ++ if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { ++ t.Fatal("Expected at least one PAX header to be written.") ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != chineseFilename { ++ t.Fatal("Couldn't recover unicode name") ++ } ++ if hdr.Gname != chineseGroupname { ++ t.Fatal("Couldn't recover unicode group") ++ } ++ if hdr.Uname != chineseUsername { ++ t.Fatal("Couldn't recover unicode user") ++ } ++} ++ + func TestPAXHeader(t *testing.T) { + medName := strings.Repeat("CD", 50) + longName := strings.Repeat("AB", 100) + paxTests := [][2]string{ +- {"name=/etc/hosts", "19 name=/etc/hosts\n"}, ++ {paxPath + "=/etc/hosts", "19 path=/etc/hosts\n"}, + {"a=b", "6 a=b\n"}, // Single digit length + {"a=names", "11 a=names\n"}, // Test case involving carries +- {"name=" + longName, fmt.Sprintf("210 name=%s\n", longName)}, +- {"name=" + medName, fmt.Sprintf("110 name=%s\n", medName)}} ++ {paxPath + "=" + longName, fmt.Sprintf("210 path=%s\n", longName)}, ++ {paxPath + "=" + medName, fmt.Sprintf("110 path=%s\n", medName)}} + + for _, test := range paxTests { + key, expected := test[0], test[1] diff --git a/golang-1.1.2-ustar-split.patch b/golang-1.1.2-ustar-split.patch new file mode 100644 index 0000000..9e97b38 --- /dev/null +++ b/golang-1.1.2-ustar-split.patch @@ -0,0 +1,62 @@ +Index: src/pkg/archive/tar/writer.go +=================================================================== +--- a/src/pkg/archive/tar/writer.go ++++ b/src/pkg/archive/tar/writer.go +@@ -263,8 +263,11 @@ + length-- + } + i := strings.LastIndex(name[:length], "/") +- nlen := length - i - 1 +- if i <= 0 || nlen > fileNameSize || nlen == 0 { ++ // nlen contains the resulting length in the name field. ++ // plen contains the resulting length in the prefix field. ++ nlen := len(name) - i - 1 ++ plen := i ++ if i <= 0 || nlen > fileNameSize || nlen == 0 || plen > fileNamePrefixSize { + err = errNameTooLong + return + } +Index: src/pkg/archive/tar/writer_test.go +=================================================================== +--- a/src/pkg/archive/tar/writer_test.go ++++ b/src/pkg/archive/tar/writer_test.go +@@ -355,3 +355,39 @@ + } + } + } ++ ++func TestUSTARLongName(t *testing.T) { ++ // Create an archive with a path that failed to split with USTAR extension in previous versions. ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ hdr.Typeflag = TypeDir ++ if err != nil { ++ t.Fatalf("os.Stat:1 %v", err) ++ } ++ // Force a PAX long name to be written. The name was taken from a practical example ++ // that fails and replaced ever char through numbers to anonymize the sample. ++ longName := "/0000_0000000/00000-000000000/0000_0000000/00000-0000000000000/0000_0000000/00000-0000000-00000000/0000_0000000/00000000/0000_0000000/000/0000_0000000/00000000v00/0000_0000000/000000/0000_0000000/0000000/0000_0000000/00000y-00/0000/0000/00000000/0x000000/" ++ hdr.Name = longName ++ ++ hdr.Size = 0 ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Test that we can get a long name back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if hdr.Name != longName { ++ t.Fatal("Couldn't recover long name") ++ } ++} diff --git a/golang.spec b/golang.spec index 9d96830..29ba550 100644 --- a/golang.spec +++ b/golang.spec @@ -25,7 +25,7 @@ Name: golang Version: 1.1.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: The Go Programming Language License: BSD @@ -35,8 +35,15 @@ Source0: https://go.googlecode.com/files/go%{version}.src.tar.gz BuildRequires: /bin/hostname BuildRequires: emacs +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc + Patch0: golang-1.1-verbose-build.patch +Patch10: golang-1.1.2-long-links.patch +Patch11: golang-1.1.2-ustar-split.patch + # Having godoc and the documentation separate was broken Obsoletes: %{name}-godoc < 1.1-4 Obsoletes: %{name}-docs < 1.1-4 @@ -98,6 +105,10 @@ end # increase verbosity of build %patch0 -p1 +# Fix BZ#1010271 +%patch10 -p1 +%patch11 -p1 + %build # create a gcc wrapper to allow us to build with our own flags @@ -231,6 +242,10 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf %changelog +* Fri Sep 20 2013 Adam Miller - 1.1.2-4 +- Pull upstream patches for BZ#1010271 +- Add glibc requirement that got dropped because of meta dep fix + * Thu Sep 19 2013 Adam Miller - 1.2.2-3 - fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) From 96d7496e0543c6de0c1a1ef8cb9ee1dbb818f6a3 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 8 Jul 2014 11:36:44 -0400 Subject: [PATCH 11/67] cleaning up multiarch builds bz1105901, bz1101508 --- golang.spec | 175 +++++++++++++--------------------------------------- 1 file changed, 42 insertions(+), 133 deletions(-) diff --git a/golang.spec b/golang.spec index 4c3a7b2..f74d7fd 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: The Go Programming Language License: BSD @@ -221,7 +221,7 @@ Requires(postun): %{_sbindir}/update-alternatives Summary: Golang compiler toolchain to compile for linux 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-386 %{summary} @@ -229,7 +229,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-amd64 %{summary} @@ -237,7 +237,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-arm %{summary} @@ -245,7 +245,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-386 %{summary} @@ -253,7 +253,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-amd64 %{summary} @@ -261,7 +261,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-386 %{summary} @@ -269,7 +269,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-amd64 %{summary} @@ -277,7 +277,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-386 %{summary} @@ -285,7 +285,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-amd64 %{summary} @@ -293,7 +293,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-386 %{summary} @@ -301,7 +301,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-amd64 %{summary} @@ -309,7 +309,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-arm %{summary} @@ -317,7 +317,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-386 %{summary} @@ -325,7 +325,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-amd64 %{summary} @@ -333,7 +333,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-arm %{summary} @@ -341,7 +341,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-386 %{summary} @@ -349,7 +349,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-amd64 %{summary} @@ -359,7 +359,6 @@ Requires(post): golang-bin #Summary: Golang compiler toolchain to compile for openbsd arm #Requires: go = %{version}-%{release} #BuildArch: noarch -#Requires(post): golang-bin #%description pkg-openbsd-arm #%{summary} @@ -436,7 +435,7 @@ pushd src PATH="$(pwd -P)/../zz:$PATH" CC="gcc" \ GOOS=${goos} \ GOARCH=${goarch} \ - ./make.bash + ./make.bash --no-clean done done popd @@ -472,7 +471,7 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} # install everything into libdir (until symlink problems are fixed) # https://code.google.com/p/go/issues/detail?id=5830 -cp -av api bin doc favicon.ico include lib pkg robots.txt src \ +cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ $RPM_BUILD_ROOT%{goroot} # remove the unnecessary zoneinfo file (Go will always use the system one first) @@ -598,61 +597,11 @@ if [ $1 = 0 ]; then fi %endif -# All these archives need to be newer than the corresponding source in goroot -# https://bugzilla.redhat.com/show_bug.cgi?id=1099206 -%post pkg-linux-386 -GOROOT=%{goroot} GOOS=linux GOARCH=386 go install std - -%post pkg-linux-amd64 -GOROOT=%{goroot} GOOS=linux GOARCH=amd64 go install std - -%post pkg-linux-arm -GOROOT=%{goroot} GOOS=linux GOARCH=arm go install std - -%post pkg-darwin-386 -GOROOT=%{goroot} GOOS=darwin GOARCH=386 go install std - -%post pkg-darwin-amd64 -GOROOT=%{goroot} GOOS=darwin GOARCH=amd64 go install std - -%post pkg-windows-386 -GOROOT=%{goroot} GOOS=windows GOARCH=386 go install std - -%post pkg-windows-amd64 -GOROOT=%{goroot} GOOS=windows GOARCH=amd64 go install std - -%post pkg-plan9-386 -GOROOT=%{goroot} GOOS=plan9 GOARCH=386 go install std - -%post pkg-plan9-amd64 -GOROOT=%{goroot} GOOS=plan9 GOARCH=amd64 go install std - -%post pkg-freebsd-386 -GOROOT=%{goroot} GOOS=freebsd GOARCH=386 go install std - -%post pkg-freebsd-amd64 -GOROOT=%{goroot} GOOS=freebsd GOARCH=amd64 go install std - -%post pkg-freebsd-arm -GOROOT=%{goroot} GOOS=freebsd GOARCH=arm go install std - -%post pkg-netbsd-386 -GOROOT=%{goroot} GOOS=netbsd GOARCH=386 go install std - -%post pkg-netbsd-amd64 -GOROOT=%{goroot} GOOS=netbsd GOARCH=amd64 go install std - -%post pkg-netbsd-arm -GOROOT=%{goroot} GOOS=netbsd GOARCH=arm go install std - -%post pkg-openbsd-386 -GOROOT=%{goroot} GOOS=openbsd GOARCH=386 go install std - -%post pkg-openbsd-amd64 -GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +# VERSION has to be present in the GOROOT, for `go install std` to work +%doc %{goroot}/VERSION # go files %dir %{goroot} @@ -708,65 +657,6 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files src %{goroot}/src/ -# files that are generated based on compile-time ARCH will go in that arch's pkg-bin-* -%ifarch %{ix86} - -# this is wacky that now these files are generated in a different arch -%exclude %{goroot}/src/cmd/8l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_386.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_386.h -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_386.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_386.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_386.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_386.c -%endif - -%ifarch x86_64 -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_amd64.h -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsema_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_amd64.go -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_amd64.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_amd64.c -%endif - -%ifarch %{arm} -%exclude %{goroot}/src/cmd/5l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_arm.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_arm.h -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/znoasm_arm_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_arm.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_arm.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_arm.c -%endif - %ifarch %{ix86} %files pkg-bin-linux-386 @@ -778,6 +668,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_386/* %{goroot}/pkg/linux_386/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_386 +%{goroot}/pkg/tool/linux_386/5a +%{goroot}/pkg/tool/linux_386/5c +%{goroot}/pkg/tool/linux_386/5g +%{goroot}/pkg/tool/linux_386/5l %{goroot}/pkg/tool/linux_386/6a %{goroot}/pkg/tool/linux_386/6c %{goroot}/pkg/tool/linux_386/6g @@ -819,10 +713,18 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_amd64/* %{goroot}/pkg/linux_amd64/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_amd64 +%{goroot}/pkg/tool/linux_amd64/5a +%{goroot}/pkg/tool/linux_amd64/5c +%{goroot}/pkg/tool/linux_amd64/5g +%{goroot}/pkg/tool/linux_amd64/5l %{goroot}/pkg/tool/linux_amd64/6a %{goroot}/pkg/tool/linux_amd64/6c %{goroot}/pkg/tool/linux_amd64/6g %{goroot}/pkg/tool/linux_amd64/6l +%{goroot}/pkg/tool/linux_amd64/8a +%{goroot}/pkg/tool/linux_amd64/8c +%{goroot}/pkg/tool/linux_amd64/8g +%{goroot}/pkg/tool/linux_amd64/8l %{goroot}/pkg/tool/linux_amd64/addr2line %{goroot}/pkg/tool/linux_amd64/dist %{goroot}/pkg/tool/linux_amd64/nm @@ -864,6 +766,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/tool/linux_arm/6c %{goroot}/pkg/tool/linux_arm/6g %{goroot}/pkg/tool/linux_arm/6l +%{goroot}/pkg/tool/linux_arm/8a +%{goroot}/pkg/tool/linux_arm/8c +%{goroot}/pkg/tool/linux_arm/8g +%{goroot}/pkg/tool/linux_arm/8l %{goroot}/pkg/tool/linux_arm/addr2line %{goroot}/pkg/tool/linux_arm/dist %{goroot}/pkg/tool/linux_arm/nm @@ -978,6 +884,9 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %changelog +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +- `go install std` requires gcc, to build cgo. bz1105901, bz1101508 + * Wed May 21 2014 Vincent Batts 1.2.2-7 - bz1099206 ghost files are not what is needed From 7c6268c5d65c4d20a27002371f01d63a6dacec1f Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 8 Jul 2014 11:36:44 -0400 Subject: [PATCH 12/67] cleaning up multiarch builds bz1105901, bz1101508 --- golang.spec | 175 +++++++++++++--------------------------------------- 1 file changed, 42 insertions(+), 133 deletions(-) diff --git a/golang.spec b/golang.spec index 74002b6..6f769e2 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: The Go Programming Language License: BSD @@ -221,7 +221,7 @@ Requires(postun): %{_sbindir}/update-alternatives Summary: Golang compiler toolchain to compile for linux 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-386 %{summary} @@ -229,7 +229,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-amd64 %{summary} @@ -237,7 +237,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-arm %{summary} @@ -245,7 +245,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-386 %{summary} @@ -253,7 +253,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-amd64 %{summary} @@ -261,7 +261,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-386 %{summary} @@ -269,7 +269,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-amd64 %{summary} @@ -277,7 +277,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-386 %{summary} @@ -285,7 +285,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-amd64 %{summary} @@ -293,7 +293,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-386 %{summary} @@ -301,7 +301,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-amd64 %{summary} @@ -309,7 +309,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-arm %{summary} @@ -317,7 +317,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-386 %{summary} @@ -325,7 +325,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-amd64 %{summary} @@ -333,7 +333,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-arm %{summary} @@ -341,7 +341,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-386 %{summary} @@ -349,7 +349,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-amd64 %{summary} @@ -359,7 +359,6 @@ Requires(post): golang-bin #Summary: Golang compiler toolchain to compile for openbsd arm #Requires: go = %{version}-%{release} #BuildArch: noarch -#Requires(post): golang-bin #%description pkg-openbsd-arm #%{summary} @@ -436,7 +435,7 @@ pushd src PATH="$(pwd -P)/../zz:$PATH" CC="gcc" \ GOOS=${goos} \ GOARCH=${goarch} \ - ./make.bash + ./make.bash --no-clean done done popd @@ -472,7 +471,7 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} # install everything into libdir (until symlink problems are fixed) # https://code.google.com/p/go/issues/detail?id=5830 -cp -av api bin doc favicon.ico include lib pkg robots.txt src \ +cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ $RPM_BUILD_ROOT%{goroot} # remove the unnecessary zoneinfo file (Go will always use the system one first) @@ -598,61 +597,11 @@ if [ $1 = 0 ]; then fi %endif -# All these archives need to be newer than the corresponding source in goroot -# https://bugzilla.redhat.com/show_bug.cgi?id=1099206 -%post pkg-linux-386 -GOROOT=%{goroot} GOOS=linux GOARCH=386 go install std - -%post pkg-linux-amd64 -GOROOT=%{goroot} GOOS=linux GOARCH=amd64 go install std - -%post pkg-linux-arm -GOROOT=%{goroot} GOOS=linux GOARCH=arm go install std - -%post pkg-darwin-386 -GOROOT=%{goroot} GOOS=darwin GOARCH=386 go install std - -%post pkg-darwin-amd64 -GOROOT=%{goroot} GOOS=darwin GOARCH=amd64 go install std - -%post pkg-windows-386 -GOROOT=%{goroot} GOOS=windows GOARCH=386 go install std - -%post pkg-windows-amd64 -GOROOT=%{goroot} GOOS=windows GOARCH=amd64 go install std - -%post pkg-plan9-386 -GOROOT=%{goroot} GOOS=plan9 GOARCH=386 go install std - -%post pkg-plan9-amd64 -GOROOT=%{goroot} GOOS=plan9 GOARCH=amd64 go install std - -%post pkg-freebsd-386 -GOROOT=%{goroot} GOOS=freebsd GOARCH=386 go install std - -%post pkg-freebsd-amd64 -GOROOT=%{goroot} GOOS=freebsd GOARCH=amd64 go install std - -%post pkg-freebsd-arm -GOROOT=%{goroot} GOOS=freebsd GOARCH=arm go install std - -%post pkg-netbsd-386 -GOROOT=%{goroot} GOOS=netbsd GOARCH=386 go install std - -%post pkg-netbsd-amd64 -GOROOT=%{goroot} GOOS=netbsd GOARCH=amd64 go install std - -%post pkg-netbsd-arm -GOROOT=%{goroot} GOOS=netbsd GOARCH=arm go install std - -%post pkg-openbsd-386 -GOROOT=%{goroot} GOOS=openbsd GOARCH=386 go install std - -%post pkg-openbsd-amd64 -GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +# VERSION has to be present in the GOROOT, for `go install std` to work +%doc %{goroot}/VERSION # go files %dir %{goroot} @@ -708,65 +657,6 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files src %{goroot}/src/ -# files that are generated based on compile-time ARCH will go in that arch's pkg-bin-* -%ifarch %{ix86} - -# this is wacky that now these files are generated in a different arch -%exclude %{goroot}/src/cmd/8l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_386.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_386.h -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_386.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_386.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_386.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_386.c -%endif - -%ifarch x86_64 -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_amd64.h -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsema_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_amd64.go -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_amd64.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_amd64.c -%endif - -%ifarch %{arm} -%exclude %{goroot}/src/cmd/5l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_arm.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_arm.h -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/znoasm_arm_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_arm.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_arm.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_arm.c -%endif - %ifarch %{ix86} %files pkg-bin-linux-386 @@ -778,6 +668,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_386/* %{goroot}/pkg/linux_386/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_386 +%{goroot}/pkg/tool/linux_386/5a +%{goroot}/pkg/tool/linux_386/5c +%{goroot}/pkg/tool/linux_386/5g +%{goroot}/pkg/tool/linux_386/5l %{goroot}/pkg/tool/linux_386/6a %{goroot}/pkg/tool/linux_386/6c %{goroot}/pkg/tool/linux_386/6g @@ -819,10 +713,18 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_amd64/* %{goroot}/pkg/linux_amd64/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_amd64 +%{goroot}/pkg/tool/linux_amd64/5a +%{goroot}/pkg/tool/linux_amd64/5c +%{goroot}/pkg/tool/linux_amd64/5g +%{goroot}/pkg/tool/linux_amd64/5l %{goroot}/pkg/tool/linux_amd64/6a %{goroot}/pkg/tool/linux_amd64/6c %{goroot}/pkg/tool/linux_amd64/6g %{goroot}/pkg/tool/linux_amd64/6l +%{goroot}/pkg/tool/linux_amd64/8a +%{goroot}/pkg/tool/linux_amd64/8c +%{goroot}/pkg/tool/linux_amd64/8g +%{goroot}/pkg/tool/linux_amd64/8l %{goroot}/pkg/tool/linux_amd64/addr2line %{goroot}/pkg/tool/linux_amd64/dist %{goroot}/pkg/tool/linux_amd64/nm @@ -864,6 +766,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/tool/linux_arm/6c %{goroot}/pkg/tool/linux_arm/6g %{goroot}/pkg/tool/linux_arm/6l +%{goroot}/pkg/tool/linux_arm/8a +%{goroot}/pkg/tool/linux_arm/8c +%{goroot}/pkg/tool/linux_arm/8g +%{goroot}/pkg/tool/linux_arm/8l %{goroot}/pkg/tool/linux_arm/addr2line %{goroot}/pkg/tool/linux_arm/dist %{goroot}/pkg/tool/linux_arm/nm @@ -978,6 +884,9 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %changelog +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +- `go install std` requires gcc, to build cgo. bz1105901, bz1101508 + * Wed May 21 2014 Vincent Batts 1.2.2-7 - bz1099206 ghost files are not what is needed From 420732b09da87b4c54764bc91a9509ee3a63d072 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 8 Jul 2014 11:36:44 -0400 Subject: [PATCH 13/67] cleaning up multiarch builds bz1105901, bz1101508 --- golang.spec | 175 +++++++++++++--------------------------------------- 1 file changed, 42 insertions(+), 133 deletions(-) diff --git a/golang.spec b/golang.spec index 576d8d0..786ed04 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: The Go Programming Language License: BSD @@ -221,7 +221,7 @@ Requires(postun): %{_sbindir}/update-alternatives Summary: Golang compiler toolchain to compile for linux 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-386 %{summary} @@ -229,7 +229,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-amd64 %{summary} @@ -237,7 +237,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for linux arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-linux-arm %{summary} @@ -245,7 +245,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-386 %{summary} @@ -253,7 +253,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for darwin amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-darwin-amd64 %{summary} @@ -261,7 +261,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-386 %{summary} @@ -269,7 +269,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for windows amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-windows-amd64 %{summary} @@ -277,7 +277,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-386 %{summary} @@ -285,7 +285,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for plan9 amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-plan9-amd64 %{summary} @@ -293,7 +293,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-386 %{summary} @@ -301,7 +301,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-amd64 %{summary} @@ -309,7 +309,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for freebsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-freebsd-arm %{summary} @@ -317,7 +317,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-386 %{summary} @@ -325,7 +325,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-amd64 %{summary} @@ -333,7 +333,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for netbsd arm Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-netbsd-arm %{summary} @@ -341,7 +341,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd 386 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-386 %{summary} @@ -349,7 +349,7 @@ Requires(post): golang-bin Summary: Golang compiler toolchain to compile for openbsd amd64 Requires: go = %{version}-%{release} BuildArch: noarch -Requires(post): golang-bin +Requires: gcc %description pkg-openbsd-amd64 %{summary} @@ -359,7 +359,6 @@ Requires(post): golang-bin #Summary: Golang compiler toolchain to compile for openbsd arm #Requires: go = %{version}-%{release} #BuildArch: noarch -#Requires(post): golang-bin #%description pkg-openbsd-arm #%{summary} @@ -436,7 +435,7 @@ pushd src PATH="$(pwd -P)/../zz:$PATH" CC="gcc" \ GOOS=${goos} \ GOARCH=${goarch} \ - ./make.bash + ./make.bash --no-clean done done popd @@ -472,7 +471,7 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} # install everything into libdir (until symlink problems are fixed) # https://code.google.com/p/go/issues/detail?id=5830 -cp -av api bin doc favicon.ico include lib pkg robots.txt src \ +cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ $RPM_BUILD_ROOT%{goroot} # remove the unnecessary zoneinfo file (Go will always use the system one first) @@ -598,61 +597,11 @@ if [ $1 = 0 ]; then fi %endif -# All these archives need to be newer than the corresponding source in goroot -# https://bugzilla.redhat.com/show_bug.cgi?id=1099206 -%post pkg-linux-386 -GOROOT=%{goroot} GOOS=linux GOARCH=386 go install std - -%post pkg-linux-amd64 -GOROOT=%{goroot} GOOS=linux GOARCH=amd64 go install std - -%post pkg-linux-arm -GOROOT=%{goroot} GOOS=linux GOARCH=arm go install std - -%post pkg-darwin-386 -GOROOT=%{goroot} GOOS=darwin GOARCH=386 go install std - -%post pkg-darwin-amd64 -GOROOT=%{goroot} GOOS=darwin GOARCH=amd64 go install std - -%post pkg-windows-386 -GOROOT=%{goroot} GOOS=windows GOARCH=386 go install std - -%post pkg-windows-amd64 -GOROOT=%{goroot} GOOS=windows GOARCH=amd64 go install std - -%post pkg-plan9-386 -GOROOT=%{goroot} GOOS=plan9 GOARCH=386 go install std - -%post pkg-plan9-amd64 -GOROOT=%{goroot} GOOS=plan9 GOARCH=amd64 go install std - -%post pkg-freebsd-386 -GOROOT=%{goroot} GOOS=freebsd GOARCH=386 go install std - -%post pkg-freebsd-amd64 -GOROOT=%{goroot} GOOS=freebsd GOARCH=amd64 go install std - -%post pkg-freebsd-arm -GOROOT=%{goroot} GOOS=freebsd GOARCH=arm go install std - -%post pkg-netbsd-386 -GOROOT=%{goroot} GOOS=netbsd GOARCH=386 go install std - -%post pkg-netbsd-amd64 -GOROOT=%{goroot} GOOS=netbsd GOARCH=amd64 go install std - -%post pkg-netbsd-arm -GOROOT=%{goroot} GOOS=netbsd GOARCH=arm go install std - -%post pkg-openbsd-386 -GOROOT=%{goroot} GOOS=openbsd GOARCH=386 go install std - -%post pkg-openbsd-amd64 -GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS VERSION +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +# VERSION has to be present in the GOROOT, for `go install std` to work +%doc %{goroot}/VERSION # go files %dir %{goroot} @@ -708,65 +657,6 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %files src %{goroot}/src/ -# files that are generated based on compile-time ARCH will go in that arch's pkg-bin-* -%ifarch %{ix86} - -# this is wacky that now these files are generated in a different arch -%exclude %{goroot}/src/cmd/8l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_386.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_386.h -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_386.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_386.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_386.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_386.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_386.c -%endif - -%ifarch x86_64 -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_amd64.h -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsema_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_amd64.go -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_amd64.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_amd64.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_amd64.c -%endif - -%ifarch %{arm} -%exclude %{goroot}/src/cmd/5l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_arm.go -%exclude %{goroot}/src/cmd/6l/enam.c -%exclude %{goroot}/src/pkg/runtime/zgoarch_amd64.go - -%exclude %{goroot}/src/pkg/runtime/zasm_linux_arm.h -%exclude %{goroot}/src/pkg/runtime/znetpoll_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmalloc_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zmprof_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/znoasm_arm_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime1_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zruntime_defs_linux_arm.go -%exclude %{goroot}/src/pkg/runtime/zsema_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsigqueue_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zstring_linux_arm.c -%exclude %{goroot}/src/pkg/runtime/zsys_linux_arm.s -%exclude %{goroot}/src/pkg/runtime/ztime_linux_arm.c -%endif - %ifarch %{ix86} %files pkg-bin-linux-386 @@ -778,6 +668,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_386/* %{goroot}/pkg/linux_386/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_386 +%{goroot}/pkg/tool/linux_386/5a +%{goroot}/pkg/tool/linux_386/5c +%{goroot}/pkg/tool/linux_386/5g +%{goroot}/pkg/tool/linux_386/5l %{goroot}/pkg/tool/linux_386/6a %{goroot}/pkg/tool/linux_386/6c %{goroot}/pkg/tool/linux_386/6g @@ -819,10 +713,18 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/obj/linux_amd64/* %{goroot}/pkg/linux_amd64/runtime/cgo.a %dir %{goroot}/pkg/tool/linux_amd64 +%{goroot}/pkg/tool/linux_amd64/5a +%{goroot}/pkg/tool/linux_amd64/5c +%{goroot}/pkg/tool/linux_amd64/5g +%{goroot}/pkg/tool/linux_amd64/5l %{goroot}/pkg/tool/linux_amd64/6a %{goroot}/pkg/tool/linux_amd64/6c %{goroot}/pkg/tool/linux_amd64/6g %{goroot}/pkg/tool/linux_amd64/6l +%{goroot}/pkg/tool/linux_amd64/8a +%{goroot}/pkg/tool/linux_amd64/8c +%{goroot}/pkg/tool/linux_amd64/8g +%{goroot}/pkg/tool/linux_amd64/8l %{goroot}/pkg/tool/linux_amd64/addr2line %{goroot}/pkg/tool/linux_amd64/dist %{goroot}/pkg/tool/linux_amd64/nm @@ -864,6 +766,10 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %{goroot}/pkg/tool/linux_arm/6c %{goroot}/pkg/tool/linux_arm/6g %{goroot}/pkg/tool/linux_arm/6l +%{goroot}/pkg/tool/linux_arm/8a +%{goroot}/pkg/tool/linux_arm/8c +%{goroot}/pkg/tool/linux_arm/8g +%{goroot}/pkg/tool/linux_arm/8l %{goroot}/pkg/tool/linux_arm/addr2line %{goroot}/pkg/tool/linux_arm/dist %{goroot}/pkg/tool/linux_arm/nm @@ -978,6 +884,9 @@ GOROOT=%{goroot} GOOS=openbsd GOARCH=amd64 go install std %changelog +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +- `go install std` requires gcc, to build cgo. bz1105901, bz1101508 + * Wed May 21 2014 Vincent Batts 1.2.2-7 - bz1099206 ghost files are not what is needed From e3554eaea80a6e928043be91e9af906a3f642c05 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 15 Jul 2014 12:30:16 -0400 Subject: [PATCH 14/67] fix gdb init for safe-paths bz981356 Conflicts: golang.spec --- golang-gdbinit | 1 - golang.spec | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/golang-gdbinit b/golang-gdbinit index 0a32958..4ef690b 100644 --- a/golang-gdbinit +++ b/golang-gdbinit @@ -1,2 +1 @@ add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py -add-auto-load-safe-path /usr/lib64/golang/src/pkg/runtime/runtime-gdb.py diff --git a/golang.spec b/golang.spec index f74d7fd..40520ae 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: The Go Programming Language License: BSD @@ -544,7 +544,7 @@ cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions # gdbinit mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d -cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang +cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb # prelink blacklist mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d @@ -884,7 +884,10 @@ fi %changelog -* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +* Tue Jul 15 2014 Vincent Batts - 1.2.2-9 +- fix the loading of gdb safe-path. bz981356 + +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 - `go install std` requires gcc, to build cgo. bz1105901, bz1101508 * Wed May 21 2014 Vincent Batts 1.2.2-7 @@ -934,7 +937,7 @@ fi * Tue Mar 04 2014 Adam Miller 1.2.1-1 - Update to latest upstream -* Thu Feb 20 2014 Adam Miller 1.2-7 +* Thu Feb 20 2014 Adam Miller 1.2-7 - Remove _BSD_SOURCE and _SVID_SOURCE, they are deprecated in recent versions of glibc and aren't needed From 73415829c2034aeee8d039f9f732ab253682d95c Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 15 Jul 2014 12:30:16 -0400 Subject: [PATCH 15/67] fix gdb init for safe-paths bz981356 Conflicts: golang.spec --- golang-gdbinit | 1 - golang.spec | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/golang-gdbinit b/golang-gdbinit index 0a32958..4ef690b 100644 --- a/golang-gdbinit +++ b/golang-gdbinit @@ -1,2 +1 @@ add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py -add-auto-load-safe-path /usr/lib64/golang/src/pkg/runtime/runtime-gdb.py diff --git a/golang.spec b/golang.spec index 786ed04..f7c32ae 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: The Go Programming Language License: BSD @@ -544,7 +544,7 @@ cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions # gdbinit mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d -cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang +cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb # prelink blacklist mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d @@ -884,7 +884,10 @@ fi %changelog -* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +* Tue Jul 15 2014 Vincent Batts - 1.2.2-9 +- fix the loading of gdb safe-path. bz981356 + +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 - `go install std` requires gcc, to build cgo. bz1105901, bz1101508 * Wed May 21 2014 Vincent Batts 1.2.2-7 @@ -934,7 +937,7 @@ fi * Tue Mar 04 2014 Adam Miller 1.2.1-1 - Update to latest upstream -* Thu Feb 20 2014 Adam Miller 1.2-7 +* Thu Feb 20 2014 Adam Miller 1.2-7 - Remove _BSD_SOURCE and _SVID_SOURCE, they are deprecated in recent versions of glibc and aren't needed From 8712265c7e57f7415c1cc5b30ff96e882b2d8949 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 15 Jul 2014 12:30:16 -0400 Subject: [PATCH 16/67] fix gdb init for safe-paths bz981356 Conflicts: golang.spec --- golang-gdbinit | 1 - golang.spec | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/golang-gdbinit b/golang-gdbinit index 0a32958..4ef690b 100644 --- a/golang-gdbinit +++ b/golang-gdbinit @@ -1,2 +1 @@ add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py -add-auto-load-safe-path /usr/lib64/golang/src/pkg/runtime/runtime-gdb.py diff --git a/golang.spec b/golang.spec index 6f769e2..4693899 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: The Go Programming Language License: BSD @@ -544,7 +544,7 @@ cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions # gdbinit mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d -cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang +cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb # prelink blacklist mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d @@ -884,7 +884,10 @@ fi %changelog -* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 +* Tue Jul 15 2014 Vincent Batts - 1.2.2-9 +- fix the loading of gdb safe-path. bz981356 + +* Tue Jul 08 2014 Vincent Batts - 1.2.2-8 - `go install std` requires gcc, to build cgo. bz1105901, bz1101508 * Wed May 21 2014 Vincent Batts 1.2.2-7 @@ -934,7 +937,7 @@ fi * Tue Mar 04 2014 Adam Miller 1.2.1-1 - Update to latest upstream -* Thu Feb 20 2014 Adam Miller 1.2-7 +* Thu Feb 20 2014 Adam Miller 1.2-7 - Remove _BSD_SOURCE and _SVID_SOURCE, they are deprecated in recent versions of glibc and aren't needed From 9abed9ed8411d1c50e7277300027e0e2585f3018 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 6 Aug 2014 21:23:25 +0000 Subject: [PATCH 17/67] making the golang-src package arch'ed. Fixes bz1099206 Conflicts: golang.spec --- golang.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index 40520ae..c2159c4 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: The Go Programming Language License: BSD @@ -161,8 +161,6 @@ BuildArch: noarch %package src Summary: Golang compiler source tree Requires: go = %{version}-%{release} -# the binary bits in this tree are for testdata -BuildArch: noarch %description src %{summary} @@ -884,6 +882,9 @@ fi %changelog +* Wed Aug 06 2014 Vincent Batts - 1.2.2-10 +- make the source subpackage arch'ed, instead of noarch + * Tue Jul 15 2014 Vincent Batts - 1.2.2-9 - fix the loading of gdb safe-path. bz981356 From c6c5ac57e3d3eeca2660b193b26222b2cf4f8ae6 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 6 Aug 2014 21:23:25 +0000 Subject: [PATCH 18/67] making the golang-src package arch'ed. Fixes bz1099206 Conflicts: golang.spec --- golang.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index f7c32ae..11be215 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: The Go Programming Language License: BSD @@ -161,8 +161,6 @@ BuildArch: noarch %package src Summary: Golang compiler source tree Requires: go = %{version}-%{release} -# the binary bits in this tree are for testdata -BuildArch: noarch %description src %{summary} @@ -884,6 +882,9 @@ fi %changelog +* Wed Aug 06 2014 Vincent Batts - 1.2.2-10 +- make the source subpackage arch'ed, instead of noarch + * Tue Jul 15 2014 Vincent Batts - 1.2.2-9 - fix the loading of gdb safe-path. bz981356 From 97dd9b460e6744d14872751426814b575359eda4 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 6 Aug 2014 21:23:25 +0000 Subject: [PATCH 19/67] making the golang-src package arch'ed. Fixes bz1099206 Conflicts: golang.spec --- golang.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index 4693899..9923ecf 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: The Go Programming Language License: BSD @@ -161,8 +161,6 @@ BuildArch: noarch %package src Summary: Golang compiler source tree Requires: go = %{version}-%{release} -# the binary bits in this tree are for testdata -BuildArch: noarch %description src %{summary} @@ -884,6 +882,9 @@ fi %changelog +* Wed Aug 06 2014 Vincent Batts - 1.2.2-10 +- make the source subpackage arch'ed, instead of noarch + * Tue Jul 15 2014 Vincent Batts - 1.2.2-9 - fix the loading of gdb safe-path. bz981356 From 6da1cd966e9a5d36005c1f30f1d7b09c9210c653 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 7 Aug 2014 03:39:03 +0000 Subject: [PATCH 20/67] xemacs version constraint for bz1127518 --- golang.spec | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index c2159c4..9789ed8 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: The Go Programming Language License: BSD @@ -65,7 +65,10 @@ Requires: golang-src BuildRequires: emacs # xemacs on fedora only %if 0%{?fedora} -BuildRequires: xemacs xemacs-packages-extra +BuildRequires: xemacs +# xemacs-packages-extra-20130408-3 worked fine, but not the newer bump +# https://bugzilla.redhat.com/show_bug.cgi?id=1127518 +BuildRequires: xemacs-packages-extra < 20140705-1 %endif Patch0: golang-1.2-verbose-build.patch @@ -149,7 +152,8 @@ BuildArch: noarch %package -n xemacs-%{name} Summary: XEmacs add-on package for Go Requires: xemacs(bin) >= %{_xemacs_version} -Requires: xemacs-packages-extra +# https://bugzilla.redhat.com/show_bug.cgi?id=1127518 +Requires: xemacs-packages-extra < 20140705-1 BuildArch: noarch %description -n xemacs-%{name} @@ -882,6 +886,9 @@ fi %changelog +* Wed Aug 06 2014 Vincent Batts - 1.2.2-11 +- set a version constraint on xemacs due to bz1127518 + * Wed Aug 06 2014 Vincent Batts - 1.2.2-10 - make the source subpackage arch'ed, instead of noarch From 688fe6aa08324e6483685fac593fc6536bbed141 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 8 Aug 2014 17:03:30 +0000 Subject: [PATCH 21/67] another version constraint on xemacs to not use the broken version of xemacs-packages-extra --- golang.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/golang.spec b/golang.spec index 9789ed8..10ea702 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 11%{?dist} +Release: 12%{?dist} Summary: The Go Programming Language License: BSD @@ -68,7 +68,8 @@ BuildRequires: emacs BuildRequires: xemacs # xemacs-packages-extra-20130408-3 worked fine, but not the newer bump # https://bugzilla.redhat.com/show_bug.cgi?id=1127518 -BuildRequires: xemacs-packages-extra < 20140705-1 +BuildConflicts: xemacs-packages-extra == 20140705-1 +BuildRequires: xemacs-packages-extra %endif Patch0: golang-1.2-verbose-build.patch @@ -152,8 +153,7 @@ BuildArch: noarch %package -n xemacs-%{name} Summary: XEmacs add-on package for Go Requires: xemacs(bin) >= %{_xemacs_version} -# https://bugzilla.redhat.com/show_bug.cgi?id=1127518 -Requires: xemacs-packages-extra < 20140705-1 +Requires: xemacs-packages-extra BuildArch: noarch %description -n xemacs-%{name} @@ -886,6 +886,9 @@ fi %changelog +* Fri Aug 08 2014 Vincent Batts - 1.2.2-12 +- set another version constraint on xemacs due to bz1127518 + * Wed Aug 06 2014 Vincent Batts - 1.2.2-11 - set a version constraint on xemacs due to bz1127518 From 90e73267ad61eecb9d5b354ba2bbd7115ff1da55 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 8 Aug 2014 21:11:50 +0000 Subject: [PATCH 22/67] set source directory timestamps during %install --- golang.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index 10ea702..ac10839 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: The Go Programming Language License: BSD @@ -476,6 +476,8 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ $RPM_BUILD_ROOT%{goroot} +find $RPM_BUILD_ROOT%{goroot}/src -type d -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; + # remove the unnecessary zoneinfo file (Go will always use the system one first) rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time @@ -886,6 +888,9 @@ fi %changelog +* Fri Aug 08 2014 Vincent Batts - 1.2.2-13 +- update timestamps of source during %%install bz1099206 + * Fri Aug 08 2014 Vincent Batts - 1.2.2-12 - set another version constraint on xemacs due to bz1127518 From ab7a3d0b63fae54ce28da54ddaf87931a62026b5 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 11 Aug 2014 14:41:34 +0000 Subject: [PATCH 23/67] don't just update directories Conflicts: golang.spec --- golang.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/golang.spec b/golang.spec index ac10839..fc39981 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 13%{?dist} +Release: 14%{?dist} Summary: The Go Programming Language License: BSD @@ -476,7 +476,8 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ $RPM_BUILD_ROOT%{goroot} -find $RPM_BUILD_ROOT%{goroot}/src -type d -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; +# bz1099206 +find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; # remove the unnecessary zoneinfo file (Go will always use the system one first) rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time @@ -888,6 +889,9 @@ fi %changelog +* Mon Aug 11 2014 Vincent Batts - 1.2.2-14 +- update timestamps of source files during %%install bz1099206 + * Fri Aug 08 2014 Vincent Batts - 1.2.2-13 - update timestamps of source during %%install bz1099206 From ea1d7adb978a2589462e8502bc560fde10a8269a Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 11 Aug 2014 15:28:01 +0000 Subject: [PATCH 24/67] make golang-src noarch again Conflicts: golang.spec --- golang.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index fc39981..87a2d61 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 14%{?dist} +Release: 15%{?dist} Summary: The Go Programming Language License: BSD @@ -165,6 +165,7 @@ BuildArch: noarch %package src Summary: Golang compiler source tree Requires: go = %{version}-%{release} +BuildArch: noarch %description src %{summary} @@ -889,6 +890,9 @@ fi %changelog +* Mon Aug 11 2014 Vincent Batts - 1.2.2-15 +- make golang-src 'noarch' again, since that was not a fix, and takes up more space + * Mon Aug 11 2014 Vincent Batts - 1.2.2-14 - update timestamps of source files during %%install bz1099206 From abfb918aebe04f2c221f6e6e2d8ae847360bb3d0 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 11 Aug 2014 18:54:30 +0000 Subject: [PATCH 25/67] more touching --- .gitignore | 1 + golang.spec | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8f0d407..11e6069 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /golang-19087:a15f344a9efa-xattrs.tar /go1.2.1.src.tar.gz /go1.2.2.src.tar.gz +/go1.3.src.tar.gz diff --git a/golang.spec b/golang.spec index 87a2d61..49d74e0 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 15%{?dist} +Release: 16%{?dist} Summary: The Go Programming Language License: BSD @@ -479,6 +479,10 @@ cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ # bz1099206 find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; +# and level out all the built archives +touch $RPM_BUILD_ROOT%{goroot}/pkg +find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \; + # remove the unnecessary zoneinfo file (Go will always use the system one first) rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time @@ -890,6 +894,9 @@ fi %changelog +* Mon Aug 11 2014 Vincent Batts - 1.2.2-16 +- touch all the built archives to be the same + * Mon Aug 11 2014 Vincent Batts - 1.2.2-15 - make golang-src 'noarch' again, since that was not a fix, and takes up more space From 9380b0ecebc3ab83622f68a2d860502c94f7ff9c Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 12 Aug 2014 15:01:25 +0000 Subject: [PATCH 26/67] file list for src tree --- golang.spec | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/golang.spec b/golang.spec index 49d74e0..0894db9 100644 --- a/golang.spec +++ b/golang.spec @@ -39,7 +39,7 @@ Name: golang Version: 1.2.2 -Release: 16%{?dist} +Release: 17%{?dist} Summary: The Go Programming Language License: BSD @@ -482,7 +482,13 @@ find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSIO # and level out all the built archives touch $RPM_BUILD_ROOT%{goroot}/pkg find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \; - +# generate the spec file ownership of this source tree +src_list=$(pwd)/go-src.list +touch $src_list +pushd $RPM_BUILD_ROOT%{goroot} + find src/ -type d -printf '%%%dir %{goroot}/%p\n' >> $src_list + find src/ ! -type d -printf '%{goroot}/%p\n' >> $src_list +popd # remove the unnecessary zoneinfo file (Go will always use the system one first) rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time @@ -665,7 +671,7 @@ fi %{_xemacs_sitestartdir}/*.el %endif -%files src +%files -f go-src.list src %{goroot}/src/ %ifarch %{ix86} @@ -894,6 +900,9 @@ fi %changelog +* Tue Aug 12 2014 Vincent Batts - 1.2.2-17 +- explicitly list all the files and directories of the src tree, to preserve timestamps + * Mon Aug 11 2014 Vincent Batts - 1.2.2-16 - touch all the built archives to be the same From 110e264e04a7b5d2f987c8fa5364fc654cc5559a Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 12 Aug 2014 20:52:59 +0000 Subject: [PATCH 27/67] now build file list for pkg rpms too --- golang.spec | 97 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 35 deletions(-) diff --git a/golang.spec b/golang.spec index 0894db9..439ddda 100644 --- a/golang.spec +++ b/golang.spec @@ -23,6 +23,9 @@ %global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ /usr/lib/rpm/brp-compress +# allow turning this off +%{!?build_xemacs:%global build_xemacs 1} + # let this match the macros in macros.golang %global goroot /usr/lib/%{name} %global gopath %{_datadir}/gocode @@ -39,7 +42,7 @@ Name: golang Version: 1.2.2 -Release: 17%{?dist} +Release: 18%{?dist} Summary: The Go Programming Language License: BSD @@ -64,7 +67,7 @@ Requires: golang-src BuildRequires: emacs # xemacs on fedora only -%if 0%{?fedora} +%if 0%{?fedora} && %{build_xemacs} == 1 BuildRequires: xemacs # xemacs-packages-extra-20130408-3 worked fine, but not the newer bump # https://bugzilla.redhat.com/show_bug.cgi?id=1127518 @@ -149,7 +152,7 @@ BuildArch: noarch # xemacs on fedora only -%if 0%{?fedora} +%if 0%{?fedora} && %{build_xemacs} == 1 %package -n xemacs-%{name} Summary: XEmacs add-on package for Go Requires: xemacs(bin) >= %{_xemacs_version} @@ -447,7 +450,7 @@ popd cd misc mv emacs/go-mode-load.el emacs/%{name}-init.el # xemacs on fedora only -%if 0%{?fedora} +%if 0%{?fedora} && %{build_xemacs} == 1 cp -av emacs xemacs %{_xemacs_bytecompile} xemacs/go-mode.el %endif @@ -455,16 +458,6 @@ cp -av emacs xemacs cd .. -%check -export GOROOT=$(pwd -P) -export PATH="$PATH":"$GOROOT"/bin -cd src -# not using our 'gcc' since the CFLAGS fails crash_cgo_test.go due to unused variables -# https://code.google.com/p/go/issues/detail?id=6883 -./run.bash --no-rebuild -cd .. - - %install rm -rf $RPM_BUILD_ROOT @@ -482,12 +475,30 @@ find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSIO # and level out all the built archives touch $RPM_BUILD_ROOT%{goroot}/pkg find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \; -# generate the spec file ownership of this source tree -src_list=$(pwd)/go-src.list +# generate the spec file ownership of this source tree and packages +cwd=$(pwd) +src_list=$cwd/go-src.list +rm -f $src_list touch $src_list pushd $RPM_BUILD_ROOT%{goroot} find src/ -type d -printf '%%%dir %{goroot}/%p\n' >> $src_list find src/ ! -type d -printf '%{goroot}/%p\n' >> $src_list + + + for goos in darwin freebsd linux netbsd openbsd plan9 windows ; do + for goarch in 386 amd64 arm ; do + if [ "${goarch}" = "arm" ] ; then + if [ "${goos}" = "darwin" -o "${goos}" = "windows" -o "${goos}" = "plan9" -o "${goos}" = "openbsd" ] ;then + continue + fi + fi + file_list=${cwd}/pkg-${goos}-${goarch}.list + rm -f $file_list + touch $file_list + find pkg/${goos}_${goarch}/ -type d -printf '%%%dir %{goroot}/%p\n' >> $file_list + find pkg/${goos}_${goarch}/ ! -type d -printf '%{goroot}/%p\n' >> $file_list + done + done popd # remove the unnecessary zoneinfo file (Go will always use the system one first) @@ -541,7 +552,7 @@ cp -av misc/emacs/go-mode.* $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name} cp -av misc/emacs/%{name}-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir} # xemacs on fedora only -%if 0%{?fedora} +%if 0%{?fedora} && %{build_xemacs} == 1 # misc/xemacs mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitelispdir}/%{name} mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitestartdir} @@ -576,6 +587,19 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang %endif +%check +export GOROOT=$(pwd -P) +export PATH="$PATH":"$GOROOT"/bin +cd src +# not using our 'gcc' since the CFLAGS fails crash_cgo_test.go due to unused variables +# https://code.google.com/p/go/issues/detail?id=6883 +./run.bash --no-rebuild +cd .. +if [ $(go list -json std | grep Stale | wc -l) -gt 2 ] ; then + # cmd/go and cmd/gofmt show like they are stale. we can ignore + exit 1 +fi + %ifarch %{ix86} %post pkg-bin-linux-386 @@ -664,7 +688,7 @@ fi # xemacs on fedora only -%if 0%{?fedora} +%if 0%{?fedora} && %{build_xemacs} == 1 %files -n xemacs-%{name} %doc AUTHORS CONTRIBUTORS LICENSE PATENTS %{_xemacs_sitelispdir}/%{name} @@ -810,7 +834,7 @@ fi %{goroot}/src/pkg/runtime/ztime_linux_arm.c %endif -%files pkg-linux-386 +%files pkg-linux-386 -f pkg-linux-386.list %{goroot}/pkg/linux_386/ %ifarch %{ix86} %exclude %{goroot}/pkg/linux_386/runtime/cgo.a @@ -819,7 +843,7 @@ fi %{goroot}/pkg/tool/linux_386/fix %{goroot}/pkg/tool/linux_386/yacc -%files pkg-linux-amd64 +%files pkg-linux-amd64 -f pkg-linux-amd64.list %{goroot}/pkg/linux_amd64/ %ifarch x86_64 %exclude %{goroot}/pkg/linux_amd64/runtime/cgo.a @@ -828,7 +852,7 @@ fi %{goroot}/pkg/tool/linux_amd64/fix %{goroot}/pkg/tool/linux_amd64/yacc -%files pkg-linux-arm +%files pkg-linux-arm -f pkg-linux-arm.list %{goroot}/pkg/linux_arm/ %ifarch %{arm} %exclude %{goroot}/pkg/linux_arm/runtime/cgo.a @@ -837,59 +861,59 @@ fi %{goroot}/pkg/tool/linux_arm/fix %{goroot}/pkg/tool/linux_arm/yacc -%files pkg-darwin-386 +%files pkg-darwin-386 -f pkg-darwin-386.list %{goroot}/pkg/darwin_386/ %{goroot}/pkg/tool/darwin_386/ -%files pkg-darwin-amd64 +%files pkg-darwin-amd64 -f pkg-darwin-amd64.list %{goroot}/pkg/darwin_amd64/ %{goroot}/pkg/tool/darwin_amd64/ -%files pkg-windows-386 +%files pkg-windows-386 -f pkg-windows-386.list %{goroot}/pkg/windows_386/ %{goroot}/pkg/tool/windows_386/ -%files pkg-windows-amd64 +%files pkg-windows-amd64 -f pkg-windows-amd64.list %{goroot}/pkg/windows_amd64/ %{goroot}/pkg/tool/windows_amd64/ -%files pkg-plan9-386 +%files pkg-plan9-386 -f pkg-plan9-386.list %{goroot}/pkg/plan9_386/ %{goroot}/pkg/tool/plan9_386/ -%files pkg-plan9-amd64 +%files pkg-plan9-amd64 -f pkg-plan9-amd64.list %{goroot}/pkg/plan9_amd64/ %{goroot}/pkg/tool/plan9_amd64/ -%files pkg-freebsd-386 +%files pkg-freebsd-386 -f pkg-freebsd-386.list %{goroot}/pkg/freebsd_386/ %{goroot}/pkg/tool/freebsd_386/ -%files pkg-freebsd-amd64 +%files pkg-freebsd-amd64 -f pkg-freebsd-amd64.list %{goroot}/pkg/freebsd_amd64/ %{goroot}/pkg/tool/freebsd_amd64/ -%files pkg-freebsd-arm +%files pkg-freebsd-arm -f pkg-freebsd-arm.list %{goroot}/pkg/freebsd_arm/ %{goroot}/pkg/tool/freebsd_arm/ -%files pkg-netbsd-386 +%files pkg-netbsd-386 -f pkg-netbsd-386.list %{goroot}/pkg/netbsd_386/ %{goroot}/pkg/tool/netbsd_386/ -%files pkg-netbsd-amd64 +%files pkg-netbsd-amd64 -f pkg-netbsd-amd64.list %{goroot}/pkg/netbsd_amd64/ %{goroot}/pkg/tool/netbsd_amd64/ -%files pkg-netbsd-arm +%files pkg-netbsd-arm -f pkg-netbsd-arm.list %{goroot}/pkg/netbsd_arm/ %{goroot}/pkg/tool/netbsd_arm/ -%files pkg-openbsd-386 +%files pkg-openbsd-386 -f pkg-openbsd-386.list %{goroot}/pkg/openbsd_386/ %{goroot}/pkg/tool/openbsd_386/ -%files pkg-openbsd-amd64 +%files pkg-openbsd-amd64 -f pkg-openbsd-amd64.list %{goroot}/pkg/openbsd_amd64/ %{goroot}/pkg/tool/openbsd_amd64/ @@ -900,6 +924,9 @@ fi %changelog +* Tue Aug 12 2014 Vincent Batts - 1.2.2-18 +- explicitly list all the files and directories for the packages trees + * Tue Aug 12 2014 Vincent Batts - 1.2.2-17 - explicitly list all the files and directories of the src tree, to preserve timestamps From 3b49f3293c98ef0767e2b75c6d7f8fdb4926739a Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 13 Aug 2014 01:04:25 +0000 Subject: [PATCH 28/67] touch cgo.a in a %post Signed-off-by: Vincent Batts --- golang.spec | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index 439ddda..3473f9a 100644 --- a/golang.spec +++ b/golang.spec @@ -42,7 +42,7 @@ Name: golang Version: 1.2.2 -Release: 18%{?dist} +Release: 19%{?dist} Summary: The Go Programming Language License: BSD @@ -603,6 +603,13 @@ fi %ifarch %{ix86} %post pkg-bin-linux-386 +# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, +# then a multitude of packages will appear Stale. For sanity we'll check whether cgo is Stale, and plum it up to runtime.a +if go list -json runtime/cgo | grep -q Stale ; then + runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') + cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') + touch -r ${runtime_file} ${cgo_file} +fi %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_386/go 90 \ --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_386/gofmt @@ -615,6 +622,13 @@ fi %ifarch x86_64 %post pkg-bin-linux-amd64 +# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, +# then a multitude of packages will appear Stale. For sanity we'll check whether cgo is Stale, and plum it up to runtime.a +if go list -json runtime/cgo | grep -q Stale ; then + runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') + cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') + touch -r ${runtime_file} ${cgo_file} +fi %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_amd64/go 90 \ --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_amd64/gofmt @@ -627,6 +641,13 @@ fi %ifarch %{arm} %post pkg-bin-linux-arm +# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, +# then a multitude of packages will appear Stale. For sanity we'll check whether cgo is Stale, and plum it up to runtime.a +if go list -json runtime/cgo | grep -q Stale ; then + runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') + cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') + touch -r ${runtime_file} ${cgo_file} +fi %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_arm/go 90 \ --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_arm/gofmt @@ -924,6 +945,9 @@ fi %changelog +* Tue Aug 12 2014 Vincent Batts - 1.2.2-19 +- finally check for a Stale cgo in a %%post + * Tue Aug 12 2014 Vincent Batts - 1.2.2-18 - explicitly list all the files and directories for the packages trees From 31e8a62d232ec1759b91187517018978b41a4e2f Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 13 Aug 2014 11:55:03 +0000 Subject: [PATCH 29/67] order the deps for the %post to run correctly Signed-off-by: Vincent Batts --- golang.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/golang.spec b/golang.spec index 3473f9a..d766d18 100644 --- a/golang.spec +++ b/golang.spec @@ -42,7 +42,7 @@ Name: golang Version: 1.2.2 -Release: 19%{?dist} +Release: 20%{?dist} Summary: The Go Programming Language License: BSD @@ -179,6 +179,7 @@ BuildArch: noarch Summary: Golang compiler tool for linux 386 Requires: go = %{version}-%{release} Requires: golang-pkg-linux-386 = %{version}-%{release} +Requires(post): golang-pkg-linux-386 = %{version}-%{release} Provides: golang-bin = 386 # We strip the meta dependency, but go does require glibc. # This is an odd issue, still looking for a better fix. @@ -194,6 +195,7 @@ Requires(postun): %{_sbindir}/update-alternatives Summary: Golang compiler tool for linux amd64 Requires: go = %{version}-%{release} Requires: golang-pkg-linux-amd64 = %{version}-%{release} +Requires(post): golang-pkg-linux-amd64 = %{version}-%{release} Provides: golang-bin = amd64 # We strip the meta dependency, but go does require glibc. # This is an odd issue, still looking for a better fix. @@ -209,6 +211,7 @@ Requires(postun): %{_sbindir}/update-alternatives Summary: Golang compiler tool for linux arm Requires: go = %{version}-%{release} Requires: golang-pkg-linux-arm = %{version}-%{release} +Requires(post): golang-pkg-linux-arm = %{version}-%{release} Provides: golang-bin = arm # We strip the meta dependency, but go does require glibc. # This is an odd issue, still looking for a better fix. @@ -945,6 +948,9 @@ fi %changelog +* Wed Aug 13 2014 Vincent Batts - 1.2.2-20 +- rpm dependency ordering for %%post + * Tue Aug 12 2014 Vincent Batts - 1.2.2-19 - finally check for a Stale cgo in a %%post From 33152ba710583cace2f5602cec4b4ce292b9e891 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 13 Aug 2014 14:32:02 +0000 Subject: [PATCH 30/67] touch cgo.a in %post, regardless --- golang.spec | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/golang.spec b/golang.spec index d766d18..0887274 100644 --- a/golang.spec +++ b/golang.spec @@ -42,7 +42,7 @@ Name: golang Version: 1.2.2 -Release: 20%{?dist} +Release: 21%{?dist} Summary: The Go Programming Language License: BSD @@ -607,12 +607,10 @@ fi %ifarch %{ix86} %post pkg-bin-linux-386 # since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -# then a multitude of packages will appear Stale. For sanity we'll check whether cgo is Stale, and plum it up to runtime.a -if go list -json runtime/cgo | grep -q Stale ; then - runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') - cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') - touch -r ${runtime_file} ${cgo_file} -fi +runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') +cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') +touch -r ${runtime_file} ${cgo_file} + %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_386/go 90 \ --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_386/gofmt @@ -626,12 +624,10 @@ fi %ifarch x86_64 %post pkg-bin-linux-amd64 # since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -# then a multitude of packages will appear Stale. For sanity we'll check whether cgo is Stale, and plum it up to runtime.a -if go list -json runtime/cgo | grep -q Stale ; then - runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') - cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') - touch -r ${runtime_file} ${cgo_file} -fi +runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') +cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') +touch -r ${runtime_file} ${cgo_file} + %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_amd64/go 90 \ --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_amd64/gofmt @@ -645,12 +641,10 @@ fi %ifarch %{arm} %post pkg-bin-linux-arm # since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -# then a multitude of packages will appear Stale. For sanity we'll check whether cgo is Stale, and plum it up to runtime.a -if go list -json runtime/cgo | grep -q Stale ; then - runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') - cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') - touch -r ${runtime_file} ${cgo_file} -fi +runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') +cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') +touch -r ${runtime_file} ${cgo_file} + %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_arm/go 90 \ --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_arm/gofmt @@ -948,6 +942,9 @@ fi %changelog +* Wed Aug 13 2014 Vincent Batts - 1.2.2-21 +- touch cgo.a regardless + * Wed Aug 13 2014 Vincent Batts - 1.2.2-20 - rpm dependency ordering for %%post From 84033d417e23b09d4702e5062368326b3b27d8b2 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 13 Aug 2014 16:54:12 +0000 Subject: [PATCH 31/67] not sure why this %post is not setting the mtime of cgo.a. Making it more explicit --- golang.spec | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/golang.spec b/golang.spec index 0887274..c30b9bb 100644 --- a/golang.spec +++ b/golang.spec @@ -42,7 +42,7 @@ Name: golang Version: 1.2.2 -Release: 21%{?dist} +Release: 22%{?dist} Summary: The Go Programming Language License: BSD @@ -607,9 +607,7 @@ fi %ifarch %{ix86} %post pkg-bin-linux-386 # since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') -cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') -touch -r ${runtime_file} ${cgo_file} +touch -r %{goroot}/pkg/linux_386/runtime.a %{goroot}/pkg/linux_386/runtime/cgo.a %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_386/go 90 \ @@ -624,9 +622,7 @@ fi %ifarch x86_64 %post pkg-bin-linux-amd64 # since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') -cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') -touch -r ${runtime_file} ${cgo_file} +touch -r %{goroot}/pkg/linux_amd64/runtime.a %{goroot}/pkg/linux_amd64/runtime/cgo.a %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_amd64/go 90 \ @@ -641,9 +637,7 @@ fi %ifarch %{arm} %post pkg-bin-linux-arm # since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -runtime_file=$(go list -json runtime | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') -cgo_file=$(go list -json runtime/cgo | grep -w Target | sed -e 's/.*".*".*"\(.*\)".*/\1/') -touch -r ${runtime_file} ${cgo_file} +touch -r %{goroot}/pkg/linux_arm/runtime.a %{goroot}/pkg/linux_arm/runtime/cgo.a %{_sbindir}/update-alternatives --install %{_bindir}/go \ go %{goroot}/bin/linux_arm/go 90 \ @@ -942,6 +936,9 @@ fi %changelog +* Wed Aug 13 2014 Vincent Batts - 1.2.2-22 +- more work to get cgo.a timestamps to line up, due to build-env + * Wed Aug 13 2014 Vincent Batts - 1.2.2-21 - touch cgo.a regardless From 65328ffa21f7ae55e562bab1c68a5c5068b4cf37 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 8 Jan 2015 10:43:25 -0500 Subject: [PATCH 32/67] golang is now in RHEL7 optional and Centos7 extras --- .gitignore | 13 - dead.package | 1 + go1.3-tar-fix_writing_of_pax_headers.patch | 110 -- go1.3-tar_reuse_buffer_readHeader.patch | 64 -- go1.3-tar_reuse_buffer_writeHeader.patch | 56 - golang-1.2-BSD-SVID-SOURCE.patch | 19 - golang-1.2-archive_tar-xattr.patch | 197 ---- golang-1.2-remove-ECC-p224.patch | 172 --- golang-1.2-skipCpuProfileTest.patch | 12 - golang-1.2-verbose-build.patch | 19 - golang-f21-hostname.patch | 11 - golang-gdbinit | 1 - golang-prelink.conf | 3 - golang.spec | 1100 -------------------- macros.golang | 8 - sources | 2 - 16 files changed, 1 insertion(+), 1787 deletions(-) delete mode 100644 .gitignore create mode 100644 dead.package delete mode 100644 go1.3-tar-fix_writing_of_pax_headers.patch delete mode 100644 go1.3-tar_reuse_buffer_readHeader.patch delete mode 100644 go1.3-tar_reuse_buffer_writeHeader.patch delete mode 100644 golang-1.2-BSD-SVID-SOURCE.patch delete mode 100644 golang-1.2-archive_tar-xattr.patch delete mode 100644 golang-1.2-remove-ECC-p224.patch delete mode 100644 golang-1.2-skipCpuProfileTest.patch delete mode 100644 golang-1.2-verbose-build.patch delete mode 100644 golang-f21-hostname.patch delete mode 100644 golang-gdbinit delete mode 100644 golang-prelink.conf delete mode 100644 golang.spec delete mode 100644 macros.golang delete mode 100644 sources diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 281e185..0000000 --- a/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -/go1.1.1.src.tar.gz -/go1.1.2.src.tar.gz -/go1.2.1.src.tar.gz -/go1.2.2.src.tar.gz -/go1.2.src.tar.gz -/go1.3.1.src.tar.gz -/go1.3.2.src.tar.gz -/go1.3.3.src.tar.gz -/go1.3beta2.src.tar.gz -/go1.3rc1.src.tar.gz -/go1.3rc2.src.tar.gz -/go1.3.src.tar.gz -/golang-19087:a15f344a9efa-xattrs.tar diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..a562c97 --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +golang is now in RHEL7 optional and Centos7 extras diff --git a/go1.3-tar-fix_writing_of_pax_headers.patch b/go1.3-tar-fix_writing_of_pax_headers.patch deleted file mode 100644 index 1c847e7..0000000 --- a/go1.3-tar-fix_writing_of_pax_headers.patch +++ /dev/null @@ -1,110 +0,0 @@ -# HG changeset patch -# User Cristian Staretu -# Date 1405555229 -36000 -# Thu Jul 17 10:00:29 2014 +1000 -# Node ID 1b17b3426e3c281a973d2d7bbf235b936d6a0942 -# Parent 278365dff593f027db6c6b2c0a89262490d6b676 -archive/tar: fix writing of pax headers - -"archive/tar: reuse temporary buffer in writeHeader" introduced a -change which was supposed to help lower the number of allocations from -512 bytes for every call to writeHeader. This change broke the writing -of PAX headers. - -writeHeader calls writePAXHeader and writePAXHeader calls writeHeader -again. writeHeader will end up writing the PAX header twice. - -example broken header: -PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000 -PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000 - -example correct header: -PaxHeaders.4290/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021516 xustar0000000000000000 -0100644000000000000000000000270412301216634007250 0ustar0000000000000000 - -This commit adds a dedicated buffer for pax headers to the Writer -struct. This change increases the size of the struct by 512 bytes, but -allows tar/writer to avoid allocating 512 bytes for all written -headers and it avoids allocating 512 more bytes for pax headers. - -LGTM=dsymonds -R=dsymonds, dave, iant -CC=golang-codereviews -https://codereview.appspot.com/110480043 - -Committer: David Symonds - -diff -r 278365dff593 -r 1b17b3426e3c src/pkg/archive/tar/writer.go ---- a/src/pkg/archive/tar/writer.go Wed Jul 16 16:29:51 2014 -0700 -+++ b/src/pkg/archive/tar/writer.go Thu Jul 17 10:00:29 2014 +1000 -@@ -39,7 +39,8 @@ - closed bool - usedBinary bool // whether the binary numeric field extension was used - preferPax bool // use pax header instead of binary numeric header -- hdrBuff [blockSize]byte // buffer to use in writeHeader -+ hdrBuff [blockSize]byte // buffer to use in writeHeader when writing a regular header -+ paxHdrBuff [blockSize]byte // buffer to use in writeHeader when writing a pax header - } - - // NewWriter creates a new Writer writing to w. -@@ -161,7 +162,17 @@ - // subsecond time resolution, but for now let's just capture - // too long fields or non ascii characters - -- header := tw.hdrBuff[:] -+ var header []byte -+ -+ // We need to select which scratch buffer to use carefully, -+ // since this method is called recursively to write PAX headers. -+ // If allowPax is true, this is the non-recursive call, and we will use hdrBuff. -+ // If allowPax is false, we are being called by writePAXHeader, and hdrBuff is -+ // already being used by the non-recursive call, so we must use paxHdrBuff. -+ header = tw.hdrBuff[:] -+ if !allowPax { -+ header = tw.paxHdrBuff[:] -+ } - copy(header, zeroBlock) - s := slicer(header) - -diff -r 278365dff593 -r 1b17b3426e3c src/pkg/archive/tar/writer_test.go ---- a/src/pkg/archive/tar/writer_test.go Wed Jul 16 16:29:51 2014 -0700 -+++ b/src/pkg/archive/tar/writer_test.go Thu Jul 17 10:00:29 2014 +1000 -@@ -454,3 +454,38 @@ - t.Fatal("Couldn't recover long name") - } - } -+ -+func TestValidTypeflagWithPAXHeader(t *testing.T) { -+ var buffer bytes.Buffer -+ tw := NewWriter(&buffer) -+ -+ fileName := strings.Repeat("ab", 100) -+ -+ hdr := &Header{ -+ Name: fileName, -+ Size: 4, -+ Typeflag: 0, -+ } -+ if err := tw.WriteHeader(hdr); err != nil { -+ t.Fatalf("Failed to write header: %s", err) -+ } -+ if _, err := tw.Write([]byte("fooo")); err != nil { -+ t.Fatalf("Failed to write the file's data: %s", err) -+ } -+ tw.Close() -+ -+ tr := NewReader(&buffer) -+ -+ for { -+ header, err := tr.Next() -+ if err == io.EOF { -+ break -+ } -+ if err != nil { -+ t.Fatalf("Failed to read header: %s", err) -+ } -+ if header.Typeflag != 0 { -+ t.Fatalf("Typeflag should've been 0, found %d", header.Typeflag) -+ } -+ } -+} diff --git a/go1.3-tar_reuse_buffer_readHeader.patch b/go1.3-tar_reuse_buffer_readHeader.patch deleted file mode 100644 index 1c6693c..0000000 --- a/go1.3-tar_reuse_buffer_readHeader.patch +++ /dev/null @@ -1,64 +0,0 @@ -# HG changeset patch -# User Cristian Staretu -# Date 1404344479 -36000 -# Thu Jul 03 09:41:19 2014 +1000 -# Node ID 17404efd6b02d4b3acd17070e3f89de97a145877 -# Parent 837348e418f33fc7a242f56dbe2feff829532526 -archive/tar: reuse temporary buffer in readHeader - -A temporary 512 bytes buffer is allocated for every call to -readHeader. This buffer isn't returned to the caller and it could -be reused to lower the number of memory allocations. - -This CL improves it by using a pool and zeroing out the buffer before -putting it back into the pool. - -benchmark old ns/op new ns/op delta -BenchmarkListFiles100k 545249903 538832687 -1.18% - -benchmark old allocs new allocs delta -BenchmarkListFiles100k 2105167 2005692 -4.73% - -benchmark old bytes new bytes delta -BenchmarkListFiles100k 105903472 54831527 -48.22% - -This improvement is very important if your code has to deal with a lot -of tarballs which contain a lot of files. - -LGTM=dsymonds -R=golang-codereviews, dave, dsymonds, bradfitz -CC=golang-codereviews -https://codereview.appspot.com/108240044 - -Committer: David Symonds - -diff -r 837348e418f3 -r 17404efd6b02 src/pkg/archive/tar/reader.go ---- a/src/pkg/archive/tar/reader.go Thu Jul 03 09:40:53 2014 +1000 -+++ b/src/pkg/archive/tar/reader.go Thu Jul 03 09:41:19 2014 +1000 -@@ -29,10 +29,11 @@ - // The Next method advances to the next file in the archive (including the first), - // and then it can be treated as an io.Reader to access the file's data. - type Reader struct { -- r io.Reader -- err error -- pad int64 // amount of padding (ignored) after current file entry -- curr numBytesReader // reader for current file entry -+ r io.Reader -+ err error -+ pad int64 // amount of padding (ignored) after current file entry -+ curr numBytesReader // reader for current file entry -+ hdrBuff [blockSize]byte // buffer to use in readHeader - } - - // A numBytesReader is an io.Reader with a numBytes method, returning the number -@@ -426,7 +427,9 @@ - } - - func (tr *Reader) readHeader() *Header { -- header := make([]byte, blockSize) -+ header := tr.hdrBuff[:] -+ copy(header, zeroBlock) -+ - if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil { - return nil - } diff --git a/go1.3-tar_reuse_buffer_writeHeader.patch b/go1.3-tar_reuse_buffer_writeHeader.patch deleted file mode 100644 index 6cd8969..0000000 --- a/go1.3-tar_reuse_buffer_writeHeader.patch +++ /dev/null @@ -1,56 +0,0 @@ -# HG changeset patch -# User Cristian Staretu -# Date 1404344453 -36000 -# Thu Jul 03 09:40:53 2014 +1000 -# Node ID 837348e418f33fc7a242f56dbe2feff829532526 -# Parent c5f72a685e256457a0872f6587e2bb9500eac7c4 -archive/tar: reuse temporary buffer in writeHeader - -A temporary 512 bytes buffer is allocated for every call to -writeHeader. This buffer could be reused the lower the number -of memory allocations. - -benchmark old ns/op new ns/op delta -BenchmarkWriteFiles100k 634622051 583810847 -8.01% - -benchmark old allocs new allocs delta -BenchmarkWriteFiles100k 2701920 2602621 -3.68% - -benchmark old bytes new bytes delta -BenchmarkWriteFiles100k 115383884 64349922 -44.23% - -This change is very important if your code has to write a lot of -tarballs with a lot of files. - -LGTM=dsymonds -R=golang-codereviews, dave, dsymonds -CC=golang-codereviews -https://codereview.appspot.com/107440043 - -Committer: David Symonds - -diff -r c5f72a685e25 -r 837348e418f3 src/pkg/archive/tar/writer.go ---- a/src/pkg/archive/tar/writer.go Wed Jul 02 15:28:57 2014 -0700 -+++ b/src/pkg/archive/tar/writer.go Thu Jul 03 09:40:53 2014 +1000 -@@ -37,8 +37,9 @@ - nb int64 // number of unwritten bytes for current file entry - pad int64 // amount of padding to write after current file entry - closed bool -- usedBinary bool // whether the binary numeric field extension was used -- preferPax bool // use pax header instead of binary numeric header -+ usedBinary bool // whether the binary numeric field extension was used -+ preferPax bool // use pax header instead of binary numeric header -+ hdrBuff [blockSize]byte // buffer to use in writeHeader - } - - // NewWriter creates a new Writer writing to w. -@@ -160,7 +161,8 @@ - // subsecond time resolution, but for now let's just capture - // too long fields or non ascii characters - -- header := make([]byte, blockSize) -+ header := tw.hdrBuff[:] -+ copy(header, zeroBlock) - s := slicer(header) - - // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax diff --git a/golang-1.2-BSD-SVID-SOURCE.patch b/golang-1.2-BSD-SVID-SOURCE.patch deleted file mode 100644 index f4927b6..0000000 --- a/golang-1.2-BSD-SVID-SOURCE.patch +++ /dev/null @@ -1,19 +0,0 @@ -Index: go/include/u.h -=================================================================== ---- go.orig/include/u.h -+++ go/include/u.h -@@ -38,10 +38,13 @@ extern "C" { - # define __MAKECONTEXT_V2_SOURCE 1 - # endif - #endif -+#if defined __linux__ || defined __GNU__ || defined __GLIBC__ -+#define _DEFAULT_SOURCE 1 -+#else - #define _BSD_SOURCE 1 - #define _NETBSD_SOURCE 1 /* NetBSD */ --#define _DEFAULT_SOURCE 1 /* glibc > 2.19 */ - #define _SVID_SOURCE 1 -+#endif - #if !defined(__APPLE__) && !defined(__OpenBSD__) - # define _XOPEN_SOURCE 1000 - # define _XOPEN_SOURCE_EXTENDED 1 diff --git a/golang-1.2-archive_tar-xattr.patch b/golang-1.2-archive_tar-xattr.patch deleted file mode 100644 index 10c8f3d..0000000 --- a/golang-1.2-archive_tar-xattr.patch +++ /dev/null @@ -1,197 +0,0 @@ -# HG changeset patch -# User Alexander Larsson -# Date 1392282510 -39600 -# Node ID a15f344a9efa35ef168c8feaa92a15a1cdc93db5 -# Parent 1a32fe60e0798d82bbff6c945001c7f0ba8de5ea -archive/tar: support extended attributes - -This adds support for archives with the SCHILY.xattr field in the -pax header. This is what gnu tar and star generate. -Fixes issue 7154. - -LGTM=dsymonds -R=golang-codereviews, gobot, dsymonds -CC=golang-codereviews -https://codereview.appspot.com/54570043 - -Committer: David Symonds - -diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/common.go ---- a/src/pkg/archive/tar/common.go Thu Feb 13 03:09:03 2014 -0500 -+++ b/src/pkg/archive/tar/common.go Thu Feb 13 20:08:30 2014 +1100 -@@ -57,6 +57,7 @@ - Devminor int64 // minor number of character or block device - AccessTime time.Time // access time - ChangeTime time.Time // status change time -+ Xattrs map[string]string - } - - // File name constants from the tar spec. -@@ -189,6 +190,7 @@ - paxSize = "size" - paxUid = "uid" - paxUname = "uname" -+ paxXattr = "SCHILY.xattr." - paxNone = "" - ) - -diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/reader.go ---- a/src/pkg/archive/tar/reader.go Thu Feb 13 03:09:03 2014 -0500 -+++ b/src/pkg/archive/tar/reader.go Thu Feb 13 20:08:30 2014 +1100 -@@ -139,8 +139,14 @@ - return err - } - hdr.Size = int64(size) -+ default: -+ if strings.HasPrefix(k, paxXattr) { -+ if hdr.Xattrs == nil { -+ hdr.Xattrs = make(map[string]string) -+ } -+ hdr.Xattrs[k[len(paxXattr):]] = v -+ } - } -- - } - return nil - } -diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/reader_test.go ---- a/src/pkg/archive/tar/reader_test.go Thu Feb 13 03:09:03 2014 -0500 -+++ b/src/pkg/archive/tar/reader_test.go Thu Feb 13 20:08:30 2014 +1100 -@@ -161,6 +161,46 @@ - }, - }, - }, -+ { -+ file: "testdata/xattrs.tar", -+ headers: []*Header{ -+ { -+ Name: "small.txt", -+ Mode: 0644, -+ Uid: 1000, -+ Gid: 10, -+ Size: 5, -+ ModTime: time.Unix(1386065770, 448252320), -+ Typeflag: '0', -+ Uname: "alex", -+ Gname: "wheel", -+ AccessTime: time.Unix(1389782991, 419875220), -+ ChangeTime: time.Unix(1389782956, 794414986), -+ Xattrs: map[string]string{ -+ "user.key": "value", -+ "user.key2": "value2", -+ // Interestingly, selinux encodes the terminating null inside the xattr -+ "security.selinux": "unconfined_u:object_r:default_t:s0\x00", -+ }, -+ }, -+ { -+ Name: "small2.txt", -+ Mode: 0644, -+ Uid: 1000, -+ Gid: 10, -+ Size: 11, -+ ModTime: time.Unix(1386065770, 449252304), -+ Typeflag: '0', -+ Uname: "alex", -+ Gname: "wheel", -+ AccessTime: time.Unix(1389782991, 419875220), -+ ChangeTime: time.Unix(1386065770, 449252304), -+ Xattrs: map[string]string{ -+ "security.selinux": "unconfined_u:object_r:default_t:s0\x00", -+ }, -+ }, -+ }, -+ }, - } - - func TestReader(t *testing.T) { -@@ -180,7 +220,7 @@ - f.Close() - continue testLoop - } -- if *hdr != *header { -+ if !reflect.DeepEqual(*hdr, *header) { - t.Errorf("test %d, entry %d: Incorrect header:\nhave %+v\nwant %+v", - i, j, *hdr, *header) - } -@@ -253,7 +293,7 @@ - } - - // check the header -- if *hdr != *headers[nread] { -+ if !reflect.DeepEqual(*hdr, *headers[nread]) { - t.Errorf("Incorrect header:\nhave %+v\nwant %+v", - *hdr, headers[nread]) - } -diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/writer.go ---- a/src/pkg/archive/tar/writer.go Thu Feb 13 03:09:03 2014 -0500 -+++ b/src/pkg/archive/tar/writer.go Thu Feb 13 20:08:30 2014 +1100 -@@ -236,6 +236,12 @@ - return tw.err - } - -+ if allowPax { -+ for k, v := range hdr.Xattrs { -+ paxHeaders[paxXattr+k] = v -+ } -+ } -+ - if len(paxHeaders) > 0 { - if !allowPax { - return errInvalidHeader -diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/writer_test.go ---- a/src/pkg/archive/tar/writer_test.go Thu Feb 13 03:09:03 2014 -0500 -+++ b/src/pkg/archive/tar/writer_test.go Thu Feb 13 20:08:30 2014 +1100 -@@ -10,6 +10,7 @@ - "io" - "io/ioutil" - "os" -+ "reflect" - "strings" - "testing" - "testing/iotest" -@@ -338,6 +339,45 @@ - } - } - -+func TestPaxXattrs(t *testing.T) { -+ xattrs := map[string]string{ -+ "user.key": "value", -+ } -+ -+ // Create an archive with an xattr -+ fileinfo, err := os.Stat("testdata/small.txt") -+ if err != nil { -+ t.Fatal(err) -+ } -+ hdr, err := FileInfoHeader(fileinfo, "") -+ if err != nil { -+ t.Fatalf("os.Stat: %v", err) -+ } -+ contents := "Kilts" -+ hdr.Xattrs = xattrs -+ var buf bytes.Buffer -+ writer := NewWriter(&buf) -+ if err := writer.WriteHeader(hdr); err != nil { -+ t.Fatal(err) -+ } -+ if _, err = writer.Write([]byte(contents)); err != nil { -+ t.Fatal(err) -+ } -+ if err := writer.Close(); err != nil { -+ t.Fatal(err) -+ } -+ // Test that we can get the xattrs back out of the archive. -+ reader := NewReader(&buf) -+ hdr, err = reader.Next() -+ if err != nil { -+ t.Fatal(err) -+ } -+ if !reflect.DeepEqual(hdr.Xattrs, xattrs) { -+ t.Fatalf("xattrs did not survive round trip: got %+v, want %+v", -+ hdr.Xattrs, xattrs) -+ } -+} -+ - func TestPAXHeader(t *testing.T) { - medName := strings.Repeat("CD", 50) - longName := strings.Repeat("AB", 100) diff --git a/golang-1.2-remove-ECC-p224.patch b/golang-1.2-remove-ECC-p224.patch deleted file mode 100644 index 1b9e021..0000000 --- a/golang-1.2-remove-ECC-p224.patch +++ /dev/null @@ -1,172 +0,0 @@ -Index: go/api/go1.txt -=================================================================== ---- go.orig/api/go1.txt -+++ go/api/go1.txt -@@ -412,7 +412,6 @@ pkg crypto/ecdsa, type PublicKey struct, - pkg crypto/ecdsa, type PublicKey struct, embedded elliptic.Curve - pkg crypto/elliptic, func GenerateKey(Curve, io.Reader) ([]uint8, *big.Int, *big.Int, error) - pkg crypto/elliptic, func Marshal(Curve, *big.Int, *big.Int) []uint8 --pkg crypto/elliptic, func P224() Curve - pkg crypto/elliptic, func P256() Curve - pkg crypto/elliptic, func P384() Curve - pkg crypto/elliptic, func P521() Curve -Index: go/src/pkg/crypto/ecdsa/ecdsa_test.go -=================================================================== ---- go.orig/src/pkg/crypto/ecdsa/ecdsa_test.go -+++ go/src/pkg/crypto/ecdsa/ecdsa_test.go -@@ -33,7 +33,6 @@ func testKeyGeneration(t *testing.T, c e - } - - func TestKeyGeneration(t *testing.T) { -- testKeyGeneration(t, elliptic.P224(), "p224") - if testing.Short() { - return - } -@@ -63,7 +62,6 @@ func testSignAndVerify(t *testing.T, c e - } - - func TestSignAndVerify(t *testing.T) { -- testSignAndVerify(t, elliptic.P224(), "p224") - if testing.Short() { - return - } -@@ -129,8 +127,6 @@ func TestVectors(t *testing.T) { - parts := strings.SplitN(line, ",", 2) - - switch parts[0] { -- case "P-224": -- pub.Curve = elliptic.P224() - case "P-256": - pub.Curve = elliptic.P256() - case "P-384": -Index: go/src/pkg/crypto/elliptic/bottombits.go -=================================================================== ---- /dev/null -+++ go/src/pkg/crypto/elliptic/bottombits.go -@@ -0,0 +1,14 @@ -+ -+// Copyright 2012 The Go Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style -+// license that can be found in the LICENSE file. -+ -+package elliptic -+ -+const bottom12Bits = 0xfff -+const bottom28Bits = 0xfffffff -+ -+const two31p3 = 1<<31 + 1<<3 -+const two31m3 = 1<<31 - 1<<3 -+const two31m15m3 = 1<<31 - 1<<15 - 1<<3 -+ -Index: go/src/pkg/crypto/elliptic/elliptic.go -=================================================================== ---- go.orig/src/pkg/crypto/elliptic/elliptic.go -+++ go/src/pkg/crypto/elliptic/elliptic.go -@@ -326,7 +326,6 @@ var p384 *CurveParams - var p521 *CurveParams - - func initAll() { -- initP224() - initP256() - initP384() - initP521() -Index: go/src/pkg/crypto/elliptic/elliptic_test.go -=================================================================== ---- go.orig/src/pkg/crypto/elliptic/elliptic_test.go -+++ go/src/pkg/crypto/elliptic/elliptic_test.go -@@ -1,3 +1,5 @@ -+// +build ignore -+ - // Copyright 2010 The Go Authors. All rights reserved. - // Use of this source code is governed by a BSD-style - // license that can be found in the LICENSE file. -Index: go/src/pkg/crypto/elliptic/p224.go -=================================================================== ---- go.orig/src/pkg/crypto/elliptic/p224.go -+++ go/src/pkg/crypto/elliptic/p224.go -@@ -1,3 +1,5 @@ -+// +build ignore -+ - // Copyright 2012 The Go Authors. All rights reserved. - // Use of this source code is governed by a BSD-style - // license that can be found in the LICENSE file. -@@ -183,10 +185,6 @@ func p224Add(out, a, b *p224FieldElement - } - } - --const two31p3 = 1<<31 + 1<<3 --const two31m3 = 1<<31 - 1<<3 --const two31m15m3 = 1<<31 - 1<<15 - 1<<3 -- - // p224ZeroModP31 is 0 mod p where bit 31 is set in all limbs so that we can - // subtract smaller amounts without underflow. See the section "Subtraction" in - // [1] for reasoning. -@@ -215,9 +213,6 @@ const two63m35m19 = 1<<63 - 1<<35 - 1<<1 - // "Subtraction" in [1] for why. - var p224ZeroModP63 = [8]uint64{two63p35, two63m35, two63m35, two63m35, two63m35m19, two63m35, two63m35, two63m35} - --const bottom12Bits = 0xfff --const bottom28Bits = 0xfffffff -- - // p224Mul computes *out = a*b - // - // a[i] < 2**29, b[i] < 2**30 (or vice versa) -Index: go/src/pkg/crypto/elliptic/p224_test.go -=================================================================== ---- go.orig/src/pkg/crypto/elliptic/p224_test.go -+++ go/src/pkg/crypto/elliptic/p224_test.go -@@ -1,3 +1,5 @@ -+// +build ignore -+ - // Copyright 2012 The Go Authors. All rights reserved. - // Use of this source code is governed by a BSD-style - // license that can be found in the LICENSE file. -Index: go/src/pkg/crypto/x509/x509.go -=================================================================== ---- go.orig/src/pkg/crypto/x509/x509.go -+++ go/src/pkg/crypto/x509/x509.go -@@ -306,9 +306,6 @@ func getPublicKeyAlgorithmFromOID(oid as - - // RFC 5480, 2.1.1.1. Named Curve - // --// secp224r1 OBJECT IDENTIFIER ::= { --// iso(1) identified-organization(3) certicom(132) curve(0) 33 } --// - // secp256r1 OBJECT IDENTIFIER ::= { - // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) - // prime(1) 7 } -@@ -321,7 +318,6 @@ func getPublicKeyAlgorithmFromOID(oid as - // - // NB: secp256r1 is equivalent to prime256v1 - var ( -- oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33} - oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7} - oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34} - oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35} -@@ -329,8 +325,6 @@ var ( - - func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { - switch { -- case oid.Equal(oidNamedCurveP224): -- return elliptic.P224() - case oid.Equal(oidNamedCurveP256): - return elliptic.P256() - case oid.Equal(oidNamedCurveP384): -@@ -343,8 +337,6 @@ func namedCurveFromOID(oid asn1.ObjectId - - func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) { - switch curve { -- case elliptic.P224(): -- return oidNamedCurveP224, true - case elliptic.P256(): - return oidNamedCurveP256, true - case elliptic.P384(): -@@ -1371,7 +1363,7 @@ func signingParamsForPrivateKey(priv int - pubType = ECDSA - - switch priv.Curve { -- case elliptic.P224(), elliptic.P256(): -+ case elliptic.P256(): - hashFunc = crypto.SHA256 - sigAlgo.Algorithm = oidSignatureECDSAWithSHA256 - case elliptic.P384(): diff --git a/golang-1.2-skipCpuProfileTest.patch b/golang-1.2-skipCpuProfileTest.patch deleted file mode 100644 index 3dee29f..0000000 --- a/golang-1.2-skipCpuProfileTest.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -r 87dea3f5ebe7 src/pkg/runtime/pprof/pprof_test.go ---- a/src/pkg/runtime/pprof/pprof_test.go Fri Nov 29 08:32:31 2013 +1100 -+++ b/src/pkg/runtime/pprof/pprof_test.go Fri Jan 24 13:47:42 2014 -0500 -@@ -32,7 +32,7 @@ - }) - } - --func TestCPUProfileMultithreaded(t *testing.T) { -+func testCPUProfileMultithreaded(t *testing.T) { - buf := make([]byte, 100000) - defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2)) - testCPUProfile(t, []string{"crc32.ChecksumIEEE", "crc32.Update"}, func() { diff --git a/golang-1.2-verbose-build.patch b/golang-1.2-verbose-build.patch deleted file mode 100644 index 1698d82..0000000 --- a/golang-1.2-verbose-build.patch +++ /dev/null @@ -1,19 +0,0 @@ -Index: go/src/make.bash -=================================================================== ---- go.orig/src/make.bash -+++ go/src/make.bash -@@ -161,12 +161,12 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH - # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, - # use the host compiler, CC, from `cmd/dist/dist env` instead. - CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ -- "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std -+ "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std - echo - fi - - echo "# Building packages and commands for $GOOS/$GOARCH." --CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std -+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std - echo - - rm -f "$GOTOOLDIR"/go_bootstrap diff --git a/golang-f21-hostname.patch b/golang-f21-hostname.patch deleted file mode 100644 index 6025ecb..0000000 --- a/golang-f21-hostname.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- src/pkg/os/os_test.go.orig 2014-02-20 13:14:45.543644182 -0600 -+++ src/pkg/os/os_test.go 2014-02-20 13:14:55.934813622 -0600 -@@ -854,7 +854,7 @@ - t.Fatal(err) - } - defer r.Close() -- p, err := StartProcess("/bin/hostname", []string{"hostname"}, &ProcAttr{Files: []*File{nil, w, Stderr}}) -+ p, err := StartProcess("/usr/bin/hostname", []string{"hostname"}, &ProcAttr{Files: []*File{nil, w, Stderr}}) - if err != nil { - t.Fatal(err) - } diff --git a/golang-gdbinit b/golang-gdbinit deleted file mode 100644 index 4ef690b..0000000 --- a/golang-gdbinit +++ /dev/null @@ -1 +0,0 @@ -add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py diff --git a/golang-prelink.conf b/golang-prelink.conf deleted file mode 100644 index 471e8e6..0000000 --- a/golang-prelink.conf +++ /dev/null @@ -1,3 +0,0 @@ -# there are ELF files in src which are testdata and shouldn't be modified --b /usr/lib/golang/src --b /usr/lib64/golang/src diff --git a/golang.spec b/golang.spec deleted file mode 100644 index e4be874..0000000 --- a/golang.spec +++ /dev/null @@ -1,1100 +0,0 @@ -# build ids are not currently generated: -# https://code.google.com/p/go/issues/detail?id=5238 -# -# also, debuginfo extraction currently fails with -# "Failed to write file: invalid section alignment" -%global debug_package %{nil} - -# we are shipping the full contents of src in the data subpackage, which -# contains binary-like things (ELF data for tests, etc) -%global _binaries_in_noarch_packages_terminate_build 0 - -# Do not check any files in doc or src for requires -%global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$ - -# Don't alter timestamps of especially the .a files (or else go will rebuild later) -# Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata -%global __strip /bin/true - -# rpmbuild magic to keep from having meta dependency on libc.so.6 -%define _use_internal_dependency_generator 0 -%define __find_requires %{nil} -%global debug_package %{nil} -%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ - /usr/lib/rpm/brp-compress - -# let this match the macros in macros.golang -%global goroot /usr/lib/%{name} -%global gopath %{_datadir}/gocode -%global go_arches %{ix86} x86_64 %{arm} -%ifarch x86_64 -%global gohostarch amd64 -%endif -%ifarch %{ix86} -%global gohostarch 386 -%endif -%ifarch %{arm} -%global gohostarch arm -%endif - -Name: golang -Version: 1.3.3 -Release: 1%{?dist} -Summary: The Go Programming Language - -License: BSD -URL: http://golang.org/ -Source0: https://storage.googleapis.com/golang/go%{version}.src.tar.gz - -# this command moved places -%if 0%{?fedora} >= 21 -BuildRequires: /usr/bin/hostname -Patch210: golang-f21-hostname.patch - -# Patch211 - F21+ has glibc 2.19.90 (2.20 devel)+ which deprecates -# _BSD_SOURCE and _SVID_SOURCE -Patch211: golang-1.2-BSD-SVID-SOURCE.patch -%else -BuildRequires: /bin/hostname -%endif - -Provides: go = %{version}-%{release} -Requires: golang-bin -Requires: golang-src - -BuildRequires: emacs - -Patch0: golang-1.2-verbose-build.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1038683 -Patch1: golang-1.2-remove-ECC-p224.patch - -# disable flaky test for now -# http://code.google.com/p/go/issues/detail?id=6522 -Patch2: ./golang-1.2-skipCpuProfileTest.patch - -# these patches can be dropped for go1.4 -# discovered working here https://github.com/dotcloud/docker/pull/6829 -Patch3: ./go1.3-tar_reuse_buffer_readHeader.patch -Patch4: ./go1.3-tar_reuse_buffer_writeHeader.patch -# https://code.google.com/p/go/source/detail?r=1b17b3426e3c -Patch5: ./go1.3-tar-fix_writing_of_pax_headers.patch - -# Having documentation separate was broken -Obsoletes: %{name}-docs < 1.1-4 - -# RPM can't handle symlink -> dir with subpackages, so merge back -Obsoletes: %{name}-data < 1.1.1-4 - -# These are the only RHEL/Fedora architectures that we compile this package for -ExclusiveArch: %{go_arches} - -Source100: golang-gdbinit -Source101: golang-prelink.conf -Source102: macros.golang - -%description -%{summary}. - - -# Restore this package if RPM gets fixed (bug #975909) -#%package data -#Summary: Required architecture-independent files for Go -#Requires: %{name} = %{version}-%{release} -#BuildArch: noarch -#Obsoletes: %{name}-docs < 1.1-4 -# -#%description data -#%{summary}. - - -%package vim -Summary: Vim plugins for Go -# fedora only -%if 0%{?fedora} -Requires: vim-filesystem -%endif -BuildArch: noarch - -%description vim -%{summary}. - - -%package -n emacs-%{name} -Summary: Emacs add-on package for Go -Requires: emacs(bin) >= %{_emacs_version} -BuildArch: noarch - -%description -n emacs-%{name} -%{summary}. - - -## -# the source tree -%package src -Summary: Golang compiler source tree -Requires: go = %{version}-%{release} -BuildArch: noarch -%description src -%{summary} - -## -# This is the only architecture specific binary -%ifarch %{ix86} -%package pkg-bin-linux-386 -Summary: Golang compiler tool for linux 386 -Requires: go = %{version}-%{release} -Requires: golang-pkg-linux-386 = %{version}-%{release} -Requires(post): golang-pkg-linux-386 = %{version}-%{release} -Provides: golang-bin = 386 -# We strip the meta dependency, but go does require glibc. -# This is an odd issue, still looking for a better fix. -Requires: glibc -Requires: gcc -Requires(post): %{_sbindir}/update-alternatives -Requires(postun): %{_sbindir}/update-alternatives -%description pkg-bin-linux-386 -%{summary} -%endif - -%ifarch x86_64 -%package pkg-bin-linux-amd64 -Summary: Golang compiler tool for linux amd64 -Requires: go = %{version}-%{release} -Requires: golang-pkg-linux-amd64 = %{version}-%{release} -Requires(post): golang-pkg-linux-amd64 = %{version}-%{release} -Provides: golang-bin = amd64 -# We strip the meta dependency, but go does require glibc. -# This is an odd issue, still looking for a better fix. -Requires: glibc -Requires: gcc -Requires(post): %{_sbindir}/update-alternatives -Requires(postun): %{_sbindir}/update-alternatives -%description pkg-bin-linux-amd64 -%{summary} -%endif - -%ifarch %{arm} -%package pkg-bin-linux-arm -Summary: Golang compiler tool for linux arm -Requires: go = %{version}-%{release} -Requires: golang-pkg-linux-arm = %{version}-%{release} -Requires(post): golang-pkg-linux-arm = %{version}-%{release} -Provides: golang-bin = arm -# We strip the meta dependency, but go does require glibc. -# This is an odd issue, still looking for a better fix. -Requires: glibc -Requires: gcc -Requires(post): %{_sbindir}/update-alternatives -Requires(postun): %{_sbindir}/update-alternatives -%description pkg-bin-linux-arm -%{summary} -%endif - -## -# architecture independent go tooling, that allows for cross -# compiling on golang supported architectures -# http://golang.org/doc/install/source#environment -%package pkg-linux-386 -Summary: Golang compiler toolchain to compile for linux 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-linux-386 -%{summary} - -%package pkg-linux-amd64 -Summary: Golang compiler toolchain to compile for linux amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-linux-amd64 -%{summary} - -%package pkg-linux-arm -Summary: Golang compiler toolchain to compile for linux arm -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-linux-arm -%{summary} - -%package pkg-darwin-386 -Summary: Golang compiler toolchain to compile for darwin 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-darwin-386 -%{summary} - -%package pkg-darwin-amd64 -Summary: Golang compiler toolchain to compile for darwin amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-darwin-amd64 -%{summary} - -%package pkg-windows-386 -Summary: Golang compiler toolchain to compile for windows 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-windows-386 -%{summary} - -%package pkg-windows-amd64 -Summary: Golang compiler toolchain to compile for windows amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-windows-amd64 -%{summary} - -%package pkg-plan9-386 -Summary: Golang compiler toolchain to compile for plan9 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-plan9-386 -%{summary} - -%package pkg-plan9-amd64 -Summary: Golang compiler toolchain to compile for plan9 amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-plan9-amd64 -%{summary} - -%package pkg-freebsd-386 -Summary: Golang compiler toolchain to compile for freebsd 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-freebsd-386 -%{summary} - -%package pkg-freebsd-amd64 -Summary: Golang compiler toolchain to compile for freebsd amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-freebsd-amd64 -%{summary} - -%package pkg-freebsd-arm -Summary: Golang compiler toolchain to compile for freebsd arm -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-freebsd-arm -%{summary} - -%package pkg-netbsd-386 -Summary: Golang compiler toolchain to compile for netbsd 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-netbsd-386 -%{summary} - -%package pkg-netbsd-amd64 -Summary: Golang compiler toolchain to compile for netbsd amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-netbsd-amd64 -%{summary} - -%package pkg-netbsd-arm -Summary: Golang compiler toolchain to compile for netbsd arm -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-netbsd-arm -%{summary} - -%package pkg-openbsd-386 -Summary: Golang compiler toolchain to compile for openbsd 386 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-openbsd-386 -%{summary} - -%package pkg-openbsd-amd64 -Summary: Golang compiler toolchain to compile for openbsd amd64 -Requires: go = %{version}-%{release} -BuildArch: noarch -%description pkg-openbsd-amd64 -%{summary} - -## missing ./go/src/pkg/runtime/defs_openbsd_arm.h -## we'll skip this bundle for now -#%package pkg-openbsd-arm -#Summary: Golang compiler toolchain to compile for openbsd arm -#Requires: go = %{version}-%{release} -#BuildArch: noarch -#%description pkg-openbsd-arm -#%{summary} - -# Workaround old RPM bug of symlink-replaced-with-dir failure -%pretrans -p -for _,d in pairs({"api", "doc", "include", "lib", "src"}) do - path = "%{goroot}/" .. d - if posix.stat(path, "type") == "link" then - os.remove(path) - posix.mkdir(path) - end -end - - -%prep -%setup -q -n go - -%if 0%{?fedora} >= 21 -%patch210 -p0 -%patch211 -p1 -%endif - -# increase verbosity of build -%patch0 -p1 - -# remove the P224 curve -%patch1 -p1 - -# skip flaky test -%patch2 -p1 - -# performance for archive/tar -%patch3 -p1 -%patch4 -p1 -# buffer the PAX header -%patch5 -p1 - -# create a [dirty] gcc wrapper to allow us to build with our own flags -# (dirty because it is spoofing 'gcc' since CC value is stored in the go tool) -# TODO: remove this and just set CFLAGS/LDFLAGS once upstream supports it -# https://code.google.com/p/go/issues/detail?id=6882 -# UPDATE: this is fixed in trunk, and will be in go1.3 -mkdir -p zz -echo -e "#!/bin/sh\n/usr/bin/gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS \"\$@\"" > ./zz/gcc -chmod +x ./zz/gcc - -%build -# set up final install location -export GOROOT_FINAL=%{goroot} - -# TODO use the system linker to get the system link flags and build-id -# when https://code.google.com/p/go/issues/detail?id=5221 is solved -#export GO_LDFLAGS="-linkmode external -extldflags $RPM_LD_FLAGS" - -export GOHOSTOS=linux -export GOHOSTARCH=%{gohostarch} - -# build for all (see http://golang.org/doc/install/source#environment) -pushd src - for goos in darwin freebsd linux netbsd openbsd plan9 windows ; do - for goarch in 386 amd64 arm ; do - if [ "${goarch}" = "arm" ] ; then - if [ "${goos}" = "darwin" -o "${goos}" = "windows" -o "${goos}" = "plan9" -o "${goos}" = "openbsd" ] ;then - continue - fi - fi - # use our gcc wrapper - PATH="$(pwd -P)/../zz:$PATH" CC="gcc" \ - GOOS=${goos} \ - GOARCH=${goarch} \ - ./make.bash --no-clean - done - done -popd - -# compile for emacs -cd misc -mv emacs/go-mode-load.el emacs/%{name}-init.el -%{_emacs_bytecompile} emacs/go-mode.el -cd .. - - -%install -rm -rf $RPM_BUILD_ROOT - -# create the top level directories -mkdir -p $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT%{goroot} - -# install everything into libdir (until symlink problems are fixed) -# https://code.google.com/p/go/issues/detail?id=5830 -cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ - $RPM_BUILD_ROOT%{goroot} - -# bz1099206 -find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; -# and level out all the built archives -touch $RPM_BUILD_ROOT%{goroot}/pkg -find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \; -# generate the spec file ownership of this source tree and packages -cwd=$(pwd) -src_list=$cwd/go-src.list -rm -f $src_list -touch $src_list -pushd $RPM_BUILD_ROOT%{goroot} - find src/ -type d -printf '%%%dir %{goroot}/%p\n' >> $src_list - find src/ ! -type d -printf '%{goroot}/%p\n' >> $src_list - - - for goos in darwin freebsd linux netbsd openbsd plan9 windows ; do - for goarch in 386 amd64 arm ; do - if [ "${goarch}" = "arm" ] ; then - if [ "${goos}" = "darwin" -o "${goos}" = "windows" -o "${goos}" = "plan9" -o "${goos}" = "openbsd" ] ;then - continue - fi - fi - file_list=${cwd}/pkg-${goos}-${goarch}.list - rm -f $file_list - touch $file_list - find pkg/${goos}_${goarch}/ -type d -printf '%%%dir %{goroot}/%p\n' >> $file_list - find pkg/${goos}_${goarch}/ ! -type d -printf '%{goroot}/%p\n' >> $file_list - done - done -popd - -# remove the unnecessary zoneinfo file (Go will always use the system one first) -rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time - -# remove the doc Makefile -rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile - -# put binaries to bindir, linked to the arch we're building, -# leave the arch independent pieces in %{goroot} -mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch} -mv $RPM_BUILD_ROOT%{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go -mv $RPM_BUILD_ROOT%{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt - -# ensure these exist and are owned -mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com/ -mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org/ -mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/ -mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p/ - -# remove the go and gofmt for other platforms (not used in the compile) -pushd $RPM_BUILD_ROOT%{goroot}/bin/ - rm -rf darwin_* windows_* freebsd_* netbsd_* openbsd_* plan9_* - case "%{gohostarch}" in - amd64) - rm -rf linux_386 linux_arm ;; - 386) - rm -rf linux_arm linux_amd64 ;; - arm) - rm -rf linux_386 linux_amd64 ;; - esac -popd - -# make sure these files exist and point to alternatives -rm -f $RPM_BUILD_ROOT%{_bindir}/go -ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go -rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt -ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt - -# misc/bash -mkdir -p $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions -cp -av misc/bash/go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions -for z in 8l 6l 5l 8g 6g 5g gofmt gccgo - do ln -s go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/$z -done - -# misc/emacs -mkdir -p $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name} -mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} -cp -av misc/emacs/go-mode.* $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name} -cp -av misc/emacs/%{name}-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir} - -# misc/vim -mkdir -p $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles -cp -av misc/vim/* $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles -rm $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/readme.txt - -# misc/zsh -mkdir -p $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions -cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions - -# gdbinit -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d -cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb - -# prelink blacklist -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d -cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf - -# rpm macros -mkdir -p %{buildroot} -%if 0%{?rhel} > 6 || 0%{?fedora} > 0 -mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d -cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d/macros.golang -%else -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm -cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang -%endif - - -%check -export GOROOT=$(pwd -P) -export PATH="$PATH":"$GOROOT"/bin -cd src -# skip using CGO for test. causes a SIGABRT on fc21 (bz1086900) -# until this test/issue is fixed -# https://bugzilla.redhat.com/show_bug.cgi?id=1086900 -# CGO for test, which fails in i686 on fc21 inside mock/chroot (bz1087621) -# https://bugzilla.redhat.com/show_bug.cgi?id=1087621 - -# not using our 'gcc' since the CFLAGS fails crash_cgo_test.go due to unused variables -# https://code.google.com/p/go/issues/detail?id=6883 -CGO_ENABLED=0 ./run.bash --no-rebuild -cd .. - -if [ $(go list -json std | grep Stale | wc -l) -gt 2 ] ; then - # cmd/go and cmd/gofmt show like they are stale. we can ignore - exit 1 -fi - - -%ifarch %{ix86} -%post pkg-bin-linux-386 -# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -touch -r %{goroot}/pkg/linux_386/runtime.a %{goroot}/pkg/linux_386/runtime/cgo.a - -%{_sbindir}/update-alternatives --install %{_bindir}/go \ - go %{goroot}/bin/linux_386/go 90 \ - --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_386/gofmt - -%preun pkg-bin-linux-386 -if [ $1 = 0 ]; then - %{_sbindir}/update-alternatives --remove go %{goroot}/bin/linux_386/go -fi -%endif - -%ifarch x86_64 -%post pkg-bin-linux-amd64 -# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -touch -r %{goroot}/pkg/linux_amd64/runtime.a %{goroot}/pkg/linux_amd64/runtime/cgo.a - -%{_sbindir}/update-alternatives --install %{_bindir}/go \ - go %{goroot}/bin/linux_amd64/go 90 \ - --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_amd64/gofmt - -%preun pkg-bin-linux-amd64 -if [ $1 = 0 ]; then - %{_sbindir}/update-alternatives --remove go %{goroot}/bin/linux_amd64/go -fi -%endif - -%ifarch %{arm} -%post pkg-bin-linux-arm -# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, -touch -r %{goroot}/pkg/linux_arm/runtime.a %{goroot}/pkg/linux_arm/runtime/cgo.a - -%{_sbindir}/update-alternatives --install %{_bindir}/go \ - go %{goroot}/bin/linux_arm/go 90 \ - --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_arm/gofmt - -%preun pkg-bin-linux-arm -if [ $1 = 0 ]; then - %{_sbindir}/update-alternatives --remove go %{goroot}/bin/linux_arm/go -fi -%endif - - -#%post pkg-openbsd-arm -#GOROOT=%{goroot} GOOS=openbsd GOARCH=arm go install std - -%files -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS -# VERSION has to be present in the GOROOT, for `go install std` to work -%doc %{goroot}/VERSION - -# go files -%dir %{goroot} -%{goroot}/* -%exclude %{goroot}/bin/ -%exclude %{goroot}/pkg/ -%exclude %{goroot}/src/ - -# ensure directory ownership, so they are cleaned up if empty -%dir %{gopath} -%dir %{gopath}/src -%dir %{gopath}/src/github.com/ -%dir %{gopath}/src/bitbucket.org/ -%dir %{gopath}/src/code.google.com/ -%dir %{gopath}/src/code.google.com/p/ - - -# autocomplete -%{_datadir}/bash-completion -%{_datadir}/zsh - -# gdbinit (for gdb debugging) -%{_sysconfdir}/gdbinit.d - -# prelink blacklist -%{_sysconfdir}/prelink.conf.d - -%if 0%{?rhel} > 6 || 0%{?fedora} > 0 -%{_rpmconfigdir}/macros.d/macros.golang -%else -%{_sysconfdir}/rpm/macros.golang -%endif - - -%files vim -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS -%{_datadir}/vim/vimfiles/* - - -%files -n emacs-%{name} -%doc AUTHORS CONTRIBUTORS LICENSE PATENTS -%{_emacs_sitelispdir}/%{name} -%{_emacs_sitestartdir}/*.el - - -%files -f go-src.list src -%{goroot}/src/ - -%ifarch %{ix86} -%files pkg-bin-linux-386 -%{goroot}/bin/linux_386/ -# binary executables -%{_bindir}/go -%{_bindir}/gofmt -%dir %{goroot}/pkg/obj/linux_386 -%{goroot}/pkg/obj/linux_386/* -%{goroot}/pkg/linux_386/runtime/cgo.a -%dir %{goroot}/pkg/tool/linux_386 -%{goroot}/pkg/tool/linux_386/5a -%{goroot}/pkg/tool/linux_386/5c -%{goroot}/pkg/tool/linux_386/5g -%{goroot}/pkg/tool/linux_386/5l -%{goroot}/pkg/tool/linux_386/6a -%{goroot}/pkg/tool/linux_386/6c -%{goroot}/pkg/tool/linux_386/6g -%{goroot}/pkg/tool/linux_386/6l -%{goroot}/pkg/tool/linux_386/8a -%{goroot}/pkg/tool/linux_386/8c -%{goroot}/pkg/tool/linux_386/8g -%{goroot}/pkg/tool/linux_386/8l -%{goroot}/pkg/tool/linux_386/addr2line -%{goroot}/pkg/tool/linux_386/dist -%{goroot}/pkg/tool/linux_386/nm -%{goroot}/pkg/tool/linux_386/objdump -%{goroot}/pkg/tool/linux_386/pack -%{goroot}/pkg/tool/linux_386/pprof - -# arch dependent generated files, used by cgo -%{goroot}/src/pkg/runtime/zasm_linux_386.h -%{goroot}/src/pkg/runtime/zgoarch_386.go -%{goroot}/src/pkg/runtime/zmalloc_linux_386.c -%{goroot}/src/pkg/runtime/zmprof_linux_386.c -%{goroot}/src/pkg/runtime/znetpoll_linux_386.c -%{goroot}/src/pkg/runtime/zruntime1_linux_386.c -%{goroot}/src/pkg/runtime/zruntime_defs_linux_386.go -%{goroot}/src/pkg/runtime/zsema_linux_386.c -%{goroot}/src/pkg/runtime/zsigqueue_linux_386.c -%{goroot}/src/pkg/runtime/zstring_linux_386.c -%{goroot}/src/pkg/runtime/zsys_linux_386.s -%{goroot}/src/pkg/runtime/ztime_linux_386.c -%{goroot}/src/pkg/runtime/zalg_linux_386.c -%{goroot}/src/pkg/runtime/zchan_linux_386.c -%{goroot}/src/pkg/runtime/zcomplex_linux_386.c -%{goroot}/src/pkg/runtime/zcpuprof_linux_386.c -%{goroot}/src/pkg/runtime/zhashmap_linux_386.c -%{goroot}/src/pkg/runtime/ziface_linux_386.c -%{goroot}/src/pkg/runtime/zlfstack_linux_386.c -%{goroot}/src/pkg/runtime/zrdebug_linux_386.c -%{goroot}/src/pkg/runtime/zslice_linux_386.c -%{goroot}/src/pkg/runtime/zsymtab_linux_386.c -%endif - -%ifarch x86_64 -%files pkg-bin-linux-amd64 -%{goroot}/bin/linux_amd64/ -# binary executables -%{_bindir}/go -%{_bindir}/gofmt -%dir %{goroot}/pkg/obj/linux_amd64 -%{goroot}/pkg/obj/linux_amd64/* -%{goroot}/pkg/linux_amd64/runtime/cgo.a -%dir %{goroot}/pkg/tool/linux_amd64 -%{goroot}/pkg/tool/linux_amd64/5a -%{goroot}/pkg/tool/linux_amd64/5c -%{goroot}/pkg/tool/linux_amd64/5g -%{goroot}/pkg/tool/linux_amd64/5l -%{goroot}/pkg/tool/linux_amd64/6a -%{goroot}/pkg/tool/linux_amd64/6c -%{goroot}/pkg/tool/linux_amd64/6g -%{goroot}/pkg/tool/linux_amd64/6l -%{goroot}/pkg/tool/linux_amd64/8a -%{goroot}/pkg/tool/linux_amd64/8c -%{goroot}/pkg/tool/linux_amd64/8g -%{goroot}/pkg/tool/linux_amd64/8l -%{goroot}/pkg/tool/linux_amd64/addr2line -%{goroot}/pkg/tool/linux_amd64/dist -%{goroot}/pkg/tool/linux_amd64/nm -%{goroot}/pkg/tool/linux_amd64/objdump -%{goroot}/pkg/tool/linux_amd64/pack -%{goroot}/pkg/tool/linux_amd64/pprof - -# arch dependent generated files, used by cgo -%{goroot}/src/pkg/runtime/zasm_linux_amd64.h -%{goroot}/src/pkg/runtime/zgoarch_amd64.go -%{goroot}/src/pkg/runtime/zmalloc_linux_amd64.c -%{goroot}/src/pkg/runtime/zmprof_linux_amd64.c -%{goroot}/src/pkg/runtime/znetpoll_linux_amd64.c -%{goroot}/src/pkg/runtime/zruntime1_linux_amd64.c -%{goroot}/src/pkg/runtime/zruntime_defs_linux_amd64.go -%{goroot}/src/pkg/runtime/zsema_linux_amd64.c -%{goroot}/src/pkg/runtime/zsigqueue_linux_amd64.c -%{goroot}/src/pkg/runtime/zstring_linux_amd64.c -%{goroot}/src/pkg/runtime/zsys_linux_amd64.s -%{goroot}/src/pkg/runtime/ztime_linux_amd64.c -%{goroot}/src/pkg/runtime/zalg_linux_amd64.c -%{goroot}/src/pkg/runtime/zchan_linux_amd64.c -%{goroot}/src/pkg/runtime/zcomplex_linux_amd64.c -%{goroot}/src/pkg/runtime/zcpuprof_linux_amd64.c -%{goroot}/src/pkg/runtime/zhashmap_linux_amd64.c -%{goroot}/src/pkg/runtime/ziface_linux_amd64.c -%{goroot}/src/pkg/runtime/zlfstack_linux_amd64.c -%{goroot}/src/pkg/runtime/zrdebug_linux_amd64.c -%{goroot}/src/pkg/runtime/zslice_linux_amd64.c -%{goroot}/src/pkg/runtime/zsymtab_linux_amd64.c -%endif - -%ifarch %{arm} -%files pkg-bin-linux-arm -%{goroot}/bin/linux_arm/ -# binary executables -%{_bindir}/go -%{_bindir}/gofmt -%dir %{goroot}/pkg/obj/linux_arm -%{goroot}/pkg/obj/linux_arm/* -%{goroot}/pkg/linux_arm/runtime/cgo.a -%dir %{goroot}/pkg/tool/linux_arm -%{goroot}/pkg/tool/linux_arm/5a -%{goroot}/pkg/tool/linux_arm/5c -%{goroot}/pkg/tool/linux_arm/5g -%{goroot}/pkg/tool/linux_arm/5l -%{goroot}/pkg/tool/linux_arm/6a -%{goroot}/pkg/tool/linux_arm/6c -%{goroot}/pkg/tool/linux_arm/6g -%{goroot}/pkg/tool/linux_arm/6l -%{goroot}/pkg/tool/linux_arm/8a -%{goroot}/pkg/tool/linux_arm/8c -%{goroot}/pkg/tool/linux_arm/8g -%{goroot}/pkg/tool/linux_arm/8l -%{goroot}/pkg/tool/linux_arm/addr2line -%{goroot}/pkg/tool/linux_arm/dist -%{goroot}/pkg/tool/linux_arm/nm -%{goroot}/pkg/tool/linux_arm/objdump -%{goroot}/pkg/tool/linux_arm/pack -%{goroot}/pkg/tool/linux_arm/pprof - -# arch dependent generated files, used by cgo -%{goroot}/src/pkg/runtime/zasm_linux_arm.h -%{goroot}/src/pkg/runtime/zgoarch_arm.go -%{goroot}/src/pkg/runtime/zmalloc_linux_arm.c -%{goroot}/src/pkg/runtime/zmprof_linux_arm.c -%{goroot}/src/pkg/runtime/znetpoll_linux_arm.c -%{goroot}/src/pkg/runtime/znoasm_arm_linux_arm.c -%{goroot}/src/pkg/runtime/zruntime1_linux_arm.c -%{goroot}/src/pkg/runtime/zruntime_defs_linux_arm.go -%{goroot}/src/pkg/runtime/zsema_linux_arm.c -%{goroot}/src/pkg/runtime/zsigqueue_linux_arm.c -%{goroot}/src/pkg/runtime/zstring_linux_arm.c -%{goroot}/src/pkg/runtime/zsys_linux_arm.s -%{goroot}/src/pkg/runtime/ztime_linux_arm.c -%{goroot}/src/pkg/runtime/zalg_linux_arm.c -%{goroot}/src/pkg/runtime/zchan_linux_arm.c -%{goroot}/src/pkg/runtime/zcomplex_linux_arm.c -%{goroot}/src/pkg/runtime/zcpuprof_linux_arm.c -%{goroot}/src/pkg/runtime/zhashmap_linux_arm.c -%{goroot}/src/pkg/runtime/ziface_linux_arm.c -%{goroot}/src/pkg/runtime/zlfstack_linux_arm.c -%{goroot}/src/pkg/runtime/zrdebug_linux_arm.c -%{goroot}/src/pkg/runtime/zslice_linux_arm.c -%{goroot}/src/pkg/runtime/zsymtab_linux_arm.c -%endif - -%files pkg-linux-386 -f pkg-linux-386.list -%{goroot}/pkg/linux_386/ -%ifarch %{ix86} -%exclude %{goroot}/pkg/linux_386/runtime/cgo.a -%endif -%{goroot}/pkg/tool/linux_386/cgo -%{goroot}/pkg/tool/linux_386/fix -%{goroot}/pkg/tool/linux_386/yacc - -%files pkg-linux-amd64 -f pkg-linux-amd64.list -%{goroot}/pkg/linux_amd64/ -%ifarch x86_64 -%exclude %{goroot}/pkg/linux_amd64/runtime/cgo.a -%endif -%{goroot}/pkg/tool/linux_amd64/cgo -%{goroot}/pkg/tool/linux_amd64/fix -%{goroot}/pkg/tool/linux_amd64/yacc - -%files pkg-linux-arm -f pkg-linux-arm.list -%{goroot}/pkg/linux_arm/ -%ifarch %{arm} -%exclude %{goroot}/pkg/linux_arm/runtime/cgo.a -%endif -%{goroot}/pkg/tool/linux_arm/cgo -%{goroot}/pkg/tool/linux_arm/fix -%{goroot}/pkg/tool/linux_arm/yacc - -%files pkg-darwin-386 -f pkg-darwin-386.list -%{goroot}/pkg/darwin_386/ -%{goroot}/pkg/tool/darwin_386/ - -%files pkg-darwin-amd64 -f pkg-darwin-amd64.list -%{goroot}/pkg/darwin_amd64/ -%{goroot}/pkg/tool/darwin_amd64/ - -%files pkg-windows-386 -f pkg-windows-386.list -%{goroot}/pkg/windows_386/ -%{goroot}/pkg/tool/windows_386/ - -%files pkg-windows-amd64 -f pkg-windows-amd64.list -%{goroot}/pkg/windows_amd64/ -%{goroot}/pkg/tool/windows_amd64/ - -%files pkg-plan9-386 -f pkg-plan9-386.list -%{goroot}/pkg/plan9_386/ -%{goroot}/pkg/tool/plan9_386/ - -%files pkg-plan9-amd64 -f pkg-plan9-amd64.list -%{goroot}/pkg/plan9_amd64/ -%{goroot}/pkg/tool/plan9_amd64/ - -%files pkg-freebsd-386 -f pkg-freebsd-386.list -%{goroot}/pkg/freebsd_386/ -%{goroot}/pkg/tool/freebsd_386/ - -%files pkg-freebsd-amd64 -f pkg-freebsd-amd64.list -%{goroot}/pkg/freebsd_amd64/ -%{goroot}/pkg/tool/freebsd_amd64/ - -%files pkg-freebsd-arm -f pkg-freebsd-arm.list -%{goroot}/pkg/freebsd_arm/ -%{goroot}/pkg/tool/freebsd_arm/ - -%files pkg-netbsd-386 -f pkg-netbsd-386.list -%{goroot}/pkg/netbsd_386/ -%{goroot}/pkg/tool/netbsd_386/ - -%files pkg-netbsd-amd64 -f pkg-netbsd-amd64.list -%{goroot}/pkg/netbsd_amd64/ -%{goroot}/pkg/tool/netbsd_amd64/ - -%files pkg-netbsd-arm -f pkg-netbsd-arm.list -%{goroot}/pkg/netbsd_arm/ -%{goroot}/pkg/tool/netbsd_arm/ - -%files pkg-openbsd-386 -f pkg-openbsd-386.list -%{goroot}/pkg/openbsd_386/ -%{goroot}/pkg/tool/openbsd_386/ - -%files pkg-openbsd-amd64 -f pkg-openbsd-amd64.list -%{goroot}/pkg/openbsd_amd64/ -%{goroot}/pkg/tool/openbsd_amd64/ - -## skipping for now -#%files pkg-openbsd-arm -#%{goroot}/pkg/openbsd_arm/ -#%{goroot}/pkg/tool/openbsd_arm/ - - -%changelog -* Wed Oct 01 2014 Vincent Batts - 1.3.3-1 -- update to go1.3.3 (bz1146882) - -* Mon Sep 29 2014 Vincent Batts - 1.3.2-1 -- update to go1.3.2 (bz1147324) - -* Thu Sep 11 2014 Vincent Batts - 1.3.1-3 -- patching the tzinfo failure - -* Sat Aug 16 2014 Fedora Release Engineering - 1.3.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - -* Wed Aug 13 2014 Vincent Batts - 1.3.1-1 -- update to go1.3.1 - -* Wed Aug 13 2014 Vincent Batts - 1.3-11 -- merged a line wrong - -* Wed Aug 13 2014 Vincent Batts - 1.3-10 -- more work to get cgo.a timestamps to line up, due to build-env -- explicitly list all the files and directories for the source and packages trees -- touch all the built archives to be the same - -* Mon Aug 11 2014 Vincent Batts - 1.3-9 -- make golang-src 'noarch' again, since that was not a fix, and takes up more space - -* Mon Aug 11 2014 Vincent Batts - 1.3-8 -- update timestamps of source files during %%install bz1099206 - -* Fri Aug 08 2014 Vincent Batts - 1.3-7 -- update timestamps of source during %%install bz1099206 - -* Wed Aug 06 2014 Vincent Batts - 1.3-6 -- make the source subpackage arch'ed, instead of noarch - -* Mon Jul 21 2014 Vincent Batts - 1.3-5 -- fix the writing of pax headers - -* Tue Jul 15 2014 Vincent Batts - 1.3-4 -- fix the loading of gdb safe-path. bz981356 - -* Tue Jul 08 2014 Vincent Batts - 1.3-3 -- `go install std` requires gcc, to build cgo. bz1105901, bz1101508 - -* Mon Jul 07 2014 Vincent Batts - 1.3-2 -- archive/tar memory allocation improvements - -* Thu Jun 19 2014 Vincent Batts - 1.3-1 -- update to go1.3 - -* Fri Jun 13 2014 Vincent Batts - 1.3rc2-1 -- update to go1.3rc2 - -* Sat Jun 07 2014 Fedora Release Engineering - 1.3rc1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Tue Jun 03 2014 Vincent Batts 1.3rc1-1 -- update to go1.3rc1 -- new arch file shuffling - -* Wed May 21 2014 Vincent Batts 1.3beta2-1 -- update to go1.3beta2 -- no longer provides go-mode for xemacs (emacs only) - -* Wed May 21 2014 Vincent Batts 1.2.2-7 -- bz1099206 ghost files are not what is needed - -* Tue May 20 2014 Vincent Batts 1.2.2-6 -- bz1099206 more fixing. The packages %%post need golang-bin present first - -* Tue May 20 2014 Vincent Batts 1.2.2-5 -- bz1099206 more fixing. Let go fix its own timestamps and freshness - -* Tue May 20 2014 Vincent Batts 1.2.2-4 -- fix the existence and alternatives of `go` and `gofmt` - -* Mon May 19 2014 Vincent Batts 1.2.2-3 -- bz1099206 fix timestamp issue caused by koji builders - -* Fri May 09 2014 Vincent Batts 1.2.2-2 -- more arch file shuffling - -* Fri May 09 2014 Vincent Batts 1.2.2-1 -- update to go1.2.2 - -* Thu May 08 2014 Vincent Batts 1.2.1-8 -- RHEL6 rpm macros can't %%exlude missing files - -* Wed May 07 2014 Vincent Batts 1.2.1-7 -- missed two arch-dependent src files - -* Wed May 07 2014 Vincent Batts 1.2.1-6 -- put generated arch-dependent src in their respective RPMs - -* Fri Apr 11 2014 Vincent Batts 1.2.1-5 -- skip test that is causing a SIGABRT on fc21 bz1086900 - -* Thu Apr 10 2014 Vincent Batts 1.2.1-4 -- fixing file and directory ownership bz1010713 - -* Wed Apr 09 2014 Vincent Batts 1.2.1-3 -- including more to macros (%%go_arches) -- set a standard goroot as /usr/lib/golang, regardless of arch -- include sub-packages for compiler toolchains, for all golang supported architectures - -* Wed Mar 26 2014 Vincent Batts 1.2.1-2 -- provide a system rpm macros. Starting with %gopath - -* Tue Mar 04 2014 Adam Miller 1.2.1-1 -- Update to latest upstream - -* Thu Feb 20 2014 Adam Miller 1.2-7 -- Remove _BSD_SOURCE and _SVID_SOURCE, they are deprecated in recent - versions of glibc and aren't needed - -* Wed Feb 19 2014 Adam Miller 1.2-6 -- pull in upstream archive/tar implementation that supports xattr for - docker 0.8.1 - -* Tue Feb 18 2014 Vincent Batts 1.2-5 -- provide 'go', so users can yum install 'go' - -* Fri Jan 24 2014 Vincent Batts 1.2-4 -- skip a flaky test that is sporadically failing on the build server - -* Thu Jan 16 2014 Vincent Batts 1.2-3 -- remove golang-godoc dependency. cyclic dependency on compiling godoc - -* Wed Dec 18 2013 Vincent Batts - 1.2-2 -- removing P224 ECC curve - -* Mon Dec 2 2013 Vincent Batts - 1.2-1 -- Update to upstream 1.2 release -- remove the pax tar patches - -* Tue Nov 26 2013 Vincent Batts - 1.1.2-8 -- fix the rpmspec conditional for rhel and fedora - -* Thu Nov 21 2013 Vincent Batts - 1.1.2-7 -- patch tests for testing on rawhide -- let the same spec work for rhel and fedora - -* Wed Nov 20 2013 Vincent Batts - 1.1.2-6 -- don't symlink /usr/bin out to ../lib..., move the file -- seperate out godoc, to accomodate the go.tools godoc - -* Fri Sep 20 2013 Adam Miller - 1.1.2-5 -- Pull upstream patches for BZ#1010271 -- Add glibc requirement that got dropped because of meta dep fix - -* Fri Aug 30 2013 Adam Miller - 1.1.2-4 -- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) - -* Tue Aug 27 2013 Adam Miller - 1.1.2-3 -- Revert incorrect merged changelog - -* Tue Aug 27 2013 Adam Miller - 1.1.2-2 -- Update spec to fix changelog entries from bad merge - -* Tue Aug 20 2013 Adam Miller - 1.1.2-1 -- Update to latest upstream - -* Wed Jul 10 2013 Adam Goode - 1.1.1-5 -- Blacklist testdata files from prelink -- Again try to fix #973842 - -* Fri Jul 5 2013 Adam Goode - 1.1.1-4 -- Move src to libdir for now (#973842) (upstream issue https://code.google.com/p/go/issues/detail?id=5830) -- Eliminate noarch data package to work around RPM bug (#975909) -- Try to add runtime-gdb.py to the gdb safe-path (#981356) - -* Wed Jun 19 2013 Adam Goode - 1.1.1-3 -- Use lua for pretrans (http://fedoraproject.org/wiki/Packaging:Guidelines#The_.25pretrans_scriptlet) - -* Mon Jun 17 2013 Adam Goode - 1.1.1-2 -- Hopefully really fix #973842 -- Fix update from pre-1.1.1 (#974840) - -* Thu Jun 13 2013 Adam Goode - 1.1.1-1 -- Update to 1.1.1 -- Fix basically useless package (#973842) - -* Sat May 25 2013 Dan Horák - 1.1-3 -- set ExclusiveArch - -* Fri May 24 2013 Adam Goode - 1.1-2 -- Fix noarch package discrepancies - -* Fri May 24 2013 Adam Goode - 1.1-1 -- Initial Fedora release. -- Update to 1.1 - -* Thu May 9 2013 Adam Goode - 1.1-0.3.rc3 -- Update to rc3 - -* Thu Apr 11 2013 Adam Goode - 1.1-0.2.beta2 -- Update to beta2 - -* Tue Apr 9 2013 Adam Goode - 1.1-0.1.beta1 -- Initial packaging. diff --git a/macros.golang b/macros.golang deleted file mode 100644 index bc6b803..0000000 --- a/macros.golang +++ /dev/null @@ -1,8 +0,0 @@ -# Where to set GOPATH for builds. Like: -# export GOPATH=$(pwd)/_build:%{gopath} -%gopath %{_datadir}/gocode - -# for use like: -# ExclusiveArch: %{go_arches} -%go_arches %{ix86} x86_64 %{arm} - diff --git a/sources b/sources deleted file mode 100644 index 66155c8..0000000 --- a/sources +++ /dev/null @@ -1,2 +0,0 @@ -d76dc07e475b2905b5fec1cf319b6356 golang-19087:a15f344a9efa-xattrs.tar -2cdbad6baefcf1007f3cf54a5bc878b7 go1.3.3.src.tar.gz From aa501a2cd88372568446113fce8f47030e14d523 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 5 Aug 2015 16:45:13 -0400 Subject: [PATCH 33/67] upstream patches for net/http Fixes: bz1250353 bz1250352 bz1250374 --- ...dcb83d7f42d6aa72241240af99ded81118e9.patch | 135 +++++++++++ ...22585e32449860e624cace9d2e521deee62e.patch | 112 +++++++++ ...9a21583e7cf0149a778a0611e76ff7c6680f.patch | 225 ++++++++++++++++++ golang.spec | 16 +- 4 files changed, 487 insertions(+), 1 deletion(-) create mode 100644 117ddcb83d7f42d6aa72241240af99ded81118e9.patch create mode 100644 143822585e32449860e624cace9d2e521deee62e.patch create mode 100644 300d9a21583e7cf0149a778a0611e76ff7c6680f.patch diff --git a/117ddcb83d7f42d6aa72241240af99ded81118e9.patch b/117ddcb83d7f42d6aa72241240af99ded81118e9.patch new file mode 100644 index 0000000..bc8eb0b --- /dev/null +++ b/117ddcb83d7f42d6aa72241240af99ded81118e9.patch @@ -0,0 +1,135 @@ +commit 117ddcb83d7f42d6aa72241240af99ded81118e9 +Author: Brad Fitzpatrick +Date: Tue Jun 30 09:22:41 2015 -0700 + + net/textproto: don't treat spaces as hyphens in header keys + + This was originally done in https://codereview.appspot.com/5690059 + (Feb 2012) to deal with bad response headers coming back from webcams, + but it presents a potential security problem with HTTP request + smuggling for request headers containing "Content Length" instead of + "Content-Length". + + Part of overall HTTP hardening for request smuggling. See RFC 7230. + + Thanks to Régis Leroy for the report. + + Change-Id: I92b17fb637c9171c5774ea1437979ae2c17ca88a + Reviewed-on: https://go-review.googlesource.com/11772 + Reviewed-by: Russ Cox + Run-TryBot: Brad Fitzpatrick + TryBot-Result: Gobot Gobot + +diff --git a/src/net/http/header.go b/src/net/http/header.go +index 153b943..d847b13 100644 +--- a/src/net/http/header.go ++++ b/src/net/http/header.go +@@ -168,6 +168,8 @@ func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error { + // letter and any letter following a hyphen to upper case; + // the rest are converted to lowercase. For example, the + // canonical key for "accept-encoding" is "Accept-Encoding". ++// If s contains a space or invalid header field bytes, it is ++// returned without modifications. + func CanonicalHeaderKey(s string) string { return textproto.CanonicalMIMEHeaderKey(s) } + + // hasToken reports whether token appears with v, ASCII +diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go +index e4b8f6b..91303fe 100644 +--- a/src/net/textproto/reader.go ++++ b/src/net/textproto/reader.go +@@ -547,11 +547,16 @@ func (r *Reader) upcomingHeaderNewlines() (n int) { + // the rest are converted to lowercase. For example, the + // canonical key for "accept-encoding" is "Accept-Encoding". + // MIME header keys are assumed to be ASCII only. ++// If s contains a space or invalid header field bytes, it is ++// returned without modifications. + func CanonicalMIMEHeaderKey(s string) string { + // Quick check for canonical encoding. + upper := true + for i := 0; i < len(s); i++ { + c := s[i] ++ if !validHeaderFieldByte(c) { ++ return s ++ } + if upper && 'a' <= c && c <= 'z' { + return canonicalMIMEHeaderKey([]byte(s)) + } +@@ -565,19 +570,44 @@ func CanonicalMIMEHeaderKey(s string) string { + + const toLower = 'a' - 'A' + ++// validHeaderFieldByte reports whether b is a valid byte in a header ++// field key. This is actually stricter than RFC 7230, which says: ++// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / ++// "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA ++// token = 1*tchar ++// TODO: revisit in Go 1.6+ and possibly expand this. But note that many ++// servers have historically dropped '_' to prevent ambiguities when mapping ++// to CGI environment variables. ++func validHeaderFieldByte(b byte) bool { ++ return ('A' <= b && b <= 'Z') || ++ ('a' <= b && b <= 'z') || ++ ('0' <= b && b <= '9') || ++ b == '-' ++} ++ + // canonicalMIMEHeaderKey is like CanonicalMIMEHeaderKey but is + // allowed to mutate the provided byte slice before returning the + // string. ++// ++// For invalid inputs (if a contains spaces or non-token bytes), a ++// is unchanged and a string copy is returned. + func canonicalMIMEHeaderKey(a []byte) string { ++ // See if a looks like a header key. If not, return it unchanged. ++ for _, c := range a { ++ if validHeaderFieldByte(c) { ++ continue ++ } ++ // Don't canonicalize. ++ return string(a) ++ } ++ + upper := true + for i, c := range a { + // Canonicalize: first letter upper case + // and upper case after each dash. + // (Host, User-Agent, If-Modified-Since). + // MIME headers are ASCII only, so no Unicode issues. +- if c == ' ' { +- c = '-' +- } else if upper && 'a' <= c && c <= 'z' { ++ if upper && 'a' <= c && c <= 'z' { + c -= toLower + } else if !upper && 'A' <= c && c <= 'Z' { + c += toLower +diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go +index 6bbd993..8fce7dd 100644 +--- a/src/net/textproto/reader_test.go ++++ b/src/net/textproto/reader_test.go +@@ -24,11 +24,14 @@ var canonicalHeaderKeyTests = []canonicalHeaderKeyTest{ + {"uSER-aGENT", "User-Agent"}, + {"user-agent", "User-Agent"}, + {"USER-AGENT", "User-Agent"}, +- {"üser-agenT", "üser-Agent"}, // non-ASCII unchanged ++ ++ // Non-ASCII or anything with spaces or non-token chars is unchanged: ++ {"üser-agenT", "üser-agenT"}, ++ {"a B", "a B"}, + + // This caused a panic due to mishandling of a space: +- {"C Ontent-Transfer-Encoding", "C-Ontent-Transfer-Encoding"}, +- {"foo bar", "Foo-Bar"}, ++ {"C Ontent-Transfer-Encoding", "C Ontent-Transfer-Encoding"}, ++ {"foo bar", "foo bar"}, + } + + func TestCanonicalMIMEHeaderKey(t *testing.T) { +@@ -194,7 +197,7 @@ func TestReadMIMEHeaderNonCompliant(t *testing.T) { + "Foo": {"bar"}, + "Content-Language": {"en"}, + "Sid": {"0"}, +- "Audio-Mode": {"None"}, ++ "Audio Mode": {"None"}, + "Privilege": {"127"}, + } + if !reflect.DeepEqual(m, want) || err != nil { diff --git a/143822585e32449860e624cace9d2e521deee62e.patch b/143822585e32449860e624cace9d2e521deee62e.patch new file mode 100644 index 0000000..b11edc6 --- /dev/null +++ b/143822585e32449860e624cace9d2e521deee62e.patch @@ -0,0 +1,112 @@ +commit 143822585e32449860e624cace9d2e521deee62e +Author: Brad Fitzpatrick +Date: Tue Jul 7 13:19:44 2015 -0600 + + net/http: revert overly-strict part of earlier smuggling defense + + The recent https://golang.org/cl/11810 is reportedly a bit too + aggressive. + + Apparently some HTTP requests in the wild do contain both a + Transfer-Encoding along with a bogus Content-Length. Instead of + returning a 400 Bad Request error, we should just ignore the + Content-Length like we did before. + + Change-Id: I0001be90d09f8293a34f04691f608342875ff5c4 + Reviewed-on: https://go-review.googlesource.com/11962 + Reviewed-by: Andrew Gerrand + Run-TryBot: Brad Fitzpatrick + TryBot-Result: Gobot Gobot + +diff --git a/src/net/http/readrequest_test.go b/src/net/http/readrequest_test.go +index 1a3cf91..60e2be4 100644 +--- a/src/net/http/readrequest_test.go ++++ b/src/net/http/readrequest_test.go +@@ -178,6 +178,36 @@ var reqTests = []reqTest{ + noError, + }, + ++ // Tests chunked body and a bogus Content-Length which should be deleted. ++ { ++ "POST / HTTP/1.1\r\n" + ++ "Host: foo.com\r\n" + ++ "Transfer-Encoding: chunked\r\n" + ++ "Content-Length: 9999\r\n\r\n" + // to be removed. ++ "3\r\nfoo\r\n" + ++ "3\r\nbar\r\n" + ++ "0\r\n" + ++ "\r\n", ++ &Request{ ++ Method: "POST", ++ URL: &url.URL{ ++ Path: "/", ++ }, ++ TransferEncoding: []string{"chunked"}, ++ Proto: "HTTP/1.1", ++ ProtoMajor: 1, ++ ProtoMinor: 1, ++ Header: Header{}, ++ ContentLength: -1, ++ Host: "foo.com", ++ RequestURI: "/", ++ }, ++ ++ "foobar", ++ noTrailer, ++ noError, ++ }, ++ + // CONNECT request with domain name: + { + "CONNECT www.google.com:443 HTTP/1.1\r\n\r\n", +@@ -400,11 +430,6 @@ Content-Length: 3 + Content-Length: 4 + + abc`)}, +- {"smuggle_chunked_and_len", reqBytes(`POST / HTTP/1.1 +-Transfer-Encoding: chunked +-Content-Length: 3 +- +-abc`)}, + {"smuggle_content_len_head", reqBytes(`HEAD / HTTP/1.1 + Host: foo + Content-Length: 5`)}, +diff --git a/src/net/http/transfer.go b/src/net/http/transfer.go +index 3c868bd..fbbbf24 100644 +--- a/src/net/http/transfer.go ++++ b/src/net/http/transfer.go +@@ -430,7 +430,6 @@ func fixTransferEncoding(isResponse bool, requestMethod string, header Header) ( + if !present { + return nil, nil + } +- isRequest := !isResponse + delete(header, "Transfer-Encoding") + + encodings := strings.Split(raw[0], ",") +@@ -458,12 +457,20 @@ func fixTransferEncoding(isResponse bool, requestMethod string, header Header) ( + // RFC 7230 3.3.2 says "A sender MUST NOT send a + // Content-Length header field in any message that + // contains a Transfer-Encoding header field." +- if len(header["Content-Length"]) > 0 { +- if isRequest { +- return nil, errors.New("http: invalid Content-Length with Transfer-Encoding") +- } +- delete(header, "Content-Length") +- } ++ // ++ // but also: ++ // "If a message is received with both a ++ // Transfer-Encoding and a Content-Length header ++ // field, the Transfer-Encoding overrides the ++ // Content-Length. Such a message might indicate an ++ // attempt to perform request smuggling (Section 9.5) ++ // or response splitting (Section 9.4) and ought to be ++ // handled as an error. A sender MUST remove the ++ // received Content-Length field prior to forwarding ++ // such a message downstream." ++ // ++ // Reportedly, these appear in the wild. ++ delete(header, "Content-Length") + return te, nil + } + diff --git a/300d9a21583e7cf0149a778a0611e76ff7c6680f.patch b/300d9a21583e7cf0149a778a0611e76ff7c6680f.patch new file mode 100644 index 0000000..1027032 --- /dev/null +++ b/300d9a21583e7cf0149a778a0611e76ff7c6680f.patch @@ -0,0 +1,225 @@ +commit 300d9a21583e7cf0149a778a0611e76ff7c6680f +Author: Brad Fitzpatrick +Date: Tue Jun 30 14:21:15 2015 -0700 + + net/http: harden Server against request smuggling + + See RFC 7230. + + Thanks to Régis Leroy for the report. + + Change-Id: Ic1779bc2180900430d4d7a4938cac04ed73c304c + Reviewed-on: https://go-review.googlesource.com/11810 + Reviewed-by: Russ Cox + Run-TryBot: Brad Fitzpatrick + +diff --git a/src/net/http/readrequest_test.go b/src/net/http/readrequest_test.go +index e930d99..1a3cf91 100644 +--- a/src/net/http/readrequest_test.go ++++ b/src/net/http/readrequest_test.go +@@ -9,6 +9,7 @@ import ( + "bytes" + "fmt" + "io" ++ "io/ioutil" + "net/url" + "reflect" + "strings" +@@ -323,6 +324,32 @@ var reqTests = []reqTest{ + noTrailer, + noError, + }, ++ ++ // HEAD with Content-Length 0. Make sure this is permitted, ++ // since I think we used to send it. ++ { ++ "HEAD / HTTP/1.1\r\nHost: issue8261.com\r\nConnection: close\r\nContent-Length: 0\r\n\r\n", ++ &Request{ ++ Method: "HEAD", ++ URL: &url.URL{ ++ Path: "/", ++ }, ++ Header: Header{ ++ "Connection": []string{"close"}, ++ "Content-Length": []string{"0"}, ++ }, ++ Host: "issue8261.com", ++ Proto: "HTTP/1.1", ++ ProtoMajor: 1, ++ ProtoMinor: 1, ++ Close: true, ++ RequestURI: "/", ++ }, ++ ++ noBody, ++ noTrailer, ++ noError, ++ }, + } + + func TestReadRequest(t *testing.T) { +@@ -356,3 +383,39 @@ func TestReadRequest(t *testing.T) { + } + } + } ++ ++// reqBytes treats req as a request (with \n delimiters) and returns it with \r\n delimiters, ++// ending in \r\n\r\n ++func reqBytes(req string) []byte { ++ return []byte(strings.Replace(strings.TrimSpace(req), "\n", "\r\n", -1) + "\r\n\r\n") ++} ++ ++var badRequestTests = []struct { ++ name string ++ req []byte ++}{ ++ {"bad_connect_host", reqBytes("CONNECT []%20%48%54%54%50%2f%31%2e%31%0a%4d%79%48%65%61%64%65%72%3a%20%31%32%33%0a%0a HTTP/1.0")}, ++ {"smuggle_two_contentlen", reqBytes(`POST / HTTP/1.1 ++Content-Length: 3 ++Content-Length: 4 ++ ++abc`)}, ++ {"smuggle_chunked_and_len", reqBytes(`POST / HTTP/1.1 ++Transfer-Encoding: chunked ++Content-Length: 3 ++ ++abc`)}, ++ {"smuggle_content_len_head", reqBytes(`HEAD / HTTP/1.1 ++Host: foo ++Content-Length: 5`)}, ++} ++ ++func TestReadRequest_Bad(t *testing.T) { ++ for _, tt := range badRequestTests { ++ got, err := ReadRequest(bufio.NewReader(bytes.NewReader(tt.req))) ++ if err == nil { ++ all, err := ioutil.ReadAll(got.Body) ++ t.Errorf("%s: got unexpected request = %#v\n Body = %q, %v", tt.name, got, all, err) ++ } ++ } ++} +diff --git a/src/net/http/transfer.go b/src/net/http/transfer.go +index 5205003..3887604 100644 +--- a/src/net/http/transfer.go ++++ b/src/net/http/transfer.go +@@ -143,6 +143,9 @@ func (t *transferWriter) shouldSendContentLength() bool { + return true + } + if t.ContentLength == 0 && isIdentity(t.TransferEncoding) { ++ if t.Method == "GET" || t.Method == "HEAD" { ++ return false ++ } + return true + } + +@@ -310,6 +313,7 @@ func readTransfer(msg interface{}, r *bufio.Reader) (err error) { + } + case *Request: + t.Header = rr.Header ++ t.RequestMethod = rr.Method + t.ProtoMajor = rr.ProtoMajor + t.ProtoMinor = rr.ProtoMinor + // Transfer semantics for Requests are exactly like those for +@@ -325,7 +329,7 @@ func readTransfer(msg interface{}, r *bufio.Reader) (err error) { + } + + // Transfer encoding, content length +- t.TransferEncoding, err = fixTransferEncoding(t.RequestMethod, t.Header) ++ t.TransferEncoding, err = fixTransferEncoding(isResponse, t.RequestMethod, t.Header) + if err != nil { + return err + } +@@ -413,12 +417,12 @@ func chunked(te []string) bool { return len(te) > 0 && te[0] == "chunked" } + func isIdentity(te []string) bool { return len(te) == 1 && te[0] == "identity" } + + // Sanitize transfer encoding +-func fixTransferEncoding(requestMethod string, header Header) ([]string, error) { ++func fixTransferEncoding(isResponse bool, requestMethod string, header Header) ([]string, error) { + raw, present := header["Transfer-Encoding"] + if !present { + return nil, nil + } +- ++ isRequest := !isResponse + delete(header, "Transfer-Encoding") + + encodings := strings.Split(raw[0], ",") +@@ -443,10 +447,15 @@ func fixTransferEncoding(requestMethod string, header Header) ([]string, error) + return nil, &badStringError{"too many transfer encodings", strings.Join(te, ",")} + } + if len(te) > 0 { +- // Chunked encoding trumps Content-Length. See RFC 2616 +- // Section 4.4. Currently len(te) > 0 implies chunked +- // encoding. +- delete(header, "Content-Length") ++ // RFC 7230 3.3.2 says "A sender MUST NOT send a ++ // Content-Length header field in any message that ++ // contains a Transfer-Encoding header field." ++ if len(header["Content-Length"]) > 0 { ++ if isRequest { ++ return nil, errors.New("http: invalid Content-Length with Transfer-Encoding") ++ } ++ delete(header, "Content-Length") ++ } + return te, nil + } + +@@ -457,9 +466,17 @@ func fixTransferEncoding(requestMethod string, header Header) ([]string, error) + // function is not a method, because ultimately it should be shared by + // ReadResponse and ReadRequest. + func fixLength(isResponse bool, status int, requestMethod string, header Header, te []string) (int64, error) { +- ++ contentLens := header["Content-Length"] ++ isRequest := !isResponse + // Logic based on response type or status + if noBodyExpected(requestMethod) { ++ // For HTTP requests, as part of hardening against request ++ // smuggling (RFC 7230), don't allow a Content-Length header for ++ // methods which don't permit bodies. As an exception, allow ++ // exactly one Content-Length header if its value is "0". ++ if isRequest && len(contentLens) > 0 && !(len(contentLens) == 1 && contentLens[0] == "0") { ++ return 0, fmt.Errorf("http: method cannot contain a Content-Length; got %q", contentLens) ++ } + return 0, nil + } + if status/100 == 1 { +@@ -470,13 +487,21 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header, + return 0, nil + } + ++ if len(contentLens) > 1 { ++ // harden against HTTP request smuggling. See RFC 7230. ++ return 0, errors.New("http: message cannot contain multiple Content-Length headers") ++ } ++ + // Logic based on Transfer-Encoding + if chunked(te) { + return -1, nil + } + + // Logic based on Content-Length +- cl := strings.TrimSpace(header.get("Content-Length")) ++ var cl string ++ if len(contentLens) == 1 { ++ cl = strings.TrimSpace(contentLens[0]) ++ } + if cl != "" { + n, err := parseContentLength(cl) + if err != nil { +@@ -487,11 +512,14 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header, + header.Del("Content-Length") + } + +- if !isResponse && requestMethod == "GET" { +- // RFC 2616 doesn't explicitly permit nor forbid an ++ if !isResponse { ++ // RFC 2616 neither explicitly permits nor forbids an + // entity-body on a GET request so we permit one if + // declared, but we default to 0 here (not -1 below) + // if there's no mention of a body. ++ // Likewise, all other request methods are assumed to have ++ // no body if neither Transfer-Encoding chunked nor a ++ // Content-Length are set. + return 0, nil + } + diff --git a/golang.spec b/golang.spec index 33cff31..dd8281d 100644 --- a/golang.spec +++ b/golang.spec @@ -40,7 +40,7 @@ Name: golang Version: 1.4.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Go Programming Language License: BSD @@ -68,6 +68,12 @@ Patch0: golang-1.2-verbose-build.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1038683 Patch1: golang-1.2-remove-ECC-p224.patch +# TODO this should be removed with go1.4.3 +# https://bugzilla.redhat.com/show_bug.cgi?id=1250352 +Patch100: 300d9a21583e7cf0149a778a0611e76ff7c6680f.patch +Patch101: 117ddcb83d7f42d6aa72241240af99ded81118e9.patch +Patch102: 143822585e32449860e624cace9d2e521deee62e.patch + # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -324,6 +330,11 @@ end # remove the P224 curve %patch1 -p1 +# bz1250352 +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 + %build # set up final install location export GOROOT_FINAL=%{goroot} @@ -739,6 +750,9 @@ fi %changelog +* Wed Aug 05 2015 Vincent Batts - 1.4.2-3 +- bz1250352 + * Wed Mar 18 2015 Vincent Batts - 1.4.2-2 - obsoleting deprecated packages From 821a201d206bb640a224ca80576d905f02d9b3a7 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 1 Sep 2015 12:16:22 -0400 Subject: [PATCH 34/67] remove f23-only history --- golang.spec | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/golang.spec b/golang.spec index 97d30cb..351d834 100644 --- a/golang.spec +++ b/golang.spec @@ -447,43 +447,6 @@ fi * Thu Aug 20 2015 Vincent Batts - 1.5-1 - updating to go1.5 -* Thu Aug 06 2015 Vincent Batts - 1.5-0.11.rc1 -- fixing the sources reference - -* Thu Aug 06 2015 Vincent Batts - 1.5-0.10.rc1 -- updating to go1.5rc1 -- checks are back in place - -* Tue Aug 04 2015 Vincent Batts - 1.5-0.9.beta3 -- pull in upstream archive/tar fix - -* Thu Jul 30 2015 Vincent Batts - 1.5-0.8.beta3 -- updating to go1.5beta3 - -* Thu Jul 30 2015 Vincent Batts - 1.5-0.7.beta2 -- add the patch .. - -* Thu Jul 30 2015 Vincent Batts - 1.5-0.6.beta2 -- increase ELFRESERVE (bz1248071) - -* Tue Jul 28 2015 Lokesh Mandvekar - 1.5-0.5.beta2 -- correct package version and release tags as per naming guidelines - -* Fri Jul 17 2015 Vincent Batts - 1.4.99-4.1.5beta2 -- adding test output, for visibility - -* Fri Jul 10 2015 Vincent Batts - 1.4.99-3.1.5beta2 -- updating to go1.5beta2 - -* Fri Jul 10 2015 Vincent Batts - 1.4.99-2.1.5beta1 -- add checksum to sources and fixed one patch - -* Fri Jul 10 2015 Vincent Batts - 1.4.99-1.1.5beta1 -- updating to go1.5beta1 - -* Wed Jun 17 2015 Fedora Release Engineering - 1.4.2-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - * Wed Aug 05 2015 Vincent Batts - 1.4.2-3 - bz1250352 From 682f928b4cca144d72f6b53695ca6fa47aeb049b Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 9 Sep 2015 10:33:51 -0400 Subject: [PATCH 35/67] update to go1.5.1 --- .gitignore | 1 + golang.spec | 9 ++++++--- sources | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7995a4a..5c0b29a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ /go1.5beta3.src.tar.gz /go1.5rc1.src.tar.gz /go1.5.src.tar.gz +/go1.5.1.src.tar.gz diff --git a/golang.spec b/golang.spec index 70ab8f4..5c996d7 100644 --- a/golang.spec +++ b/golang.spec @@ -43,11 +43,11 @@ %endif %global go_api 1.5 -%global go_version 1.5 +%global go_version 1.5.1 Name: golang -Version: 1.5 -Release: 6%{?dist} +Version: 1.5.1 +Release: 0%{?dist} Summary: The Go Programming Language License: BSD @@ -427,6 +427,9 @@ fi %endif %changelog +* Wed Sep 09 2015 Vincent Batts - 1.5.1-0 +- update to go1.5.1 + * Thu Aug 27 2015 Vincent Batts - 1.5-6 - starting a shared object subpackage. This will be x86_64 only until upstream supports more arches shared objects. diff --git a/sources b/sources index 259d362..23e64bc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3f072baece07fa42d18376419afad323 go1.5.src.tar.gz +4adfbdfca523cc1c229be8a321f3602f go1.5.1.src.tar.gz From 27c6fb3111d21909a6a94589649af5889f35e25c Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 19 Oct 2015 20:32:59 -0400 Subject: [PATCH 36/67] bz1271709 fix from upstream --- golang-1.5.1-a3156aaa12.patch | 309 ++++++++++++++++++++++++++++++++++ golang.spec | 10 +- 2 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 golang-1.5.1-a3156aaa12.patch diff --git a/golang-1.5.1-a3156aaa12.patch b/golang-1.5.1-a3156aaa12.patch new file mode 100644 index 0000000..afff18d --- /dev/null +++ b/golang-1.5.1-a3156aaa12.patch @@ -0,0 +1,309 @@ +commit a3156aaa121446c4136927f8c2139fefe05ba82c +Author: Brad Fitzpatrick +Date: Tue Sep 29 14:26:48 2015 -0700 + + net/http/httptest: change Server to use http.Server.ConnState for accounting + + With this CL, httptest.Server now uses connection-level accounting of + outstanding requests instead of ServeHTTP-level accounting. This is + more robust and results in a non-racy shutdown. + + This is much easier now that net/http.Server has the ConnState hook. + + Fixes #12789 + Fixes #12781 + + Change-Id: I098cf334a6494316acb66cd07df90766df41764b + Reviewed-on: https://go-review.googlesource.com/15151 + Reviewed-by: Andrew Gerrand + Run-TryBot: Brad Fitzpatrick + TryBot-Result: Gobot Gobot + +diff --git a/src/net/http/httptest/server.go b/src/net/http/httptest/server.go +index 96eb0ef..e4f680f 100644 +--- a/src/net/http/httptest/server.go ++++ b/src/net/http/httptest/server.go +@@ -7,13 +7,17 @@ + package httptest + + import ( ++ "bytes" + "crypto/tls" + "flag" + "fmt" ++ "log" + "net" + "net/http" + "os" ++ "runtime" + "sync" ++ "time" + ) + + // A Server is an HTTP server listening on a system-chosen port on the +@@ -34,24 +38,10 @@ type Server struct { + // wg counts the number of outstanding HTTP requests on this server. + // Close blocks until all requests are finished. + wg sync.WaitGroup +-} +- +-// historyListener keeps track of all connections that it's ever +-// accepted. +-type historyListener struct { +- net.Listener +- sync.Mutex // protects history +- history []net.Conn +-} + +-func (hs *historyListener) Accept() (c net.Conn, err error) { +- c, err = hs.Listener.Accept() +- if err == nil { +- hs.Lock() +- hs.history = append(hs.history, c) +- hs.Unlock() +- } +- return ++ mu sync.Mutex // guards closed and conns ++ closed bool ++ conns map[net.Conn]http.ConnState // except terminal states + } + + func newLocalListener() net.Listener { +@@ -103,10 +93,9 @@ func (s *Server) Start() { + if s.URL != "" { + panic("Server already started") + } +- s.Listener = &historyListener{Listener: s.Listener} + s.URL = "http://" + s.Listener.Addr().String() +- s.wrapHandler() +- go s.Config.Serve(s.Listener) ++ s.wrap() ++ s.goServe() + if *serve != "" { + fmt.Fprintln(os.Stderr, "httptest: serving on", s.URL) + select {} +@@ -134,23 +123,10 @@ func (s *Server) StartTLS() { + if len(s.TLS.Certificates) == 0 { + s.TLS.Certificates = []tls.Certificate{cert} + } +- tlsListener := tls.NewListener(s.Listener, s.TLS) +- +- s.Listener = &historyListener{Listener: tlsListener} ++ s.Listener = tls.NewListener(s.Listener, s.TLS) + s.URL = "https://" + s.Listener.Addr().String() +- s.wrapHandler() +- go s.Config.Serve(s.Listener) +-} +- +-func (s *Server) wrapHandler() { +- h := s.Config.Handler +- if h == nil { +- h = http.DefaultServeMux +- } +- s.Config.Handler = &waitGroupHandler{ +- s: s, +- h: h, +- } ++ s.wrap() ++ s.goServe() + } + + // NewTLSServer starts and returns a new Server using TLS. +@@ -161,43 +137,139 @@ func NewTLSServer(handler http.Handler) *Server { + return ts + } + ++type closeIdleTransport interface { ++ CloseIdleConnections() ++} ++ + // Close shuts down the server and blocks until all outstanding + // requests on this server have completed. + func (s *Server) Close() { +- s.Listener.Close() +- s.wg.Wait() +- s.CloseClientConnections() +- if t, ok := http.DefaultTransport.(*http.Transport); ok { ++ s.mu.Lock() ++ if !s.closed { ++ s.closed = true ++ s.Listener.Close() ++ s.Config.SetKeepAlivesEnabled(false) ++ for c, st := range s.conns { ++ if st == http.StateIdle { ++ s.closeConn(c) ++ } ++ } ++ // If this server doesn't shut down in 5 seconds, tell the user why. ++ t := time.AfterFunc(5*time.Second, s.logCloseHangDebugInfo) ++ defer t.Stop() ++ } ++ s.mu.Unlock() ++ ++ // Not part of httptest.Server's correctness, but assume most ++ // users of httptest.Server will be using the standard ++ // transport, so help them out and close any idle connections for them. ++ if t, ok := http.DefaultTransport.(closeIdleTransport); ok { + t.CloseIdleConnections() + } ++ ++ s.wg.Wait() + } + +-// CloseClientConnections closes any currently open HTTP connections +-// to the test Server. ++func (s *Server) logCloseHangDebugInfo() { ++ s.mu.Lock() ++ defer s.mu.Unlock() ++ var buf bytes.Buffer ++ buf.WriteString("httptest.Server blocked in Close after 5 seconds, waiting for connections:\n") ++ for c, st := range s.conns { ++ fmt.Fprintf(&buf, " %T %p %v in state %v\n", c, c, c.RemoteAddr(), st) ++ } ++ log.Print(buf.String()) ++} ++ ++// CloseClientConnections closes any open HTTP connections to the test Server. + func (s *Server) CloseClientConnections() { +- hl, ok := s.Listener.(*historyListener) +- if !ok { +- return ++ s.mu.Lock() ++ defer s.mu.Unlock() ++ for c := range s.conns { ++ s.closeConn(c) + } +- hl.Lock() +- for _, conn := range hl.history { +- conn.Close() ++} ++ ++func (s *Server) goServe() { ++ s.wg.Add(1) ++ go func() { ++ defer s.wg.Done() ++ s.Config.Serve(s.Listener) ++ }() ++} ++ ++// wrap installs the connection state-tracking hook to know which ++// connections are idle. ++func (s *Server) wrap() { ++ oldHook := s.Config.ConnState ++ s.Config.ConnState = func(c net.Conn, cs http.ConnState) { ++ s.mu.Lock() ++ defer s.mu.Unlock() ++ switch cs { ++ case http.StateNew: ++ s.wg.Add(1) ++ if _, exists := s.conns[c]; exists { ++ panic("invalid state transition") ++ } ++ if s.conns == nil { ++ s.conns = make(map[net.Conn]http.ConnState) ++ } ++ s.conns[c] = cs ++ if s.closed { ++ // Probably just a socket-late-binding dial from ++ // the default transport that lost the race (and ++ // thus this connection is now idle and will ++ // never be used). ++ s.closeConn(c) ++ } ++ case http.StateActive: ++ if oldState, ok := s.conns[c]; ok { ++ if oldState != http.StateNew && oldState != http.StateIdle { ++ panic("invalid state transition") ++ } ++ s.conns[c] = cs ++ } ++ case http.StateIdle: ++ if oldState, ok := s.conns[c]; ok { ++ if oldState != http.StateActive { ++ panic("invalid state transition") ++ } ++ s.conns[c] = cs ++ } ++ if s.closed { ++ s.closeConn(c) ++ } ++ case http.StateHijacked, http.StateClosed: ++ s.forgetConn(c) ++ } ++ if oldHook != nil { ++ oldHook(c, cs) ++ } + } +- hl.Unlock() + } + +-// waitGroupHandler wraps a handler, incrementing and decrementing a +-// sync.WaitGroup on each request, to enable Server.Close to block +-// until outstanding requests are finished. +-type waitGroupHandler struct { +- s *Server +- h http.Handler // non-nil ++// closeConn closes c. Except on plan9, which is special. See comment below. ++// s.mu must be held. ++func (s *Server) closeConn(c net.Conn) { ++ if runtime.GOOS == "plan9" { ++ // Go's Plan 9 net package isn't great at unblocking reads when ++ // their underlying TCP connections are closed. Don't trust ++ // that that the ConnState state machine will get to ++ // StateClosed. Instead, just go there directly. Plan 9 may leak ++ // resources if the syscall doesn't end up returning. Oh well. ++ s.forgetConn(c) ++ } ++ go c.Close() + } + +-func (h *waitGroupHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +- h.s.wg.Add(1) +- defer h.s.wg.Done() // a defer, in case ServeHTTP below panics +- h.h.ServeHTTP(w, r) ++// forgetConn removes c from the set of tracked conns and decrements it from the ++// waitgroup, unless it was previously removed. ++// s.mu must be held. ++func (s *Server) forgetConn(c net.Conn) { ++ if _, ok := s.conns[c]; ok { ++ delete(s.conns, c) ++ s.wg.Done() ++ } + } + + // localhostCert is a PEM-encoded TLS cert with SAN IPs +diff --git a/src/net/http/httptest/server_test.go b/src/net/http/httptest/server_test.go +index 500a9f0..90901ce 100644 +--- a/src/net/http/httptest/server_test.go ++++ b/src/net/http/httptest/server_test.go +@@ -27,3 +27,30 @@ func TestServer(t *testing.T) { + t.Errorf("got %q, want hello", string(got)) + } + } ++ ++// Issue 12781 ++func TestGetAfterClose(t *testing.T) { ++ ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ++ w.Write([]byte("hello")) ++ })) ++ ++ res, err := http.Get(ts.URL) ++ if err != nil { ++ t.Fatal(err) ++ } ++ got, err := ioutil.ReadAll(res.Body) ++ if err != nil { ++ t.Fatal(err) ++ } ++ if string(got) != "hello" { ++ t.Fatalf("got %q, want hello", string(got)) ++ } ++ ++ ts.Close() ++ ++ res, err = http.Get(ts.URL) ++ if err == nil { ++ body, _ := ioutil.ReadAll(res.Body) ++ t.Fatalf("Unexected response after close: %v, %v, %s", res.Status, res.Header, body) ++ } ++} diff --git a/golang.spec b/golang.spec index 5c996d7..7d53ef8 100644 --- a/golang.spec +++ b/golang.spec @@ -47,7 +47,7 @@ Name: golang Version: 1.5.1 -Release: 0%{?dist} +Release: 1%{?dist} Summary: The Go Programming Language License: BSD @@ -86,6 +86,9 @@ Patch214: go1.5beta2-disable-TestCloneNEWUSERAndRemapNoRootDisableSetgroup # 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 +# https://bugzilla.redhat.com/show_bug.cgi?id=1271709 +Patch216: ./golang-1.5.1-a3156aaa12.patch + # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -211,6 +214,8 @@ Summary: Golang shared object libraries # disable TestCloneNEWUSERAndRemapNoRootDisableSetgroups %patch214 -p1 +%patch216 -p1 + %build # go1.5 bootstrapping. The compiler is written in golang. export GOROOT_BOOTSTRAP=%{goroot} @@ -427,6 +432,9 @@ fi %endif %changelog +* Mon Oct 19 2015 Vincent Batts - 1.5.1-1 +- bz1271709 include patch from upstream fix + * Wed Sep 09 2015 Vincent Batts - 1.5.1-0 - update to go1.5.1 From fd042bef95564711068e5b1e3caed2400491413f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 23 Sep 2016 15:27:32 +0200 Subject: [PATCH 37/67] rebase to go1.7.1 Resolves: BZ#1293449 - CVE-2015-8618, BZ#1357601 - CVE-2016-5386, BZ#1324345 - CVE-2016-3959, BZ#1376555 --- .gitignore | 1 + go1.5beta1-disable-TestGdbPython.patch | 15 +++-- golang-1.2-remove-ECC-p224.patch | 54 +++++++++-------- golang-1.5-bootstrap-binary-path.patch | 41 +++++++------ golang.spec | 84 +++++++++++++++----------- sources | 2 +- 6 files changed, 108 insertions(+), 89 deletions(-) diff --git a/.gitignore b/.gitignore index 5c0b29a..4908d1b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ /go1.5rc1.src.tar.gz /go1.5.src.tar.gz /go1.5.1.src.tar.gz +/go1.7.1.src.tar.gz diff --git a/go1.5beta1-disable-TestGdbPython.patch b/go1.5beta1-disable-TestGdbPython.patch index 8e0491f..89d7d68 100644 --- a/go1.5beta1-disable-TestGdbPython.patch +++ b/go1.5beta1-disable-TestGdbPython.patch @@ -1,13 +1,12 @@ -diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go -index f4014b2..2c09441 100644 ---- a/src/runtime/runtime-gdb_test.go -+++ b/src/runtime/runtime-gdb_test.go -@@ -38,7 +38,7 @@ func main() { +diff -up go/src/runtime/runtime-gdb_test.go.gdb go/src/runtime/runtime-gdb_test.go +--- go/src/runtime/runtime-gdb_test.go.gdb 2016-04-28 10:31:13.005689813 +0200 ++++ go/src/runtime/runtime-gdb_test.go 2016-04-28 10:32:12.202935125 +0200 +@@ -72,7 +72,7 @@ func main() { } ` -func TestGdbPython(t *testing.T) { +func testGdbPython(t *testing.T) { - if runtime.GOOS == "darwin" { - t.Skip("gdb does not work on darwin") - } + checkGdbEnvironment(t) + checkGdbVersion(t) + checkGdbPython(t) diff --git a/golang-1.2-remove-ECC-p224.patch b/golang-1.2-remove-ECC-p224.patch index 85abbb3..2b2d1a1 100644 --- a/golang-1.2-remove-ECC-p224.patch +++ b/golang-1.2-remove-ECC-p224.patch @@ -1,9 +1,3 @@ -commit f8eb1e50541c8a9e55545d7470dbeab96073a632 -Author: Vincent Batts -Date: Thu Jul 16 11:38:45 2015 -0400 - - p224 - diff --git a/api/go1.txt b/api/go1.txt index 5e3dea5..1a1ee83 100644 --- a/api/go1.txt @@ -17,7 +11,7 @@ index 5e3dea5..1a1ee83 100644 pkg crypto/elliptic, func P384() Curve pkg crypto/elliptic, func P521() Curve diff --git a/src/crypto/ecdsa/ecdsa_test.go b/src/crypto/ecdsa/ecdsa_test.go -index 169944d..c653464 100644 +index fc25fd7..356e617 100644 --- a/src/crypto/ecdsa/ecdsa_test.go +++ b/src/crypto/ecdsa/ecdsa_test.go @@ -33,11 +33,10 @@ func testKeyGeneration(t *testing.T, c elliptic.Curve, tag string) { @@ -33,7 +27,7 @@ index 169944d..c653464 100644 testKeyGeneration(t, elliptic.P384(), "p384") testKeyGeneration(t, elliptic.P521(), "p521") } -@@ -63,11 +62,10 @@ func testSignAndVerify(t *testing.T, c elliptic.Curve, tag string) { +@@ -98,11 +97,10 @@ func testSignAndVerify(t *testing.T, c elliptic.Curve, tag string) { } func TestSignAndVerify(t *testing.T) { @@ -46,7 +40,7 @@ index 169944d..c653464 100644 testSignAndVerify(t, elliptic.P384(), "p384") testSignAndVerify(t, elliptic.P521(), "p521") } -@@ -100,11 +98,10 @@ func testNonceSafety(t *testing.T, c elliptic.Curve, tag string) { +@@ -135,11 +133,10 @@ func testNonceSafety(t *testing.T, c elliptic.Curve, tag string) { } func TestNonceSafety(t *testing.T) { @@ -59,7 +53,7 @@ index 169944d..c653464 100644 testNonceSafety(t, elliptic.P384(), "p384") testNonceSafety(t, elliptic.P521(), "p521") } -@@ -135,11 +132,10 @@ func testINDCCA(t *testing.T, c elliptic.Curve, tag string) { +@@ -170,11 +167,10 @@ func testINDCCA(t *testing.T, c elliptic.Curve, tag string) { } func TestINDCCA(t *testing.T) { @@ -72,7 +66,7 @@ index 169944d..c653464 100644 testINDCCA(t, elliptic.P384(), "p384") testINDCCA(t, elliptic.P521(), "p521") } -@@ -201,8 +197,6 @@ func TestVectors(t *testing.T) { +@@ -236,8 +232,6 @@ func TestVectors(t *testing.T) { parts := strings.SplitN(line, ",", 2) switch parts[0] { @@ -81,6 +75,14 @@ index 169944d..c653464 100644 case "P-256": pub.Curve = elliptic.P256() case "P-384": +@@ -314,7 +308,6 @@ func testNegativeInputs(t *testing.T, curve elliptic.Curve, tag string) { + } + + func TestNegativeInputs(t *testing.T) { +- testNegativeInputs(t, elliptic.P224(), "p224") + testNegativeInputs(t, elliptic.P256(), "p256") + testNegativeInputs(t, elliptic.P384(), "p384") + testNegativeInputs(t, elliptic.P521(), "p521") diff --git a/src/crypto/elliptic/bottombits.go b/src/crypto/elliptic/bottombits.go new file mode 100644 index 0000000..4544722 @@ -92,10 +94,10 @@ index 0000000..4544722 +const bottom28Bits = 0xfffffff +const two31m3 = 1<<31 - 1<<3 diff --git a/src/crypto/elliptic/elliptic.go b/src/crypto/elliptic/elliptic.go -index f3b84e1..ca0b7cf 100644 +index c02df45..f713ad7 100644 --- a/src/crypto/elliptic/elliptic.go +++ b/src/crypto/elliptic/elliptic.go -@@ -331,7 +331,6 @@ var p384 *CurveParams +@@ -338,7 +338,6 @@ var p384 *CurveParams var p521 *CurveParams func initAll() { @@ -104,7 +106,7 @@ index f3b84e1..ca0b7cf 100644 initP384() initP521() diff --git a/src/crypto/elliptic/elliptic_test.go b/src/crypto/elliptic/elliptic_test.go -index 7e27913..e0034fc 100644 +index 7f3f1a2..833668e 100644 --- a/src/crypto/elliptic/elliptic_test.go +++ b/src/crypto/elliptic/elliptic_test.go @@ -6,27 +6,25 @@ package elliptic @@ -240,7 +242,7 @@ index 7e27913..e0034fc 100644 k, _ := new(big.Int).SetString(e.k, 10) b.StartTimer() for i := 0; i < b.N; i++ { -@@ -442,14 +393,14 @@ func BenchmarkBaseMultP256(b *testing.B) { +@@ -454,14 +405,14 @@ func BenchmarkScalarMultP256(b *testing.B) { } func TestMarshal(t *testing.T) { @@ -259,7 +261,7 @@ index 7e27913..e0034fc 100644 if xx == nil { t.Error("failed to unmarshal") return -@@ -459,13 +410,3 @@ func TestMarshal(t *testing.T) { +@@ -471,13 +422,3 @@ func TestMarshal(t *testing.T) { return } } @@ -275,11 +277,11 @@ index 7e27913..e0034fc 100644 -} diff --git a/src/crypto/elliptic/p224.go b/src/crypto/elliptic/p224.go deleted file mode 100644 -index 2d3fac7..0000000 +index de266ca..0000000 --- a/src/crypto/elliptic/p224.go +++ /dev/null @@ -1,765 +0,0 @@ --// Copyright 2012 The Go Authors. All rights reserved. +-// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - @@ -1046,11 +1048,11 @@ index 2d3fac7..0000000 -} diff --git a/src/crypto/elliptic/p224_test.go b/src/crypto/elliptic/p224_test.go deleted file mode 100644 -index 4b26d16..0000000 +index 8b4fa04..0000000 --- a/src/crypto/elliptic/p224_test.go +++ /dev/null @@ -1,47 +0,0 @@ --// Copyright 2012 The Go Authors. All rights reserved. +-// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - @@ -1120,10 +1122,10 @@ index 83f9916..dea8589 100644 priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) case "P384": diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go -index be6c013..428053a 100644 +index 9e6d67d..580831e 100644 --- a/src/crypto/x509/x509.go +++ b/src/crypto/x509/x509.go -@@ -308,9 +308,6 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm +@@ -340,9 +340,6 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm // RFC 5480, 2.1.1.1. Named Curve // @@ -1133,7 +1135,7 @@ index be6c013..428053a 100644 // secp256r1 OBJECT IDENTIFIER ::= { // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) // prime(1) 7 } -@@ -323,7 +320,6 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm +@@ -355,7 +352,6 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm // // NB: secp256r1 is equivalent to prime256v1 var ( @@ -1141,7 +1143,7 @@ index be6c013..428053a 100644 oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7} oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34} oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35} -@@ -331,8 +327,6 @@ var ( +@@ -363,8 +359,6 @@ var ( func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { switch { @@ -1150,7 +1152,7 @@ index be6c013..428053a 100644 case oid.Equal(oidNamedCurveP256): return elliptic.P256() case oid.Equal(oidNamedCurveP384): -@@ -345,8 +339,6 @@ func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { +@@ -377,8 +371,6 @@ func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) { switch curve { @@ -1159,7 +1161,7 @@ index be6c013..428053a 100644 case elliptic.P256(): return oidNamedCurveP256, true case elliptic.P384(): -@@ -1466,7 +1458,7 @@ func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgori +@@ -1508,7 +1500,7 @@ func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgori pubType = ECDSA switch pub.Curve { diff --git a/golang-1.5-bootstrap-binary-path.patch b/golang-1.5-bootstrap-binary-path.patch index 8444727..5ef35ac 100644 --- a/golang-1.5-bootstrap-binary-path.patch +++ b/golang-1.5-bootstrap-binary-path.patch @@ -1,17 +1,16 @@ -diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go -index be54ac4..6744fbdc 100644 ---- a/src/cmd/dist/buildtool.go -+++ b/src/cmd/dist/buildtool.go -@@ -108,12 +108,20 @@ func bootstrapBuildTools() { +diff -up go/src/cmd/dist/buildtool.go.bootstrap go/src/cmd/dist/buildtool.go +--- go/src/cmd/dist/buildtool.go.bootstrap 2016-06-06 14:26:37.638374670 +0200 ++++ go/src/cmd/dist/buildtool.go 2016-06-06 14:30:33.873262307 +0200 +@@ -111,15 +111,23 @@ func bootstrapBuildTools() { + defer os.Setenv("GOBIN", os.Getenv("GOBIN")) os.Setenv("GOBIN", "") - os.Setenv("GOOS", "") -- os.Setenv("GOHOSTOS", "") - os.Setenv("GOARCH", "") -+ + hostos := os.Getenv("GOHOSTOS") + hostarch := os.Getenv("GOHOSTARCH") -+ os.Setenv("GOHOSTOS", "") ++ + os.Setenv("GOOS", "") + os.Setenv("GOHOSTOS", "") + os.Setenv("GOARCH", "") os.Setenv("GOHOSTARCH", "") + bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch) @@ -19,17 +18,18 @@ index be54ac4..6744fbdc 100644 + bingopath = pathf("%s/bin/go", goroot_bootstrap) + } + - // Run Go 1.4 to build binaries. -- run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...") -+ run(workspace, ShowOutput|CheckExit, bingopath, "install", "-v", "bootstrap/...") + // Run Go 1.4 to build binaries. Use -gcflags=-l to disable inlining to + // workaround bugs in Go 1.4's compiler. See discussion thread: + // https://groups.google.com/d/msg/golang-dev/Ss7mCKsvk8w/Gsq7VYI0AwAJ +- run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-gcflags=-l", "-v", "bootstrap/...") ++ run(workspace, ShowOutput|CheckExit, bingopath, "install", "-gcflags=-l", "-v", "bootstrap/...") // Copy binaries into tool binary directory. for _, name := range bootstrapDirs { -diff --git a/src/make.bash b/src/make.bash -index f17648a..77f463c 100755 ---- a/src/make.bash -+++ b/src/make.bash -@@ -113,12 +113,17 @@ echo '##### Building Go bootstrap tool.' +diff -up go/src/make.bash.bootstrap go/src/make.bash +--- go/src/make.bash.bootstrap 2016-06-06 14:26:37.628374633 +0200 ++++ go/src/make.bash 2016-06-06 14:26:37.638374670 +0200 +@@ -118,8 +118,15 @@ echo '##### Building Go bootstrap tool.' echo cmd/dist export GOROOT="$(cd .. && pwd)" GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4} @@ -45,6 +45,11 @@ index f17648a..77f463c 100755 + echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2 + echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2 echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 + exit 1 + fi +@@ -128,8 +135,6 @@ if [ "$GOROOT_BOOTSTRAP" == "$GOROOT" ]; + echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 + exit 1 fi -rm -f cmd/dist/dist -GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist diff --git a/golang.spec b/golang.spec index 7d53ef8..fe273f9 100644 --- a/golang.spec +++ b/golang.spec @@ -29,6 +29,7 @@ %global goroot /usr/lib/%{name} %global gopath %{_datadir}/gocode %global go_arches %{ix86} x86_64 %{arm} aarch64 +%global golibdir %{_libdir}/golang %ifarch x86_64 %global gohostarch amd64 %endif @@ -42,30 +43,29 @@ %global gohostarch arm64 %endif -%global go_api 1.5 -%global go_version 1.5.1 +%global go_api 1.7 +%global go_version 1.7.1 Name: golang -Version: 1.5.1 +Version: 1.7.1 Release: 1%{?dist} Summary: The Go Programming Language - -License: BSD +# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain +License: BSD and Public Domain URL: http://golang.org/ Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz # go1.5 bootstrapping. The compiler is written in golang. BuildRequires: golang > 1.4 -BuildRequires: pcre-devel +BuildRequires: pcre-devel, glibc-static, perl %if 0%{?rhel} > 6 || 0%{?fedora} > 0 BuildRequires: hostname %else BuildRequires: net-tools %endif -# use the arch dependent path in the bootstrap -Patch212: golang-1.5-bootstrap-binary-path.patch Provides: go = %{version}-%{release} +Provides: go-srpm-macros Requires: %{name}-bin Requires: %{name}-src = %{version}-%{release} @@ -74,21 +74,17 @@ Patch0: golang-1.2-verbose-build.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1038683 Patch1: golang-1.2-remove-ECC-p224.patch +# use the arch dependent path in the bootstrap +Patch212: golang-1.5-bootstrap-binary-path.patch + # disable TestGdbPython # https://github.com/golang/go/issues/11214 Patch213: go1.5beta1-disable-TestGdbPython.patch -# disable TestCloneNEWUSERAndRemapNoRootDisableSetgroups -# this is not possible in the limitied build chroot -Patch214: go1.5beta2-disable-TestCloneNEWUSERAndRemapNoRootDisableSetgroups.patch - # 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 -# https://bugzilla.redhat.com/show_bug.cgi?id=1271709 -Patch216: ./golang-1.5.1-a3156aaa12.patch - # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -168,6 +164,9 @@ Obsoletes: %{name}-pkg-netbsd-arm < 1.4.99 Obsoletes: %{name}-pkg-openbsd-386 < 1.4.99 Obsoletes: %{name}-pkg-openbsd-amd64 < 1.4.99 +Obsoletes: golang-vet < 0-12.1 +Obsoletes: golang-cover < 0-12.1 + Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives @@ -200,23 +199,26 @@ Summary: Golang shared object libraries %setup -q -n go # increase verbosity of build -%patch0 -p1 +%patch0 -p1 -b .verbose # remove the P224 curve -%patch1 -p1 +%patch1 -p1 -b .curve # use the arch dependent path in the bootstrap -%patch212 -p1 +%patch212 -p1 -b .bootstrap # disable TestGdbPython -%patch213 -p1 +%patch213 -p1 -b .gdb -# disable TestCloneNEWUSERAndRemapNoRootDisableSetgroups -%patch214 -p1 +%patch215 -p1 -%patch216 -p1 %build +# print out system information +uname -a +cat /proc/cpuinfo +cat /proc/meminfo + # go1.5 bootstrapping. The compiler is written in golang. export GOROOT_BOOTSTRAP=%{goroot} @@ -288,6 +290,18 @@ pushd $RPM_BUILD_ROOT%{goroot} find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list %ifarch x86_64 + mkdir -p %{buildroot}/%{_libdir}/ + mkdir -p %{buildroot}/%{golibdir}/ + for file in $(find . -iname "*.so" ); do + chmod 755 $file + mv $file %{buildroot}/%{golibdir} + pushd $(dirname $file) + ln -fs %{golibdir}/$(basename $file) $(basename $file) + popd + echo "%%{goroot}/$file" >> $shared_list + echo "%%{golibdir}/$(basename $file)" >> $shared_list + done + find pkg/*_dynlink/ -type d -printf '%%%dir %{goroot}/%p\n' >> $shared_list find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list %endif @@ -305,7 +319,7 @@ popd rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile # put binaries to bindir, linked to the arch we're building, -# leave the arch independent pieces in %{goroot} +# leave the arch independent pieces in {goroot} mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch} ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt @@ -345,22 +359,15 @@ cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang export GOROOT=$(pwd -P) export PATH="$GOROOT"/bin:"$PATH" cd src -# skip using CGO for test. causes a SIGABRT on fc21 (bz1086900) -# until this test/issue is fixed -# https://bugzilla.redhat.com/show_bug.cgi?id=1086900 -# CGO for test, which fails in i686 on fc21 inside mock/chroot (bz1087621) -# https://bugzilla.redhat.com/show_bug.cgi?id=1087621 -# not using our 'gcc' since the CFLAGS fails crash_cgo_test.go due to unused variables -# https://code.google.com/p/go/issues/detail?id=6883 +export CC="gcc" +export CFLAGS="$RPM_OPT_FLAGS" +export LDFLAGS="$RPM_LD_FLAGS" -# XXX reenable. likely go1.5beta2 https://github.com/golang/go/commit/9adf684686bad7c6319080d0b1da8308a77b08c9 -#CGO_ENABLED=0 ./run.bash --no-rebuild +# make sure to not timeout +export GO_TEST_TIMEOUT_SCALE=2 -CC="gcc" \ -CFLAGS="$RPM_OPT_FLAGS" \ -LDFLAGS="$RPM_LD_FLAGS" \ -./run.bash --no-rebuild -v -k +./run.bash --no-rebuild -v -v -v -k cd .. @@ -432,6 +439,11 @@ fi %endif %changelog +* Fri Sep 16 2016 Jakub Čajka - 1.7.1-1 +- rebase to go1.7.1 +- Resolves: BZ#1293449 - CVE-2015-8618, BZ#1357601 - CVE-2016-5386, +BZ#1324345 - CVE-2016-3959, BZ#1376555 + * Mon Oct 19 2015 Vincent Batts - 1.5.1-1 - bz1271709 include patch from upstream fix diff --git a/sources b/sources index 23e64bc..f3a3cd9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4adfbdfca523cc1c229be8a321f3602f go1.5.1.src.tar.gz +433e2158e5c28fe24b11622df393cc46 go1.7.1.src.tar.gz From 414707a1eb0b3e9b7db27f43b0cba65e070f8621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 21 Oct 2016 12:00:50 +0200 Subject: [PATCH 38/67] rebase to go1.7.3 Fix possible relocation overflows on ppc Fix failing test due to latest tzdata --- .gitignore | 1 + golang.spec | 20 +- ppc64x-overflow-1.patch | 457 ++++++++++++++++++++++++++++++++++++++++ ppc64x-overflow-2.patch | 150 +++++++++++++ sources | 2 +- tzdata-fix.patch | 34 +++ 6 files changed, 661 insertions(+), 3 deletions(-) create mode 100644 ppc64x-overflow-1.patch create mode 100644 ppc64x-overflow-2.patch create mode 100644 tzdata-fix.patch diff --git a/.gitignore b/.gitignore index 4908d1b..72f9827 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ /go1.5.src.tar.gz /go1.5.1.src.tar.gz /go1.7.1.src.tar.gz +/go1.7.3.src.tar.gz diff --git a/golang.spec b/golang.spec index fe273f9..662dbb9 100644 --- a/golang.spec +++ b/golang.spec @@ -44,10 +44,10 @@ %endif %global go_api 1.7 -%global go_version 1.7.1 +%global go_version 1.7.3 Name: golang -Version: 1.7.1 +Version: 1.7.3 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -85,6 +85,13 @@ Patch213: go1.5beta1-disable-TestGdbPython.patch # 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 +#PPC64X relocation overflow fix +Patch216: ppc64x-overflow-1.patch +Patch217: ppc64x-overflow-2.patch + +# Fix for https://github.com/golang/go/issues/17276 +Patch218: tzdata-fix.patch + # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -212,6 +219,10 @@ Summary: Golang shared object libraries %patch215 -p1 +%patch216 -p1 +%patch217 -p1 + +%patch218 -p1 %build # print out system information @@ -439,6 +450,11 @@ fi %endif %changelog +* Fri Oct 21 2016 Jakub Čajka - 1.7.3-1 +- rebase to go1.7.3 +- Fix possible relocation overflows on ppc +- Fix failing test due to latest tzdata + * Fri Sep 16 2016 Jakub Čajka - 1.7.1-1 - rebase to go1.7.1 - Resolves: BZ#1293449 - CVE-2015-8618, BZ#1357601 - CVE-2016-5386, diff --git a/ppc64x-overflow-1.patch b/ppc64x-overflow-1.patch new file mode 100644 index 0000000..35e3e3d --- /dev/null +++ b/ppc64x-overflow-1.patch @@ -0,0 +1,457 @@ +From d6beea7f9ea1aa2ae5abca7fccb252767820aa13 Mon Sep 17 00:00:00 2001 +From: Lynn Boger +Date: Tue, 26 Jul 2016 08:51:10 -0500 +Subject: [PATCH] cmd/link: split large elf text sections for ppc64x + +Some applications built with Go on ppc64x with +external linking can fail to link with relocation +truncation errors, due to the way that the golang +compiler generates a single go.o file containing +a single large text section to send to the GNU +linker. If the size of the single text section is +greater than 2^26, this can lead to link errors +due to 24 bit offset field in the bl (call) +instruction. + +This fix solves the problem by splitting into +multiple text sections when this limit is reached. +When this is done then the GNU linker can fix the +long calls and insert jump tables where needed. +--- + src/cmd/link/internal/ld/data.go | 52 +++++++++++++++++++++++++++++-- + src/cmd/link/internal/ld/elf.go | 60 ++++++++++++++++++++++++++++++++--- + src/cmd/link/internal/ld/lib.go | 20 ++++++++++++ + src/cmd/link/internal/ld/symtab.go | 64 ++++++++++++++++++++++++++++++++++++++ + src/cmd/link/internal/ppc64/asm.go | 12 ++++--- + src/runtime/symtab.go | 34 +++++++++++++++----- + src/runtime/type.go | 16 +++++++++- + 7 files changed, 237 insertions(+), 21 deletions(-) + +diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go +index 57a0dad..58ce18c 100644 +--- a/src/cmd/link/internal/ld/data.go ++++ b/src/cmd/link/internal/ld/data.go +@@ -527,7 +527,15 @@ func relocsym(s *LSym) { + o = Symaddr(r.Sym) + r.Add - int64(r.Sym.Sect.Vaddr) + + case obj.R_ADDROFF: +- o = Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr) + r.Add ++ ++ // The method offset tables using this relocation expect the offset to be relative ++ // to the start of the first text section, even if there are multiple. ++ ++ if Linkmode == LinkExternal && r.Sym.Sect.Name == ".text" && r.Sym.Sect.Vaddr != Segtext.Vaddr { ++ o = Symaddr(r.Sym) - int64(Segtext.Vaddr) + r.Add ++ } else { ++ o = Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr) + r.Add ++ } + + // r->sym can be null when CALL $(constant) is transformed from absolute PC to relative PC call. + case obj.R_CALL, obj.R_GOTPCREL, obj.R_PCREL: +@@ -1926,6 +1934,7 @@ func textaddress() { + } + va := uint64(INITTEXT) + sect.Vaddr = va ++ n := 1 + for _, sym := range Ctxt.Textp { + sym.Sect = sect + if sym.Type&obj.SSUB != 0 { +@@ -1948,9 +1957,30 @@ func textaddress() { + } else { + va += uint64(sym.Size) + } ++ // On ppc64x a text section should not be larger than 2^26 bytes due to the size of ++ // call target offset field in the bl instruction. Splitting into text ++ // sections smaller than this limit allows the GNU linker to modify the long calls ++ // appropriately. The limit allows for the space for linker tables. ++ ++ // Only break at outermost syms. ++ ++ if sym.Outer == nil && Iself && Linkmode == LinkExternal && SysArch.InFamily(sys.PPC64) && va-sect.Vaddr > uint64(0x1c00000) { ++ ++ // Set the length for the previous text section ++ sect.Length = va - sect.Vaddr ++ ++ // Create new section, set the starting Vaddr ++ sect = addsection(&Segtext, ".text", 05) ++ sect.Vaddr = va ++ ++ // Create a symbol for the start and end of the secondary text section ++ Linklookup(Ctxt, fmt.Sprintf("runtime.text.%d", n), 0).Sect = sect ++ n++ ++ } + } + + sect.Length = va - sect.Vaddr ++ Linklookup(Ctxt, "runtime.etext", 0).Sect = sect + } + + // assign addresses +@@ -2057,11 +2087,27 @@ func address() { + Segdwarf.Filelen = va - Segdwarf.Vaddr + + text := Segtext.Sect ++ lasttext := text + var rodata *Section + if Segrodata.Sect != nil { + rodata = Segrodata.Sect + } else { +- rodata = text.Next ++ // Could be multiple .text sections ++ n := 1 ++ for sect := Segtext.Sect.Next; sect != nil; sect = sect.Next { ++ if sect.Name != ".text" { ++ break ++ } ++ lasttext = sect ++ symname := fmt.Sprintf("runtime.text.%d", n) ++ xdefine(symname, obj.STEXT, int64(sect.Vaddr)) ++ n++ ++ } ++ ++ rodata = lasttext.Next ++ if rodata != nil && rodata.Name != ".rodata" { ++ Diag("Unexpected section order in text segment") ++ } + } + var relrodata *Section + typelink := rodata.Next +@@ -2108,7 +2154,7 @@ func address() { + } + + xdefine("runtime.text", obj.STEXT, int64(text.Vaddr)) +- xdefine("runtime.etext", obj.STEXT, int64(text.Vaddr+text.Length)) ++ xdefine("runtime.etext", obj.STEXT, int64(lasttext.Vaddr+lasttext.Length)) + if HEADTYPE == obj.Hwindows { + xdefine(".text", obj.STEXT, int64(text.Vaddr)) + } +diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go +index 39d3609..ecb00c2 100644 +--- a/src/cmd/link/internal/ld/elf.go ++++ b/src/cmd/link/internal/ld/elf.go +@@ -1623,6 +1623,25 @@ func elfshname(name string) *ElfShdr { + return nil + } + ++// Create an ElfShdr for the section with name. ++// A new one is created even if one already exists with ++// the same name. ++func elfshnamedup(name string) *ElfShdr { ++ var off int ++ var sh *ElfShdr ++ ++ for i := 0; i < nelfstr; i++ { ++ if name == elfstr[i].s { ++ off = elfstr[i].off ++ sh = newElfShdr(int64(off)) ++ return sh ++ } ++ } ++ Diag("cannot find elf name %s", name) ++ errorexit() ++ return nil ++} ++ + func elfshalloc(sect *Section) *ElfShdr { + sh := elfshname(sect.Name) + sect.Elfsect = sh +@@ -1630,7 +1649,17 @@ func elfshalloc(sect *Section) *ElfShdr { + } + + func elfshbits(sect *Section) *ElfShdr { +- sh := elfshalloc(sect) ++ var sh *ElfShdr ++ ++ if sect.Name == ".text" { ++ if sect.Elfsect == nil { ++ sect.Elfsect = elfshnamedup(sect.Name) ++ } ++ sh = sect.Elfsect ++ } else { ++ sh = elfshalloc(sect) ++ } ++ + // If this section has already been set up as a note, we assume type_ and + // flags are already correct, but the other fields still need filling in. + if sh.type_ == SHT_NOTE { +@@ -1706,6 +1735,15 @@ func elfshreloc(sect *Section) *ElfShdr { + } + + sh := elfshname(elfRelType + sect.Name) ++ ++ // There could be multiple text sections but each needs ++ // its own .rela.text. ++ if sect.Name == ".text" { ++ if sh.info != 0 && sh.info != uint32(sect.Elfsect.shnum) { ++ sh = elfshnamedup(elfRelType + sect.Name) ++ } ++ } ++ + sh.type_ = uint32(typ) + sh.entsize = uint64(SysArch.RegSize) * 2 + if typ == SHT_RELA { +@@ -1776,9 +1814,12 @@ func Elfemitreloc() { + Cput(0) + } + +- elfrelocsect(Segtext.Sect, Ctxt.Textp) +- for sect := Segtext.Sect.Next; sect != nil; sect = sect.Next { +- elfrelocsect(sect, datap) ++ for sect := Segtext.Sect; sect != nil; sect = sect.Next { ++ if sect.Name == ".text" { ++ elfrelocsect(sect, Ctxt.Textp) ++ } else { ++ elfrelocsect(sect, datap) ++ } + } + for sect := Segrodata.Sect; sect != nil; sect = sect.Next { + elfrelocsect(sect, datap) +@@ -2109,7 +2150,16 @@ func Asmbelfsetup() { + elfshname("") + + for sect := Segtext.Sect; sect != nil; sect = sect.Next { +- elfshalloc(sect) ++ ++ // There could be multiple .text sections. Instead check the Elfsect ++ // field to determine if already has an ElfShdr and if not, create one. ++ if sect.Name == ".text" { ++ if sect.Elfsect == nil { ++ sect.Elfsect = elfshnamedup(sect.Name) ++ } ++ } else { ++ elfshalloc(sect) ++ } + } + for sect := Segrodata.Sect; sect != nil; sect = sect.Next { + elfshalloc(sect) +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 14f4fa9..709e7ca 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1956,6 +1956,26 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) { + if s.Type == obj.STEXT { + put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), nil) + } ++ n := 0 ++ ++ // Generate base addresses for all text sections if there are multiple ++ for sect := Segtext.Sect; sect != nil; sect = sect.Next { ++ if n == 0 { ++ n++ ++ continue ++ } ++ if sect.Name != ".text" { ++ break ++ } ++ s = Linkrlookup(Ctxt, fmt.Sprintf("runtime.text.%d", n), 0) ++ if s == nil { ++ break ++ } ++ if s.Type == obj.STEXT { ++ put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), nil) ++ } ++ n++ ++ } + s = Linklookup(Ctxt, "runtime.etext", 0) + if s.Type == obj.STEXT { + put(s, s.Name, 'T', s.Value, s.Size, int(s.Version), nil) +diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go +index 06d7792..80eb33d 100644 +--- a/src/cmd/link/internal/ld/symtab.go ++++ b/src/cmd/link/internal/ld/symtab.go +@@ -315,6 +315,62 @@ func (libs byPkg) Swap(a, b int) { + libs[a], libs[b] = libs[b], libs[a] + } + ++// Create a table with information on the text sections. ++ ++func textsectionmap() uint32 { ++ ++ t := Linklookup(Ctxt, "runtime.textsectionmap", 0) ++ t.Type = obj.SRODATA ++ t.Attr |= AttrReachable ++ nsections := int64(0) ++ ++ for sect := Segtext.Sect; sect != nil; sect = sect.Next { ++ if sect.Name == ".text" { ++ nsections++ ++ } else { ++ break ++ } ++ } ++ Symgrow(Ctxt, t, nsections*3*8) ++ ++ off := int64(0) ++ n := 0 ++ ++ // The vaddr for each text section is the difference between the section's ++ // Vaddr and the Vaddr for the first text section as determined at compile ++ // time. ++ ++ // The symbol name for the start address of the first text section is ++ // runtime.text. Additional text sections are named runtime.text.n where n is the ++ // order of creation starting with 1. These symbols provide the section's ++ // start address after relocation by the linker. ++ ++ textbase := Segtext.Sect.Vaddr ++ for sect := Segtext.Sect; sect != nil; sect = sect.Next { ++ if sect.Name != ".text" { ++ break ++ } ++ off = setuintxx(Ctxt, t, off, sect.Vaddr-textbase, int64(SysArch.IntSize)) ++ off = setuintxx(Ctxt, t, off, sect.Length, int64(SysArch.IntSize)) ++ if n == 0 { ++ s := Linkrlookup(Ctxt, "runtime.text", 0) ++ if s == nil { ++ Diag("Unable to find symbol runtime.text\n") ++ } ++ off = setaddr(Ctxt, t, off, s) ++ ++ } else { ++ s := Linklookup(Ctxt, fmt.Sprintf("runtime.text.%d", n), 0) ++ if s == nil { ++ Diag("Unable to find symbol runtime.text.%d\n", n) ++ } ++ off = setaddr(Ctxt, t, off, s) ++ } ++ n++ ++ } ++ return uint32(n) ++} ++ + func symtab() { + dosymtype() + +@@ -489,6 +545,8 @@ func symtab() { + adduint(Ctxt, abihashgostr, uint64(hashsym.Size)) + } + ++ nsections := textsectionmap() ++ + // Information about the layout of the executable image for the + // runtime to use. Any changes here must be matched by changes to + // the definition of moduledata in runtime/symtab.go. +@@ -527,6 +585,12 @@ func symtab() { + Addaddr(Ctxt, moduledata, Linklookup(Ctxt, "runtime.gcbss", 0)) + Addaddr(Ctxt, moduledata, Linklookup(Ctxt, "runtime.types", 0)) + Addaddr(Ctxt, moduledata, Linklookup(Ctxt, "runtime.etypes", 0)) ++ ++ // text section information ++ Addaddr(Ctxt, moduledata, Linklookup(Ctxt, "runtime.textsectionmap", 0)) ++ adduint(Ctxt, moduledata, uint64(nsections)) ++ adduint(Ctxt, moduledata, uint64(nsections)) ++ + // The typelinks slice + Addaddr(Ctxt, moduledata, Linklookup(Ctxt, "runtime.typelink", 0)) + adduint(Ctxt, moduledata, uint64(ntypelinks)) +diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go +index bd2e23f..ab59fa8 100644 +--- a/src/cmd/link/internal/ppc64/asm.go ++++ b/src/cmd/link/internal/ppc64/asm.go +@@ -813,12 +813,14 @@ func asmb() { + ld.Asmbelfsetup() + } + +- sect := ld.Segtext.Sect +- ld.Cseek(int64(sect.Vaddr - ld.Segtext.Vaddr + ld.Segtext.Fileoff)) +- ld.Codeblk(int64(sect.Vaddr), int64(sect.Length)) +- for sect = sect.Next; sect != nil; sect = sect.Next { ++ for sect := ld.Segtext.Sect; sect != nil; sect = sect.Next { + ld.Cseek(int64(sect.Vaddr - ld.Segtext.Vaddr + ld.Segtext.Fileoff)) +- ld.Datblk(int64(sect.Vaddr), int64(sect.Length)) ++ // Might have multiple text sections ++ if sect.Name == ".text" { ++ ld.Codeblk(int64(sect.Vaddr), int64(sect.Length)) ++ } else { ++ ld.Datblk(int64(sect.Vaddr), int64(sect.Length)) ++ } + } + + if ld.Segrodata.Filelen > 0 { +diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go +index 4f6fae2..23e80ce 100644 +--- a/src/runtime/symtab.go ++++ b/src/runtime/symtab.go +@@ -195,8 +195,9 @@ type moduledata struct { + end, gcdata, gcbss uintptr + types, etypes uintptr + +- typelinks []int32 // offsets from types +- itablinks []*itab ++ textsectmap []textsect ++ typelinks []int32 // offsets from types ++ itablinks []*itab + + modulename string + modulehashes []modulehash +@@ -226,6 +227,14 @@ type functab struct { + funcoff uintptr + } + ++// Mapping information for secondary text sections ++ ++type textsect struct { ++ vaddr uint64 // prelinked section vaddr ++ length uint64 // section length ++ baseaddr uintptr // relocated section address ++} ++ + const minfunc = 16 // minimum function size + const pcbucketsize = 256 * minfunc // size of bucket in the pc->func lookup table + +@@ -368,12 +377,23 @@ func findfunc(pc uintptr) *_func { + ffb := (*findfuncbucket)(add(unsafe.Pointer(datap.findfunctab), b*unsafe.Sizeof(findfuncbucket{}))) + idx := ffb.idx + uint32(ffb.subbuckets[i]) + if pc < datap.ftab[idx].entry { +- throw("findfunc: bad findfunctab entry") +- } + +- // linear search to find func with pc >= entry. +- for datap.ftab[idx+1].entry <= pc { +- idx++ ++ // If there are multiple text sections then the buckets for the secondary ++ // text sections will be off because the addresses in those text sections ++ // were relocated to higher addresses. Search back to find it. ++ ++ for datap.ftab[idx].entry > pc && idx > 0 { ++ idx-- ++ } ++ if idx == 0 { ++ throw("findfunc: bad findfunctab entry idx") ++ } ++ } else { ++ ++ // linear search to find func with pc >= entry. ++ for datap.ftab[idx+1].entry <= pc { ++ idx++ ++ } + } + return (*_func)(unsafe.Pointer(&datap.pclntable[datap.ftab[idx].funcoff])) + } +diff --git a/src/runtime/type.go b/src/runtime/type.go +index 5ef11a4..f641adc 100644 +--- a/src/runtime/type.go ++++ b/src/runtime/type.go +@@ -257,7 +257,21 @@ func (t *_type) textOff(off textOff) unsafe.Pointer { + } + return res + } +- res := md.text + uintptr(off) ++ res := uintptr(0) ++ ++ // Find the text section range that contains the offset to determine the section's base ++ // address. In cases where there are multiple text sections, the base address might be ++ // relocated by the linker. ++ ++ for i := 0; i < len(md.textsectmap); i++ { ++ sectaddr := md.textsectmap[i].vaddr ++ sectlen := md.textsectmap[i].length ++ if uint64(off) >= sectaddr && uint64(off) <= sectaddr+sectlen { ++ res = md.textsectmap[i].baseaddr + uintptr(off) - uintptr(md.textsectmap[i].vaddr) ++ break ++ } ++ } ++ + if res > md.etext { + println("runtime: textOff", hex(off), "out of range", hex(md.text), "-", hex(md.etext)) + throw("runtime: text offset out of range") diff --git a/ppc64x-overflow-2.patch b/ppc64x-overflow-2.patch new file mode 100644 index 0000000..35dfc0e --- /dev/null +++ b/ppc64x-overflow-2.patch @@ -0,0 +1,150 @@ +From a5b97a846d70cd8db7f33c24f2b9159f935ce318 Mon Sep 17 00:00:00 2001 +From: Lynn Boger +Date: Tue, 13 Sep 2016 15:13:08 -0500 +Subject: [PATCH] cmd/compile: large text sections on ppc64le + +Additional fixes as submitted upstream. +--- + src/cmd/link/internal/ld/data.go | 24 ++++++++++++------------ + src/cmd/link/internal/ld/lib.go | 2 +- + src/cmd/link/internal/ld/symtab.go | 2 +- + src/runtime/type.go | 28 ++++++++++++++++++---------- + 4 files changed, 32 insertions(+), 24 deletions(-) + +diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go +index 58ce18c..d8e43ff 100644 +--- a/src/cmd/link/internal/ld/data.go ++++ b/src/cmd/link/internal/ld/data.go +@@ -531,7 +531,7 @@ func relocsym(s *LSym) { + // The method offset tables using this relocation expect the offset to be relative + // to the start of the first text section, even if there are multiple. + +- if Linkmode == LinkExternal && r.Sym.Sect.Name == ".text" && r.Sym.Sect.Vaddr != Segtext.Vaddr { ++ if r.Sym.Sect.Name == ".text" { + o = Symaddr(r.Sym) - int64(Segtext.Vaddr) + r.Add + } else { + o = Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr) + r.Add +@@ -1928,7 +1928,6 @@ func textaddress() { + + sect.Align = int32(Funcalign) + Linklookup(Ctxt, "runtime.text", 0).Sect = sect +- Linklookup(Ctxt, "runtime.etext", 0).Sect = sect + if HEADTYPE == obj.Hwindows { + Linklookup(Ctxt, ".text", 0).Sect = sect + } +@@ -1964,7 +1963,7 @@ func textaddress() { + + // Only break at outermost syms. + +- if sym.Outer == nil && Iself && Linkmode == LinkExternal && SysArch.InFamily(sys.PPC64) && va-sect.Vaddr > uint64(0x1c00000) { ++ if sym.Outer == nil && Iself && Linkmode == LinkExternal && SysArch.InFamily(sys.PPC64) && va-sect.Vaddr > 0x1c00000 { + + // Set the length for the previous text section + sect.Length = va - sect.Vaddr +@@ -1973,7 +1972,7 @@ func textaddress() { + sect = addsection(&Segtext, ".text", 05) + sect.Vaddr = va + +- // Create a symbol for the start and end of the secondary text section ++ // Create a symbol for the start of the secondary text section + Linklookup(Ctxt, fmt.Sprintf("runtime.text.%d", n), 0).Sect = sect + n++ + } +@@ -2093,15 +2092,8 @@ func address() { + rodata = Segrodata.Sect + } else { + // Could be multiple .text sections +- n := 1 +- for sect := Segtext.Sect.Next; sect != nil; sect = sect.Next { +- if sect.Name != ".text" { +- break +- } ++ for sect := Segtext.Sect.Next; sect != nil && sect.Name == ".text"; sect = sect.Next { + lasttext = sect +- symname := fmt.Sprintf("runtime.text.%d", n) +- xdefine(symname, obj.STEXT, int64(sect.Vaddr)) +- n++ + } + + rodata = lasttext.Next +@@ -2155,6 +2147,14 @@ func address() { + + xdefine("runtime.text", obj.STEXT, int64(text.Vaddr)) + xdefine("runtime.etext", obj.STEXT, int64(lasttext.Vaddr+lasttext.Length)) ++ ++ n := 1 ++ for sect := Segtext.Sect.Next; sect != nil && sect.Name == ".text"; sect = sect.Next { ++ symname := fmt.Sprintf("runtime.text.%d", n) ++ xdefine(symname, obj.STEXT, int64(sect.Vaddr)) ++ n++ ++ } ++ + if HEADTYPE == obj.Hwindows { + xdefine(".text", obj.STEXT, int64(text.Vaddr)) + } +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 709e7ca..c37ef92 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1958,7 +1958,7 @@ func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) { + } + n := 0 + +- // Generate base addresses for all text sections if there are multiple ++ // Generate base addresses for all text sections if there are multiple. + for sect := Segtext.Sect; sect != nil; sect = sect.Next { + if n == 0 { + n++ +diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go +index 80eb33d..ec26f88 100644 +--- a/src/cmd/link/internal/ld/symtab.go ++++ b/src/cmd/link/internal/ld/symtab.go +@@ -331,7 +331,7 @@ func textsectionmap() uint32 { + break + } + } +- Symgrow(Ctxt, t, nsections*3*8) ++ Symgrow(Ctxt, t, nsections*(2*int64(SysArch.IntSize)+int64(SysArch.PtrSize))) + + off := int64(0) + n := 0 +diff --git a/src/runtime/type.go b/src/runtime/type.go +index f641adc..d4df5a9 100644 +--- a/src/runtime/type.go ++++ b/src/runtime/type.go +@@ -259,17 +259,25 @@ func (t *_type) textOff(off textOff) unsafe.Pointer { + } + res := uintptr(0) + +- // Find the text section range that contains the offset to determine the section's base +- // address. In cases where there are multiple text sections, the base address might be +- // relocated by the linker. +- +- for i := 0; i < len(md.textsectmap); i++ { +- sectaddr := md.textsectmap[i].vaddr +- sectlen := md.textsectmap[i].length +- if uint64(off) >= sectaddr && uint64(off) <= sectaddr+sectlen { +- res = md.textsectmap[i].baseaddr + uintptr(off) - uintptr(md.textsectmap[i].vaddr) +- break ++ // The text, or instruction stream is generated as one large buffer. The off (offset) for a method is ++ // its offset within this buffer. If the total text size gets too large, there can be issues on platforms like ppc64 if ++ // the target of calls are too far for the call instruction. To resolve the large text issue, the text is split ++ // into multiple text sections to allow the linker to generate long calls when necessary. When this happens, the vaddr ++ // for each text section is set to its offset within the text. Each method's offset is compared against the section ++ // vaddrs and sizes to determine the containing section. Then the section relative offset is added to the section's ++ // relocated baseaddr to compute the method addess. ++ ++ if len(md.textsectmap) > 1 { ++ for i := 0; i < len(md.textsectmap); i++ { ++ sectaddr := md.textsectmap[i].vaddr ++ sectlen := md.textsectmap[i].length ++ if uint64(off) >= sectaddr && uint64(off) <= sectaddr+sectlen { ++ res = md.textsectmap[i].baseaddr + uintptr(off) - uintptr(md.textsectmap[i].vaddr) ++ break ++ } + } ++ } else { ++ res = md.text + uintptr(off) + } + + if res > md.etext { diff --git a/sources b/sources index f3a3cd9..8390332 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -433e2158e5c28fe24b11622df393cc46 go1.7.1.src.tar.gz +83d1b7bd4281479ab7d153e5152c9fc9 go1.7.3.src.tar.gz diff --git a/tzdata-fix.patch b/tzdata-fix.patch new file mode 100644 index 0000000..b7e6e41 --- /dev/null +++ b/tzdata-fix.patch @@ -0,0 +1,34 @@ +From c5434f2973a87acff76bac359236e690d632ce95 Mon Sep 17 00:00:00 2001 +From: Alberto Donizetti +Date: Thu, 29 Sep 2016 13:59:10 +0200 +Subject: [PATCH] time: update test for tzdata-2016g + +Fixes #17276 + +Change-Id: I0188cf9bc5fdb48c71ad929cc54206d03e0b96e4 +Reviewed-on: https://go-review.googlesource.com/29995 +Reviewed-by: Brad Fitzpatrick +Run-TryBot: Brad Fitzpatrick +TryBot-Result: Gobot Gobot +--- + src/time/time_test.go | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/time/time_test.go b/src/time/time_test.go +index 68236fd..2e47d08 100644 +--- a/src/time/time_test.go ++++ b/src/time/time_test.go +@@ -943,8 +943,11 @@ func TestLoadFixed(t *testing.T) { + // but Go and most other systems use "east is positive". + // So GMT+1 corresponds to -3600 in the Go zone, not +3600. + name, offset := Now().In(loc).Zone() +- if name != "GMT+1" || offset != -1*60*60 { +- t.Errorf("Now().In(loc).Zone() = %q, %d, want %q, %d", name, offset, "GMT+1", -1*60*60) ++ // The zone abbreviation is "-01" since tzdata-2016g, and "GMT+1" ++ // on earlier versions; we accept both. (Issue #17276). ++ if !(name == "GMT+1" || name == "-01") || offset != -1*60*60 { ++ t.Errorf("Now().In(loc).Zone() = %q, %d, want %q or %q, %d", ++ name, offset, "GMT+1", "-01", -1*60*60) + } + } + From 45a3692f231069585527548bc26471644e5347db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 18 Nov 2016 11:21:08 +0100 Subject: [PATCH 39/67] enable back p224 curve(see BZ#1038683) --- golang-1.2-remove-ECC-p224.patch | 1172 ------------------------------ golang.spec | 11 +- 2 files changed, 4 insertions(+), 1179 deletions(-) delete mode 100644 golang-1.2-remove-ECC-p224.patch diff --git a/golang-1.2-remove-ECC-p224.patch b/golang-1.2-remove-ECC-p224.patch deleted file mode 100644 index 2b2d1a1..0000000 --- a/golang-1.2-remove-ECC-p224.patch +++ /dev/null @@ -1,1172 +0,0 @@ -diff --git a/api/go1.txt b/api/go1.txt -index 5e3dea5..1a1ee83 100644 ---- a/api/go1.txt -+++ b/api/go1.txt -@@ -412,7 +412,6 @@ pkg crypto/ecdsa, type PublicKey struct, Y *big.Int - pkg crypto/ecdsa, type PublicKey struct, embedded elliptic.Curve - pkg crypto/elliptic, func GenerateKey(Curve, io.Reader) ([]uint8, *big.Int, *big.Int, error) - pkg crypto/elliptic, func Marshal(Curve, *big.Int, *big.Int) []uint8 --pkg crypto/elliptic, func P224() Curve - pkg crypto/elliptic, func P256() Curve - pkg crypto/elliptic, func P384() Curve - pkg crypto/elliptic, func P521() Curve -diff --git a/src/crypto/ecdsa/ecdsa_test.go b/src/crypto/ecdsa/ecdsa_test.go -index fc25fd7..356e617 100644 ---- a/src/crypto/ecdsa/ecdsa_test.go -+++ b/src/crypto/ecdsa/ecdsa_test.go -@@ -33,11 +33,10 @@ func testKeyGeneration(t *testing.T, c elliptic.Curve, tag string) { - } - - func TestKeyGeneration(t *testing.T) { -- testKeyGeneration(t, elliptic.P224(), "p224") -+ testKeyGeneration(t, elliptic.P256(), "p256") - if testing.Short() { - return - } -- testKeyGeneration(t, elliptic.P256(), "p256") - testKeyGeneration(t, elliptic.P384(), "p384") - testKeyGeneration(t, elliptic.P521(), "p521") - } -@@ -98,11 +97,10 @@ func testSignAndVerify(t *testing.T, c elliptic.Curve, tag string) { - } - - func TestSignAndVerify(t *testing.T) { -- testSignAndVerify(t, elliptic.P224(), "p224") -+ testSignAndVerify(t, elliptic.P256(), "p256") - if testing.Short() { - return - } -- testSignAndVerify(t, elliptic.P256(), "p256") - testSignAndVerify(t, elliptic.P384(), "p384") - testSignAndVerify(t, elliptic.P521(), "p521") - } -@@ -135,11 +133,10 @@ func testNonceSafety(t *testing.T, c elliptic.Curve, tag string) { - } - - func TestNonceSafety(t *testing.T) { -- testNonceSafety(t, elliptic.P224(), "p224") -+ testNonceSafety(t, elliptic.P256(), "p256") - if testing.Short() { - return - } -- testNonceSafety(t, elliptic.P256(), "p256") - testNonceSafety(t, elliptic.P384(), "p384") - testNonceSafety(t, elliptic.P521(), "p521") - } -@@ -170,11 +167,10 @@ func testINDCCA(t *testing.T, c elliptic.Curve, tag string) { - } - - func TestINDCCA(t *testing.T) { -- testINDCCA(t, elliptic.P224(), "p224") -+ testINDCCA(t, elliptic.P256(), "p256") - if testing.Short() { - return - } -- testINDCCA(t, elliptic.P256(), "p256") - testINDCCA(t, elliptic.P384(), "p384") - testINDCCA(t, elliptic.P521(), "p521") - } -@@ -236,8 +232,6 @@ func TestVectors(t *testing.T) { - parts := strings.SplitN(line, ",", 2) - - switch parts[0] { -- case "P-224": -- pub.Curve = elliptic.P224() - case "P-256": - pub.Curve = elliptic.P256() - case "P-384": -@@ -314,7 +308,6 @@ func testNegativeInputs(t *testing.T, curve elliptic.Curve, tag string) { - } - - func TestNegativeInputs(t *testing.T) { -- testNegativeInputs(t, elliptic.P224(), "p224") - testNegativeInputs(t, elliptic.P256(), "p256") - testNegativeInputs(t, elliptic.P384(), "p384") - testNegativeInputs(t, elliptic.P521(), "p521") -diff --git a/src/crypto/elliptic/bottombits.go b/src/crypto/elliptic/bottombits.go -new file mode 100644 -index 0000000..4544722 ---- /dev/null -+++ b/src/crypto/elliptic/bottombits.go -@@ -0,0 +1,4 @@ -+package elliptic -+ -+const bottom28Bits = 0xfffffff -+const two31m3 = 1<<31 - 1<<3 -diff --git a/src/crypto/elliptic/elliptic.go b/src/crypto/elliptic/elliptic.go -index c02df45..f713ad7 100644 ---- a/src/crypto/elliptic/elliptic.go -+++ b/src/crypto/elliptic/elliptic.go -@@ -338,7 +338,6 @@ var p384 *CurveParams - var p521 *CurveParams - - func initAll() { -- initP224() - initP256() - initP384() - initP521() -diff --git a/src/crypto/elliptic/elliptic_test.go b/src/crypto/elliptic/elliptic_test.go -index 7f3f1a2..833668e 100644 ---- a/src/crypto/elliptic/elliptic_test.go -+++ b/src/crypto/elliptic/elliptic_test.go -@@ -6,27 +6,25 @@ package elliptic - - import ( - "crypto/rand" -- "encoding/hex" -- "fmt" - "math/big" - "testing" - ) - - func TestOnCurve(t *testing.T) { -- p224 := P224() -- if !p224.IsOnCurve(p224.Params().Gx, p224.Params().Gy) { -+ p256 := P256() -+ if !p256.IsOnCurve(p256.Params().Gx, p256.Params().Gy) { - t.Errorf("FAIL") - } - } - - func TestOffCurve(t *testing.T) { -- p224 := P224() -+ p256 := P256() - x, y := new(big.Int).SetInt64(1), new(big.Int).SetInt64(1) -- if p224.IsOnCurve(x, y) { -+ if p256.IsOnCurve(x, y) { - t.Errorf("FAIL: point off curve is claimed to be on the curve") - } -- b := Marshal(p224, x, y) -- x1, y1 := Unmarshal(p224, b) -+ b := Marshal(p256, x, y) -+ x1, y1 := Unmarshal(p256, b) - if x1 != nil || y1 != nil { - t.Errorf("FAIL: unmarshalling a point not on the curve succeeded") - } -@@ -37,7 +35,7 @@ type baseMultTest struct { - x, y string - } - --var p224BaseMultTests = []baseMultTest{ -+var p256BaseMultTests = []baseMultTest{ - { - "1", - "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", -@@ -300,47 +298,12 @@ var p224BaseMultTests = []baseMultTest{ - }, - } - --func TestBaseMult(t *testing.T) { -- p224 := P224() -- for i, e := range p224BaseMultTests { -- k, ok := new(big.Int).SetString(e.k, 10) -- if !ok { -- t.Errorf("%d: bad value for k: %s", i, e.k) -- } -- x, y := p224.ScalarBaseMult(k.Bytes()) -- if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y { -- t.Errorf("%d: bad output for k=%s: got (%x, %x), want (%s, %s)", i, e.k, x, y, e.x, e.y) -- } -- if testing.Short() && i > 5 { -- break -- } -- } --} -- --func TestGenericBaseMult(t *testing.T) { -- // We use the P224 CurveParams directly in order to test the generic implementation. -- p224 := P224().Params() -- for i, e := range p224BaseMultTests { -- k, ok := new(big.Int).SetString(e.k, 10) -- if !ok { -- t.Errorf("%d: bad value for k: %s", i, e.k) -- } -- x, y := p224.ScalarBaseMult(k.Bytes()) -- if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y { -- t.Errorf("%d: bad output for k=%s: got (%x, %x), want (%s, %s)", i, e.k, x, y, e.x, e.y) -- } -- if testing.Short() && i > 5 { -- break -- } -- } --} -- - func TestP256BaseMult(t *testing.T) { - p256 := P256() - p256Generic := p256.Params() - -- scalars := make([]*big.Int, 0, len(p224BaseMultTests)+1) -- for _, e := range p224BaseMultTests { -+ scalars := make([]*big.Int, 0, len(p256BaseMultTests)+1) -+ for _, e := range p256BaseMultTests { - k, _ := new(big.Int).SetString(e.k, 10) - scalars = append(scalars, k) - } -@@ -365,7 +328,7 @@ func TestP256Mult(t *testing.T) { - p256 := P256() - p256Generic := p256.Params() - -- for i, e := range p224BaseMultTests { -+ for i, e := range p256BaseMultTests { - x, _ := new(big.Int).SetString(e.x, 16) - y, _ := new(big.Int).SetString(e.y, 16) - k, _ := new(big.Int).SetString(e.k, 10) -@@ -386,7 +349,6 @@ func TestInfinity(t *testing.T) { - name string - curve Curve - }{ -- {"p224", P224()}, - {"p256", P256()}, - } - -@@ -419,21 +381,10 @@ func TestInfinity(t *testing.T) { - } - } - --func BenchmarkBaseMult(b *testing.B) { -- b.ResetTimer() -- p224 := P224() -- e := p224BaseMultTests[25] -- k, _ := new(big.Int).SetString(e.k, 10) -- b.StartTimer() -- for i := 0; i < b.N; i++ { -- p224.ScalarBaseMult(k.Bytes()) -- } --} -- - func BenchmarkBaseMultP256(b *testing.B) { - b.ResetTimer() - p256 := P256() -- e := p224BaseMultTests[25] -+ e := p256BaseMultTests[25] - k, _ := new(big.Int).SetString(e.k, 10) - b.StartTimer() - for i := 0; i < b.N; i++ { -@@ -454,14 +405,14 @@ func BenchmarkScalarMultP256(b *testing.B) { - } - - func TestMarshal(t *testing.T) { -- p224 := P224() -- _, x, y, err := GenerateKey(p224, rand.Reader) -+ p256 := P256() -+ _, x, y, err := GenerateKey(p256, rand.Reader) - if err != nil { - t.Error(err) - return - } -- serialized := Marshal(p224, x, y) -- xx, yy := Unmarshal(p224, serialized) -+ serialized := Marshal(p256, x, y) -+ xx, yy := Unmarshal(p256, serialized) - if xx == nil { - t.Error("failed to unmarshal") - return -@@ -471,13 +422,3 @@ func TestMarshal(t *testing.T) { - return - } - } -- --func TestP224Overflow(t *testing.T) { -- // This tests for a specific bug in the P224 implementation. -- p224 := P224() -- pointData, _ := hex.DecodeString("049B535B45FB0A2072398A6831834624C7E32CCFD5A4B933BCEAF77F1DD945E08BBE5178F5EDF5E733388F196D2A631D2E075BB16CBFEEA15B") -- x, y := Unmarshal(p224, pointData) -- if !p224.IsOnCurve(x, y) { -- t.Error("P224 failed to validate a correct point") -- } --} -diff --git a/src/crypto/elliptic/p224.go b/src/crypto/elliptic/p224.go -deleted file mode 100644 -index de266ca..0000000 ---- a/src/crypto/elliptic/p224.go -+++ /dev/null -@@ -1,765 +0,0 @@ --// Copyright 2012 The Go Authors. All rights reserved. --// Use of this source code is governed by a BSD-style --// license that can be found in the LICENSE file. -- --package elliptic -- --// This is a constant-time, 32-bit implementation of P224. See FIPS 186-3, --// section D.2.2. --// --// See http://www.imperialviolet.org/2010/12/04/ecc.html ([1]) for background. -- --import ( -- "math/big" --) -- --var p224 p224Curve -- --type p224Curve struct { -- *CurveParams -- gx, gy, b p224FieldElement --} -- --func initP224() { -- // See FIPS 186-3, section D.2.2 -- p224.CurveParams = &CurveParams{Name: "P-224"} -- p224.P, _ = new(big.Int).SetString("26959946667150639794667015087019630673557916260026308143510066298881", 10) -- p224.N, _ = new(big.Int).SetString("26959946667150639794667015087019625940457807714424391721682722368061", 10) -- p224.B, _ = new(big.Int).SetString("b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4", 16) -- p224.Gx, _ = new(big.Int).SetString("b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", 16) -- p224.Gy, _ = new(big.Int).SetString("bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34", 16) -- p224.BitSize = 224 -- -- p224FromBig(&p224.gx, p224.Gx) -- p224FromBig(&p224.gy, p224.Gy) -- p224FromBig(&p224.b, p224.B) --} -- --// P224 returns a Curve which implements P-224 (see FIPS 186-3, section D.2.2) --func P224() Curve { -- initonce.Do(initAll) -- return p224 --} -- --func (curve p224Curve) Params() *CurveParams { -- return curve.CurveParams --} -- --func (curve p224Curve) IsOnCurve(bigX, bigY *big.Int) bool { -- var x, y p224FieldElement -- p224FromBig(&x, bigX) -- p224FromBig(&y, bigY) -- -- // y² = x³ - 3x + b -- var tmp p224LargeFieldElement -- var x3 p224FieldElement -- p224Square(&x3, &x, &tmp) -- p224Mul(&x3, &x3, &x, &tmp) -- -- for i := 0; i < 8; i++ { -- x[i] *= 3 -- } -- p224Sub(&x3, &x3, &x) -- p224Reduce(&x3) -- p224Add(&x3, &x3, &curve.b) -- p224Contract(&x3, &x3) -- -- p224Square(&y, &y, &tmp) -- p224Contract(&y, &y) -- -- for i := 0; i < 8; i++ { -- if y[i] != x3[i] { -- return false -- } -- } -- return true --} -- --func (p224Curve) Add(bigX1, bigY1, bigX2, bigY2 *big.Int) (x, y *big.Int) { -- var x1, y1, z1, x2, y2, z2, x3, y3, z3 p224FieldElement -- -- p224FromBig(&x1, bigX1) -- p224FromBig(&y1, bigY1) -- if bigX1.Sign() != 0 || bigY1.Sign() != 0 { -- z1[0] = 1 -- } -- p224FromBig(&x2, bigX2) -- p224FromBig(&y2, bigY2) -- if bigX2.Sign() != 0 || bigY2.Sign() != 0 { -- z2[0] = 1 -- } -- -- p224AddJacobian(&x3, &y3, &z3, &x1, &y1, &z1, &x2, &y2, &z2) -- return p224ToAffine(&x3, &y3, &z3) --} -- --func (p224Curve) Double(bigX1, bigY1 *big.Int) (x, y *big.Int) { -- var x1, y1, z1, x2, y2, z2 p224FieldElement -- -- p224FromBig(&x1, bigX1) -- p224FromBig(&y1, bigY1) -- z1[0] = 1 -- -- p224DoubleJacobian(&x2, &y2, &z2, &x1, &y1, &z1) -- return p224ToAffine(&x2, &y2, &z2) --} -- --func (p224Curve) ScalarMult(bigX1, bigY1 *big.Int, scalar []byte) (x, y *big.Int) { -- var x1, y1, z1, x2, y2, z2 p224FieldElement -- -- p224FromBig(&x1, bigX1) -- p224FromBig(&y1, bigY1) -- z1[0] = 1 -- -- p224ScalarMult(&x2, &y2, &z2, &x1, &y1, &z1, scalar) -- return p224ToAffine(&x2, &y2, &z2) --} -- --func (curve p224Curve) ScalarBaseMult(scalar []byte) (x, y *big.Int) { -- var z1, x2, y2, z2 p224FieldElement -- -- z1[0] = 1 -- p224ScalarMult(&x2, &y2, &z2, &curve.gx, &curve.gy, &z1, scalar) -- return p224ToAffine(&x2, &y2, &z2) --} -- --// Field element functions. --// --// The field that we're dealing with is ℤ/pℤ where p = 2**224 - 2**96 + 1. --// --// Field elements are represented by a FieldElement, which is a typedef to an --// array of 8 uint32's. The value of a FieldElement, a, is: --// a[0] + 2**28·a[1] + 2**56·a[1] + ... + 2**196·a[7] --// --// Using 28-bit limbs means that there's only 4 bits of headroom, which is less --// than we would really like. But it has the useful feature that we hit 2**224 --// exactly, making the reflections during a reduce much nicer. --type p224FieldElement [8]uint32 -- --// p224P is the order of the field, represented as a p224FieldElement. --var p224P = [8]uint32{1, 0, 0, 0xffff000, 0xfffffff, 0xfffffff, 0xfffffff, 0xfffffff} -- --// p224IsZero returns 1 if a == 0 mod p and 0 otherwise. --// --// a[i] < 2**29 --func p224IsZero(a *p224FieldElement) uint32 { -- // Since a p224FieldElement contains 224 bits there are two possible -- // representations of 0: 0 and p. -- var minimal p224FieldElement -- p224Contract(&minimal, a) -- -- var isZero, isP uint32 -- for i, v := range minimal { -- isZero |= v -- isP |= v - p224P[i] -- } -- -- // If either isZero or isP is 0, then we should return 1. -- isZero |= isZero >> 16 -- isZero |= isZero >> 8 -- isZero |= isZero >> 4 -- isZero |= isZero >> 2 -- isZero |= isZero >> 1 -- -- isP |= isP >> 16 -- isP |= isP >> 8 -- isP |= isP >> 4 -- isP |= isP >> 2 -- isP |= isP >> 1 -- -- // For isZero and isP, the LSB is 0 iff all the bits are zero. -- result := isZero & isP -- result = (^result) & 1 -- -- return result --} -- --// p224Add computes *out = a+b --// --// a[i] + b[i] < 2**32 --func p224Add(out, a, b *p224FieldElement) { -- for i := 0; i < 8; i++ { -- out[i] = a[i] + b[i] -- } --} -- --const two31p3 = 1<<31 + 1<<3 --const two31m3 = 1<<31 - 1<<3 --const two31m15m3 = 1<<31 - 1<<15 - 1<<3 -- --// p224ZeroModP31 is 0 mod p where bit 31 is set in all limbs so that we can --// subtract smaller amounts without underflow. See the section "Subtraction" in --// [1] for reasoning. --var p224ZeroModP31 = []uint32{two31p3, two31m3, two31m3, two31m15m3, two31m3, two31m3, two31m3, two31m3} -- --// p224Sub computes *out = a-b --// --// a[i], b[i] < 2**30 --// out[i] < 2**32 --func p224Sub(out, a, b *p224FieldElement) { -- for i := 0; i < 8; i++ { -- out[i] = a[i] + p224ZeroModP31[i] - b[i] -- } --} -- --// LargeFieldElement also represents an element of the field. The limbs are --// still spaced 28-bits apart and in little-endian order. So the limbs are at --// 0, 28, 56, ..., 392 bits, each 64-bits wide. --type p224LargeFieldElement [15]uint64 -- --const two63p35 = 1<<63 + 1<<35 --const two63m35 = 1<<63 - 1<<35 --const two63m35m19 = 1<<63 - 1<<35 - 1<<19 -- --// p224ZeroModP63 is 0 mod p where bit 63 is set in all limbs. See the section --// "Subtraction" in [1] for why. --var p224ZeroModP63 = [8]uint64{two63p35, two63m35, two63m35, two63m35, two63m35m19, two63m35, two63m35, two63m35} -- --const bottom12Bits = 0xfff --const bottom28Bits = 0xfffffff -- --// p224Mul computes *out = a*b --// --// a[i] < 2**29, b[i] < 2**30 (or vice versa) --// out[i] < 2**29 --func p224Mul(out, a, b *p224FieldElement, tmp *p224LargeFieldElement) { -- for i := 0; i < 15; i++ { -- tmp[i] = 0 -- } -- -- for i := 0; i < 8; i++ { -- for j := 0; j < 8; j++ { -- tmp[i+j] += uint64(a[i]) * uint64(b[j]) -- } -- } -- -- p224ReduceLarge(out, tmp) --} -- --// Square computes *out = a*a --// --// a[i] < 2**29 --// out[i] < 2**29 --func p224Square(out, a *p224FieldElement, tmp *p224LargeFieldElement) { -- for i := 0; i < 15; i++ { -- tmp[i] = 0 -- } -- -- for i := 0; i < 8; i++ { -- for j := 0; j <= i; j++ { -- r := uint64(a[i]) * uint64(a[j]) -- if i == j { -- tmp[i+j] += r -- } else { -- tmp[i+j] += r << 1 -- } -- } -- } -- -- p224ReduceLarge(out, tmp) --} -- --// ReduceLarge converts a p224LargeFieldElement to a p224FieldElement. --// --// in[i] < 2**62 --func p224ReduceLarge(out *p224FieldElement, in *p224LargeFieldElement) { -- for i := 0; i < 8; i++ { -- in[i] += p224ZeroModP63[i] -- } -- -- // Eliminate the coefficients at 2**224 and greater. -- for i := 14; i >= 8; i-- { -- in[i-8] -= in[i] -- in[i-5] += (in[i] & 0xffff) << 12 -- in[i-4] += in[i] >> 16 -- } -- in[8] = 0 -- // in[0..8] < 2**64 -- -- // As the values become small enough, we start to store them in |out| -- // and use 32-bit operations. -- for i := 1; i < 8; i++ { -- in[i+1] += in[i] >> 28 -- out[i] = uint32(in[i] & bottom28Bits) -- } -- in[0] -= in[8] -- out[3] += uint32(in[8]&0xffff) << 12 -- out[4] += uint32(in[8] >> 16) -- // in[0] < 2**64 -- // out[3] < 2**29 -- // out[4] < 2**29 -- // out[1,2,5..7] < 2**28 -- -- out[0] = uint32(in[0] & bottom28Bits) -- out[1] += uint32((in[0] >> 28) & bottom28Bits) -- out[2] += uint32(in[0] >> 56) -- // out[0] < 2**28 -- // out[1..4] < 2**29 -- // out[5..7] < 2**28 --} -- --// Reduce reduces the coefficients of a to smaller bounds. --// --// On entry: a[i] < 2**31 + 2**30 --// On exit: a[i] < 2**29 --func p224Reduce(a *p224FieldElement) { -- for i := 0; i < 7; i++ { -- a[i+1] += a[i] >> 28 -- a[i] &= bottom28Bits -- } -- top := a[7] >> 28 -- a[7] &= bottom28Bits -- -- // top < 2**4 -- mask := top -- mask |= mask >> 2 -- mask |= mask >> 1 -- mask <<= 31 -- mask = uint32(int32(mask) >> 31) -- // Mask is all ones if top != 0, all zero otherwise -- -- a[0] -= top -- a[3] += top << 12 -- -- // We may have just made a[0] negative but, if we did, then we must -- // have added something to a[3], this it's > 2**12. Therefore we can -- // carry down to a[0]. -- a[3] -= 1 & mask -- a[2] += mask & (1<<28 - 1) -- a[1] += mask & (1<<28 - 1) -- a[0] += mask & (1 << 28) --} -- --// p224Invert calculates *out = in**-1 by computing in**(2**224 - 2**96 - 1), --// i.e. Fermat's little theorem. --func p224Invert(out, in *p224FieldElement) { -- var f1, f2, f3, f4 p224FieldElement -- var c p224LargeFieldElement -- -- p224Square(&f1, in, &c) // 2 -- p224Mul(&f1, &f1, in, &c) // 2**2 - 1 -- p224Square(&f1, &f1, &c) // 2**3 - 2 -- p224Mul(&f1, &f1, in, &c) // 2**3 - 1 -- p224Square(&f2, &f1, &c) // 2**4 - 2 -- p224Square(&f2, &f2, &c) // 2**5 - 4 -- p224Square(&f2, &f2, &c) // 2**6 - 8 -- p224Mul(&f1, &f1, &f2, &c) // 2**6 - 1 -- p224Square(&f2, &f1, &c) // 2**7 - 2 -- for i := 0; i < 5; i++ { // 2**12 - 2**6 -- p224Square(&f2, &f2, &c) -- } -- p224Mul(&f2, &f2, &f1, &c) // 2**12 - 1 -- p224Square(&f3, &f2, &c) // 2**13 - 2 -- for i := 0; i < 11; i++ { // 2**24 - 2**12 -- p224Square(&f3, &f3, &c) -- } -- p224Mul(&f2, &f3, &f2, &c) // 2**24 - 1 -- p224Square(&f3, &f2, &c) // 2**25 - 2 -- for i := 0; i < 23; i++ { // 2**48 - 2**24 -- p224Square(&f3, &f3, &c) -- } -- p224Mul(&f3, &f3, &f2, &c) // 2**48 - 1 -- p224Square(&f4, &f3, &c) // 2**49 - 2 -- for i := 0; i < 47; i++ { // 2**96 - 2**48 -- p224Square(&f4, &f4, &c) -- } -- p224Mul(&f3, &f3, &f4, &c) // 2**96 - 1 -- p224Square(&f4, &f3, &c) // 2**97 - 2 -- for i := 0; i < 23; i++ { // 2**120 - 2**24 -- p224Square(&f4, &f4, &c) -- } -- p224Mul(&f2, &f4, &f2, &c) // 2**120 - 1 -- for i := 0; i < 6; i++ { // 2**126 - 2**6 -- p224Square(&f2, &f2, &c) -- } -- p224Mul(&f1, &f1, &f2, &c) // 2**126 - 1 -- p224Square(&f1, &f1, &c) // 2**127 - 2 -- p224Mul(&f1, &f1, in, &c) // 2**127 - 1 -- for i := 0; i < 97; i++ { // 2**224 - 2**97 -- p224Square(&f1, &f1, &c) -- } -- p224Mul(out, &f1, &f3, &c) // 2**224 - 2**96 - 1 --} -- --// p224Contract converts a FieldElement to its unique, minimal form. --// --// On entry, in[i] < 2**29 --// On exit, in[i] < 2**28 --func p224Contract(out, in *p224FieldElement) { -- copy(out[:], in[:]) -- -- for i := 0; i < 7; i++ { -- out[i+1] += out[i] >> 28 -- out[i] &= bottom28Bits -- } -- top := out[7] >> 28 -- out[7] &= bottom28Bits -- -- out[0] -= top -- out[3] += top << 12 -- -- // We may just have made out[i] negative. So we carry down. If we made -- // out[0] negative then we know that out[3] is sufficiently positive -- // because we just added to it. -- for i := 0; i < 3; i++ { -- mask := uint32(int32(out[i]) >> 31) -- out[i] += (1 << 28) & mask -- out[i+1] -= 1 & mask -- } -- -- // We might have pushed out[3] over 2**28 so we perform another, partial, -- // carry chain. -- for i := 3; i < 7; i++ { -- out[i+1] += out[i] >> 28 -- out[i] &= bottom28Bits -- } -- top = out[7] >> 28 -- out[7] &= bottom28Bits -- -- // Eliminate top while maintaining the same value mod p. -- out[0] -= top -- out[3] += top << 12 -- -- // There are two cases to consider for out[3]: -- // 1) The first time that we eliminated top, we didn't push out[3] over -- // 2**28. In this case, the partial carry chain didn't change any values -- // and top is zero. -- // 2) We did push out[3] over 2**28 the first time that we eliminated top. -- // The first value of top was in [0..16), therefore, prior to eliminating -- // the first top, 0xfff1000 <= out[3] <= 0xfffffff. Therefore, after -- // overflowing and being reduced by the second carry chain, out[3] <= -- // 0xf000. Thus it cannot have overflowed when we eliminated top for the -- // second time. -- -- // Again, we may just have made out[0] negative, so do the same carry down. -- // As before, if we made out[0] negative then we know that out[3] is -- // sufficiently positive. -- for i := 0; i < 3; i++ { -- mask := uint32(int32(out[i]) >> 31) -- out[i] += (1 << 28) & mask -- out[i+1] -= 1 & mask -- } -- -- // Now we see if the value is >= p and, if so, subtract p. -- -- // First we build a mask from the top four limbs, which must all be -- // equal to bottom28Bits if the whole value is >= p. If top4AllOnes -- // ends up with any zero bits in the bottom 28 bits, then this wasn't -- // true. -- top4AllOnes := uint32(0xffffffff) -- for i := 4; i < 8; i++ { -- top4AllOnes &= out[i] -- } -- top4AllOnes |= 0xf0000000 -- // Now we replicate any zero bits to all the bits in top4AllOnes. -- top4AllOnes &= top4AllOnes >> 16 -- top4AllOnes &= top4AllOnes >> 8 -- top4AllOnes &= top4AllOnes >> 4 -- top4AllOnes &= top4AllOnes >> 2 -- top4AllOnes &= top4AllOnes >> 1 -- top4AllOnes = uint32(int32(top4AllOnes<<31) >> 31) -- -- // Now we test whether the bottom three limbs are non-zero. -- bottom3NonZero := out[0] | out[1] | out[2] -- bottom3NonZero |= bottom3NonZero >> 16 -- bottom3NonZero |= bottom3NonZero >> 8 -- bottom3NonZero |= bottom3NonZero >> 4 -- bottom3NonZero |= bottom3NonZero >> 2 -- bottom3NonZero |= bottom3NonZero >> 1 -- bottom3NonZero = uint32(int32(bottom3NonZero<<31) >> 31) -- -- // Everything depends on the value of out[3]. -- // If it's > 0xffff000 and top4AllOnes != 0 then the whole value is >= p -- // If it's = 0xffff000 and top4AllOnes != 0 and bottom3NonZero != 0, -- // then the whole value is >= p -- // If it's < 0xffff000, then the whole value is < p -- n := out[3] - 0xffff000 -- out3Equal := n -- out3Equal |= out3Equal >> 16 -- out3Equal |= out3Equal >> 8 -- out3Equal |= out3Equal >> 4 -- out3Equal |= out3Equal >> 2 -- out3Equal |= out3Equal >> 1 -- out3Equal = ^uint32(int32(out3Equal<<31) >> 31) -- -- // If out[3] > 0xffff000 then n's MSB will be zero. -- out3GT := ^uint32(int32(n) >> 31) -- -- mask := top4AllOnes & ((out3Equal & bottom3NonZero) | out3GT) -- out[0] -= 1 & mask -- out[3] -= 0xffff000 & mask -- out[4] -= 0xfffffff & mask -- out[5] -= 0xfffffff & mask -- out[6] -= 0xfffffff & mask -- out[7] -= 0xfffffff & mask --} -- --// Group element functions. --// --// These functions deal with group elements. The group is an elliptic curve --// group with a = -3 defined in FIPS 186-3, section D.2.2. -- --// p224AddJacobian computes *out = a+b where a != b. --func p224AddJacobian(x3, y3, z3, x1, y1, z1, x2, y2, z2 *p224FieldElement) { -- // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-p224Add-2007-bl -- var z1z1, z2z2, u1, u2, s1, s2, h, i, j, r, v p224FieldElement -- var c p224LargeFieldElement -- -- z1IsZero := p224IsZero(z1) -- z2IsZero := p224IsZero(z2) -- -- // Z1Z1 = Z1² -- p224Square(&z1z1, z1, &c) -- // Z2Z2 = Z2² -- p224Square(&z2z2, z2, &c) -- // U1 = X1*Z2Z2 -- p224Mul(&u1, x1, &z2z2, &c) -- // U2 = X2*Z1Z1 -- p224Mul(&u2, x2, &z1z1, &c) -- // S1 = Y1*Z2*Z2Z2 -- p224Mul(&s1, z2, &z2z2, &c) -- p224Mul(&s1, y1, &s1, &c) -- // S2 = Y2*Z1*Z1Z1 -- p224Mul(&s2, z1, &z1z1, &c) -- p224Mul(&s2, y2, &s2, &c) -- // H = U2-U1 -- p224Sub(&h, &u2, &u1) -- p224Reduce(&h) -- xEqual := p224IsZero(&h) -- // I = (2*H)² -- for j := 0; j < 8; j++ { -- i[j] = h[j] << 1 -- } -- p224Reduce(&i) -- p224Square(&i, &i, &c) -- // J = H*I -- p224Mul(&j, &h, &i, &c) -- // r = 2*(S2-S1) -- p224Sub(&r, &s2, &s1) -- p224Reduce(&r) -- yEqual := p224IsZero(&r) -- if xEqual == 1 && yEqual == 1 && z1IsZero == 0 && z2IsZero == 0 { -- p224DoubleJacobian(x3, y3, z3, x1, y1, z1) -- return -- } -- for i := 0; i < 8; i++ { -- r[i] <<= 1 -- } -- p224Reduce(&r) -- // V = U1*I -- p224Mul(&v, &u1, &i, &c) -- // Z3 = ((Z1+Z2)²-Z1Z1-Z2Z2)*H -- p224Add(&z1z1, &z1z1, &z2z2) -- p224Add(&z2z2, z1, z2) -- p224Reduce(&z2z2) -- p224Square(&z2z2, &z2z2, &c) -- p224Sub(z3, &z2z2, &z1z1) -- p224Reduce(z3) -- p224Mul(z3, z3, &h, &c) -- // X3 = r²-J-2*V -- for i := 0; i < 8; i++ { -- z1z1[i] = v[i] << 1 -- } -- p224Add(&z1z1, &j, &z1z1) -- p224Reduce(&z1z1) -- p224Square(x3, &r, &c) -- p224Sub(x3, x3, &z1z1) -- p224Reduce(x3) -- // Y3 = r*(V-X3)-2*S1*J -- for i := 0; i < 8; i++ { -- s1[i] <<= 1 -- } -- p224Mul(&s1, &s1, &j, &c) -- p224Sub(&z1z1, &v, x3) -- p224Reduce(&z1z1) -- p224Mul(&z1z1, &z1z1, &r, &c) -- p224Sub(y3, &z1z1, &s1) -- p224Reduce(y3) -- -- p224CopyConditional(x3, x2, z1IsZero) -- p224CopyConditional(x3, x1, z2IsZero) -- p224CopyConditional(y3, y2, z1IsZero) -- p224CopyConditional(y3, y1, z2IsZero) -- p224CopyConditional(z3, z2, z1IsZero) -- p224CopyConditional(z3, z1, z2IsZero) --} -- --// p224DoubleJacobian computes *out = a+a. --func p224DoubleJacobian(x3, y3, z3, x1, y1, z1 *p224FieldElement) { -- var delta, gamma, beta, alpha, t p224FieldElement -- var c p224LargeFieldElement -- -- p224Square(&delta, z1, &c) -- p224Square(&gamma, y1, &c) -- p224Mul(&beta, x1, &gamma, &c) -- -- // alpha = 3*(X1-delta)*(X1+delta) -- p224Add(&t, x1, &delta) -- for i := 0; i < 8; i++ { -- t[i] += t[i] << 1 -- } -- p224Reduce(&t) -- p224Sub(&alpha, x1, &delta) -- p224Reduce(&alpha) -- p224Mul(&alpha, &alpha, &t, &c) -- -- // Z3 = (Y1+Z1)²-gamma-delta -- p224Add(z3, y1, z1) -- p224Reduce(z3) -- p224Square(z3, z3, &c) -- p224Sub(z3, z3, &gamma) -- p224Reduce(z3) -- p224Sub(z3, z3, &delta) -- p224Reduce(z3) -- -- // X3 = alpha²-8*beta -- for i := 0; i < 8; i++ { -- delta[i] = beta[i] << 3 -- } -- p224Reduce(&delta) -- p224Square(x3, &alpha, &c) -- p224Sub(x3, x3, &delta) -- p224Reduce(x3) -- -- // Y3 = alpha*(4*beta-X3)-8*gamma² -- for i := 0; i < 8; i++ { -- beta[i] <<= 2 -- } -- p224Sub(&beta, &beta, x3) -- p224Reduce(&beta) -- p224Square(&gamma, &gamma, &c) -- for i := 0; i < 8; i++ { -- gamma[i] <<= 3 -- } -- p224Reduce(&gamma) -- p224Mul(y3, &alpha, &beta, &c) -- p224Sub(y3, y3, &gamma) -- p224Reduce(y3) --} -- --// p224CopyConditional sets *out = *in iff the least-significant-bit of control --// is true, and it runs in constant time. --func p224CopyConditional(out, in *p224FieldElement, control uint32) { -- control <<= 31 -- control = uint32(int32(control) >> 31) -- -- for i := 0; i < 8; i++ { -- out[i] ^= (out[i] ^ in[i]) & control -- } --} -- --func p224ScalarMult(outX, outY, outZ, inX, inY, inZ *p224FieldElement, scalar []byte) { -- var xx, yy, zz p224FieldElement -- for i := 0; i < 8; i++ { -- outX[i] = 0 -- outY[i] = 0 -- outZ[i] = 0 -- } -- -- for _, byte := range scalar { -- for bitNum := uint(0); bitNum < 8; bitNum++ { -- p224DoubleJacobian(outX, outY, outZ, outX, outY, outZ) -- bit := uint32((byte >> (7 - bitNum)) & 1) -- p224AddJacobian(&xx, &yy, &zz, inX, inY, inZ, outX, outY, outZ) -- p224CopyConditional(outX, &xx, bit) -- p224CopyConditional(outY, &yy, bit) -- p224CopyConditional(outZ, &zz, bit) -- } -- } --} -- --// p224ToAffine converts from Jacobian to affine form. --func p224ToAffine(x, y, z *p224FieldElement) (*big.Int, *big.Int) { -- var zinv, zinvsq, outx, outy p224FieldElement -- var tmp p224LargeFieldElement -- -- if isPointAtInfinity := p224IsZero(z); isPointAtInfinity == 1 { -- return new(big.Int), new(big.Int) -- } -- -- p224Invert(&zinv, z) -- p224Square(&zinvsq, &zinv, &tmp) -- p224Mul(x, x, &zinvsq, &tmp) -- p224Mul(&zinvsq, &zinvsq, &zinv, &tmp) -- p224Mul(y, y, &zinvsq, &tmp) -- -- p224Contract(&outx, x) -- p224Contract(&outy, y) -- return p224ToBig(&outx), p224ToBig(&outy) --} -- --// get28BitsFromEnd returns the least-significant 28 bits from buf>>shift, --// where buf is interpreted as a big-endian number. --func get28BitsFromEnd(buf []byte, shift uint) (uint32, []byte) { -- var ret uint32 -- -- for i := uint(0); i < 4; i++ { -- var b byte -- if l := len(buf); l > 0 { -- b = buf[l-1] -- // We don't remove the byte if we're about to return and we're not -- // reading all of it. -- if i != 3 || shift == 4 { -- buf = buf[:l-1] -- } -- } -- ret |= uint32(b) << (8 * i) >> shift -- } -- ret &= bottom28Bits -- return ret, buf --} -- --// p224FromBig sets *out = *in. --func p224FromBig(out *p224FieldElement, in *big.Int) { -- bytes := in.Bytes() -- out[0], bytes = get28BitsFromEnd(bytes, 0) -- out[1], bytes = get28BitsFromEnd(bytes, 4) -- out[2], bytes = get28BitsFromEnd(bytes, 0) -- out[3], bytes = get28BitsFromEnd(bytes, 4) -- out[4], bytes = get28BitsFromEnd(bytes, 0) -- out[5], bytes = get28BitsFromEnd(bytes, 4) -- out[6], bytes = get28BitsFromEnd(bytes, 0) -- out[7], bytes = get28BitsFromEnd(bytes, 4) --} -- --// p224ToBig returns in as a big.Int. --func p224ToBig(in *p224FieldElement) *big.Int { -- var buf [28]byte -- buf[27] = byte(in[0]) -- buf[26] = byte(in[0] >> 8) -- buf[25] = byte(in[0] >> 16) -- buf[24] = byte(((in[0] >> 24) & 0x0f) | (in[1]<<4)&0xf0) -- -- buf[23] = byte(in[1] >> 4) -- buf[22] = byte(in[1] >> 12) -- buf[21] = byte(in[1] >> 20) -- -- buf[20] = byte(in[2]) -- buf[19] = byte(in[2] >> 8) -- buf[18] = byte(in[2] >> 16) -- buf[17] = byte(((in[2] >> 24) & 0x0f) | (in[3]<<4)&0xf0) -- -- buf[16] = byte(in[3] >> 4) -- buf[15] = byte(in[3] >> 12) -- buf[14] = byte(in[3] >> 20) -- -- buf[13] = byte(in[4]) -- buf[12] = byte(in[4] >> 8) -- buf[11] = byte(in[4] >> 16) -- buf[10] = byte(((in[4] >> 24) & 0x0f) | (in[5]<<4)&0xf0) -- -- buf[9] = byte(in[5] >> 4) -- buf[8] = byte(in[5] >> 12) -- buf[7] = byte(in[5] >> 20) -- -- buf[6] = byte(in[6]) -- buf[5] = byte(in[6] >> 8) -- buf[4] = byte(in[6] >> 16) -- buf[3] = byte(((in[6] >> 24) & 0x0f) | (in[7]<<4)&0xf0) -- -- buf[2] = byte(in[7] >> 4) -- buf[1] = byte(in[7] >> 12) -- buf[0] = byte(in[7] >> 20) -- -- return new(big.Int).SetBytes(buf[:]) --} -diff --git a/src/crypto/elliptic/p224_test.go b/src/crypto/elliptic/p224_test.go -deleted file mode 100644 -index 8b4fa04..0000000 ---- a/src/crypto/elliptic/p224_test.go -+++ /dev/null -@@ -1,47 +0,0 @@ --// Copyright 2012 The Go Authors. All rights reserved. --// Use of this source code is governed by a BSD-style --// license that can be found in the LICENSE file. -- --package elliptic -- --import ( -- "math/big" -- "testing" --) -- --var toFromBigTests = []string{ -- "0", -- "1", -- "23", -- "b70e0cb46bb4bf7f321390b94a03c1d356c01122343280d6105c1d21", -- "706a46d476dcb76798e6046d89474788d164c18032d268fd10704fa6", --} -- --func p224AlternativeToBig(in *p224FieldElement) *big.Int { -- ret := new(big.Int) -- tmp := new(big.Int) -- -- for i := uint(0); i < 8; i++ { -- tmp.SetInt64(int64(in[i])) -- tmp.Lsh(tmp, 28*i) -- ret.Add(ret, tmp) -- } -- ret.Mod(ret, p224.P) -- return ret --} -- --func TestToFromBig(t *testing.T) { -- for i, test := range toFromBigTests { -- n, _ := new(big.Int).SetString(test, 16) -- var x p224FieldElement -- p224FromBig(&x, n) -- m := p224ToBig(&x) -- if n.Cmp(m) != 0 { -- t.Errorf("#%d: %x != %x", i, n, m) -- } -- q := p224AlternativeToBig(&x) -- if n.Cmp(q) != 0 { -- t.Errorf("#%d: %x != %x (alternative)", i, n, m) -- } -- } --} -diff --git a/src/crypto/tls/generate_cert.go b/src/crypto/tls/generate_cert.go -index 83f9916..dea8589 100644 ---- a/src/crypto/tls/generate_cert.go -+++ b/src/crypto/tls/generate_cert.go -@@ -33,7 +33,7 @@ var ( - validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for") - isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority") - rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set") -- ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521") -+ ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P256, P384, P521") - ) - - func publicKey(priv interface{}) interface{} { -@@ -75,8 +75,6 @@ func main() { - switch *ecdsaCurve { - case "": - priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) -- case "P224": -- priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) - case "P256": - priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - case "P384": -diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go -index 9e6d67d..580831e 100644 ---- a/src/crypto/x509/x509.go -+++ b/src/crypto/x509/x509.go -@@ -340,9 +340,6 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm - - // RFC 5480, 2.1.1.1. Named Curve - // --// secp224r1 OBJECT IDENTIFIER ::= { --// iso(1) identified-organization(3) certicom(132) curve(0) 33 } --// - // secp256r1 OBJECT IDENTIFIER ::= { - // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) - // prime(1) 7 } -@@ -355,7 +352,6 @@ func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm - // - // NB: secp256r1 is equivalent to prime256v1 - var ( -- oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33} - oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7} - oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34} - oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35} -@@ -363,8 +359,6 @@ var ( - - func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { - switch { -- case oid.Equal(oidNamedCurveP224): -- return elliptic.P224() - case oid.Equal(oidNamedCurveP256): - return elliptic.P256() - case oid.Equal(oidNamedCurveP384): -@@ -377,8 +371,6 @@ func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { - - func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) { - switch curve { -- case elliptic.P224(): -- return oidNamedCurveP224, true - case elliptic.P256(): - return oidNamedCurveP256, true - case elliptic.P384(): -@@ -1508,7 +1500,7 @@ func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgori - pubType = ECDSA - - switch pub.Curve { -- case elliptic.P224(), elliptic.P256(): -+ case elliptic.P256(): - hashFunc = crypto.SHA256 - sigAlgo.Algorithm = oidSignatureECDSAWithSHA256 - case elliptic.P384(): diff --git a/golang.spec b/golang.spec index 662dbb9..460c082 100644 --- a/golang.spec +++ b/golang.spec @@ -48,7 +48,7 @@ Name: golang Version: 1.7.3 -Release: 1%{?dist} +Release: 2%{?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 @@ -71,9 +71,6 @@ Requires: %{name}-src = %{version}-%{release} Patch0: golang-1.2-verbose-build.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=1038683 -Patch1: golang-1.2-remove-ECC-p224.patch - # use the arch dependent path in the bootstrap Patch212: golang-1.5-bootstrap-binary-path.patch @@ -208,9 +205,6 @@ Summary: Golang shared object libraries # increase verbosity of build %patch0 -p1 -b .verbose -# remove the P224 curve -%patch1 -p1 -b .curve - # use the arch dependent path in the bootstrap %patch212 -p1 -b .bootstrap @@ -450,6 +444,9 @@ fi %endif %changelog +* Fri Nov 18 2016 Jakub Čajka - 1.7.3-2 +- enable back p224 curve(see BZ#1038683) + * Fri Oct 21 2016 Jakub Čajka - 1.7.3-1 - rebase to go1.7.3 - Fix possible relocation overflows on ppc From e3d5bfee3fd0699a378638692b8b1cd2766c863d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 5 Dec 2016 14:21:12 +0100 Subject: [PATCH 40/67] Bump to 1.7.4 Resolves: BZ#1400732 --- .gitignore | 1 + golang.spec | 10 +++++++--- sources | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 72f9827..ec82f39 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ /go1.5.1.src.tar.gz /go1.7.1.src.tar.gz /go1.7.3.src.tar.gz +/go1.7.4.src.tar.gz diff --git a/golang.spec b/golang.spec index 460c082..35324fe 100644 --- a/golang.spec +++ b/golang.spec @@ -44,11 +44,11 @@ %endif %global go_api 1.7 -%global go_version 1.7.3 +%global go_version 1.7.4 Name: golang -Version: 1.7.3 -Release: 2%{?dist} +Version: 1.7.4 +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 @@ -444,6 +444,10 @@ fi %endif %changelog +* Mon Dec 05 2016 Jakub Čajka - 1.7.4-1 +- Bump to 1.7.4 +- Resolves: BZ#1400732 + * Fri Nov 18 2016 Jakub Čajka - 1.7.3-2 - enable back p224 curve(see BZ#1038683) diff --git a/sources b/sources index 8390332..a66d54c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -83d1b7bd4281479ab7d153e5152c9fc9 go1.7.3.src.tar.gz +49c1076428a5d3b5ad7ac65233fcca2f go1.7.4.src.tar.gz From 5c3bfeff0a8f8962aa1c6adc308c0baf802c748a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Thu, 15 Jun 2017 14:21:12 +0200 Subject: [PATCH 41/67] Bump to 1.7.6 Fix for CVE-2017-8932 Resolves: BZ#1455190 --- .gitignore | 1 + golang.spec | 10 +++-- sources | 2 +- tzdata-fix.patch | 113 ++++++++++++++++++++++++++++++++++++----------- 4 files changed, 97 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index ec82f39..6969e5f 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ /go1.7.1.src.tar.gz /go1.7.3.src.tar.gz /go1.7.4.src.tar.gz +/go1.7.6.src.tar.gz diff --git a/golang.spec b/golang.spec index 35324fe..6b72c37 100644 --- a/golang.spec +++ b/golang.spec @@ -44,10 +44,10 @@ %endif %global go_api 1.7 -%global go_version 1.7.4 +%global go_version 1.7.6 Name: golang -Version: 1.7.4 +Version: 1.7.6 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -86,7 +86,6 @@ Patch215: ./go1.5-zoneinfo_testing_only.patch Patch216: ppc64x-overflow-1.patch Patch217: ppc64x-overflow-2.patch -# Fix for https://github.com/golang/go/issues/17276 Patch218: tzdata-fix.patch # Having documentation separate was broken @@ -444,6 +443,11 @@ fi %endif %changelog +* Thu Jun 15 2017 Jakub Čajka - 1.7.4-1 +- Bump to 1.7.6 +- Fix for CVE-2017-8932 +- Resolves: BZ#1455190 + * Mon Dec 05 2016 Jakub Čajka - 1.7.4-1 - Bump to 1.7.4 - Resolves: BZ#1400732 diff --git a/sources b/sources index a66d54c..2eb8220 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -49c1076428a5d3b5ad7ac65233fcca2f go1.7.4.src.tar.gz +SHA512 (go1.7.6.src.tar.gz) = b01846bfb17bf91a9c493c4d6c43bbe7e17270b9e8a229a2be4032b78ef9395f5512917ea9faab74a120c755bbd53bbd816b033caadcbb7679e91702b37f8c7f diff --git a/tzdata-fix.patch b/tzdata-fix.patch index b7e6e41..8fb9f40 100644 --- a/tzdata-fix.patch +++ b/tzdata-fix.patch @@ -1,34 +1,97 @@ -From c5434f2973a87acff76bac359236e690d632ce95 Mon Sep 17 00:00:00 2001 +From 8890527476e25747f063377d637b106db0008329 Mon Sep 17 00:00:00 2001 From: Alberto Donizetti -Date: Thu, 29 Sep 2016 13:59:10 +0200 -Subject: [PATCH] time: update test for tzdata-2016g +Date: Thu, 9 Mar 2017 13:20:54 +0100 +Subject: [PATCH] [release-branch.go1.8] time: make the ParseInLocation test + more robust -Fixes #17276 +The tzdata 2017a update (2017-02-28) changed the abbreviation of the +Asia/Baghdad time zone (used in TestParseInLocation) from 'AST' to the +numeric '+03'. -Change-Id: I0188cf9bc5fdb48c71ad929cc54206d03e0b96e4 -Reviewed-on: https://go-review.googlesource.com/29995 -Reviewed-by: Brad Fitzpatrick -Run-TryBot: Brad Fitzpatrick +Update the test so that it skips the checks if we're using a recent +tzdata release. + +Fixes #19457 + +Change-Id: I45d705a5520743a611bdd194dc8f8d618679980c +Reviewed-on: https://go-review.googlesource.com/37964 +Reviewed-by: Ian Lance Taylor +Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot +(cherry picked from commit 91563ced5897faf729a34be7081568efcfedda31) +Reviewed-on: https://go-review.googlesource.com/37991 +Run-TryBot: Brad Fitzpatrick --- - src/time/time_test.go | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) + src/time/format_test.go | 41 +++++++++++++++++++++++++++++++---------- + 1 file changed, 31 insertions(+), 10 deletions(-) -diff --git a/src/time/time_test.go b/src/time/time_test.go -index 68236fd..2e47d08 100644 ---- a/src/time/time_test.go -+++ b/src/time/time_test.go -@@ -943,8 +943,11 @@ func TestLoadFixed(t *testing.T) { - // but Go and most other systems use "east is positive". - // So GMT+1 corresponds to -3600 in the Go zone, not +3600. - name, offset := Now().In(loc).Zone() -- if name != "GMT+1" || offset != -1*60*60 { -- t.Errorf("Now().In(loc).Zone() = %q, %d, want %q, %d", name, offset, "GMT+1", -1*60*60) -+ // The zone abbreviation is "-01" since tzdata-2016g, and "GMT+1" -+ // on earlier versions; we accept both. (Issue #17276). -+ if !(name == "GMT+1" || name == "-01") || offset != -1*60*60 { -+ t.Errorf("Now().In(loc).Zone() = %q, %d, want %q or %q, %d", -+ name, offset, "GMT+1", "-01", -1*60*60) +diff --git a/src/time/format_test.go b/src/time/format_test.go +index 219c2ca..d0013bc 100644 +--- a/src/time/format_test.go ++++ b/src/time/format_test.go +@@ -245,27 +245,45 @@ func TestParseDayOutOfRange(t *testing.T) { } } ++// TestParseInLocation checks that the Parse and ParseInLocation ++// functions do not get confused by the fact that AST (Arabia Standard ++// Time) and AST (Atlantic Standard Time) are different time zones, ++// even though they have the same abbreviation. ++// ++// ICANN has been slowly phasing out invented abbreviation in favor of ++// numeric time zones (for example, the Asia/Baghdad time zone ++// abbreviation got changed from AST to +03 in the 2017a tzdata ++// release); but we still want to make sure that the time package does ++// not get confused on systems with slightly older tzdata packages. + func TestParseInLocation(t *testing.T) { +- // Check that Parse (and ParseInLocation) understand that +- // Feb 01 AST (Arabia Standard Time) and Feb 01 AST (Atlantic Standard Time) +- // are in different time zones even though both are called AST + + baghdad, err := LoadLocation("Asia/Baghdad") + if err != nil { + t.Fatal(err) + } + +- t1, err := ParseInLocation("Jan 02 2006 MST", "Feb 01 2013 AST", baghdad) ++ var t1, t2 Time ++ ++ t1, err = ParseInLocation("Jan 02 2006 MST", "Feb 01 2013 AST", baghdad) + if err != nil { + t.Fatal(err) + } +- t2 := Date(2013, February, 1, 00, 00, 00, 0, baghdad) +- if t1 != t2 { +- t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad) = %v, want %v", t1, t2) +- } ++ + _, offset := t1.Zone() +- if offset != 3*60*60 { +- t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad).Zone = _, %d, want _, %d", offset, 3*60*60) ++ ++ // A zero offset means that ParseInLocation did not recognize the ++ // 'AST' abbreviation as matching the current location (Baghdad, ++ // where we'd expect a +03 hrs offset); likely because we're using ++ // a recent tzdata release (2017a or newer). ++ // If it happens, skip the Baghdad test. ++ if offset != 0 { ++ t2 = Date(2013, February, 1, 00, 00, 00, 0, baghdad) ++ if t1 != t2 { ++ t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad) = %v, want %v", t1, t2) ++ } ++ if offset != 3*60*60 { ++ t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad).Zone = _, %d, want _, %d", offset, 3*60*60) ++ } + } + + blancSablon, err := LoadLocation("America/Blanc-Sablon") +@@ -273,6 +291,9 @@ func TestParseInLocation(t *testing.T) { + t.Fatal(err) + } + ++ // In this case 'AST' means 'Atlantic Standard Time', and we ++ // expect the abbreviation to correctly match the american ++ // location. + t1, err = ParseInLocation("Jan 02 2006 MST", "Feb 01 2013 AST", blancSablon) + if err != nil { + t.Fatal(err) From dc8fe7c9cedbbf0e998dbcd072a0530ed52b456a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 13 Oct 2017 14:13:08 +0200 Subject: [PATCH 42/67] fix CVE-2017-15041 and CVE-2017-15042 --- CVE-2017-15041.patch | 127 ++++++++++++++++++++++++++++++++++++++ CVE-2017-15042.patch | 144 +++++++++++++++++++++++++++++++++++++++++++ golang.spec | 5 +- 3 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 CVE-2017-15041.patch create mode 100644 CVE-2017-15042.patch diff --git a/CVE-2017-15041.patch b/CVE-2017-15041.patch new file mode 100644 index 0000000..4c4747c --- /dev/null +++ b/CVE-2017-15041.patch @@ -0,0 +1,127 @@ +diff -up go/src/cmd/go/get.go.cve go/src/cmd/go/get.go +--- go/src/cmd/go/get.go.cve 2017-05-23 20:35:22.000000000 +0200 ++++ go/src/cmd/go/get.go 2017-10-10 10:25:24.485047705 +0200 +@@ -401,6 +401,11 @@ func downloadPackage(p *Package) error { + p.build.PkgRoot = filepath.Join(list[0], "pkg") + } + root := filepath.Join(p.build.SrcRoot, filepath.FromSlash(rootPath)) ++ ++ if err := checkNestedVCS(vcs, root, p.build.SrcRoot); err != nil { ++ return err ++ } ++ + // If we've considered this repository already, don't do it again. + if downloadRootCache[root] { + return nil +diff -up go/src/cmd/go/go_test.go.cve go/src/cmd/go/go_test.go +--- go/src/cmd/go/go_test.go.cve 2017-05-23 20:35:22.000000000 +0200 ++++ go/src/cmd/go/go_test.go 2017-10-10 10:25:24.485047705 +0200 +@@ -1235,6 +1235,25 @@ func TestGetGitDefaultBranch(t *testing. + tg.grepStdout(`\* another-branch`, "not on correct default branch") + } + ++func TestAccidentalGitCheckout(t *testing.T) { ++ testenv.MustHaveExternalNetwork(t) ++ if _, err := exec.LookPath("git"); err != nil { ++ t.Skip("skipping because git binary not found") ++ } ++ ++ tg := testgo(t) ++ defer tg.cleanup() ++ tg.parallel() ++ tg.tempDir("src") ++ tg.setenv("GOPATH", tg.path(".")) ++ ++ tg.runFail("get", "-u", "vcs-test.golang.org/go/test1-svn-git") ++ tg.grepStderr("src[\\\\/]vcs-test.* uses git, but parent .*src[\\\\/]vcs-test.* uses svn", "get did not fail for right reason") ++ ++ tg.runFail("get", "-u", "vcs-test.golang.org/go/test2-svn-git/test2main") ++ tg.grepStderr("src[\\\\/]vcs-test.* uses git, but parent .*src[\\\\/]vcs-test.* uses svn", "get did not fail for right reason") ++} ++ + func TestErrorMessageForSyntaxErrorInTestGoFileSaysFAIL(t *testing.T) { + tg := testgo(t) + defer tg.cleanup() +diff -up go/src/cmd/go/vcs.go.cve go/src/cmd/go/vcs.go +--- go/src/cmd/go/vcs.go.cve 2017-05-23 20:35:22.000000000 +0200 ++++ go/src/cmd/go/vcs.go 2017-10-10 10:30:52.151621206 +0200 +@@ -479,11 +479,29 @@ func vcsFromDir(dir, srcRoot string) (vc + return nil, "", fmt.Errorf("directory %q is outside source root %q", dir, srcRoot) + } + ++ var vcsRet *vcsCmd ++ var rootRet string ++ + origDir := dir + for len(dir) > len(srcRoot) { + for _, vcs := range vcsList { + if fi, err := os.Stat(filepath.Join(dir, "."+vcs.cmd)); err == nil && fi.IsDir() { +- return vcs, filepath.ToSlash(dir[len(srcRoot)+1:]), nil ++ root := filepath.ToSlash(dir[len(srcRoot)+1:]) ++ // Record first VCS we find, but keep looking, ++ // to detect mistakes like one kind of VCS inside another. ++ if vcsRet == nil { ++ vcsRet = vcs ++ rootRet = root ++ continue ++ } ++ // Allow .git inside .git, which can arise due to submodules. ++ if vcsRet == vcs && vcs.cmd == "git" { ++ continue ++ } ++ // Otherwise, we have one VCS inside a different VCS. ++ return nil, "", fmt.Errorf("directory %q uses %s, but parent %q uses %s", ++ filepath.Join(srcRoot, rootRet), vcsRet.cmd, filepath.Join(srcRoot, root), vcs.cmd) ++ + } + } + +@@ -496,9 +514,48 @@ func vcsFromDir(dir, srcRoot string) (vc + dir = ndir + } + ++ if vcsRet != nil { ++ return vcsRet, rootRet, nil ++ } ++ + return nil, "", fmt.Errorf("directory %q is not using a known version control system", origDir) + } + ++// checkNestedVCS checks for an incorrectly-nested VCS-inside-VCS ++// situation for dir, checking parents up until srcRoot. ++func checkNestedVCS(vcs *vcsCmd, dir, srcRoot string) error { ++ if len(dir) <= len(srcRoot) || dir[len(srcRoot)] != filepath.Separator { ++ return fmt.Errorf("directory %q is outside source root %q", dir, srcRoot) ++ } ++ ++ otherDir := dir ++ for len(otherDir) > len(srcRoot) { ++ for _, otherVCS := range vcsList { ++ if _, err := os.Stat(filepath.Join(dir, "."+otherVCS.cmd)); err == nil { ++ // Allow expected vcs in original dir. ++ if otherDir == dir && otherVCS == vcs { ++ continue ++ } ++ // Allow .git inside .git, which can arise due to submodules. ++ if otherVCS == vcs && vcs.cmd == "git" { ++ continue ++ } ++ // Otherwise, we have one VCS inside a different VCS. ++ return fmt.Errorf("directory %q uses %s, but parent %q uses %s", dir, vcs.cmd, otherDir, otherVCS.cmd) ++ } ++ } ++ // Move to parent. ++ newDir := filepath.Dir(otherDir) ++ if len(newDir) >= len(otherDir) { ++ // Shouldn't happen, but just in case, stop. ++ break ++ } ++ otherDir = newDir ++ } ++ ++ return nil ++} ++ + // repoRoot represents a version control system, a repo, and a root of + // where to put it on disk. + type repoRoot struct { diff --git a/CVE-2017-15042.patch b/CVE-2017-15042.patch new file mode 100644 index 0000000..aca6049 --- /dev/null +++ b/CVE-2017-15042.patch @@ -0,0 +1,144 @@ +From 4be3fc33ef512532b916aa14258087e89eb47347 Mon Sep 17 00:00:00 2001 +From: Russ Cox +Date: Wed, 4 Oct 2017 13:24:49 -0400 +Subject: [PATCH] [release-branch.go1.8] net/smtp: fix PlainAuth to refuse to + send passwords to non-TLS servers + +PlainAuth originally refused to send passwords to non-TLS servers +and was documented as such. + +In 2013, issue #5184 was filed objecting to the TLS requirement, +despite the fact that it is spelled out clearly in RFC 4954. +The only possibly legitimate use case raised was using PLAIN auth +for connections to localhost, and the suggested fix was to let the +server decide: if it advertises that PLAIN auth is OK, believe it. +That approach was adopted in CL 8279043 and released in Go 1.1. + +Unfortunately, this is exactly wrong. The whole point of the TLS +requirement is to make sure not to send the password to the wrong +server or to a man-in-the-middle. Instead of implementing this rule, +CL 8279043 blindly trusts the server, so that if a man-in-the-middle +says "it's OK, you can send me your password," PlainAuth does. +And the documentation was not updated to reflect any of this. + +This CL restores the original TLS check, as required by RFC 4954 +and as promised in the documentation for PlainAuth. +It then carves out a documented exception for connections made +to localhost (defined as "localhost", "127.0.0.1", or "::1"). + +Cherry-pick of CL 68170. + +Change-Id: I1d3729bbd33aa2f11a03f4c000e6bb473164957b +Reviewed-on: https://go-review.googlesource.com/68023 +Run-TryBot: Russ Cox +Reviewed-by: Chris Broadfoot +--- + src/net/smtp/auth.go | 33 ++++++++++++++++++--------------- + src/net/smtp/smtp_test.go | 32 ++++++++++++++++++++++---------- + 2 files changed, 40 insertions(+), 25 deletions(-) + +diff --git a/src/net/smtp/auth.go b/src/net/smtp/auth.go +index 3f1339ebc56..fd1a472f930 100644 +--- a/src/net/smtp/auth.go ++++ b/src/net/smtp/auth.go +@@ -44,26 +44,29 @@ type plainAuth struct { + } + + // PlainAuth returns an Auth that implements the PLAIN authentication +-// mechanism as defined in RFC 4616. +-// The returned Auth uses the given username and password to authenticate +-// on TLS connections to host and act as identity. Usually identity will be +-// left blank to act as username. ++// mechanism as defined in RFC 4616. The returned Auth uses the given ++// username and password to authenticate to host and act as identity. ++// Usually identity should be the empty string, to act as username. ++// ++// PlainAuth will only send the credentials if the connection is using TLS ++// or is connected to localhost. Otherwise authentication will fail with an ++// error, without sending the credentials. + func PlainAuth(identity, username, password, host string) Auth { + return &plainAuth{identity, username, password, host} + } + ++func isLocalhost(name string) bool { ++ return name == "localhost" || name == "127.0.0.1" || name == "::1" ++} ++ + func (a *plainAuth) Start(server *ServerInfo) (string, []byte, error) { +- if !server.TLS { +- advertised := false +- for _, mechanism := range server.Auth { +- if mechanism == "PLAIN" { +- advertised = true +- break +- } +- } +- if !advertised { +- return "", nil, errors.New("unencrypted connection") +- } ++ // Must have TLS, or else localhost server. ++ // Note: If TLS is not true, then we can't trust ANYTHING in ServerInfo. ++ // In particular, it doesn't matter if the server advertises PLAIN auth. ++ // That might just be the attacker saying ++ // "it's ok, you can trust me with your password." ++ if !server.TLS && !isLocalhost(server.Name) { ++ return "", nil, errors.New("unencrypted connection") + } + if server.Name != a.host { + return "", nil, errors.New("wrong host name") +diff --git a/src/net/smtp/smtp_test.go b/src/net/smtp/smtp_test.go +index c48fae6d5ac..15eaca524be 100644 +--- a/src/net/smtp/smtp_test.go ++++ b/src/net/smtp/smtp_test.go +@@ -60,29 +60,41 @@ testLoop: + } + + func TestAuthPlain(t *testing.T) { +- auth := PlainAuth("foo", "bar", "baz", "servername") + + tests := []struct { +- server *ServerInfo +- err string ++ authName string ++ server *ServerInfo ++ err string + }{ + { +- server: &ServerInfo{Name: "servername", TLS: true}, ++ authName: "servername", ++ server: &ServerInfo{Name: "servername", TLS: true}, + }, + { +- // Okay; explicitly advertised by server. +- server: &ServerInfo{Name: "servername", Auth: []string{"PLAIN"}}, ++ // OK to use PlainAuth on localhost without TLS ++ authName: "localhost", ++ server: &ServerInfo{Name: "localhost", TLS: false}, + }, + { +- server: &ServerInfo{Name: "servername", Auth: []string{"CRAM-MD5"}}, +- err: "unencrypted connection", ++ // NOT OK on non-localhost, even if server says PLAIN is OK. ++ // (We don't know that the server is the real server.) ++ authName: "servername", ++ server: &ServerInfo{Name: "servername", Auth: []string{"PLAIN"}}, ++ err: "unencrypted connection", + }, + { +- server: &ServerInfo{Name: "attacker", TLS: true}, +- err: "wrong host name", ++ authName: "servername", ++ server: &ServerInfo{Name: "servername", Auth: []string{"CRAM-MD5"}}, ++ err: "unencrypted connection", ++ }, ++ { ++ authName: "servername", ++ server: &ServerInfo{Name: "attacker", TLS: true}, ++ err: "wrong host name", + }, + } + for i, tt := range tests { ++ auth := PlainAuth("foo", "bar", "baz", tt.authName) + _, _, err := auth.Start(tt.server) + got := "" + if err != nil { diff --git a/golang.spec b/golang.spec index 6b72c37..0e99aa8 100644 --- a/golang.spec +++ b/golang.spec @@ -48,7 +48,7 @@ Name: golang Version: 1.7.6 -Release: 1%{?dist} +Release: 2%{?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 @@ -443,6 +443,9 @@ fi %endif %changelog +* Fri Oct 13 2017 Jakub Čajka - 1.7.4-2 +- fix CVE-2017-15041 and CVE-2017-15042 + * Thu Jun 15 2017 Jakub Čajka - 1.7.4-1 - Bump to 1.7.6 - Fix for CVE-2017-8932 From 55f301f00665c790af4905d515a116d06cb6dc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 13 Oct 2017 14:16:44 +0200 Subject: [PATCH 43/67] Use and apply the patches... --- golang.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/golang.spec b/golang.spec index 0e99aa8..9cd3988 100644 --- a/golang.spec +++ b/golang.spec @@ -88,6 +88,9 @@ Patch217: ppc64x-overflow-2.patch Patch218: tzdata-fix.patch +Patch219: CVE-2017-15041.patch +Patch220: CVE-2017-15042.patch + # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -217,6 +220,9 @@ Summary: Golang shared object libraries %patch218 -p1 +%patch219 -p1 +%patch220 -p1 + %build # print out system information uname -a From 9ca117e19c457f39daa5b393556e298f12d351ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 26 Jan 2018 10:36:57 +0100 Subject: [PATCH 44/67] Rebase to 1.9.3 --- .gitignore | 1 + golang.spec | 43 +++++++++++++++++++++++++++++++++++++++++-- sources | 2 +- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0b3a44f..7edd558 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ /go1.9.src.tar.gz /go1.9.1.src.tar.gz /go1.9.2.src.tar.gz +/go1.9.3.src.tar.gz diff --git a/golang.spec b/golang.spec index 363fb31..59acbf5 100644 --- a/golang.spec +++ b/golang.spec @@ -96,10 +96,10 @@ %endif %global go_api 1.9 -%global go_version 1.9.2 +%global go_version 1.9.3 Name: golang -Version: 1.9.2 +Version: 1.9.3 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -124,6 +124,42 @@ BuildRequires: net-tools BuildRequires: pcre-devel, glibc-static, perl-interpreter, procps-ng Provides: go = %{version}-%{release} + +# go list -f {{.ImportPath}} ./src/vendor/... | sed "s:_$PWD/src/vendor/::g;s:_:.:;s:.*:Provides\: bundled(golang(&)):" && go list -f {{.ImportPath}} ./src/cmd/vendor/... | sed "s:_$PWD/src/cmd/vendor/::g;s:_:.:;s:.*:Provides\: bundled(golang(&)):" +Provides: bundled(golang(golang.org/x/crypto/chacha20poly1305)) +Provides: bundled(golang(golang.org/x/crypto/chacha20poly1305/internal/chacha20)) +Provides: bundled(golang(golang.org/x/crypto/curve25519)) +Provides: bundled(golang(golang.org/x/crypto/poly1305)) +Provides: bundled(golang(golang.org/x/net/http2/hpack)) +Provides: bundled(golang(golang.org/x/net/idna)) +Provides: bundled(golang(golang.org/x/net/lex/httplex)) +Provides: bundled(golang(golang.org/x/net/nettest)) +Provides: bundled(golang(golang.org/x/net/proxy)) +Provides: bundled(golang(golang.org/x/text/secure)) +Provides: bundled(golang(golang.org/x/text/secure/bidirule)) +Provides: bundled(golang(golang.org/x/text/transform)) +Provides: bundled(golang(golang.org/x/text/unicode)) +Provides: bundled(golang(golang.org/x/text/unicode/bidi)) +Provides: bundled(golang(golang.org/x/text/unicode/norm)) +Provides: bundled(golang(github.com/google/pprof)) +Provides: bundled(golang(github.com/google/pprof/driver)) +Provides: bundled(golang(github.com/google/pprof/internal/binutils)) +Provides: bundled(golang(github.com/google/pprof/internal/driver)) +Provides: bundled(golang(github.com/google/pprof/internal/elfexec)) +Provides: bundled(golang(github.com/google/pprof/internal/graph)) +Provides: bundled(golang(github.com/google/pprof/internal/measurement)) +Provides: bundled(golang(github.com/google/pprof/internal/plugin)) +Provides: bundled(golang(github.com/google/pprof/internal/proftest)) +Provides: bundled(golang(github.com/google/pprof/internal/report)) +Provides: bundled(golang(github.com/google/pprof/internal/symbolizer)) +Provides: bundled(golang(github.com/google/pprof/internal/symbolz)) +Provides: bundled(golang(github.com/google/pprof/profile)) +Provides: bundled(golang(github.com/google/pprof/third.party/svg)) +Provides: bundled(golang(github.com/ianlancetaylor/demangle)) +Provides: bundled(golang(golang.org/x/arch/arm/armasm)) +Provides: bundled(golang(golang.org/x/arch/ppc64/ppc64asm)) +Provides: bundled(golang(golang.org/x/arch/x86/x86asm)) + Requires: %{name}-bin = %{version}-%{release} Requires: %{name}-src = %{version}-%{release} Requires: go-srpm-macros @@ -518,6 +554,9 @@ fi %endif %changelog +* Fri Jan 26 2018 Jakub Čajka - 1.9.3-1 +- Rebase to 1.9.3 + * Thu Oct 26 2017 Jakub Čajka - 1.9.2-1 - Rebase to 1.9.2 - execute correctly pie tests diff --git a/sources b/sources index 757bcda..f19f9a1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.9.2.src.tar.gz) = 1034098575c317eeaf648629690a4dea0c479a69c3b80d9917f6b96c8781ce79c0f29859f667dc4e07d47a44972aa09bd0163a458f897cf45f9d09eb03e4abb5 +SHA512 (go1.9.3.src.tar.gz) = 31c564af58b78c648c9bece8fa2ed3334feb80316b07b16f6286319e26d317da90d1af0464c3a2f776a3da72d31b22b063dbc620b93114bf142a11e8a625e527 From 5abf0c8166f62eb45111b6bb3474d171984ddad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Thu, 8 Feb 2018 15:04:08 +0100 Subject: [PATCH 45/67] Rebase to 1.9.4 Fix CVE-2018-6574 Resolves: BZ#1543561, BZ#1543562 --- .gitignore | 1 + golang.spec | 9 +++++++-- sources | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7edd558..cc45de7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ /go1.9.1.src.tar.gz /go1.9.2.src.tar.gz /go1.9.3.src.tar.gz +/go1.9.4.src.tar.gz diff --git a/golang.spec b/golang.spec index 59acbf5..f086f33 100644 --- a/golang.spec +++ b/golang.spec @@ -96,10 +96,10 @@ %endif %global go_api 1.9 -%global go_version 1.9.3 +%global go_version 1.9.4 Name: golang -Version: 1.9.3 +Version: 1.9.4 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -554,6 +554,11 @@ fi %endif %changelog +* Thu Feb 08 2018 Jakub Čajka - 1.9.4-1 +- Rebase to 1.9.4 +- Fix CVE-2018-6574 +- Resolves: BZ#1543561, BZ#1543562 + * Fri Jan 26 2018 Jakub Čajka - 1.9.3-1 - Rebase to 1.9.3 diff --git a/sources b/sources index f19f9a1..06e4a51 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.9.3.src.tar.gz) = 31c564af58b78c648c9bece8fa2ed3334feb80316b07b16f6286319e26d317da90d1af0464c3a2f776a3da72d31b22b063dbc620b93114bf142a11e8a625e527 +SHA512 (go1.9.4.src.tar.gz) = 1a7c830e07507ff7b89025adfb5c713444d97301f8ad47ef2564722c1e28186e946350f07e22777fbdd6f2f589c334eb01dfd589e97cb8a86f73669547badb0b From 6e78911a79e379e519188b43d3d5d01eca39b70b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Sun, 4 Mar 2018 10:24:11 +0100 Subject: [PATCH 46/67] Fix CVE-2018-7187 Resolves: BZ#1546386, BZ#1546388 --- CVE-2018-7187.patch | 124 ++++++++++++++++++++++++++++++++++++++++++++ golang.spec | 10 +++- 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 CVE-2018-7187.patch diff --git a/CVE-2018-7187.patch b/CVE-2018-7187.patch new file mode 100644 index 0000000..591ba32 --- /dev/null +++ b/CVE-2018-7187.patch @@ -0,0 +1,124 @@ +From c941e27e70c3e06e1011d2dd71d72a7a06a9bcbc Mon Sep 17 00:00:00 2001 +From: Ian Lance Taylor +Date: Thu, 15 Feb 2018 15:57:13 -0800 +Subject: [PATCH] cmd/go: restrict meta imports to valid schemes + +Before this change, when using -insecure, we permitted any meta import +repo root as long as it contained "://". When not using -insecure, we +restrict meta import repo roots to be valid URLs. People may depend on +that somehow, so permit meta import repo roots to be invalid URLs, but +require them to have valid schemes per RFC 3986. + +Fixes #23867 + +Change-Id: Iac666dfc75ac321bf8639dda5b0dba7c8840922d +Reviewed-on: https://go-review.googlesource.com/94603 +Reviewed-by: Brad Fitzpatrick +--- + src/cmd/go/internal/get/vcs.go | 34 +++++++++++++++++++++++++++-- + src/cmd/go/internal/get/vcs_test.go | 43 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 75 insertions(+), 2 deletions(-) + +diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go +index ee6b16a1369..dced0ed8db5 100644 +--- a/src/cmd/go/internal/get/vcs.go ++++ b/src/cmd/go/internal/get/vcs.go +@@ -809,8 +809,8 @@ func repoRootForImportDynamic(importPath string, security web.SecurityMode) (*re + } + } + +- if !strings.Contains(mmi.RepoRoot, "://") { +- return nil, fmt.Errorf("%s: invalid repo root %q; no scheme", urlStr, mmi.RepoRoot) ++ if err := validateRepoRootScheme(mmi.RepoRoot); err != nil { ++ return nil, fmt.Errorf("%s: invalid repo root %q: %v", urlStr, mmi.RepoRoot, err) + } + rr := &repoRoot{ + vcs: vcsByCmd(mmi.VCS), +@@ -824,6 +824,36 @@ func repoRootForImportDynamic(importPath string, security web.SecurityMode) (*re + return rr, nil + } + ++// validateRepoRootScheme returns an error if repoRoot does not seem ++// to have a valid URL scheme. At this point we permit things that ++// aren't valid URLs, although later, if not using -insecure, we will ++// restrict repoRoots to be valid URLs. This is only because we've ++// historically permitted them, and people may depend on that. ++func validateRepoRootScheme(repoRoot string) error { ++ end := strings.Index(repoRoot, "://") ++ if end <= 0 { ++ return errors.New("no scheme") ++ } ++ ++ // RFC 3986 section 3.1. ++ for i := 0; i < end; i++ { ++ c := repoRoot[i] ++ switch { ++ case 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z': ++ // OK. ++ case '0' <= c && c <= '9' || c == '+' || c == '-' || c == '.': ++ // OK except at start. ++ if i == 0 { ++ return errors.New("invalid scheme") ++ } ++ default: ++ return errors.New("invalid scheme") ++ } ++ } ++ ++ return nil ++} ++ + var fetchGroup singleflight.Group + var ( + fetchCacheMu sync.Mutex +diff --git a/src/cmd/go/internal/get/vcs_test.go b/src/cmd/go/internal/get/vcs_test.go +index 2cb611fabd8..ece78b563ce 100644 +--- a/src/cmd/go/internal/get/vcs_test.go ++++ b/src/cmd/go/internal/get/vcs_test.go +@@ -416,3 +416,46 @@ func TestMatchGoImport(t *testing.T) { + } + } + } ++ ++func TestValidateRepoRootScheme(t *testing.T) { ++ tests := []struct { ++ root string ++ err string ++ }{ ++ { ++ root: "", ++ err: "no scheme", ++ }, ++ { ++ root: "http://", ++ err: "", ++ }, ++ { ++ root: "a://", ++ err: "", ++ }, ++ { ++ root: "a#://", ++ err: "invalid scheme", ++ }, ++ { ++ root: "-config://", ++ err: "invalid scheme", ++ }, ++ } ++ ++ for _, test := range tests { ++ err := validateRepoRootScheme(test.root) ++ if err == nil { ++ if test.err != "" { ++ t.Errorf("validateRepoRootScheme(%q) = nil, want %q", test.root, test.err) ++ } ++ } else if test.err == "" { ++ if err != nil { ++ t.Errorf("validateRepoRootScheme(%q) = %q, want nil", test.root, test.err) ++ } ++ } else if err.Error() != test.err { ++ t.Errorf("validateRepoRootScheme(%q) = %q, want %q", test.root, err, test.err) ++ } ++ } ++} diff --git a/golang.spec b/golang.spec index f086f33..4e6be96 100644 --- a/golang.spec +++ b/golang.spec @@ -100,7 +100,7 @@ Name: golang Version: 1.9.4 -Release: 1%{?dist} +Release: 2%{?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 @@ -183,6 +183,8 @@ Patch221: use-buildmode-pie-for-pie-testing.patch # https://github.com/hyangah/go/commit/3502496d03bcd842fd7aac95ec0d7096d581cd26 Patch222: use-no-pie-where-needed.patch +Patch223: CVE-2018-7187.patch + # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -319,6 +321,8 @@ Requires: %{name} = %{version}-%{release} %patch221 -p1 -b pie %patch222 -p1 +%patch223 -p1 + cp %{SOURCE1} ./src/runtime/ %build @@ -554,6 +558,10 @@ fi %endif %changelog +* Sat Mar 03 2018 Jakub Čajka - 1.9.4-2 +- Fix CVE-2018-7187 +- Resolves: BZ#1546386, BZ#1546388 + * Thu Feb 08 2018 Jakub Čajka - 1.9.4-1 - Rebase to 1.9.4 - Fix CVE-2018-6574 From a6109823f24a8a5155fe266bfcd43c94d4d93090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Tue, 3 Apr 2018 15:42:14 +0200 Subject: [PATCH 47/67] Rebase to 1.9.5 --- .gitignore | 1 + golang.spec | 13 ++++++------- sources | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index cc45de7..0218b4d 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ /go1.9.2.src.tar.gz /go1.9.3.src.tar.gz /go1.9.4.src.tar.gz +/go1.9.5.src.tar.gz diff --git a/golang.spec b/golang.spec index 4e6be96..f930b52 100644 --- a/golang.spec +++ b/golang.spec @@ -96,11 +96,11 @@ %endif %global go_api 1.9 -%global go_version 1.9.4 +%global go_version 1.9.5 Name: golang -Version: 1.9.4 -Release: 2%{?dist} +Version: 1.9.5 +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 @@ -183,8 +183,6 @@ Patch221: use-buildmode-pie-for-pie-testing.patch # https://github.com/hyangah/go/commit/3502496d03bcd842fd7aac95ec0d7096d581cd26 Patch222: use-no-pie-where-needed.patch -Patch223: CVE-2018-7187.patch - # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -321,8 +319,6 @@ Requires: %{name} = %{version}-%{release} %patch221 -p1 -b pie %patch222 -p1 -%patch223 -p1 - cp %{SOURCE1} ./src/runtime/ %build @@ -558,6 +554,9 @@ fi %endif %changelog +* Tue Apr 03 2018 Jakub Čajka - 1.9.5-1 +- Rebase to 1.9.5 + * Sat Mar 03 2018 Jakub Čajka - 1.9.4-2 - Fix CVE-2018-7187 - Resolves: BZ#1546386, BZ#1546388 diff --git a/sources b/sources index 06e4a51..9c6b46c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.9.4.src.tar.gz) = 1a7c830e07507ff7b89025adfb5c713444d97301f8ad47ef2564722c1e28186e946350f07e22777fbdd6f2f589c334eb01dfd589e97cb8a86f73669547badb0b +SHA512 (go1.9.5.src.tar.gz) = 5cde6a3c6e6040ddbcafa75dae551500d0bb15096a523ee29f788cbf3fa11d083d4e4a1b56a094ad2234f967c0d1be280ae00479d5f7c01174dc6da2a5a25924 From 371df34265a3aa06bd6c328fcf38bb83f92a9eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Thu, 3 May 2018 15:17:35 +0200 Subject: [PATCH 48/67] Rebase to 1.9.6 --- .gitignore | 1 + ...1-Make-build-little-bit-more-verbose.patch | 23 +++- ...=> 0002-Don-t-use-the-bundled-tzdata.patch | 14 +- ...expose-IfInfomsg.X__ifi_pad-on-s390x.patch | 13 +- ...h => 0004-Ignore-L0-A-during-linking.patch | 14 +- ...s-github.com-golang-go-commit-ca8c36.patch | 24 +++- ...testcarchive-use-no-pie-where-needed.patch | 11 +- 31bit-OID-asn1.patch | 83 ------------ CVE-2018-7187.patch | 124 ------------------ golang-1.5-bootstrap-binary-path.patch | 61 --------- golang.spec | 51 +++---- sources | 2 +- 12 files changed, 98 insertions(+), 323 deletions(-) rename golang-1.2-verbose-build.patch => 0001-Make-build-little-bit-more-verbose.patch (58%) rename go1.5-zoneinfo_testing_only.patch => 0002-Don-t-use-the-bundled-tzdata.patch (65%) rename s390x-expose-IfInfomsg-X__ifi_pad.patch => 0003-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch (69%) rename s390x-ignore-L0syms.patch => 0004-Ignore-L0-A-during-linking.patch (69%) rename use-buildmode-pie-for-pie-testing.patch => 0005-Backport-of-https-github.com-golang-go-commit-ca8c36.patch (68%) rename use-no-pie-where-needed.patch => 0006-misc-cgo-testcarchive-use-no-pie-where-needed.patch (89%) delete mode 100644 31bit-OID-asn1.patch delete mode 100644 CVE-2018-7187.patch delete mode 100644 golang-1.5-bootstrap-binary-path.patch diff --git a/.gitignore b/.gitignore index 0218b4d..85c8935 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ /go1.9.3.src.tar.gz /go1.9.4.src.tar.gz /go1.9.5.src.tar.gz +/go1.9.6.src.tar.gz diff --git a/golang-1.2-verbose-build.patch b/0001-Make-build-little-bit-more-verbose.patch similarity index 58% rename from golang-1.2-verbose-build.patch rename to 0001-Make-build-little-bit-more-verbose.patch index c9dbba2..b6e0343 100644 --- a/golang-1.2-verbose-build.patch +++ b/0001-Make-build-little-bit-more-verbose.patch @@ -1,7 +1,17 @@ -diff -up go/src/make.bash.verbose go/src/make.bash ---- go/src/make.bash.verbose 2017-07-11 12:00:09.513553508 +0200 -+++ go/src/make.bash 2017-07-11 12:01:25.288245720 +0200 -@@ -167,7 +167,7 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH +From 2f52dca801a86a729fb69dc9123d111a9e995895 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20=C4=8Cajka?= +Date: Thu, 22 Mar 2018 12:39:16 +0100 +Subject: [PATCH 1/6] Make build little bit more verbose + +--- + src/make.bash | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/make.bash b/src/make.bash +index 71e75318f2..14c4424392 100755 +--- a/src/make.bash ++++ b/src/make.bash +@@ -167,7 +167,7 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, # use the host compiler, CC, from `cmd/dist/dist env` instead. CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ @@ -10,7 +20,7 @@ diff -up go/src/make.bash.verbose go/src/make.bash echo fi -@@ -175,7 +175,7 @@ echo "##### Building packages and comman +@@ -175,7 +175,7 @@ echo "##### Building packages and commands for $GOOS/$GOARCH." old_bin_files=$(cd $GOROOT/bin && echo *) @@ -19,3 +29,6 @@ diff -up go/src/make.bash.verbose go/src/make.bash # Check that there are no new files in $GOROOT/bin other than go and gofmt # and $GOOS_$GOARCH (a directory used when cross-compiling). +-- +2.14.3 + diff --git a/go1.5-zoneinfo_testing_only.patch b/0002-Don-t-use-the-bundled-tzdata.patch similarity index 65% rename from go1.5-zoneinfo_testing_only.patch rename to 0002-Don-t-use-the-bundled-tzdata.patch index 3e9cb5f..7a01b48 100644 --- a/go1.5-zoneinfo_testing_only.patch +++ b/0002-Don-t-use-the-bundled-tzdata.patch @@ -1,5 +1,14 @@ +From 63c8189910c1cc2a45a7fb21fbc5c516ce01f46c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20=C4=8Cajka?= +Date: Thu, 22 Mar 2018 12:41:12 +0100 +Subject: [PATCH 2/6] Don't use the bundled tzdata + +--- + src/time/zoneinfo_unix.go | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go -index ed9502d..c2569e7 100644 +index bbf263a16f..ec14bc0f7b 100644 --- a/src/time/zoneinfo_unix.go +++ b/src/time/zoneinfo_unix.go @@ -32,14 +32,14 @@ var zoneDirs = []string{ @@ -19,3 +28,6 @@ index ed9502d..c2569e7 100644 if zipOnly { for i := 0; i < len(zoneDirs)-1; i++ { zoneDirs[i] = "/XXXNOEXIST" +-- +2.14.3 + diff --git a/s390x-expose-IfInfomsg-X__ifi_pad.patch b/0003-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch similarity index 69% rename from s390x-expose-IfInfomsg-X__ifi_pad.patch rename to 0003-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch index ec53077..eabd27a 100644 --- a/s390x-expose-IfInfomsg-X__ifi_pad.patch +++ b/0003-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch @@ -1,7 +1,7 @@ -From 84b8c9ceaa5257f7ff4ab059ff208246ecdfe9d9 Mon Sep 17 00:00:00 2001 +From d53a3784bbeab6ac7405c88e56528024061d2ef2 Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Tue, 17 Jan 2017 11:33:38 -0500 -Subject: [PATCH] syscall: expose IfInfomsg.X__ifi_pad on s390x +Subject: [PATCH 3/6] 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. @@ -10,12 +10,14 @@ 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 63c4a83..b589425 100644 +index 63c4a83b19..b5894255df 100644 --- a/src/syscall/ztypes_linux_s390x.go +++ b/src/syscall/ztypes_linux_s390x.go -@@ -449,12 +449,12 @@ +@@ -449,12 +449,12 @@ type RtAttr struct { } type IfInfomsg struct { @@ -34,3 +36,6 @@ index 63c4a83..b589425 100644 } type IfAddrmsg struct { +-- +2.14.3 + diff --git a/s390x-ignore-L0syms.patch b/0004-Ignore-L0-A-during-linking.patch similarity index 69% rename from s390x-ignore-L0syms.patch rename to 0004-Ignore-L0-A-during-linking.patch index a6c65e0..4a88532 100644 --- a/s390x-ignore-L0syms.patch +++ b/0004-Ignore-L0-A-during-linking.patch @@ -1,5 +1,14 @@ +From a170a330e0598ad67240a4080a2ab185491884f5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20=C4=8Cajka?= +Date: Thu, 22 Mar 2018 12:42:33 +0100 +Subject: [PATCH 4/6] Ignore L0^A during linking + +--- + src/cmd/link/internal/ld/ldelf.go | 7 +++++++ + 1 file changed, 7 insertions(+) + diff --git a/src/cmd/link/internal/ld/ldelf.go b/src/cmd/link/internal/ld/ldelf.go -index d4f9fc4..87dabaa 100644 +index d4f9fc44d7..9b02bf5d36 100644 --- a/src/cmd/link/internal/ld/ldelf.go +++ b/src/cmd/link/internal/ld/ldelf.go @@ -799,6 +799,13 @@ func ldelf(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) { @@ -16,3 +25,6 @@ index d4f9fc4..87dabaa 100644 if strings.HasPrefix(sym.name, ".LASF") { // gcc on s390x does this continue } +-- +2.14.3 + diff --git a/use-buildmode-pie-for-pie-testing.patch b/0005-Backport-of-https-github.com-golang-go-commit-ca8c36.patch similarity index 68% rename from use-buildmode-pie-for-pie-testing.patch rename to 0005-Backport-of-https-github.com-golang-go-commit-ca8c36.patch index 9f0db0e..c9a68c7 100644 --- a/use-buildmode-pie-for-pie-testing.patch +++ b/0005-Backport-of-https-github.com-golang-go-commit-ca8c36.patch @@ -1,7 +1,18 @@ -diff -up go/src/cmd/dist/test.go.pie go/src/cmd/dist/test.go ---- go/src/cmd/dist/test.go.pie 2017-10-25 20:30:21.000000000 +0200 -+++ go/src/cmd/dist/test.go 2017-11-03 16:47:55.290829798 +0100 -@@ -852,6 +852,16 @@ func (t *tester) supportedBuildmode(mode +From 6d91532e4da10746ced62f714783017f682f83e1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20=C4=8Cajka?= +Date: Thu, 22 Mar 2018 12:44:25 +0100 +Subject: [PATCH 5/6] Backport of + https://github.com/golang/go/commit/ca8c361d867d62bd46013c5abbaaad0b2ca6077f + +--- + src/cmd/dist/test.go | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go +index 73432d31ea..ed7151ab66 100644 +--- a/src/cmd/dist/test.go ++++ b/src/cmd/dist/test.go +@@ -852,6 +852,16 @@ func (t *tester) supportedBuildmode(mode string) bool { return true } return false @@ -18,7 +29,7 @@ diff -up go/src/cmd/dist/test.go.pie go/src/cmd/dist/test.go default: log.Fatalf("internal error: unknown buildmode %s", mode) return false -@@ -953,24 +963,16 @@ func (t *tester) cgoTest(dt *distTest) e +@@ -953,24 +963,16 @@ func (t *tester) cgoTest(dt *distTest) error { } } @@ -49,3 +60,6 @@ diff -up go/src/cmd/dist/test.go.pie go/src/cmd/dist/test.go } } } +-- +2.14.3 + diff --git a/use-no-pie-where-needed.patch b/0006-misc-cgo-testcarchive-use-no-pie-where-needed.patch similarity index 89% rename from use-no-pie-where-needed.patch rename to 0006-misc-cgo-testcarchive-use-no-pie-where-needed.patch index e970498..0a65eaf 100644 --- a/use-no-pie-where-needed.patch +++ b/0006-misc-cgo-testcarchive-use-no-pie-where-needed.patch @@ -1,7 +1,7 @@ -From 3502496d03bcd842fd7aac95ec0d7096d581cd26 Mon Sep 17 00:00:00 2001 +From 0c99703e993fe8a68bdf311b51bfe7b03b9eced0 Mon Sep 17 00:00:00 2001 From: Lynn Boger Date: Wed, 11 Oct 2017 16:02:59 -0400 -Subject: [PATCH] misc/cgo/testcarchive: use -no-pie where needed +Subject: [PATCH 6/6] misc/cgo/testcarchive: use -no-pie where needed Starting in gcc 6, -pie is passed to the linker by default on some platforms, including ppc64le. If the objects @@ -22,7 +22,7 @@ Reviewed-by: Ian Lance Taylor 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/misc/cgo/testcarchive/carchive_test.go b/misc/cgo/testcarchive/carchive_test.go -index b5123154e79..ac637c06007 100644 +index 74897c7f6f..958d9d739e 100644 --- a/misc/cgo/testcarchive/carchive_test.go +++ b/misc/cgo/testcarchive/carchive_test.go @@ -6,6 +6,7 @@ package carchive_test @@ -33,7 +33,7 @@ index b5123154e79..ac637c06007 100644 "debug/elf" "fmt" "io/ioutil" -@@ -609,9 +610,26 @@ func TestCompileWithoutShared(t *testing.T) { +@@ -605,9 +606,26 @@ func TestCompileWithoutShared(t *testing.T) { } exe := "./testnoshared" + exeSuffix @@ -61,3 +61,6 @@ index b5123154e79..ac637c06007 100644 t.Logf("%s", out) if err != nil { t.Fatal(err) +-- +2.14.3 + diff --git a/31bit-OID-asn1.patch b/31bit-OID-asn1.patch deleted file mode 100644 index 4d01b3d..0000000 --- a/31bit-OID-asn1.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 94aba76639cf4d5e30975d846bb0368db8202269 Mon Sep 17 00:00:00 2001 -From: Monis Khan -Date: Wed, 12 Apr 2017 16:00:58 -0400 -Subject: [PATCH] encoding/asn1: support 31 bit identifiers with OID - -The current implementation uses a max of 28 bits when decoding an -ObjectIdentifier. This change makes it so that an int64 is used to -accumulate up to 35 bits. If the resulting data would not overflow -an int32, it is used as an int. Thus up to 31 bits may be used to -represent each subidentifier of an ObjectIdentifier. - -Fixes #19933 - -Change-Id: I95d74b64b24cdb1339ff13421055bce61c80243c -Reviewed-on: https://go-review.googlesource.com/40436 -Reviewed-by: Adam Langley -Run-TryBot: Adam Langley ---- - src/encoding/asn1/asn1.go | 15 ++++++++++++--- - src/encoding/asn1/asn1_test.go | 3 +++ - 2 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go -index c2c0ee420ac..65f018d0148 100644 ---- a/src/encoding/asn1/asn1.go -+++ b/src/encoding/asn1/asn1.go -@@ -22,6 +22,7 @@ package asn1 - import ( - "errors" - "fmt" -+ "math" - "math/big" - "reflect" - "strconv" -@@ -293,16 +294,24 @@ type Flag bool - // given byte slice. It returns the value and the new offset. - func parseBase128Int(bytes []byte, initOffset int) (ret, offset int, err error) { - offset = initOffset -+ var ret64 int64 - for shifted := 0; offset < len(bytes); shifted++ { -- if shifted == 4 { -+ // 5 * 7 bits per byte == 35 bits of data -+ // Thus the representation is either non-minimal or too large for an int32 -+ if shifted == 5 { - err = StructuralError{"base 128 integer too large"} - return - } -- ret <<= 7 -+ ret64 <<= 7 - b := bytes[offset] -- ret |= int(b & 0x7f) -+ ret64 |= int64(b & 0x7f) - offset++ - if b&0x80 == 0 { -+ ret = int(ret64) -+ // Ensure that the returned value fits in an int on all platforms -+ if ret64 > math.MaxInt32 { -+ err = StructuralError{"base 128 integer too large"} -+ } - return - } - } -diff --git a/src/encoding/asn1/asn1_test.go b/src/encoding/asn1/asn1_test.go -index 9976656df89..2dd799f2362 100644 ---- a/src/encoding/asn1/asn1_test.go -+++ b/src/encoding/asn1/asn1_test.go -@@ -7,6 +7,7 @@ package asn1 - import ( - "bytes" - "fmt" -+ "math" - "math/big" - "reflect" - "strings" -@@ -386,6 +387,8 @@ var tagAndLengthData = []tagAndLengthTest{ - {[]byte{0xa0, 0x81, 0x7f}, false, tagAndLength{}}, - // Tag numbers which would overflow int32 are rejected. (The value below is 2^31.) - {[]byte{0x1f, 0x88, 0x80, 0x80, 0x80, 0x00, 0x00}, false, tagAndLength{}}, -+ // Tag numbers that fit in an int32 are valid. (The value below is 2^31 - 1.) -+ {[]byte{0x1f, 0x87, 0xFF, 0xFF, 0xFF, 0x7F, 0x00}, true, tagAndLength{tag: math.MaxInt32}}, - // Long tag number form may not be used for tags that fit in short form. - {[]byte{0x1f, 0x1e, 0x00}, false, tagAndLength{}}, - } diff --git a/CVE-2018-7187.patch b/CVE-2018-7187.patch deleted file mode 100644 index 591ba32..0000000 --- a/CVE-2018-7187.patch +++ /dev/null @@ -1,124 +0,0 @@ -From c941e27e70c3e06e1011d2dd71d72a7a06a9bcbc Mon Sep 17 00:00:00 2001 -From: Ian Lance Taylor -Date: Thu, 15 Feb 2018 15:57:13 -0800 -Subject: [PATCH] cmd/go: restrict meta imports to valid schemes - -Before this change, when using -insecure, we permitted any meta import -repo root as long as it contained "://". When not using -insecure, we -restrict meta import repo roots to be valid URLs. People may depend on -that somehow, so permit meta import repo roots to be invalid URLs, but -require them to have valid schemes per RFC 3986. - -Fixes #23867 - -Change-Id: Iac666dfc75ac321bf8639dda5b0dba7c8840922d -Reviewed-on: https://go-review.googlesource.com/94603 -Reviewed-by: Brad Fitzpatrick ---- - src/cmd/go/internal/get/vcs.go | 34 +++++++++++++++++++++++++++-- - src/cmd/go/internal/get/vcs_test.go | 43 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 75 insertions(+), 2 deletions(-) - -diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go -index ee6b16a1369..dced0ed8db5 100644 ---- a/src/cmd/go/internal/get/vcs.go -+++ b/src/cmd/go/internal/get/vcs.go -@@ -809,8 +809,8 @@ func repoRootForImportDynamic(importPath string, security web.SecurityMode) (*re - } - } - -- if !strings.Contains(mmi.RepoRoot, "://") { -- return nil, fmt.Errorf("%s: invalid repo root %q; no scheme", urlStr, mmi.RepoRoot) -+ if err := validateRepoRootScheme(mmi.RepoRoot); err != nil { -+ return nil, fmt.Errorf("%s: invalid repo root %q: %v", urlStr, mmi.RepoRoot, err) - } - rr := &repoRoot{ - vcs: vcsByCmd(mmi.VCS), -@@ -824,6 +824,36 @@ func repoRootForImportDynamic(importPath string, security web.SecurityMode) (*re - return rr, nil - } - -+// validateRepoRootScheme returns an error if repoRoot does not seem -+// to have a valid URL scheme. At this point we permit things that -+// aren't valid URLs, although later, if not using -insecure, we will -+// restrict repoRoots to be valid URLs. This is only because we've -+// historically permitted them, and people may depend on that. -+func validateRepoRootScheme(repoRoot string) error { -+ end := strings.Index(repoRoot, "://") -+ if end <= 0 { -+ return errors.New("no scheme") -+ } -+ -+ // RFC 3986 section 3.1. -+ for i := 0; i < end; i++ { -+ c := repoRoot[i] -+ switch { -+ case 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z': -+ // OK. -+ case '0' <= c && c <= '9' || c == '+' || c == '-' || c == '.': -+ // OK except at start. -+ if i == 0 { -+ return errors.New("invalid scheme") -+ } -+ default: -+ return errors.New("invalid scheme") -+ } -+ } -+ -+ return nil -+} -+ - var fetchGroup singleflight.Group - var ( - fetchCacheMu sync.Mutex -diff --git a/src/cmd/go/internal/get/vcs_test.go b/src/cmd/go/internal/get/vcs_test.go -index 2cb611fabd8..ece78b563ce 100644 ---- a/src/cmd/go/internal/get/vcs_test.go -+++ b/src/cmd/go/internal/get/vcs_test.go -@@ -416,3 +416,46 @@ func TestMatchGoImport(t *testing.T) { - } - } - } -+ -+func TestValidateRepoRootScheme(t *testing.T) { -+ tests := []struct { -+ root string -+ err string -+ }{ -+ { -+ root: "", -+ err: "no scheme", -+ }, -+ { -+ root: "http://", -+ err: "", -+ }, -+ { -+ root: "a://", -+ err: "", -+ }, -+ { -+ root: "a#://", -+ err: "invalid scheme", -+ }, -+ { -+ root: "-config://", -+ err: "invalid scheme", -+ }, -+ } -+ -+ for _, test := range tests { -+ err := validateRepoRootScheme(test.root) -+ if err == nil { -+ if test.err != "" { -+ t.Errorf("validateRepoRootScheme(%q) = nil, want %q", test.root, test.err) -+ } -+ } else if test.err == "" { -+ if err != nil { -+ t.Errorf("validateRepoRootScheme(%q) = %q, want nil", test.root, test.err) -+ } -+ } else if err.Error() != test.err { -+ t.Errorf("validateRepoRootScheme(%q) = %q, want %q", test.root, err, test.err) -+ } -+ } -+} diff --git a/golang-1.5-bootstrap-binary-path.patch b/golang-1.5-bootstrap-binary-path.patch deleted file mode 100644 index af7d069..0000000 --- a/golang-1.5-bootstrap-binary-path.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff -up go/src/cmd/dist/buildtool.go.bootstrap go/src/cmd/dist/buildtool.go ---- go/src/cmd/dist/buildtool.go.bootstrap 2017-07-11 12:05:00.041373419 +0200 -+++ go/src/cmd/dist/buildtool.go 2017-07-11 12:07:27.141775914 +0200 -@@ -153,18 +153,26 @@ func bootstrapBuildTools() { - defer os.Setenv("GOBIN", os.Getenv("GOBIN")) - os.Setenv("GOBIN", "") - -+ hostos := os.Getenv("GOHOSTOS") -+ hostarch := os.Getenv("GOHOSTARCH") -+ - os.Setenv("GOOS", "") - os.Setenv("GOHOSTOS", "") - os.Setenv("GOARCH", "") - os.Setenv("GOHOSTARCH", "") - -+ bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch) -+ if _, err := os.Stat(bingopath); os.IsNotExist(err) { -+ bingopath = pathf("%s/bin/go", goroot_bootstrap) -+ } -+ - // Run Go 1.4 to build binaries. Use -gcflags=-l to disable inlining to - // workaround bugs in Go 1.4's compiler. See discussion thread: - // https://groups.google.com/d/msg/golang-dev/Ss7mCKsvk8w/Gsq7VYI0AwAJ - // Use the math_big_pure_go build tag to disable the assembly in math/big - // which may contain unsupported instructions. - cmd := []string{ -- pathf("%s/bin/go", goroot_bootstrap), -+ bingopath, - "install", - "-gcflags=-l", - "-tags=math_big_pure_go", -diff -up go/src/make.bash.bootstrap go/src/make.bash ---- go/src/make.bash.bootstrap 2017-07-11 12:05:00.036373439 +0200 -+++ go/src/make.bash 2017-07-11 12:05:00.041373419 +0200 -@@ -120,8 +120,15 @@ echo '##### Building Go bootstrap tool.' - echo cmd/dist - export GOROOT="$(cd .. && pwd)" - GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4} --if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then -- echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2 -+if [ -x "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" ]; then -+ rm -f cmd/dist/dist -+ GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" build -o cmd/dist/dist ./cmd/dist -+elif [ -x "$GOROOT_BOOTSTRAP/bin/go" ]; then -+ rm -f cmd/dist/dist -+ GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist -+else -+ echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2 -+ echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2 - echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 - exit 1 - fi -@@ -130,8 +137,6 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; - echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 - exit 1 - fi --rm -f cmd/dist/dist --GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist - - # -e doesn't propagate out of eval, so check success by hand. - eval $(./cmd/dist/dist env -p || echo FAIL=true) diff --git a/golang.spec b/golang.spec index f930b52..0e04a7c 100644 --- a/golang.spec +++ b/golang.spec @@ -96,10 +96,10 @@ %endif %global go_api 1.9 -%global go_version 1.9.5 +%global go_version 1.9.6 Name: golang -Version: 1.9.5 +Version: 1.9.6 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -164,24 +164,12 @@ Requires: %{name}-bin = %{version}-%{release} Requires: %{name}-src = %{version}-%{release} Requires: go-srpm-macros -Patch0: golang-1.2-verbose-build.patch - -# use the arch dependent path in the bootstrap -Patch212: golang-1.5-bootstrap-binary-path.patch - -# 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 - -Patch220: s390x-ignore-L0syms.patch - -# https://github.com/golang/go/commit/ca8c361d867d62bd46013c5abbaaad0b2ca6077f -Patch221: use-buildmode-pie-for-pie-testing.patch -# https://github.com/hyangah/go/commit/3502496d03bcd842fd7aac95ec0d7096d581cd26 -Patch222: use-no-pie-where-needed.patch +Patch1: 0001-Make-build-little-bit-more-verbose.patch +Patch2: 0002-Don-t-use-the-bundled-tzdata.patch +Patch3: 0003-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch +Patch4: 0004-Ignore-L0-A-during-linking.patch +Patch5: 0005-Backport-of-https-github.com-golang-go-commit-ca8c36.patch +Patch6: 0006-misc-cgo-testcarchive-use-no-pie-where-needed.patch # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -304,20 +292,12 @@ Requires: %{name} = %{version}-%{release} %prep %setup -q -n go -# increase verbosity of build -%patch0 -p1 -b .verbose - -# use the arch dependent path in the bootstrap -%patch212 -p1 -b .bootstrap - -%patch215 -p1 - -%patch219 -p1 - -%patch220 -p1 - -%patch221 -p1 -b pie -%patch222 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 cp %{SOURCE1} ./src/runtime/ @@ -554,6 +534,9 @@ fi %endif %changelog +* Thu May 03 2018 Jakub Čajka - 1.9.6-1 +- Rebase to 1.9.6 + * Tue Apr 03 2018 Jakub Čajka - 1.9.5-1 - Rebase to 1.9.5 diff --git a/sources b/sources index 9c6b46c..af65b4f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.9.5.src.tar.gz) = 5cde6a3c6e6040ddbcafa75dae551500d0bb15096a523ee29f788cbf3fa11d083d4e4a1b56a094ad2234f967c0d1be280ae00479d5f7c01174dc6da2a5a25924 +SHA512 (go1.9.6.src.tar.gz) = f7863a4fe586414c91465a6a82a47097b2593384688a7c68ad3e9981559047b4faf2c134104ad09a64125576dac557809884d9f125d91108dd51746620a368a2 From 8547fbcae7ffb31ffe4762b6b8b6ef15b779b4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 11 Jun 2018 13:44:48 +0200 Subject: [PATCH 49/67] Rebase to 1.9.7 --- .gitignore | 1 + golang.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 85c8935..30946e0 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ /go1.9.4.src.tar.gz /go1.9.5.src.tar.gz /go1.9.6.src.tar.gz +/go1.9.7.src.tar.gz diff --git a/golang.spec b/golang.spec index 0e04a7c..cb7adbd 100644 --- a/golang.spec +++ b/golang.spec @@ -96,10 +96,10 @@ %endif %global go_api 1.9 -%global go_version 1.9.6 +%global go_version 1.9.7 Name: golang -Version: 1.9.6 +Version: 1.9.7 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -534,6 +534,9 @@ fi %endif %changelog +* Mon Jun 11 2018 Jakub Čajka - 1.9.7-1 +- Rebase to 1.9.7 + * Thu May 03 2018 Jakub Čajka - 1.9.6-1 - Rebase to 1.9.6 diff --git a/sources b/sources index af65b4f..8f90cda 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.9.6.src.tar.gz) = f7863a4fe586414c91465a6a82a47097b2593384688a7c68ad3e9981559047b4faf2c134104ad09a64125576dac557809884d9f125d91108dd51746620a368a2 +SHA512 (go1.9.7.src.tar.gz) = 1ed3375870223a73c9cf94839bfd8894b92f44f9a3ba3b2bec1e9cd8d2212519344c8afcb87a516d6ad3e1ccdc74d9dba225a222bdc5e60f6d73cb474d5f7664 From c6f5d788eba44689b9d12b64e83f4e6f92c661d6 Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Thu, 15 Nov 2018 14:02:30 -0500 Subject: [PATCH 50/67] Revert "golang is now in RHEL7 optional and Centos7 extras" Unretirement for https://pagure.io/releng/issue/7919 This reverts commit 65328ffa21f7ae55e562bab1c68a5c5068b4cf37. --- .gitignore | 13 + dead.package | 1 - go1.3-tar-fix_writing_of_pax_headers.patch | 110 ++ go1.3-tar_reuse_buffer_readHeader.patch | 64 ++ go1.3-tar_reuse_buffer_writeHeader.patch | 56 + golang-1.2-BSD-SVID-SOURCE.patch | 19 + golang-1.2-archive_tar-xattr.patch | 197 ++++ golang-1.2-remove-ECC-p224.patch | 172 +++ golang-1.2-skipCpuProfileTest.patch | 12 + golang-1.2-verbose-build.patch | 19 + golang-f21-hostname.patch | 11 + golang-gdbinit | 1 + golang-prelink.conf | 3 + golang.spec | 1100 ++++++++++++++++++++ macros.golang | 8 + sources | 2 + 16 files changed, 1787 insertions(+), 1 deletion(-) create mode 100644 .gitignore delete mode 100644 dead.package create mode 100644 go1.3-tar-fix_writing_of_pax_headers.patch create mode 100644 go1.3-tar_reuse_buffer_readHeader.patch create mode 100644 go1.3-tar_reuse_buffer_writeHeader.patch create mode 100644 golang-1.2-BSD-SVID-SOURCE.patch create mode 100644 golang-1.2-archive_tar-xattr.patch create mode 100644 golang-1.2-remove-ECC-p224.patch create mode 100644 golang-1.2-skipCpuProfileTest.patch create mode 100644 golang-1.2-verbose-build.patch create mode 100644 golang-f21-hostname.patch create mode 100644 golang-gdbinit create mode 100644 golang-prelink.conf create mode 100644 golang.spec create mode 100644 macros.golang create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..281e185 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +/go1.1.1.src.tar.gz +/go1.1.2.src.tar.gz +/go1.2.1.src.tar.gz +/go1.2.2.src.tar.gz +/go1.2.src.tar.gz +/go1.3.1.src.tar.gz +/go1.3.2.src.tar.gz +/go1.3.3.src.tar.gz +/go1.3beta2.src.tar.gz +/go1.3rc1.src.tar.gz +/go1.3rc2.src.tar.gz +/go1.3.src.tar.gz +/golang-19087:a15f344a9efa-xattrs.tar diff --git a/dead.package b/dead.package deleted file mode 100644 index a562c97..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -golang is now in RHEL7 optional and Centos7 extras diff --git a/go1.3-tar-fix_writing_of_pax_headers.patch b/go1.3-tar-fix_writing_of_pax_headers.patch new file mode 100644 index 0000000..1c847e7 --- /dev/null +++ b/go1.3-tar-fix_writing_of_pax_headers.patch @@ -0,0 +1,110 @@ +# HG changeset patch +# User Cristian Staretu +# Date 1405555229 -36000 +# Thu Jul 17 10:00:29 2014 +1000 +# Node ID 1b17b3426e3c281a973d2d7bbf235b936d6a0942 +# Parent 278365dff593f027db6c6b2c0a89262490d6b676 +archive/tar: fix writing of pax headers + +"archive/tar: reuse temporary buffer in writeHeader" introduced a +change which was supposed to help lower the number of allocations from +512 bytes for every call to writeHeader. This change broke the writing +of PAX headers. + +writeHeader calls writePAXHeader and writePAXHeader calls writeHeader +again. writeHeader will end up writing the PAX header twice. + +example broken header: +PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000 +PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000 + +example correct header: +PaxHeaders.4290/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021516 xustar0000000000000000 +0100644000000000000000000000270412301216634007250 0ustar0000000000000000 + +This commit adds a dedicated buffer for pax headers to the Writer +struct. This change increases the size of the struct by 512 bytes, but +allows tar/writer to avoid allocating 512 bytes for all written +headers and it avoids allocating 512 more bytes for pax headers. + +LGTM=dsymonds +R=dsymonds, dave, iant +CC=golang-codereviews +https://codereview.appspot.com/110480043 + +Committer: David Symonds + +diff -r 278365dff593 -r 1b17b3426e3c src/pkg/archive/tar/writer.go +--- a/src/pkg/archive/tar/writer.go Wed Jul 16 16:29:51 2014 -0700 ++++ b/src/pkg/archive/tar/writer.go Thu Jul 17 10:00:29 2014 +1000 +@@ -39,7 +39,8 @@ + closed bool + usedBinary bool // whether the binary numeric field extension was used + preferPax bool // use pax header instead of binary numeric header +- hdrBuff [blockSize]byte // buffer to use in writeHeader ++ hdrBuff [blockSize]byte // buffer to use in writeHeader when writing a regular header ++ paxHdrBuff [blockSize]byte // buffer to use in writeHeader when writing a pax header + } + + // NewWriter creates a new Writer writing to w. +@@ -161,7 +162,17 @@ + // subsecond time resolution, but for now let's just capture + // too long fields or non ascii characters + +- header := tw.hdrBuff[:] ++ var header []byte ++ ++ // We need to select which scratch buffer to use carefully, ++ // since this method is called recursively to write PAX headers. ++ // If allowPax is true, this is the non-recursive call, and we will use hdrBuff. ++ // If allowPax is false, we are being called by writePAXHeader, and hdrBuff is ++ // already being used by the non-recursive call, so we must use paxHdrBuff. ++ header = tw.hdrBuff[:] ++ if !allowPax { ++ header = tw.paxHdrBuff[:] ++ } + copy(header, zeroBlock) + s := slicer(header) + +diff -r 278365dff593 -r 1b17b3426e3c src/pkg/archive/tar/writer_test.go +--- a/src/pkg/archive/tar/writer_test.go Wed Jul 16 16:29:51 2014 -0700 ++++ b/src/pkg/archive/tar/writer_test.go Thu Jul 17 10:00:29 2014 +1000 +@@ -454,3 +454,38 @@ + t.Fatal("Couldn't recover long name") + } + } ++ ++func TestValidTypeflagWithPAXHeader(t *testing.T) { ++ var buffer bytes.Buffer ++ tw := NewWriter(&buffer) ++ ++ fileName := strings.Repeat("ab", 100) ++ ++ hdr := &Header{ ++ Name: fileName, ++ Size: 4, ++ Typeflag: 0, ++ } ++ if err := tw.WriteHeader(hdr); err != nil { ++ t.Fatalf("Failed to write header: %s", err) ++ } ++ if _, err := tw.Write([]byte("fooo")); err != nil { ++ t.Fatalf("Failed to write the file's data: %s", err) ++ } ++ tw.Close() ++ ++ tr := NewReader(&buffer) ++ ++ for { ++ header, err := tr.Next() ++ if err == io.EOF { ++ break ++ } ++ if err != nil { ++ t.Fatalf("Failed to read header: %s", err) ++ } ++ if header.Typeflag != 0 { ++ t.Fatalf("Typeflag should've been 0, found %d", header.Typeflag) ++ } ++ } ++} diff --git a/go1.3-tar_reuse_buffer_readHeader.patch b/go1.3-tar_reuse_buffer_readHeader.patch new file mode 100644 index 0000000..1c6693c --- /dev/null +++ b/go1.3-tar_reuse_buffer_readHeader.patch @@ -0,0 +1,64 @@ +# HG changeset patch +# User Cristian Staretu +# Date 1404344479 -36000 +# Thu Jul 03 09:41:19 2014 +1000 +# Node ID 17404efd6b02d4b3acd17070e3f89de97a145877 +# Parent 837348e418f33fc7a242f56dbe2feff829532526 +archive/tar: reuse temporary buffer in readHeader + +A temporary 512 bytes buffer is allocated for every call to +readHeader. This buffer isn't returned to the caller and it could +be reused to lower the number of memory allocations. + +This CL improves it by using a pool and zeroing out the buffer before +putting it back into the pool. + +benchmark old ns/op new ns/op delta +BenchmarkListFiles100k 545249903 538832687 -1.18% + +benchmark old allocs new allocs delta +BenchmarkListFiles100k 2105167 2005692 -4.73% + +benchmark old bytes new bytes delta +BenchmarkListFiles100k 105903472 54831527 -48.22% + +This improvement is very important if your code has to deal with a lot +of tarballs which contain a lot of files. + +LGTM=dsymonds +R=golang-codereviews, dave, dsymonds, bradfitz +CC=golang-codereviews +https://codereview.appspot.com/108240044 + +Committer: David Symonds + +diff -r 837348e418f3 -r 17404efd6b02 src/pkg/archive/tar/reader.go +--- a/src/pkg/archive/tar/reader.go Thu Jul 03 09:40:53 2014 +1000 ++++ b/src/pkg/archive/tar/reader.go Thu Jul 03 09:41:19 2014 +1000 +@@ -29,10 +29,11 @@ + // The Next method advances to the next file in the archive (including the first), + // and then it can be treated as an io.Reader to access the file's data. + type Reader struct { +- r io.Reader +- err error +- pad int64 // amount of padding (ignored) after current file entry +- curr numBytesReader // reader for current file entry ++ r io.Reader ++ err error ++ pad int64 // amount of padding (ignored) after current file entry ++ curr numBytesReader // reader for current file entry ++ hdrBuff [blockSize]byte // buffer to use in readHeader + } + + // A numBytesReader is an io.Reader with a numBytes method, returning the number +@@ -426,7 +427,9 @@ + } + + func (tr *Reader) readHeader() *Header { +- header := make([]byte, blockSize) ++ header := tr.hdrBuff[:] ++ copy(header, zeroBlock) ++ + if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil { + return nil + } diff --git a/go1.3-tar_reuse_buffer_writeHeader.patch b/go1.3-tar_reuse_buffer_writeHeader.patch new file mode 100644 index 0000000..6cd8969 --- /dev/null +++ b/go1.3-tar_reuse_buffer_writeHeader.patch @@ -0,0 +1,56 @@ +# HG changeset patch +# User Cristian Staretu +# Date 1404344453 -36000 +# Thu Jul 03 09:40:53 2014 +1000 +# Node ID 837348e418f33fc7a242f56dbe2feff829532526 +# Parent c5f72a685e256457a0872f6587e2bb9500eac7c4 +archive/tar: reuse temporary buffer in writeHeader + +A temporary 512 bytes buffer is allocated for every call to +writeHeader. This buffer could be reused the lower the number +of memory allocations. + +benchmark old ns/op new ns/op delta +BenchmarkWriteFiles100k 634622051 583810847 -8.01% + +benchmark old allocs new allocs delta +BenchmarkWriteFiles100k 2701920 2602621 -3.68% + +benchmark old bytes new bytes delta +BenchmarkWriteFiles100k 115383884 64349922 -44.23% + +This change is very important if your code has to write a lot of +tarballs with a lot of files. + +LGTM=dsymonds +R=golang-codereviews, dave, dsymonds +CC=golang-codereviews +https://codereview.appspot.com/107440043 + +Committer: David Symonds + +diff -r c5f72a685e25 -r 837348e418f3 src/pkg/archive/tar/writer.go +--- a/src/pkg/archive/tar/writer.go Wed Jul 02 15:28:57 2014 -0700 ++++ b/src/pkg/archive/tar/writer.go Thu Jul 03 09:40:53 2014 +1000 +@@ -37,8 +37,9 @@ + nb int64 // number of unwritten bytes for current file entry + pad int64 // amount of padding to write after current file entry + closed bool +- usedBinary bool // whether the binary numeric field extension was used +- preferPax bool // use pax header instead of binary numeric header ++ usedBinary bool // whether the binary numeric field extension was used ++ preferPax bool // use pax header instead of binary numeric header ++ hdrBuff [blockSize]byte // buffer to use in writeHeader + } + + // NewWriter creates a new Writer writing to w. +@@ -160,7 +161,8 @@ + // subsecond time resolution, but for now let's just capture + // too long fields or non ascii characters + +- header := make([]byte, blockSize) ++ header := tw.hdrBuff[:] ++ copy(header, zeroBlock) + s := slicer(header) + + // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax diff --git a/golang-1.2-BSD-SVID-SOURCE.patch b/golang-1.2-BSD-SVID-SOURCE.patch new file mode 100644 index 0000000..f4927b6 --- /dev/null +++ b/golang-1.2-BSD-SVID-SOURCE.patch @@ -0,0 +1,19 @@ +Index: go/include/u.h +=================================================================== +--- go.orig/include/u.h ++++ go/include/u.h +@@ -38,10 +38,13 @@ extern "C" { + # define __MAKECONTEXT_V2_SOURCE 1 + # endif + #endif ++#if defined __linux__ || defined __GNU__ || defined __GLIBC__ ++#define _DEFAULT_SOURCE 1 ++#else + #define _BSD_SOURCE 1 + #define _NETBSD_SOURCE 1 /* NetBSD */ +-#define _DEFAULT_SOURCE 1 /* glibc > 2.19 */ + #define _SVID_SOURCE 1 ++#endif + #if !defined(__APPLE__) && !defined(__OpenBSD__) + # define _XOPEN_SOURCE 1000 + # define _XOPEN_SOURCE_EXTENDED 1 diff --git a/golang-1.2-archive_tar-xattr.patch b/golang-1.2-archive_tar-xattr.patch new file mode 100644 index 0000000..10c8f3d --- /dev/null +++ b/golang-1.2-archive_tar-xattr.patch @@ -0,0 +1,197 @@ +# HG changeset patch +# User Alexander Larsson +# Date 1392282510 -39600 +# Node ID a15f344a9efa35ef168c8feaa92a15a1cdc93db5 +# Parent 1a32fe60e0798d82bbff6c945001c7f0ba8de5ea +archive/tar: support extended attributes + +This adds support for archives with the SCHILY.xattr field in the +pax header. This is what gnu tar and star generate. +Fixes issue 7154. + +LGTM=dsymonds +R=golang-codereviews, gobot, dsymonds +CC=golang-codereviews +https://codereview.appspot.com/54570043 + +Committer: David Symonds + +diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/common.go +--- a/src/pkg/archive/tar/common.go Thu Feb 13 03:09:03 2014 -0500 ++++ b/src/pkg/archive/tar/common.go Thu Feb 13 20:08:30 2014 +1100 +@@ -57,6 +57,7 @@ + Devminor int64 // minor number of character or block device + AccessTime time.Time // access time + ChangeTime time.Time // status change time ++ Xattrs map[string]string + } + + // File name constants from the tar spec. +@@ -189,6 +190,7 @@ + paxSize = "size" + paxUid = "uid" + paxUname = "uname" ++ paxXattr = "SCHILY.xattr." + paxNone = "" + ) + +diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/reader.go +--- a/src/pkg/archive/tar/reader.go Thu Feb 13 03:09:03 2014 -0500 ++++ b/src/pkg/archive/tar/reader.go Thu Feb 13 20:08:30 2014 +1100 +@@ -139,8 +139,14 @@ + return err + } + hdr.Size = int64(size) ++ default: ++ if strings.HasPrefix(k, paxXattr) { ++ if hdr.Xattrs == nil { ++ hdr.Xattrs = make(map[string]string) ++ } ++ hdr.Xattrs[k[len(paxXattr):]] = v ++ } + } +- + } + return nil + } +diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/reader_test.go +--- a/src/pkg/archive/tar/reader_test.go Thu Feb 13 03:09:03 2014 -0500 ++++ b/src/pkg/archive/tar/reader_test.go Thu Feb 13 20:08:30 2014 +1100 +@@ -161,6 +161,46 @@ + }, + }, + }, ++ { ++ file: "testdata/xattrs.tar", ++ headers: []*Header{ ++ { ++ Name: "small.txt", ++ Mode: 0644, ++ Uid: 1000, ++ Gid: 10, ++ Size: 5, ++ ModTime: time.Unix(1386065770, 448252320), ++ Typeflag: '0', ++ Uname: "alex", ++ Gname: "wheel", ++ AccessTime: time.Unix(1389782991, 419875220), ++ ChangeTime: time.Unix(1389782956, 794414986), ++ Xattrs: map[string]string{ ++ "user.key": "value", ++ "user.key2": "value2", ++ // Interestingly, selinux encodes the terminating null inside the xattr ++ "security.selinux": "unconfined_u:object_r:default_t:s0\x00", ++ }, ++ }, ++ { ++ Name: "small2.txt", ++ Mode: 0644, ++ Uid: 1000, ++ Gid: 10, ++ Size: 11, ++ ModTime: time.Unix(1386065770, 449252304), ++ Typeflag: '0', ++ Uname: "alex", ++ Gname: "wheel", ++ AccessTime: time.Unix(1389782991, 419875220), ++ ChangeTime: time.Unix(1386065770, 449252304), ++ Xattrs: map[string]string{ ++ "security.selinux": "unconfined_u:object_r:default_t:s0\x00", ++ }, ++ }, ++ }, ++ }, + } + + func TestReader(t *testing.T) { +@@ -180,7 +220,7 @@ + f.Close() + continue testLoop + } +- if *hdr != *header { ++ if !reflect.DeepEqual(*hdr, *header) { + t.Errorf("test %d, entry %d: Incorrect header:\nhave %+v\nwant %+v", + i, j, *hdr, *header) + } +@@ -253,7 +293,7 @@ + } + + // check the header +- if *hdr != *headers[nread] { ++ if !reflect.DeepEqual(*hdr, *headers[nread]) { + t.Errorf("Incorrect header:\nhave %+v\nwant %+v", + *hdr, headers[nread]) + } +diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/writer.go +--- a/src/pkg/archive/tar/writer.go Thu Feb 13 03:09:03 2014 -0500 ++++ b/src/pkg/archive/tar/writer.go Thu Feb 13 20:08:30 2014 +1100 +@@ -236,6 +236,12 @@ + return tw.err + } + ++ if allowPax { ++ for k, v := range hdr.Xattrs { ++ paxHeaders[paxXattr+k] = v ++ } ++ } ++ + if len(paxHeaders) > 0 { + if !allowPax { + return errInvalidHeader +diff -r 1a32fe60e079 -r a15f344a9efa src/pkg/archive/tar/writer_test.go +--- a/src/pkg/archive/tar/writer_test.go Thu Feb 13 03:09:03 2014 -0500 ++++ b/src/pkg/archive/tar/writer_test.go Thu Feb 13 20:08:30 2014 +1100 +@@ -10,6 +10,7 @@ + "io" + "io/ioutil" + "os" ++ "reflect" + "strings" + "testing" + "testing/iotest" +@@ -338,6 +339,45 @@ + } + } + ++func TestPaxXattrs(t *testing.T) { ++ xattrs := map[string]string{ ++ "user.key": "value", ++ } ++ ++ // Create an archive with an xattr ++ fileinfo, err := os.Stat("testdata/small.txt") ++ if err != nil { ++ t.Fatal(err) ++ } ++ hdr, err := FileInfoHeader(fileinfo, "") ++ if err != nil { ++ t.Fatalf("os.Stat: %v", err) ++ } ++ contents := "Kilts" ++ hdr.Xattrs = xattrs ++ var buf bytes.Buffer ++ writer := NewWriter(&buf) ++ if err := writer.WriteHeader(hdr); err != nil { ++ t.Fatal(err) ++ } ++ if _, err = writer.Write([]byte(contents)); err != nil { ++ t.Fatal(err) ++ } ++ if err := writer.Close(); err != nil { ++ t.Fatal(err) ++ } ++ // Test that we can get the xattrs back out of the archive. ++ reader := NewReader(&buf) ++ hdr, err = reader.Next() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if !reflect.DeepEqual(hdr.Xattrs, xattrs) { ++ t.Fatalf("xattrs did not survive round trip: got %+v, want %+v", ++ hdr.Xattrs, xattrs) ++ } ++} ++ + func TestPAXHeader(t *testing.T) { + medName := strings.Repeat("CD", 50) + longName := strings.Repeat("AB", 100) diff --git a/golang-1.2-remove-ECC-p224.patch b/golang-1.2-remove-ECC-p224.patch new file mode 100644 index 0000000..1b9e021 --- /dev/null +++ b/golang-1.2-remove-ECC-p224.patch @@ -0,0 +1,172 @@ +Index: go/api/go1.txt +=================================================================== +--- go.orig/api/go1.txt ++++ go/api/go1.txt +@@ -412,7 +412,6 @@ pkg crypto/ecdsa, type PublicKey struct, + pkg crypto/ecdsa, type PublicKey struct, embedded elliptic.Curve + pkg crypto/elliptic, func GenerateKey(Curve, io.Reader) ([]uint8, *big.Int, *big.Int, error) + pkg crypto/elliptic, func Marshal(Curve, *big.Int, *big.Int) []uint8 +-pkg crypto/elliptic, func P224() Curve + pkg crypto/elliptic, func P256() Curve + pkg crypto/elliptic, func P384() Curve + pkg crypto/elliptic, func P521() Curve +Index: go/src/pkg/crypto/ecdsa/ecdsa_test.go +=================================================================== +--- go.orig/src/pkg/crypto/ecdsa/ecdsa_test.go ++++ go/src/pkg/crypto/ecdsa/ecdsa_test.go +@@ -33,7 +33,6 @@ func testKeyGeneration(t *testing.T, c e + } + + func TestKeyGeneration(t *testing.T) { +- testKeyGeneration(t, elliptic.P224(), "p224") + if testing.Short() { + return + } +@@ -63,7 +62,6 @@ func testSignAndVerify(t *testing.T, c e + } + + func TestSignAndVerify(t *testing.T) { +- testSignAndVerify(t, elliptic.P224(), "p224") + if testing.Short() { + return + } +@@ -129,8 +127,6 @@ func TestVectors(t *testing.T) { + parts := strings.SplitN(line, ",", 2) + + switch parts[0] { +- case "P-224": +- pub.Curve = elliptic.P224() + case "P-256": + pub.Curve = elliptic.P256() + case "P-384": +Index: go/src/pkg/crypto/elliptic/bottombits.go +=================================================================== +--- /dev/null ++++ go/src/pkg/crypto/elliptic/bottombits.go +@@ -0,0 +1,14 @@ ++ ++// Copyright 2012 The Go Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++package elliptic ++ ++const bottom12Bits = 0xfff ++const bottom28Bits = 0xfffffff ++ ++const two31p3 = 1<<31 + 1<<3 ++const two31m3 = 1<<31 - 1<<3 ++const two31m15m3 = 1<<31 - 1<<15 - 1<<3 ++ +Index: go/src/pkg/crypto/elliptic/elliptic.go +=================================================================== +--- go.orig/src/pkg/crypto/elliptic/elliptic.go ++++ go/src/pkg/crypto/elliptic/elliptic.go +@@ -326,7 +326,6 @@ var p384 *CurveParams + var p521 *CurveParams + + func initAll() { +- initP224() + initP256() + initP384() + initP521() +Index: go/src/pkg/crypto/elliptic/elliptic_test.go +=================================================================== +--- go.orig/src/pkg/crypto/elliptic/elliptic_test.go ++++ go/src/pkg/crypto/elliptic/elliptic_test.go +@@ -1,3 +1,5 @@ ++// +build ignore ++ + // Copyright 2010 The Go Authors. All rights reserved. + // Use of this source code is governed by a BSD-style + // license that can be found in the LICENSE file. +Index: go/src/pkg/crypto/elliptic/p224.go +=================================================================== +--- go.orig/src/pkg/crypto/elliptic/p224.go ++++ go/src/pkg/crypto/elliptic/p224.go +@@ -1,3 +1,5 @@ ++// +build ignore ++ + // Copyright 2012 The Go Authors. All rights reserved. + // Use of this source code is governed by a BSD-style + // license that can be found in the LICENSE file. +@@ -183,10 +185,6 @@ func p224Add(out, a, b *p224FieldElement + } + } + +-const two31p3 = 1<<31 + 1<<3 +-const two31m3 = 1<<31 - 1<<3 +-const two31m15m3 = 1<<31 - 1<<15 - 1<<3 +- + // p224ZeroModP31 is 0 mod p where bit 31 is set in all limbs so that we can + // subtract smaller amounts without underflow. See the section "Subtraction" in + // [1] for reasoning. +@@ -215,9 +213,6 @@ const two63m35m19 = 1<<63 - 1<<35 - 1<<1 + // "Subtraction" in [1] for why. + var p224ZeroModP63 = [8]uint64{two63p35, two63m35, two63m35, two63m35, two63m35m19, two63m35, two63m35, two63m35} + +-const bottom12Bits = 0xfff +-const bottom28Bits = 0xfffffff +- + // p224Mul computes *out = a*b + // + // a[i] < 2**29, b[i] < 2**30 (or vice versa) +Index: go/src/pkg/crypto/elliptic/p224_test.go +=================================================================== +--- go.orig/src/pkg/crypto/elliptic/p224_test.go ++++ go/src/pkg/crypto/elliptic/p224_test.go +@@ -1,3 +1,5 @@ ++// +build ignore ++ + // Copyright 2012 The Go Authors. All rights reserved. + // Use of this source code is governed by a BSD-style + // license that can be found in the LICENSE file. +Index: go/src/pkg/crypto/x509/x509.go +=================================================================== +--- go.orig/src/pkg/crypto/x509/x509.go ++++ go/src/pkg/crypto/x509/x509.go +@@ -306,9 +306,6 @@ func getPublicKeyAlgorithmFromOID(oid as + + // RFC 5480, 2.1.1.1. Named Curve + // +-// secp224r1 OBJECT IDENTIFIER ::= { +-// iso(1) identified-organization(3) certicom(132) curve(0) 33 } +-// + // secp256r1 OBJECT IDENTIFIER ::= { + // iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) + // prime(1) 7 } +@@ -321,7 +318,6 @@ func getPublicKeyAlgorithmFromOID(oid as + // + // NB: secp256r1 is equivalent to prime256v1 + var ( +- oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33} + oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7} + oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34} + oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35} +@@ -329,8 +325,6 @@ var ( + + func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { + switch { +- case oid.Equal(oidNamedCurveP224): +- return elliptic.P224() + case oid.Equal(oidNamedCurveP256): + return elliptic.P256() + case oid.Equal(oidNamedCurveP384): +@@ -343,8 +337,6 @@ func namedCurveFromOID(oid asn1.ObjectId + + func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) { + switch curve { +- case elliptic.P224(): +- return oidNamedCurveP224, true + case elliptic.P256(): + return oidNamedCurveP256, true + case elliptic.P384(): +@@ -1371,7 +1363,7 @@ func signingParamsForPrivateKey(priv int + pubType = ECDSA + + switch priv.Curve { +- case elliptic.P224(), elliptic.P256(): ++ case elliptic.P256(): + hashFunc = crypto.SHA256 + sigAlgo.Algorithm = oidSignatureECDSAWithSHA256 + case elliptic.P384(): diff --git a/golang-1.2-skipCpuProfileTest.patch b/golang-1.2-skipCpuProfileTest.patch new file mode 100644 index 0000000..3dee29f --- /dev/null +++ b/golang-1.2-skipCpuProfileTest.patch @@ -0,0 +1,12 @@ +diff -r 87dea3f5ebe7 src/pkg/runtime/pprof/pprof_test.go +--- a/src/pkg/runtime/pprof/pprof_test.go Fri Nov 29 08:32:31 2013 +1100 ++++ b/src/pkg/runtime/pprof/pprof_test.go Fri Jan 24 13:47:42 2014 -0500 +@@ -32,7 +32,7 @@ + }) + } + +-func TestCPUProfileMultithreaded(t *testing.T) { ++func testCPUProfileMultithreaded(t *testing.T) { + buf := make([]byte, 100000) + defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2)) + testCPUProfile(t, []string{"crc32.ChecksumIEEE", "crc32.Update"}, func() { diff --git a/golang-1.2-verbose-build.patch b/golang-1.2-verbose-build.patch new file mode 100644 index 0000000..1698d82 --- /dev/null +++ b/golang-1.2-verbose-build.patch @@ -0,0 +1,19 @@ +Index: go/src/make.bash +=================================================================== +--- go.orig/src/make.bash ++++ go/src/make.bash +@@ -161,12 +161,12 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH + # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, + # use the host compiler, CC, from `cmd/dist/dist env` instead. + CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ +- "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std ++ "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std + echo + fi + + echo "# Building packages and commands for $GOOS/$GOARCH." +-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std ++CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std + echo + + rm -f "$GOTOOLDIR"/go_bootstrap diff --git a/golang-f21-hostname.patch b/golang-f21-hostname.patch new file mode 100644 index 0000000..6025ecb --- /dev/null +++ b/golang-f21-hostname.patch @@ -0,0 +1,11 @@ +--- src/pkg/os/os_test.go.orig 2014-02-20 13:14:45.543644182 -0600 ++++ src/pkg/os/os_test.go 2014-02-20 13:14:55.934813622 -0600 +@@ -854,7 +854,7 @@ + t.Fatal(err) + } + defer r.Close() +- p, err := StartProcess("/bin/hostname", []string{"hostname"}, &ProcAttr{Files: []*File{nil, w, Stderr}}) ++ p, err := StartProcess("/usr/bin/hostname", []string{"hostname"}, &ProcAttr{Files: []*File{nil, w, Stderr}}) + if err != nil { + t.Fatal(err) + } diff --git a/golang-gdbinit b/golang-gdbinit new file mode 100644 index 0000000..4ef690b --- /dev/null +++ b/golang-gdbinit @@ -0,0 +1 @@ +add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py diff --git a/golang-prelink.conf b/golang-prelink.conf new file mode 100644 index 0000000..471e8e6 --- /dev/null +++ b/golang-prelink.conf @@ -0,0 +1,3 @@ +# there are ELF files in src which are testdata and shouldn't be modified +-b /usr/lib/golang/src +-b /usr/lib64/golang/src diff --git a/golang.spec b/golang.spec new file mode 100644 index 0000000..e4be874 --- /dev/null +++ b/golang.spec @@ -0,0 +1,1100 @@ +# build ids are not currently generated: +# https://code.google.com/p/go/issues/detail?id=5238 +# +# also, debuginfo extraction currently fails with +# "Failed to write file: invalid section alignment" +%global debug_package %{nil} + +# we are shipping the full contents of src in the data subpackage, which +# contains binary-like things (ELF data for tests, etc) +%global _binaries_in_noarch_packages_terminate_build 0 + +# Do not check any files in doc or src for requires +%global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$ + +# Don't alter timestamps of especially the .a files (or else go will rebuild later) +# Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata +%global __strip /bin/true + +# rpmbuild magic to keep from having meta dependency on libc.so.6 +%define _use_internal_dependency_generator 0 +%define __find_requires %{nil} +%global debug_package %{nil} +%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \ + /usr/lib/rpm/brp-compress + +# let this match the macros in macros.golang +%global goroot /usr/lib/%{name} +%global gopath %{_datadir}/gocode +%global go_arches %{ix86} x86_64 %{arm} +%ifarch x86_64 +%global gohostarch amd64 +%endif +%ifarch %{ix86} +%global gohostarch 386 +%endif +%ifarch %{arm} +%global gohostarch arm +%endif + +Name: golang +Version: 1.3.3 +Release: 1%{?dist} +Summary: The Go Programming Language + +License: BSD +URL: http://golang.org/ +Source0: https://storage.googleapis.com/golang/go%{version}.src.tar.gz + +# this command moved places +%if 0%{?fedora} >= 21 +BuildRequires: /usr/bin/hostname +Patch210: golang-f21-hostname.patch + +# Patch211 - F21+ has glibc 2.19.90 (2.20 devel)+ which deprecates +# _BSD_SOURCE and _SVID_SOURCE +Patch211: golang-1.2-BSD-SVID-SOURCE.patch +%else +BuildRequires: /bin/hostname +%endif + +Provides: go = %{version}-%{release} +Requires: golang-bin +Requires: golang-src + +BuildRequires: emacs + +Patch0: golang-1.2-verbose-build.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=1038683 +Patch1: golang-1.2-remove-ECC-p224.patch + +# disable flaky test for now +# http://code.google.com/p/go/issues/detail?id=6522 +Patch2: ./golang-1.2-skipCpuProfileTest.patch + +# these patches can be dropped for go1.4 +# discovered working here https://github.com/dotcloud/docker/pull/6829 +Patch3: ./go1.3-tar_reuse_buffer_readHeader.patch +Patch4: ./go1.3-tar_reuse_buffer_writeHeader.patch +# https://code.google.com/p/go/source/detail?r=1b17b3426e3c +Patch5: ./go1.3-tar-fix_writing_of_pax_headers.patch + +# Having documentation separate was broken +Obsoletes: %{name}-docs < 1.1-4 + +# RPM can't handle symlink -> dir with subpackages, so merge back +Obsoletes: %{name}-data < 1.1.1-4 + +# These are the only RHEL/Fedora architectures that we compile this package for +ExclusiveArch: %{go_arches} + +Source100: golang-gdbinit +Source101: golang-prelink.conf +Source102: macros.golang + +%description +%{summary}. + + +# Restore this package if RPM gets fixed (bug #975909) +#%package data +#Summary: Required architecture-independent files for Go +#Requires: %{name} = %{version}-%{release} +#BuildArch: noarch +#Obsoletes: %{name}-docs < 1.1-4 +# +#%description data +#%{summary}. + + +%package vim +Summary: Vim plugins for Go +# fedora only +%if 0%{?fedora} +Requires: vim-filesystem +%endif +BuildArch: noarch + +%description vim +%{summary}. + + +%package -n emacs-%{name} +Summary: Emacs add-on package for Go +Requires: emacs(bin) >= %{_emacs_version} +BuildArch: noarch + +%description -n emacs-%{name} +%{summary}. + + +## +# the source tree +%package src +Summary: Golang compiler source tree +Requires: go = %{version}-%{release} +BuildArch: noarch +%description src +%{summary} + +## +# This is the only architecture specific binary +%ifarch %{ix86} +%package pkg-bin-linux-386 +Summary: Golang compiler tool for linux 386 +Requires: go = %{version}-%{release} +Requires: golang-pkg-linux-386 = %{version}-%{release} +Requires(post): golang-pkg-linux-386 = %{version}-%{release} +Provides: golang-bin = 386 +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc +Requires: gcc +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +%description pkg-bin-linux-386 +%{summary} +%endif + +%ifarch x86_64 +%package pkg-bin-linux-amd64 +Summary: Golang compiler tool for linux amd64 +Requires: go = %{version}-%{release} +Requires: golang-pkg-linux-amd64 = %{version}-%{release} +Requires(post): golang-pkg-linux-amd64 = %{version}-%{release} +Provides: golang-bin = amd64 +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc +Requires: gcc +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +%description pkg-bin-linux-amd64 +%{summary} +%endif + +%ifarch %{arm} +%package pkg-bin-linux-arm +Summary: Golang compiler tool for linux arm +Requires: go = %{version}-%{release} +Requires: golang-pkg-linux-arm = %{version}-%{release} +Requires(post): golang-pkg-linux-arm = %{version}-%{release} +Provides: golang-bin = arm +# We strip the meta dependency, but go does require glibc. +# This is an odd issue, still looking for a better fix. +Requires: glibc +Requires: gcc +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +%description pkg-bin-linux-arm +%{summary} +%endif + +## +# architecture independent go tooling, that allows for cross +# compiling on golang supported architectures +# http://golang.org/doc/install/source#environment +%package pkg-linux-386 +Summary: Golang compiler toolchain to compile for linux 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-linux-386 +%{summary} + +%package pkg-linux-amd64 +Summary: Golang compiler toolchain to compile for linux amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-linux-amd64 +%{summary} + +%package pkg-linux-arm +Summary: Golang compiler toolchain to compile for linux arm +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-linux-arm +%{summary} + +%package pkg-darwin-386 +Summary: Golang compiler toolchain to compile for darwin 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-darwin-386 +%{summary} + +%package pkg-darwin-amd64 +Summary: Golang compiler toolchain to compile for darwin amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-darwin-amd64 +%{summary} + +%package pkg-windows-386 +Summary: Golang compiler toolchain to compile for windows 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-windows-386 +%{summary} + +%package pkg-windows-amd64 +Summary: Golang compiler toolchain to compile for windows amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-windows-amd64 +%{summary} + +%package pkg-plan9-386 +Summary: Golang compiler toolchain to compile for plan9 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-plan9-386 +%{summary} + +%package pkg-plan9-amd64 +Summary: Golang compiler toolchain to compile for plan9 amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-plan9-amd64 +%{summary} + +%package pkg-freebsd-386 +Summary: Golang compiler toolchain to compile for freebsd 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-freebsd-386 +%{summary} + +%package pkg-freebsd-amd64 +Summary: Golang compiler toolchain to compile for freebsd amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-freebsd-amd64 +%{summary} + +%package pkg-freebsd-arm +Summary: Golang compiler toolchain to compile for freebsd arm +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-freebsd-arm +%{summary} + +%package pkg-netbsd-386 +Summary: Golang compiler toolchain to compile for netbsd 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-netbsd-386 +%{summary} + +%package pkg-netbsd-amd64 +Summary: Golang compiler toolchain to compile for netbsd amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-netbsd-amd64 +%{summary} + +%package pkg-netbsd-arm +Summary: Golang compiler toolchain to compile for netbsd arm +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-netbsd-arm +%{summary} + +%package pkg-openbsd-386 +Summary: Golang compiler toolchain to compile for openbsd 386 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-openbsd-386 +%{summary} + +%package pkg-openbsd-amd64 +Summary: Golang compiler toolchain to compile for openbsd amd64 +Requires: go = %{version}-%{release} +BuildArch: noarch +%description pkg-openbsd-amd64 +%{summary} + +## missing ./go/src/pkg/runtime/defs_openbsd_arm.h +## we'll skip this bundle for now +#%package pkg-openbsd-arm +#Summary: Golang compiler toolchain to compile for openbsd arm +#Requires: go = %{version}-%{release} +#BuildArch: noarch +#%description pkg-openbsd-arm +#%{summary} + +# Workaround old RPM bug of symlink-replaced-with-dir failure +%pretrans -p +for _,d in pairs({"api", "doc", "include", "lib", "src"}) do + path = "%{goroot}/" .. d + if posix.stat(path, "type") == "link" then + os.remove(path) + posix.mkdir(path) + end +end + + +%prep +%setup -q -n go + +%if 0%{?fedora} >= 21 +%patch210 -p0 +%patch211 -p1 +%endif + +# increase verbosity of build +%patch0 -p1 + +# remove the P224 curve +%patch1 -p1 + +# skip flaky test +%patch2 -p1 + +# performance for archive/tar +%patch3 -p1 +%patch4 -p1 +# buffer the PAX header +%patch5 -p1 + +# create a [dirty] gcc wrapper to allow us to build with our own flags +# (dirty because it is spoofing 'gcc' since CC value is stored in the go tool) +# TODO: remove this and just set CFLAGS/LDFLAGS once upstream supports it +# https://code.google.com/p/go/issues/detail?id=6882 +# UPDATE: this is fixed in trunk, and will be in go1.3 +mkdir -p zz +echo -e "#!/bin/sh\n/usr/bin/gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS \"\$@\"" > ./zz/gcc +chmod +x ./zz/gcc + +%build +# set up final install location +export GOROOT_FINAL=%{goroot} + +# TODO use the system linker to get the system link flags and build-id +# when https://code.google.com/p/go/issues/detail?id=5221 is solved +#export GO_LDFLAGS="-linkmode external -extldflags $RPM_LD_FLAGS" + +export GOHOSTOS=linux +export GOHOSTARCH=%{gohostarch} + +# build for all (see http://golang.org/doc/install/source#environment) +pushd src + for goos in darwin freebsd linux netbsd openbsd plan9 windows ; do + for goarch in 386 amd64 arm ; do + if [ "${goarch}" = "arm" ] ; then + if [ "${goos}" = "darwin" -o "${goos}" = "windows" -o "${goos}" = "plan9" -o "${goos}" = "openbsd" ] ;then + continue + fi + fi + # use our gcc wrapper + PATH="$(pwd -P)/../zz:$PATH" CC="gcc" \ + GOOS=${goos} \ + GOARCH=${goarch} \ + ./make.bash --no-clean + done + done +popd + +# compile for emacs +cd misc +mv emacs/go-mode-load.el emacs/%{name}-init.el +%{_emacs_bytecompile} emacs/go-mode.el +cd .. + + +%install +rm -rf $RPM_BUILD_ROOT + +# create the top level directories +mkdir -p $RPM_BUILD_ROOT%{_bindir} +mkdir -p $RPM_BUILD_ROOT%{goroot} + +# install everything into libdir (until symlink problems are fixed) +# https://code.google.com/p/go/issues/detail?id=5830 +cp -apv api bin doc favicon.ico include lib pkg robots.txt src misc VERSION \ + $RPM_BUILD_ROOT%{goroot} + +# bz1099206 +find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; +# and level out all the built archives +touch $RPM_BUILD_ROOT%{goroot}/pkg +find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \; +# generate the spec file ownership of this source tree and packages +cwd=$(pwd) +src_list=$cwd/go-src.list +rm -f $src_list +touch $src_list +pushd $RPM_BUILD_ROOT%{goroot} + find src/ -type d -printf '%%%dir %{goroot}/%p\n' >> $src_list + find src/ ! -type d -printf '%{goroot}/%p\n' >> $src_list + + + for goos in darwin freebsd linux netbsd openbsd plan9 windows ; do + for goarch in 386 amd64 arm ; do + if [ "${goarch}" = "arm" ] ; then + if [ "${goos}" = "darwin" -o "${goos}" = "windows" -o "${goos}" = "plan9" -o "${goos}" = "openbsd" ] ;then + continue + fi + fi + file_list=${cwd}/pkg-${goos}-${goarch}.list + rm -f $file_list + touch $file_list + find pkg/${goos}_${goarch}/ -type d -printf '%%%dir %{goroot}/%p\n' >> $file_list + find pkg/${goos}_${goarch}/ ! -type d -printf '%{goroot}/%p\n' >> $file_list + done + done +popd + +# remove the unnecessary zoneinfo file (Go will always use the system one first) +rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time + +# remove the doc Makefile +rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile + +# put binaries to bindir, linked to the arch we're building, +# leave the arch independent pieces in %{goroot} +mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch} +mv $RPM_BUILD_ROOT%{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go +mv $RPM_BUILD_ROOT%{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt + +# ensure these exist and are owned +mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com/ +mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org/ +mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/ +mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p/ + +# remove the go and gofmt for other platforms (not used in the compile) +pushd $RPM_BUILD_ROOT%{goroot}/bin/ + rm -rf darwin_* windows_* freebsd_* netbsd_* openbsd_* plan9_* + case "%{gohostarch}" in + amd64) + rm -rf linux_386 linux_arm ;; + 386) + rm -rf linux_arm linux_amd64 ;; + arm) + rm -rf linux_386 linux_amd64 ;; + esac +popd + +# make sure these files exist and point to alternatives +rm -f $RPM_BUILD_ROOT%{_bindir}/go +ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go +rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt +ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt + +# misc/bash +mkdir -p $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions +cp -av misc/bash/go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions +for z in 8l 6l 5l 8g 6g 5g gofmt gccgo + do ln -s go $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/$z +done + +# misc/emacs +mkdir -p $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name} +mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} +cp -av misc/emacs/go-mode.* $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name} +cp -av misc/emacs/%{name}-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir} + +# misc/vim +mkdir -p $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles +cp -av misc/vim/* $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles +rm $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/readme.txt + +# misc/zsh +mkdir -p $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions +cp -av misc/zsh/go $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions + +# gdbinit +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d +cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb + +# prelink blacklist +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d +cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf + +# rpm macros +mkdir -p %{buildroot} +%if 0%{?rhel} > 6 || 0%{?fedora} > 0 +mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d +cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d/macros.golang +%else +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm +cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang +%endif + + +%check +export GOROOT=$(pwd -P) +export PATH="$PATH":"$GOROOT"/bin +cd src +# skip using CGO for test. causes a SIGABRT on fc21 (bz1086900) +# until this test/issue is fixed +# https://bugzilla.redhat.com/show_bug.cgi?id=1086900 +# CGO for test, which fails in i686 on fc21 inside mock/chroot (bz1087621) +# https://bugzilla.redhat.com/show_bug.cgi?id=1087621 + +# not using our 'gcc' since the CFLAGS fails crash_cgo_test.go due to unused variables +# https://code.google.com/p/go/issues/detail?id=6883 +CGO_ENABLED=0 ./run.bash --no-rebuild +cd .. + +if [ $(go list -json std | grep Stale | wc -l) -gt 2 ] ; then + # cmd/go and cmd/gofmt show like they are stale. we can ignore + exit 1 +fi + + +%ifarch %{ix86} +%post pkg-bin-linux-386 +# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, +touch -r %{goroot}/pkg/linux_386/runtime.a %{goroot}/pkg/linux_386/runtime/cgo.a + +%{_sbindir}/update-alternatives --install %{_bindir}/go \ + go %{goroot}/bin/linux_386/go 90 \ + --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_386/gofmt + +%preun pkg-bin-linux-386 +if [ $1 = 0 ]; then + %{_sbindir}/update-alternatives --remove go %{goroot}/bin/linux_386/go +fi +%endif + +%ifarch x86_64 +%post pkg-bin-linux-amd64 +# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, +touch -r %{goroot}/pkg/linux_amd64/runtime.a %{goroot}/pkg/linux_amd64/runtime/cgo.a + +%{_sbindir}/update-alternatives --install %{_bindir}/go \ + go %{goroot}/bin/linux_amd64/go 90 \ + --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_amd64/gofmt + +%preun pkg-bin-linux-amd64 +if [ $1 = 0 ]; then + %{_sbindir}/update-alternatives --remove go %{goroot}/bin/linux_amd64/go +fi +%endif + +%ifarch %{arm} +%post pkg-bin-linux-arm +# since the cgo.a packaged in this rpm will be older than the other archives likely built on the ARM builder, +touch -r %{goroot}/pkg/linux_arm/runtime.a %{goroot}/pkg/linux_arm/runtime/cgo.a + +%{_sbindir}/update-alternatives --install %{_bindir}/go \ + go %{goroot}/bin/linux_arm/go 90 \ + --slave %{_bindir}/gofmt gofmt %{goroot}/bin/linux_arm/gofmt + +%preun pkg-bin-linux-arm +if [ $1 = 0 ]; then + %{_sbindir}/update-alternatives --remove go %{goroot}/bin/linux_arm/go +fi +%endif + + +#%post pkg-openbsd-arm +#GOROOT=%{goroot} GOOS=openbsd GOARCH=arm go install std + +%files +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +# VERSION has to be present in the GOROOT, for `go install std` to work +%doc %{goroot}/VERSION + +# go files +%dir %{goroot} +%{goroot}/* +%exclude %{goroot}/bin/ +%exclude %{goroot}/pkg/ +%exclude %{goroot}/src/ + +# ensure directory ownership, so they are cleaned up if empty +%dir %{gopath} +%dir %{gopath}/src +%dir %{gopath}/src/github.com/ +%dir %{gopath}/src/bitbucket.org/ +%dir %{gopath}/src/code.google.com/ +%dir %{gopath}/src/code.google.com/p/ + + +# autocomplete +%{_datadir}/bash-completion +%{_datadir}/zsh + +# gdbinit (for gdb debugging) +%{_sysconfdir}/gdbinit.d + +# prelink blacklist +%{_sysconfdir}/prelink.conf.d + +%if 0%{?rhel} > 6 || 0%{?fedora} > 0 +%{_rpmconfigdir}/macros.d/macros.golang +%else +%{_sysconfdir}/rpm/macros.golang +%endif + + +%files vim +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +%{_datadir}/vim/vimfiles/* + + +%files -n emacs-%{name} +%doc AUTHORS CONTRIBUTORS LICENSE PATENTS +%{_emacs_sitelispdir}/%{name} +%{_emacs_sitestartdir}/*.el + + +%files -f go-src.list src +%{goroot}/src/ + +%ifarch %{ix86} +%files pkg-bin-linux-386 +%{goroot}/bin/linux_386/ +# binary executables +%{_bindir}/go +%{_bindir}/gofmt +%dir %{goroot}/pkg/obj/linux_386 +%{goroot}/pkg/obj/linux_386/* +%{goroot}/pkg/linux_386/runtime/cgo.a +%dir %{goroot}/pkg/tool/linux_386 +%{goroot}/pkg/tool/linux_386/5a +%{goroot}/pkg/tool/linux_386/5c +%{goroot}/pkg/tool/linux_386/5g +%{goroot}/pkg/tool/linux_386/5l +%{goroot}/pkg/tool/linux_386/6a +%{goroot}/pkg/tool/linux_386/6c +%{goroot}/pkg/tool/linux_386/6g +%{goroot}/pkg/tool/linux_386/6l +%{goroot}/pkg/tool/linux_386/8a +%{goroot}/pkg/tool/linux_386/8c +%{goroot}/pkg/tool/linux_386/8g +%{goroot}/pkg/tool/linux_386/8l +%{goroot}/pkg/tool/linux_386/addr2line +%{goroot}/pkg/tool/linux_386/dist +%{goroot}/pkg/tool/linux_386/nm +%{goroot}/pkg/tool/linux_386/objdump +%{goroot}/pkg/tool/linux_386/pack +%{goroot}/pkg/tool/linux_386/pprof + +# arch dependent generated files, used by cgo +%{goroot}/src/pkg/runtime/zasm_linux_386.h +%{goroot}/src/pkg/runtime/zgoarch_386.go +%{goroot}/src/pkg/runtime/zmalloc_linux_386.c +%{goroot}/src/pkg/runtime/zmprof_linux_386.c +%{goroot}/src/pkg/runtime/znetpoll_linux_386.c +%{goroot}/src/pkg/runtime/zruntime1_linux_386.c +%{goroot}/src/pkg/runtime/zruntime_defs_linux_386.go +%{goroot}/src/pkg/runtime/zsema_linux_386.c +%{goroot}/src/pkg/runtime/zsigqueue_linux_386.c +%{goroot}/src/pkg/runtime/zstring_linux_386.c +%{goroot}/src/pkg/runtime/zsys_linux_386.s +%{goroot}/src/pkg/runtime/ztime_linux_386.c +%{goroot}/src/pkg/runtime/zalg_linux_386.c +%{goroot}/src/pkg/runtime/zchan_linux_386.c +%{goroot}/src/pkg/runtime/zcomplex_linux_386.c +%{goroot}/src/pkg/runtime/zcpuprof_linux_386.c +%{goroot}/src/pkg/runtime/zhashmap_linux_386.c +%{goroot}/src/pkg/runtime/ziface_linux_386.c +%{goroot}/src/pkg/runtime/zlfstack_linux_386.c +%{goroot}/src/pkg/runtime/zrdebug_linux_386.c +%{goroot}/src/pkg/runtime/zslice_linux_386.c +%{goroot}/src/pkg/runtime/zsymtab_linux_386.c +%endif + +%ifarch x86_64 +%files pkg-bin-linux-amd64 +%{goroot}/bin/linux_amd64/ +# binary executables +%{_bindir}/go +%{_bindir}/gofmt +%dir %{goroot}/pkg/obj/linux_amd64 +%{goroot}/pkg/obj/linux_amd64/* +%{goroot}/pkg/linux_amd64/runtime/cgo.a +%dir %{goroot}/pkg/tool/linux_amd64 +%{goroot}/pkg/tool/linux_amd64/5a +%{goroot}/pkg/tool/linux_amd64/5c +%{goroot}/pkg/tool/linux_amd64/5g +%{goroot}/pkg/tool/linux_amd64/5l +%{goroot}/pkg/tool/linux_amd64/6a +%{goroot}/pkg/tool/linux_amd64/6c +%{goroot}/pkg/tool/linux_amd64/6g +%{goroot}/pkg/tool/linux_amd64/6l +%{goroot}/pkg/tool/linux_amd64/8a +%{goroot}/pkg/tool/linux_amd64/8c +%{goroot}/pkg/tool/linux_amd64/8g +%{goroot}/pkg/tool/linux_amd64/8l +%{goroot}/pkg/tool/linux_amd64/addr2line +%{goroot}/pkg/tool/linux_amd64/dist +%{goroot}/pkg/tool/linux_amd64/nm +%{goroot}/pkg/tool/linux_amd64/objdump +%{goroot}/pkg/tool/linux_amd64/pack +%{goroot}/pkg/tool/linux_amd64/pprof + +# arch dependent generated files, used by cgo +%{goroot}/src/pkg/runtime/zasm_linux_amd64.h +%{goroot}/src/pkg/runtime/zgoarch_amd64.go +%{goroot}/src/pkg/runtime/zmalloc_linux_amd64.c +%{goroot}/src/pkg/runtime/zmprof_linux_amd64.c +%{goroot}/src/pkg/runtime/znetpoll_linux_amd64.c +%{goroot}/src/pkg/runtime/zruntime1_linux_amd64.c +%{goroot}/src/pkg/runtime/zruntime_defs_linux_amd64.go +%{goroot}/src/pkg/runtime/zsema_linux_amd64.c +%{goroot}/src/pkg/runtime/zsigqueue_linux_amd64.c +%{goroot}/src/pkg/runtime/zstring_linux_amd64.c +%{goroot}/src/pkg/runtime/zsys_linux_amd64.s +%{goroot}/src/pkg/runtime/ztime_linux_amd64.c +%{goroot}/src/pkg/runtime/zalg_linux_amd64.c +%{goroot}/src/pkg/runtime/zchan_linux_amd64.c +%{goroot}/src/pkg/runtime/zcomplex_linux_amd64.c +%{goroot}/src/pkg/runtime/zcpuprof_linux_amd64.c +%{goroot}/src/pkg/runtime/zhashmap_linux_amd64.c +%{goroot}/src/pkg/runtime/ziface_linux_amd64.c +%{goroot}/src/pkg/runtime/zlfstack_linux_amd64.c +%{goroot}/src/pkg/runtime/zrdebug_linux_amd64.c +%{goroot}/src/pkg/runtime/zslice_linux_amd64.c +%{goroot}/src/pkg/runtime/zsymtab_linux_amd64.c +%endif + +%ifarch %{arm} +%files pkg-bin-linux-arm +%{goroot}/bin/linux_arm/ +# binary executables +%{_bindir}/go +%{_bindir}/gofmt +%dir %{goroot}/pkg/obj/linux_arm +%{goroot}/pkg/obj/linux_arm/* +%{goroot}/pkg/linux_arm/runtime/cgo.a +%dir %{goroot}/pkg/tool/linux_arm +%{goroot}/pkg/tool/linux_arm/5a +%{goroot}/pkg/tool/linux_arm/5c +%{goroot}/pkg/tool/linux_arm/5g +%{goroot}/pkg/tool/linux_arm/5l +%{goroot}/pkg/tool/linux_arm/6a +%{goroot}/pkg/tool/linux_arm/6c +%{goroot}/pkg/tool/linux_arm/6g +%{goroot}/pkg/tool/linux_arm/6l +%{goroot}/pkg/tool/linux_arm/8a +%{goroot}/pkg/tool/linux_arm/8c +%{goroot}/pkg/tool/linux_arm/8g +%{goroot}/pkg/tool/linux_arm/8l +%{goroot}/pkg/tool/linux_arm/addr2line +%{goroot}/pkg/tool/linux_arm/dist +%{goroot}/pkg/tool/linux_arm/nm +%{goroot}/pkg/tool/linux_arm/objdump +%{goroot}/pkg/tool/linux_arm/pack +%{goroot}/pkg/tool/linux_arm/pprof + +# arch dependent generated files, used by cgo +%{goroot}/src/pkg/runtime/zasm_linux_arm.h +%{goroot}/src/pkg/runtime/zgoarch_arm.go +%{goroot}/src/pkg/runtime/zmalloc_linux_arm.c +%{goroot}/src/pkg/runtime/zmprof_linux_arm.c +%{goroot}/src/pkg/runtime/znetpoll_linux_arm.c +%{goroot}/src/pkg/runtime/znoasm_arm_linux_arm.c +%{goroot}/src/pkg/runtime/zruntime1_linux_arm.c +%{goroot}/src/pkg/runtime/zruntime_defs_linux_arm.go +%{goroot}/src/pkg/runtime/zsema_linux_arm.c +%{goroot}/src/pkg/runtime/zsigqueue_linux_arm.c +%{goroot}/src/pkg/runtime/zstring_linux_arm.c +%{goroot}/src/pkg/runtime/zsys_linux_arm.s +%{goroot}/src/pkg/runtime/ztime_linux_arm.c +%{goroot}/src/pkg/runtime/zalg_linux_arm.c +%{goroot}/src/pkg/runtime/zchan_linux_arm.c +%{goroot}/src/pkg/runtime/zcomplex_linux_arm.c +%{goroot}/src/pkg/runtime/zcpuprof_linux_arm.c +%{goroot}/src/pkg/runtime/zhashmap_linux_arm.c +%{goroot}/src/pkg/runtime/ziface_linux_arm.c +%{goroot}/src/pkg/runtime/zlfstack_linux_arm.c +%{goroot}/src/pkg/runtime/zrdebug_linux_arm.c +%{goroot}/src/pkg/runtime/zslice_linux_arm.c +%{goroot}/src/pkg/runtime/zsymtab_linux_arm.c +%endif + +%files pkg-linux-386 -f pkg-linux-386.list +%{goroot}/pkg/linux_386/ +%ifarch %{ix86} +%exclude %{goroot}/pkg/linux_386/runtime/cgo.a +%endif +%{goroot}/pkg/tool/linux_386/cgo +%{goroot}/pkg/tool/linux_386/fix +%{goroot}/pkg/tool/linux_386/yacc + +%files pkg-linux-amd64 -f pkg-linux-amd64.list +%{goroot}/pkg/linux_amd64/ +%ifarch x86_64 +%exclude %{goroot}/pkg/linux_amd64/runtime/cgo.a +%endif +%{goroot}/pkg/tool/linux_amd64/cgo +%{goroot}/pkg/tool/linux_amd64/fix +%{goroot}/pkg/tool/linux_amd64/yacc + +%files pkg-linux-arm -f pkg-linux-arm.list +%{goroot}/pkg/linux_arm/ +%ifarch %{arm} +%exclude %{goroot}/pkg/linux_arm/runtime/cgo.a +%endif +%{goroot}/pkg/tool/linux_arm/cgo +%{goroot}/pkg/tool/linux_arm/fix +%{goroot}/pkg/tool/linux_arm/yacc + +%files pkg-darwin-386 -f pkg-darwin-386.list +%{goroot}/pkg/darwin_386/ +%{goroot}/pkg/tool/darwin_386/ + +%files pkg-darwin-amd64 -f pkg-darwin-amd64.list +%{goroot}/pkg/darwin_amd64/ +%{goroot}/pkg/tool/darwin_amd64/ + +%files pkg-windows-386 -f pkg-windows-386.list +%{goroot}/pkg/windows_386/ +%{goroot}/pkg/tool/windows_386/ + +%files pkg-windows-amd64 -f pkg-windows-amd64.list +%{goroot}/pkg/windows_amd64/ +%{goroot}/pkg/tool/windows_amd64/ + +%files pkg-plan9-386 -f pkg-plan9-386.list +%{goroot}/pkg/plan9_386/ +%{goroot}/pkg/tool/plan9_386/ + +%files pkg-plan9-amd64 -f pkg-plan9-amd64.list +%{goroot}/pkg/plan9_amd64/ +%{goroot}/pkg/tool/plan9_amd64/ + +%files pkg-freebsd-386 -f pkg-freebsd-386.list +%{goroot}/pkg/freebsd_386/ +%{goroot}/pkg/tool/freebsd_386/ + +%files pkg-freebsd-amd64 -f pkg-freebsd-amd64.list +%{goroot}/pkg/freebsd_amd64/ +%{goroot}/pkg/tool/freebsd_amd64/ + +%files pkg-freebsd-arm -f pkg-freebsd-arm.list +%{goroot}/pkg/freebsd_arm/ +%{goroot}/pkg/tool/freebsd_arm/ + +%files pkg-netbsd-386 -f pkg-netbsd-386.list +%{goroot}/pkg/netbsd_386/ +%{goroot}/pkg/tool/netbsd_386/ + +%files pkg-netbsd-amd64 -f pkg-netbsd-amd64.list +%{goroot}/pkg/netbsd_amd64/ +%{goroot}/pkg/tool/netbsd_amd64/ + +%files pkg-netbsd-arm -f pkg-netbsd-arm.list +%{goroot}/pkg/netbsd_arm/ +%{goroot}/pkg/tool/netbsd_arm/ + +%files pkg-openbsd-386 -f pkg-openbsd-386.list +%{goroot}/pkg/openbsd_386/ +%{goroot}/pkg/tool/openbsd_386/ + +%files pkg-openbsd-amd64 -f pkg-openbsd-amd64.list +%{goroot}/pkg/openbsd_amd64/ +%{goroot}/pkg/tool/openbsd_amd64/ + +## skipping for now +#%files pkg-openbsd-arm +#%{goroot}/pkg/openbsd_arm/ +#%{goroot}/pkg/tool/openbsd_arm/ + + +%changelog +* Wed Oct 01 2014 Vincent Batts - 1.3.3-1 +- update to go1.3.3 (bz1146882) + +* Mon Sep 29 2014 Vincent Batts - 1.3.2-1 +- update to go1.3.2 (bz1147324) + +* Thu Sep 11 2014 Vincent Batts - 1.3.1-3 +- patching the tzinfo failure + +* Sat Aug 16 2014 Fedora Release Engineering - 1.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Wed Aug 13 2014 Vincent Batts - 1.3.1-1 +- update to go1.3.1 + +* Wed Aug 13 2014 Vincent Batts - 1.3-11 +- merged a line wrong + +* Wed Aug 13 2014 Vincent Batts - 1.3-10 +- more work to get cgo.a timestamps to line up, due to build-env +- explicitly list all the files and directories for the source and packages trees +- touch all the built archives to be the same + +* Mon Aug 11 2014 Vincent Batts - 1.3-9 +- make golang-src 'noarch' again, since that was not a fix, and takes up more space + +* Mon Aug 11 2014 Vincent Batts - 1.3-8 +- update timestamps of source files during %%install bz1099206 + +* Fri Aug 08 2014 Vincent Batts - 1.3-7 +- update timestamps of source during %%install bz1099206 + +* Wed Aug 06 2014 Vincent Batts - 1.3-6 +- make the source subpackage arch'ed, instead of noarch + +* Mon Jul 21 2014 Vincent Batts - 1.3-5 +- fix the writing of pax headers + +* Tue Jul 15 2014 Vincent Batts - 1.3-4 +- fix the loading of gdb safe-path. bz981356 + +* Tue Jul 08 2014 Vincent Batts - 1.3-3 +- `go install std` requires gcc, to build cgo. bz1105901, bz1101508 + +* Mon Jul 07 2014 Vincent Batts - 1.3-2 +- archive/tar memory allocation improvements + +* Thu Jun 19 2014 Vincent Batts - 1.3-1 +- update to go1.3 + +* Fri Jun 13 2014 Vincent Batts - 1.3rc2-1 +- update to go1.3rc2 + +* Sat Jun 07 2014 Fedora Release Engineering - 1.3rc1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Jun 03 2014 Vincent Batts 1.3rc1-1 +- update to go1.3rc1 +- new arch file shuffling + +* Wed May 21 2014 Vincent Batts 1.3beta2-1 +- update to go1.3beta2 +- no longer provides go-mode for xemacs (emacs only) + +* Wed May 21 2014 Vincent Batts 1.2.2-7 +- bz1099206 ghost files are not what is needed + +* Tue May 20 2014 Vincent Batts 1.2.2-6 +- bz1099206 more fixing. The packages %%post need golang-bin present first + +* Tue May 20 2014 Vincent Batts 1.2.2-5 +- bz1099206 more fixing. Let go fix its own timestamps and freshness + +* Tue May 20 2014 Vincent Batts 1.2.2-4 +- fix the existence and alternatives of `go` and `gofmt` + +* Mon May 19 2014 Vincent Batts 1.2.2-3 +- bz1099206 fix timestamp issue caused by koji builders + +* Fri May 09 2014 Vincent Batts 1.2.2-2 +- more arch file shuffling + +* Fri May 09 2014 Vincent Batts 1.2.2-1 +- update to go1.2.2 + +* Thu May 08 2014 Vincent Batts 1.2.1-8 +- RHEL6 rpm macros can't %%exlude missing files + +* Wed May 07 2014 Vincent Batts 1.2.1-7 +- missed two arch-dependent src files + +* Wed May 07 2014 Vincent Batts 1.2.1-6 +- put generated arch-dependent src in their respective RPMs + +* Fri Apr 11 2014 Vincent Batts 1.2.1-5 +- skip test that is causing a SIGABRT on fc21 bz1086900 + +* Thu Apr 10 2014 Vincent Batts 1.2.1-4 +- fixing file and directory ownership bz1010713 + +* Wed Apr 09 2014 Vincent Batts 1.2.1-3 +- including more to macros (%%go_arches) +- set a standard goroot as /usr/lib/golang, regardless of arch +- include sub-packages for compiler toolchains, for all golang supported architectures + +* Wed Mar 26 2014 Vincent Batts 1.2.1-2 +- provide a system rpm macros. Starting with %gopath + +* Tue Mar 04 2014 Adam Miller 1.2.1-1 +- Update to latest upstream + +* Thu Feb 20 2014 Adam Miller 1.2-7 +- Remove _BSD_SOURCE and _SVID_SOURCE, they are deprecated in recent + versions of glibc and aren't needed + +* Wed Feb 19 2014 Adam Miller 1.2-6 +- pull in upstream archive/tar implementation that supports xattr for + docker 0.8.1 + +* Tue Feb 18 2014 Vincent Batts 1.2-5 +- provide 'go', so users can yum install 'go' + +* Fri Jan 24 2014 Vincent Batts 1.2-4 +- skip a flaky test that is sporadically failing on the build server + +* Thu Jan 16 2014 Vincent Batts 1.2-3 +- remove golang-godoc dependency. cyclic dependency on compiling godoc + +* Wed Dec 18 2013 Vincent Batts - 1.2-2 +- removing P224 ECC curve + +* Mon Dec 2 2013 Vincent Batts - 1.2-1 +- Update to upstream 1.2 release +- remove the pax tar patches + +* Tue Nov 26 2013 Vincent Batts - 1.1.2-8 +- fix the rpmspec conditional for rhel and fedora + +* Thu Nov 21 2013 Vincent Batts - 1.1.2-7 +- patch tests for testing on rawhide +- let the same spec work for rhel and fedora + +* Wed Nov 20 2013 Vincent Batts - 1.1.2-6 +- don't symlink /usr/bin out to ../lib..., move the file +- seperate out godoc, to accomodate the go.tools godoc + +* Fri Sep 20 2013 Adam Miller - 1.1.2-5 +- Pull upstream patches for BZ#1010271 +- Add glibc requirement that got dropped because of meta dep fix + +* Fri Aug 30 2013 Adam Miller - 1.1.2-4 +- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix) + +* Tue Aug 27 2013 Adam Miller - 1.1.2-3 +- Revert incorrect merged changelog + +* Tue Aug 27 2013 Adam Miller - 1.1.2-2 +- Update spec to fix changelog entries from bad merge + +* Tue Aug 20 2013 Adam Miller - 1.1.2-1 +- Update to latest upstream + +* Wed Jul 10 2013 Adam Goode - 1.1.1-5 +- Blacklist testdata files from prelink +- Again try to fix #973842 + +* Fri Jul 5 2013 Adam Goode - 1.1.1-4 +- Move src to libdir for now (#973842) (upstream issue https://code.google.com/p/go/issues/detail?id=5830) +- Eliminate noarch data package to work around RPM bug (#975909) +- Try to add runtime-gdb.py to the gdb safe-path (#981356) + +* Wed Jun 19 2013 Adam Goode - 1.1.1-3 +- Use lua for pretrans (http://fedoraproject.org/wiki/Packaging:Guidelines#The_.25pretrans_scriptlet) + +* Mon Jun 17 2013 Adam Goode - 1.1.1-2 +- Hopefully really fix #973842 +- Fix update from pre-1.1.1 (#974840) + +* Thu Jun 13 2013 Adam Goode - 1.1.1-1 +- Update to 1.1.1 +- Fix basically useless package (#973842) + +* Sat May 25 2013 Dan Horák - 1.1-3 +- set ExclusiveArch + +* Fri May 24 2013 Adam Goode - 1.1-2 +- Fix noarch package discrepancies + +* Fri May 24 2013 Adam Goode - 1.1-1 +- Initial Fedora release. +- Update to 1.1 + +* Thu May 9 2013 Adam Goode - 1.1-0.3.rc3 +- Update to rc3 + +* Thu Apr 11 2013 Adam Goode - 1.1-0.2.beta2 +- Update to beta2 + +* Tue Apr 9 2013 Adam Goode - 1.1-0.1.beta1 +- Initial packaging. diff --git a/macros.golang b/macros.golang new file mode 100644 index 0000000..bc6b803 --- /dev/null +++ b/macros.golang @@ -0,0 +1,8 @@ +# Where to set GOPATH for builds. Like: +# export GOPATH=$(pwd)/_build:%{gopath} +%gopath %{_datadir}/gocode + +# for use like: +# ExclusiveArch: %{go_arches} +%go_arches %{ix86} x86_64 %{arm} + diff --git a/sources b/sources new file mode 100644 index 0000000..66155c8 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +d76dc07e475b2905b5fec1cf319b6356 golang-19087:a15f344a9efa-xattrs.tar +2cdbad6baefcf1007f3cf54a5bc878b7 go1.3.3.src.tar.gz From 46137b6f4c99f705b18597c83163f0ebd7e2b43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 26 Nov 2018 10:32:52 +0100 Subject: [PATCH 51/67] Add aarch64 and ppc64le in to the macros file --- golang.spec | 5 ++++- macros.golang | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/golang.spec b/golang.spec index afaf3bc..4d9dfa0 100644 --- a/golang.spec +++ b/golang.spec @@ -103,7 +103,7 @@ Name: golang Version: 1.11.2 -Release: 1%{?dist} +Release: 2%{?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 @@ -571,6 +571,9 @@ fi %endif %changelog +* Mon Nov 26 2018 Jakub Čajka - 1.11.2-2 +- fix up macros file for aarch64 + * Fri Nov 23 2018 Jakub Čajka - 1.11.2-1 - Rebase to go1.11.2 diff --git a/macros.golang b/macros.golang index bc6b803..de6c610 100644 --- a/macros.golang +++ b/macros.golang @@ -4,5 +4,5 @@ # for use like: # ExclusiveArch: %{go_arches} -%go_arches %{ix86} x86_64 %{arm} +%go_arches %{ix86} x86_64 %{arm} aarch64 ppc64le From fc3cecf952d7a947a4cc53cd02fdcf3372bd0df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Fri, 30 Nov 2018 14:04:07 +0100 Subject: [PATCH 52/67] Add ppc64le proper --- golang.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/golang.spec b/golang.spec index 4d9dfa0..2b0bec5 100644 --- a/golang.spec +++ b/golang.spec @@ -73,7 +73,7 @@ # Fedora GOROOT %global goroot /usr/lib/%{name} %global gopath %{_datadir}/gocode -%global go_arches %{ix86} x86_64 %{arm} aarch64 +%global go_arches %{ix86} x86_64 %{arm} aarch64 ppc64le %global golibdir %{_libdir}/golang %ifarch x86_64 @@ -103,7 +103,7 @@ Name: golang Version: 1.11.2 -Release: 2%{?dist} +Release: 3%{?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 @@ -571,6 +571,9 @@ fi %endif %changelog +* Fri Nov 30 2018 Jakub Čajka - 1.11.2-3 +- add ppc64le proper + * Mon Nov 26 2018 Jakub Čajka - 1.11.2-2 - fix up macros file for aarch64 From d0a2453060fd61f77b742d45cf1dfbed4711d9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Sun, 27 Jan 2019 12:54:28 +0100 Subject: [PATCH 53/67] Rebase to go1.11.5 Fix for CVE-2019-6486 --- .gitignore | 1 + golang.spec | 9 +++++++-- sources | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d200ff1..5e10e22 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ /go1.11.1.src.tar.gz /go1.11.2.src.tar.gz /go1.11.4.src.tar.gz +/go1.11.5.src.tar.gz diff --git a/golang.spec b/golang.spec index 53b0e49..0485432 100644 --- a/golang.spec +++ b/golang.spec @@ -102,10 +102,10 @@ %endif %global go_api 1.11 -%global go_version 1.11.4 +%global go_version 1.11.5 Name: golang -Version: 1.11.4 +Version: 1.11.5 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -546,6 +546,11 @@ fi %endif %changelog +* Sun Jan 27 2019 Jakub Čajka - 1.11.5-1 +- Rebase to go1.11.5 +- Fix for CVE-2019-6486 +- Resolves: BZ#1668973 + * Wed Jan 02 2019 Jakub Čajka - 1.11.4-1 - Rebase to go1.11.4 - Fix for CVE-2018-16875, CVE-2018-16874 and CVE-2018-16873 diff --git a/sources b/sources index fd855af..06d5eb7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.11.4.src.tar.gz) = 9aa2e1800807841ec0432289b672c1607bdcb295f29c02d38adfaf1e3bf043040c9f916e4cb170875d92fe168c5ba6baef2b3d1f824a56ff9138ca2cdcc646e0 +SHA512 (go1.11.5.src.tar.gz) = 63500238e8d73e4b29279ee3eb9242960de93ccd3b52bacc4009f45cf123cb8edfe5f519d38c5b07bdf2a810925758511ff3255310a056113d0169f78be1d2f6 From 7d97257830588e67b2e586451d9bbf1a6679b39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 1 Apr 2019 13:41:56 +0200 Subject: [PATCH 54/67] Rebase to 1.11.6 Fix CVE-2019-9741 Fix requirement for %preun (instead of %postun) scriptlet thanks to Tim Landscheidt Use weak deps for SCM deps Resolves: BZ#1688233 --- .gitignore | 1 + golang.spec | 15 +++++++++++---- sources | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5e10e22..a55c8ab 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ /go1.11.2.src.tar.gz /go1.11.4.src.tar.gz /go1.11.5.src.tar.gz +/go1.11.6.src.tar.gz diff --git a/golang.spec b/golang.spec index 0485432..d435867 100644 --- a/golang.spec +++ b/golang.spec @@ -102,10 +102,10 @@ %endif %global go_api 1.11 -%global go_version 1.11.5 +%global go_version 1.11.6 Name: golang -Version: 1.11.5 +Version: 1.11.6 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -265,13 +265,13 @@ Obsoletes: golang-vet < 0-12.1 Obsoletes: golang-cover < 0-12.1 Requires(post): %{_sbindir}/update-alternatives -Requires(postun): %{_sbindir}/update-alternatives +Requires(preun): %{_sbindir}/update-alternatives # We strip the meta dependency, but go does require glibc. # This is an odd issue, still looking for a better fix. Requires: glibc Requires: gcc -Requires: git, subversion, mercurial +Recommends: git, subversion, mercurial %description bin %{summary} @@ -546,6 +546,13 @@ fi %endif %changelog +* Fri Mar 15 2019 Jakub Čajka - 1.11.6-1 +- Rebase to 1.11.6 +- Fix CVE-2019-9741 +- Fix requirement for %preun (instead of %postun) scriptlet thanks to Tim Landscheidt +- Use weak deps for SCM deps +- Resolves: BZ#1688233 + * Sun Jan 27 2019 Jakub Čajka - 1.11.5-1 - Rebase to go1.11.5 - Fix for CVE-2019-6486 diff --git a/sources b/sources index 06d5eb7..e4381cf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.11.5.src.tar.gz) = 63500238e8d73e4b29279ee3eb9242960de93ccd3b52bacc4009f45cf123cb8edfe5f519d38c5b07bdf2a810925758511ff3255310a056113d0169f78be1d2f6 +SHA512 (go1.11.6.src.tar.gz) = bc29df69a08a4e9e703de72b5eda5f2d63b78f18f3e7a1173eae5c6dd767f29f1b865a2fc3f692e15277df2d45e74ee17875b275eb3fc50aac2b88082e618bf5 From 0301e6483af13cbcb7a82fd800580ead15db097c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 8 Apr 2019 13:30:59 +0200 Subject: [PATCH 55/67] Rebase to 1.11.7 --- .gitignore | 1 + golang.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a55c8ab..601c71a 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ /go1.11.4.src.tar.gz /go1.11.5.src.tar.gz /go1.11.6.src.tar.gz +/go1.11.7.src.tar.gz diff --git a/golang.spec b/golang.spec index d435867..8e5cd0f 100644 --- a/golang.spec +++ b/golang.spec @@ -102,10 +102,10 @@ %endif %global go_api 1.11 -%global go_version 1.11.6 +%global go_version 1.11.7 Name: golang -Version: 1.11.6 +Version: 1.11.7 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -546,6 +546,9 @@ fi %endif %changelog +* Mon Apr 8 2019 Jakub Čajka - 1.11.7-1 +- Rebase to 1.11.7 + * Fri Mar 15 2019 Jakub Čajka - 1.11.6-1 - Rebase to 1.11.6 - Fix CVE-2019-9741 diff --git a/sources b/sources index e4381cf..cca6ed6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.11.6.src.tar.gz) = bc29df69a08a4e9e703de72b5eda5f2d63b78f18f3e7a1173eae5c6dd767f29f1b865a2fc3f692e15277df2d45e74ee17875b275eb3fc50aac2b88082e618bf5 +SHA512 (go1.11.7.src.tar.gz) = 26bc2a3ab51ebe1179cd83897dae6ca17f30126189bf2c0b60060a25f3f22e72bcda383055825a9151948f074a103a177ab5550f5c2d088448bdf5455448061e From 9ad1b634eab1a76cbd089ffbeff7abacb57ef0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Thu, 16 May 2019 13:41:31 +0200 Subject: [PATCH 56/67] Rebase to go1.11.10 --- .gitignore | 1 + golang.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 601c71a..875065d 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,4 @@ /go1.11.5.src.tar.gz /go1.11.6.src.tar.gz /go1.11.7.src.tar.gz +/go1.11.10.src.tar.gz diff --git a/golang.spec b/golang.spec index 8e5cd0f..bf26666 100644 --- a/golang.spec +++ b/golang.spec @@ -102,10 +102,10 @@ %endif %global go_api 1.11 -%global go_version 1.11.7 +%global go_version 1.11.10 Name: golang -Version: 1.11.7 +Version: 1.11.10 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -546,6 +546,9 @@ fi %endif %changelog +* Thu May 16 2019 Jakub Čajka - 1.11.10-1 +- Rebase to 1.11.10 + * Mon Apr 8 2019 Jakub Čajka - 1.11.7-1 - Rebase to 1.11.7 diff --git a/sources b/sources index cca6ed6..aa17f31 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.11.7.src.tar.gz) = 26bc2a3ab51ebe1179cd83897dae6ca17f30126189bf2c0b60060a25f3f22e72bcda383055825a9151948f074a103a177ab5550f5c2d088448bdf5455448061e +SHA512 (go1.11.10.src.tar.gz) = 8fab3b96d1c47b8f75b135da9d1a104c485098f6f42041b69336216a57cfd49c0785c8cfa7b016020ded5f0aadd279d7a76feeca33038321a4930139aee28cc8 From 3b89fed2fe44e8b5529f911517d21b20e5ef9e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Thu, 13 Jun 2019 10:37:15 +0200 Subject: [PATCH 57/67] Rebase to 1.11.11 --- .gitignore | 1 + golang.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 875065d..70f1512 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ /go1.11.6.src.tar.gz /go1.11.7.src.tar.gz /go1.11.10.src.tar.gz +/go1.11.11.src.tar.gz diff --git a/golang.spec b/golang.spec index bf26666..61ad5c4 100644 --- a/golang.spec +++ b/golang.spec @@ -102,10 +102,10 @@ %endif %global go_api 1.11 -%global go_version 1.11.10 +%global go_version 1.11.11 Name: golang -Version: 1.11.10 +Version: 1.11.11 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -546,6 +546,9 @@ fi %endif %changelog +* Thu Jun 13 2019 Jakub Čajka - 1.11.11-1 +- Rebase to 1.11.11 + * Thu May 16 2019 Jakub Čajka - 1.11.10-1 - Rebase to 1.11.10 diff --git a/sources b/sources index aa17f31..aab6223 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.11.10.src.tar.gz) = 8fab3b96d1c47b8f75b135da9d1a104c485098f6f42041b69336216a57cfd49c0785c8cfa7b016020ded5f0aadd279d7a76feeca33038321a4930139aee28cc8 +SHA512 (go1.11.11.src.tar.gz) = ee5e5dfdca1bade6d8b5957a21d89d553089152fe35e070c0c1c4849dbb3370e2591208569ec131187a7e8ae9ab775ad302225f7c19ddabee8fd3d6dfb9763e6 From c3b72c1a47212d528cf9bea637e3efd2a8fabb0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Wed, 10 Jul 2019 13:10:29 +0200 Subject: [PATCH 58/67] Rebase to 1.11.12 --- .gitignore | 1 + golang.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 70f1512..102d118 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ /go1.11.7.src.tar.gz /go1.11.10.src.tar.gz /go1.11.11.src.tar.gz +/go1.11.12.src.tar.gz diff --git a/golang.spec b/golang.spec index 61ad5c4..6525ba6 100644 --- a/golang.spec +++ b/golang.spec @@ -102,10 +102,10 @@ %endif %global go_api 1.11 -%global go_version 1.11.11 +%global go_version 1.11.12 Name: golang -Version: 1.11.11 +Version: 1.11.12 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -546,6 +546,9 @@ fi %endif %changelog +* Wed Jul 10 2019 Jakub Čajka - 1.11.12-1 +- Rebase to 1.11.12 + * Thu Jun 13 2019 Jakub Čajka - 1.11.11-1 - Rebase to 1.11.11 diff --git a/sources b/sources index aab6223..3ab14b1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.11.11.src.tar.gz) = ee5e5dfdca1bade6d8b5957a21d89d553089152fe35e070c0c1c4849dbb3370e2591208569ec131187a7e8ae9ab775ad302225f7c19ddabee8fd3d6dfb9763e6 +SHA512 (go1.11.12.src.tar.gz) = ff74678d7002be20c994702cc778d2447bbe4aad2ecf906e4cde9cf00c0c226c2f0def25146acd24f86fddf397b47602c1e5509c21b0d7b856cf933a05e19a6d From b688c00ba080a2d3772a78693a8dd53eebd09c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Sat, 2 Nov 2019 20:07:10 +0100 Subject: [PATCH 59/67] Fix missing macros... --- golang.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/golang.spec b/golang.spec index bdba872..49459f1 100644 --- a/golang.spec +++ b/golang.spec @@ -72,6 +72,9 @@ # Fedora GOROOT %global goroot /usr/lib/%{name} +%global gopath %{_datadir}/gocode +%global go_arches %{ix86} x86_64 %{arm} aarch64 ppc64le +%global golibdir %{_libdir}/golang %ifarch x86_64 %global gohostarch amd64 From 85c5fb262c1e8f09aa7751a18152b737631a585e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Thu, 30 Jan 2020 14:21:27 +0100 Subject: [PATCH 60/67] Rebase to go1.13.9 Fix for CVE-2020-7919 Resolves: BZ#1808044 --- .gitignore | 2 ++ golang.spec | 11 ++++++++--- sources | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2f45c1b..6b2f0e7 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,5 @@ /go1.13.4.src.tar.gz /go1.13.5.src.tar.gz /go1.13.6.src.tar.gz +/go1.13.7.src.tar.gz +/go1.13.9.src.tar.gz diff --git a/golang.spec b/golang.spec index 976b80b..a5fd941 100644 --- a/golang.spec +++ b/golang.spec @@ -105,10 +105,10 @@ %endif %global go_api 1.13 -%global go_version 1.13.6 +%global go_version 1.13.9 Name: golang -Version: 1.13.6 +Version: 1.13.9 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -581,7 +581,12 @@ fi %endif %changelog -* Mon Jan 13 2020 Jakub Čajka - 1.13.6-1 +* Mon Mar 30 2020 Jakub Čajka - 1.13.9-1 +- Rebase to go1.13.9 +- Fix for CVE-2020-0601 and CVE-2020-7919 +- Resolves: + +* Mon Jan 13 2020 Jakub Čajka - 1.13.6-1 - Rebase to go1.13.6 * Thu Dec 05 2019 Jakub Čajka - 1.13.5-1 diff --git a/sources b/sources index e30151f..d20c902 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.13.6.src.tar.gz) = dffb6e06eea0b1541901dfbed8d28e8cc1eac3184dc40a19ed3637737df796a67a2e7170b228e1003d36b14e6f0f13bb8be9d2a702834a9c06228d1821659528 +SHA512 (go1.13.9.src.tar.gz) = 0034ec394141e2c19941bf839cad93992c175476e3f3fa7b483c919aeea01fa4e0136eb8dd87a3158b911c04ded98a3c4960975a13280f1be076eb8f51464a98 From 8f8a5ff9576065657a8fdef6e46e7c85060dbe78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Tue, 31 Mar 2020 12:59:40 +0200 Subject: [PATCH 61/67] Fix change log --- golang.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/golang.spec b/golang.spec index a5fd941..b908269 100644 --- a/golang.spec +++ b/golang.spec @@ -583,8 +583,8 @@ fi %changelog * Mon Mar 30 2020 Jakub Čajka - 1.13.9-1 - Rebase to go1.13.9 -- Fix for CVE-2020-0601 and CVE-2020-7919 -- Resolves: +- Fix for CVE-2020-7919 +- Resolves: BZ#1808044 * Mon Jan 13 2020 Jakub Čajka - 1.13.6-1 - Rebase to go1.13.6 From fda316437979cddacb3de8bd6f8e7963b7079d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 20 Apr 2020 20:05:49 +0200 Subject: [PATCH 62/67] Rebase to go1.13.10 --- .gitignore | 1 + golang.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6b2f0e7..f06e411 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ /go1.13.6.src.tar.gz /go1.13.7.src.tar.gz /go1.13.9.src.tar.gz +/go1.13.10.src.tar.gz diff --git a/golang.spec b/golang.spec index b908269..4e39acc 100644 --- a/golang.spec +++ b/golang.spec @@ -105,10 +105,10 @@ %endif %global go_api 1.13 -%global go_version 1.13.9 +%global go_version 1.13.10 Name: golang -Version: 1.13.9 +Version: 1.13.10 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -581,6 +581,9 @@ fi %endif %changelog +* Mon Apr 20 2020 Jakub Čajka - 1.13.10-1 +- Rebase to go1.13.10 + * Mon Mar 30 2020 Jakub Čajka - 1.13.9-1 - Rebase to go1.13.9 - Fix for CVE-2020-7919 diff --git a/sources b/sources index d20c902..e0e14b8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.13.9.src.tar.gz) = 0034ec394141e2c19941bf839cad93992c175476e3f3fa7b483c919aeea01fa4e0136eb8dd87a3158b911c04ded98a3c4960975a13280f1be076eb8f51464a98 +SHA512 (go1.13.10.src.tar.gz) = 9e020dd89ab6201c4cbb893caecc0b077d5fbb2e10381e1b76a29ddc18c141d8db67a1b0f607ed915b0e9c40c4fb2c65b0319472535892534a31ad962e72fe05 From 62b1543a88f5f96e336f286d73389ebb48c910b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20S=C3=A1ez?= Date: Mon, 18 May 2020 20:03:09 +0200 Subject: [PATCH 63/67] Rebase to go1.13.11 --- golang.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/golang.spec b/golang.spec index 4e39acc..2c2cbdc 100644 --- a/golang.spec +++ b/golang.spec @@ -105,10 +105,10 @@ %endif %global go_api 1.13 -%global go_version 1.13.10 +%global go_version 1.13.11 Name: golang -Version: 1.13.10 +Version: 1.13.11 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -581,6 +581,9 @@ fi %endif %changelog +* Mon May 18 2020 Álex Sáez - 1.13.11-1 +- Rebase to go1.13.11 + * Mon Apr 20 2020 Jakub Čajka - 1.13.10-1 - Rebase to go1.13.10 From 3f1710e2ebaee5c110e4d3ad5635359010f9d6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Wed, 20 May 2020 19:04:42 +0200 Subject: [PATCH 64/67] New sources --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f06e411..958123e 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,4 @@ /go1.13.7.src.tar.gz /go1.13.9.src.tar.gz /go1.13.10.src.tar.gz +/go1.13.11.src.tar.gz diff --git a/sources b/sources index e0e14b8..a73e449 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.13.10.src.tar.gz) = 9e020dd89ab6201c4cbb893caecc0b077d5fbb2e10381e1b76a29ddc18c141d8db67a1b0f607ed915b0e9c40c4fb2c65b0319472535892534a31ad962e72fe05 +SHA512 (go1.13.11.src.tar.gz) = 2342e70779d2d5a77da00815078e8ed4f00ed5cc0509e332e4d46eb441f0a50e7697b7afe3ba0b12c3be697b9beb6650c196f0e603d602d255e4415a703ed7df From 69ff2bc2116ef3937f34e337d4909e37614188c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 20 Jul 2020 14:42:35 +0200 Subject: [PATCH 65/67] Rebase to go1.13.14 Fix for CVE-2020-14040 and CVE-2020-15586 Resolves: BZ#1853653, BZ#1856957 --- .gitignore | 1 + golang.spec | 9 +++++++-- sources | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 958123e..e3988d3 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,4 @@ /go1.13.9.src.tar.gz /go1.13.10.src.tar.gz /go1.13.11.src.tar.gz +/go1.13.14.src.tar.gz diff --git a/golang.spec b/golang.spec index 2c2cbdc..808ecbb 100644 --- a/golang.spec +++ b/golang.spec @@ -105,10 +105,10 @@ %endif %global go_api 1.13 -%global go_version 1.13.11 +%global go_version 1.13.14 Name: golang -Version: 1.13.11 +Version: 1.13.14 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -581,6 +581,11 @@ fi %endif %changelog +* Mon Jul 20 2020 Jakub Čajka - 1.13.14-1 +- Rebase to go1.13.14 +- Fix for CVE-2020-14040 and CVE-2020-15586 +- Resolves: BZ#1853653, BZ#1856957 + * Mon May 18 2020 Álex Sáez - 1.13.11-1 - Rebase to go1.13.11 diff --git a/sources b/sources index a73e449..1c4e814 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.13.11.src.tar.gz) = 2342e70779d2d5a77da00815078e8ed4f00ed5cc0509e332e4d46eb441f0a50e7697b7afe3ba0b12c3be697b9beb6650c196f0e603d602d255e4415a703ed7df +SHA512 (go1.13.14.src.tar.gz) = 49dd28394333eaa7676fdf530d2fc18a645546c814fbe9247c9613e36529eb23634816b5c84574fea1cd9191fa86e684130e75dc70545344851c6b47c846558d From b7775309153e816f06978a6b826b6c4f5c1d8391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Wed, 26 Aug 2020 20:09:33 +0200 Subject: [PATCH 66/67] Revert to older atomics as RHEL 6 uses gcc4.4 --- el6-atomics.patch | 52 +++++++++++++++++++++++++++++++++++++++++++++++ golang.spec | 3 +++ 2 files changed, 55 insertions(+) create mode 100644 el6-atomics.patch diff --git a/el6-atomics.patch b/el6-atomics.patch new file mode 100644 index 0000000..cc3895d --- /dev/null +++ b/el6-atomics.patch @@ -0,0 +1,52 @@ +diff -up go/misc/cgo/test/testx.go.rev ./go/misc/cgo/test/testx.go +--- go/misc/cgo/test/testx.go.rev 2020-08-26 19:36:41.493810467 +0200 ++++ go/misc/cgo/test/testx.go 2020-08-26 19:36:48.498808001 +0200 +@@ -83,18 +83,33 @@ extern void f7665(void); + + void issue7978cb(void); + ++#if defined(__APPLE__) && defined(__arm__) ++// on Darwin/ARM, libSystem doesn't provide implementation of the __sync_fetch_and_add ++// primitive, and although gcc supports it, it doesn't inline its definition. ++// Clang could inline its definition, so we require clang on Darwin/ARM. ++#if defined(__clang__) ++#define HAS_SYNC_FETCH_AND_ADD 1 ++#else ++#define HAS_SYNC_FETCH_AND_ADD 0 ++#endif ++#else ++#define HAS_SYNC_FETCH_AND_ADD 1 ++#endif ++ + // use ugly atomic variable sync since that doesn't require calling back into + // Go code or OS dependencies + static void issue7978c(uint32_t *sync) { +- while(__atomic_load_n(sync, __ATOMIC_SEQ_CST) != 0) ++#if HAS_SYNC_FETCH_AND_ADD ++ while(__sync_fetch_and_add(sync, 0) != 0) + ; +- __atomic_add_fetch(sync, 1, __ATOMIC_SEQ_CST); +- while(__atomic_load_n(sync, __ATOMIC_SEQ_CST) != 2) ++ __sync_fetch_and_add(sync, 1); ++ while(__sync_fetch_and_add(sync, 0) != 2) + ; + issue7978cb(); +- __atomic_add_fetch(sync, 1, __ATOMIC_SEQ_CST); +- while(__atomic_load_n(sync, __ATOMIC_SEQ_CST) != 6) ++ __sync_fetch_and_add(sync, 1); ++ while(__sync_fetch_and_add(sync, 0) != 6) + ; ++#endif + } + + // issue 8331 part 2 - part 1 in test.go +@@ -502,6 +517,9 @@ func test7978(t *testing.T) { + if runtime.Compiler == "gccgo" { + t.Skip("gccgo can not do stack traces of C code") + } ++ if C.HAS_SYNC_FETCH_AND_ADD == 0 { ++ t.Skip("clang required for __sync_fetch_and_add support on darwin/arm") ++ } + debug.SetTraceback("2") + issue7978sync = 0 + go issue7978go() diff --git a/golang.spec b/golang.spec index 39a968b..7410734 100644 --- a/golang.spec +++ b/golang.spec @@ -226,6 +226,9 @@ Requires: go-srpm-macros 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-disable-Google-s-proxy-and-sumdb.patch +# Revert https://github.com/golang/go/commit/b4924870f4b8302aba051a506bb499fad99b464e +# as RHEL 6 is using gcc 4.4 +Patch4: el6-atomics.patch # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 From efeddef8de80a06e43aac1c13eadb3b1f5fc2e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Tue, 15 Sep 2020 09:33:03 +0200 Subject: [PATCH 67/67] Rebase to go1.15.2 Security fix for CVE-2020-24553 Resolves: BZ#1874859 --- .gitignore | 2 ++ golang.spec | 9 +++++++-- sources | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index da5148e..b91a66c 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,5 @@ /go1.15rc1.src.tar.gz /go1.15rc2.src.tar.gz /go1.15.src.tar.gz +/go1.15.1.src.tar.gz +/go1.15.2.src.tar.gz diff --git a/golang.spec b/golang.spec index 39a968b..fac405c 100644 --- a/golang.spec +++ b/golang.spec @@ -94,10 +94,10 @@ %endif %global go_api 1.15 -%global go_version 1.15 +%global go_version 1.15.2 Name: golang -Version: 1.15 +Version: 1.15.2 Release: 1%{?dist} Summary: The Go Programming Language # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain @@ -615,6 +615,11 @@ fi %endif %changelog +* Thu Sep 10 2020 Jakub Čajka - 1.15.2-1 +- Rebase to go1.15.2 +- Security fix for CVE-2020-24553 +- Resolves: BZ#1874859 + * Tue Aug 25 2020 Jakub Čajka - 1.15-1 - Rebase to go1.15 - Security fix for CVE-2020-16845 and CVE-2020-14040 diff --git a/sources b/sources index 6556b35..53c462f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.15.src.tar.gz) = 7d85382bcc6a0625dfa3d07196ab364860846367ed67697a7b1516b0af551a72bc4873882141fc3c7a60d39f2e27b33f6693e8b18b608de76fc9a55b5eac55ea +SHA512 (go1.15.2.src.tar.gz) = c8b69556ddbbae4790c923547d90259c2208490ed26e75b6318dcc19893f50788e17207140deed1fe9d1e214b9a8f3769242fb7dfd06ebac37ba2c67f0281a73