Compare commits

..

123 Commits

Author SHA1 Message Date
Jakub Čajka 27a8ad3859
Rebase to go1.15.5
Security fix for CVE-2020-28362, CVE-2020-28367 and CVE-2020-28366
Resolves: BZ#1897342, BZ#1897636, BZ#1897644, BZ#1897647
2020-11-14 08:55:50 +01:00
Jakub Čajka c88a8dfff5
Rebase to go1.15.4
Resolves BZ#1895189
2020-11-06 16:34:38 +01:00
Jakub Čajka 61730a32f4
Rebase to go1.15.3
Resolves: BZ#1888443
2020-10-15 13:41:00 +02:00
Jakub Čajka d7ab797463
Rebase to go1.15.2
Resolves: BZ#1877565
2020-09-10 12:57:26 +02:00
Jakub Čajka fb39d90765
Rebase to go1.15.1
Security fix for CVE-2020-24553
Resolves: BZ#1874858, BZ#1866892
2020-09-04 15:43:41 +02:00
Jakub Čajka d3aa981e83
Rebase to go1.15 proper
Resolves: BZ#1859241, BZ#1866892
2020-08-12 10:33:11 +02:00
Jakub Čajka dac586c9c7
Rebase to go1.15rc1
Security fix for CVE-2020-16845
Resolves: BZ#1867101
Related: BZ#1859241
2020-08-10 12:04:23 +02:00
Fedora Release Engineering e8c1f5c4a2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 20:57:54 +00:00
Jakub Čajka 132cf34fe6
Rebase to go1.15rc1
Related: BZ#1859241
2020-07-27 10:26:48 +02:00
Jakub Čajka a3e201c572
Rebase to go1.15beta1 2020-07-20 18:36:44 +02:00
Jakub Čajka 6db1c7a908
Rebase to go1.14.6
Security fix for CVE-2020-14040 and CVE-2020-15586
Resolves: BZ#1842708, BZ#1856957, BZ#1853653
2020-07-20 10:27:10 +02:00
Alejandro Sáez 0cb15e561e Add patch that fixes issue in ppc64le
Fix: https://golang.org/issue/39991
Add sources
2020-07-14 14:48:03 +02:00
Jakub Čajka 91d21a3bde
It is FALGS 2020-07-03 08:31:27 +02:00
Jakub Čajka ea99ebaff6
Workaround tests failures on aarch64 2020-07-02 21:35:44 +02:00
Alejandro Sáez ecf8f72447 Rebase to go1.14.4
Related: BZ#1842708
2020-07-02 18:30:16 +00:00
Jakub Čajka fde02715d5
Add new sources and BZ 2020-05-21 08:37:26 +02:00
Álex Sáez 8716ef4de3 Rebase to go1.14.3 2020-05-18 19:59:24 +02:00
Jakub Čajka aa89c2b0f2
Rebase to go1.14.2
Resolves: BZ#1815282
2020-04-20 13:34:36 +02:00
Neal Gompa 1f08860197 Fix building on older than EL8
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2020-04-18 13:26:06 -04:00
Jakub Čajka 4487a1b142
Rebase to go1.14 proper
Resolves: BZ#1792475
2020-02-26 15:26:46 +01:00
Jakub Čajka 9f5b8dce35
Rebase to go1.14rc1 2020-02-06 13:40:49 +01:00
Fedora Release Engineering 4751ecad2f - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 23:13:43 +00:00
Jakub Čajka fd2a3fb06e
Rebase to go1.14beta1
Resolves: BZ#1792475
2020-01-21 10:24:40 +01:00
Jakub Čajka fbfc80f071
Rebase to go1.13.6 2020-01-13 22:15:11 +01:00
Jakub Čajka 1524937377
Rebase to go1.13.5 2019-12-05 13:39:28 +01:00
Neal Gompa a522b09638 Fix date for changelog entry
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2019-12-04 09:05:11 -05:00
Neal Gompa 50defcc683 Small fixes to the spec and tighten up the file list
Signed-off-by: Neal Gompa <ngompa@datto.com>
2019-12-02 11:27:25 -05:00
Jakub Čajka f445d76353
Rebase to go1.13.4
Resolves: BZ#1767673
2019-11-01 16:38:39 +01:00
Jakub Čajka 069e0f1f5f
Rebase to go1.13.3
Fix for CVE-2019-17596
Resolves: BZ#1755639, BZ#1763312
2019-10-21 16:20:13 +02:00
Jakub Čajka 151fe9ed9a Rebase to go1.13.1
Fix for CVE-2019-16276
Resolves: BZ#1755970

Signed-off-by: Jakub Čajka <jcajka@redhat.com>
2019-09-30 08:57:44 +02:00
Jakub Čajka 25a05dd355 Back to go1.13 tls1.3 behavior
Signed-off-by: Jakub Čajka <jcajka@redhat.com>
2019-09-05 13:52:39 +02:00
Jakub Čajka 8f7b389463 Rebase to go1.13 2019-09-04 13:26:49 +02:00
Jakub Čajka e45411af09 Rebase to 1.13rc2
Do not enable tls1.3 by default
Related: BZ#1737471
2019-09-03 17:26:29 +02:00
Jakub Čajka af8d391cb2 Actually fix CVE-2019-9514 and CVE-2019-9512 2019-08-28 12:37:49 +02:00
Jakub Čajka 081d5ff6f2 Rebase to 1.13rc1
Fix for CVE-2019-14809, CVE-2019-9514 and CVE-2019-9512
Resolves: BZ#1741816, BZ#1741827 and BZ#1743131
2019-08-26 12:09:05 +02:00
Jakub Čajka 0e633c63ed Fix ICE affecting aarch64
Resolves: BZ#1735290
2019-08-02 10:42:35 +02:00
Fedora Release Engineering 140a7e1b44 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 04:35:33 +00:00
Jakub Čajka 29d5602b19 De-configure sumdb and go proxy 2019-07-24 01:35:09 +02:00
Jakub Čajka f80e5ff991 Rebase to 1.13beta1
Related: BZ#1732118
2019-07-24 00:27:11 +02:00
Jakub Čajka a94ffe83e5 Rebase to 1.12.7
Resolves: BZ#1728056
2019-07-09 16:38:56 +02:00
Jakub Čajka 6c0cf70db5 Rebase to go1.12.6
Resolvse: BZ#1719483
2019-06-12 16:09:25 +02:00
Jakub Čajka a562f38c65 Rebase to go1.12.5
Resolves: BZ#1707187
2019-05-07 14:22:33 +02:00
Jakub Čajka f344d3da25 Rebase to 1.12.2
Resolves: BZ#1688996
2019-04-08 10:49:18 +02:00
Jakub Čajka 9985c0a473 Fixup changelog 2019-04-01 09:59:04 +02:00
Jakub Čajka ef14b33215 Rebase to 1.12.1
Fix CVE-2019-9741
Use weak deps for SCM deps
Resolves: BZ#1688233
2019-03-15 09:53:03 +01:00
Tim Landscheidt ff7ebd7613 Fix requirement for %preun (instead of %postun) scriptlet 2019-03-12 19:01:55 +00:00
Jakub Čajka c74b6b6cb8 Rebase to go1.12 proper
Resolves:  BZ#1680040
2019-02-27 21:29:49 +01:00
Jakub Čajka 73766cf515 Rebase to go1.12rc1 2019-02-18 10:08:01 +01:00
Fedora Release Engineering e3e1bdbf46 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-01-31 23:34:32 +00:00
Jakub Čajka 8ae8c86871 Fix for CVE-2019-6486 2019-01-29 12:52:29 +01:00
Jakub Čajka bc69b83b00 Rebase to go1.12beta2 2019-01-11 13:33:12 +01:00
Jakub Čajka 50b7643bf7 Rebase to go1.11.4
Fix for CVE-2018-16875, CVE-2018-16874 and CVE-2018-16873
Resolves: BZ#1659290, BZ#1659289, BZ#1659288
2019-01-02 11:50:21 +01:00
Jakub Čajka b86284b4f3 Rebase to 1.11.2 2018-11-05 15:16:56 +01:00
Jakub Čajka eb7ec5ddc1 Rebase to 1.11.1 2018-10-06 15:39:01 +02:00
Jakub Čajka 3014b94569 Rebase to 1.11 release 2018-08-27 16:21:42 +02:00
Jakub Čajka f1f6f5d515 Rebase to go1.11rc2
Reduce size of bin package
2018-08-23 11:20:46 +02:00
Jakub Čajka a273a5236a Rebase to go 1.11rc1 2018-08-14 14:48:38 +02:00
Jakub Čajka c45c363337 Rebase to go 1.11beta3 2018-08-06 12:28:08 +02:00
Jakub Čajka 4043bb182d Turn on back DWARF compression by default
Use less memory on 32bit targets during build
2018-07-27 15:36:47 +02:00
Jakub Čajka 62f2ae0511 Rebase to 1.11beta2 2018-07-20 10:14:54 +02:00
Jakub Čajka 75f7f03cb6 Turn off DWARF compression by default as it is not supported by rpm/debuginfo 2018-07-18 14:00:27 +02:00
Fedora Release Engineering 72a9f2e921 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 03:12:06 +00:00
Jakub Čajka 19d1adeab4 Rebase to go1.11beta1 2018-07-10 21:46:22 +02:00
Jakub Čajka c333e76e86 Rebase to 1.10.3 2018-06-11 09:04:52 +02:00
Jakub Čajka 6caa43c106 Rebase to 1.10.2
Patch clean up
2018-05-03 11:11:48 +02:00
Jakub Čajka 66a92c4de7 Rebase to 1.10.1
Resolves: BZ#1562270
2018-04-04 10:10:28 +02:00
Jakub Čajka 2389428bde Fix CVE-2018-7187
Resolves: BZ#1546386, BZ#1546388
2018-03-03 11:26:41 +01:00
Jakub Čajka e8abe4385f Add dependency on scm tools so go get works out of box in minimal envs 2018-02-21 13:11:15 +01:00
Jakub Čajka 639f9ab37f Rebase to 1.10 2018-02-21 13:01:34 +01:00
Jakub Čajka 5f45ed12c2 Rebase to 1.10rc2
Fix CVE-2018-6574
Resolves: BZ#1543561, BZ#1543562
2018-02-09 13:49:40 +01:00
Fedora Release Engineering 13bb238b09 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 13:48:58 +00:00
Jakub Čajka 63e3cb4201 Rebase to 1.10rc1 2018-01-27 09:34:18 +01:00
Jakub Čajka 77baa559ba Rebase to 1.10beta2 2018-01-12 12:47:23 +01:00
Jakub Čajka d37b3b5006 Rebase to 1.10beta1
Drop verbose patch as most of it is now implemented by bootstrap tool and is easily toggled by passing -v flag to make.bash
2018-01-09 12:59:49 +01:00
Jakub Čajka 4bc73c764a Add bundled provides 2017-12-06 12:22:23 +01:00
Jakub Čajka b65272222a Temporalily ignore test failures on 32bit intel and aarch64 2017-11-23 16:28:44 +01:00
Jakub Čajka 315b776905 Rebase to 1.9.2
execute correctly pie tests
allow to ignore tests via bcond
reduce size of golang package
2017-11-07 13:42:51 +01:00
Jakub Čajka 920ea39083 add bcond for bootstraping 2017-10-12 15:52:28 +02:00
Jakub Čajka 387b897724 Use corect version 2017-10-06 13:17:08 +02:00
Jakub Čajka ceb83a748c fix CVE-2017-15041 and CVE-2017-15042 2017-10-06 13:12:30 +02:00
Jakub Čajka 903219bc93 Bump to release version 2017-09-15 13:25:24 +02:00
Fedora Release Engineering cb0891bb70 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-02 22:14:37 +00:00
Fedora Release Engineering 494a6d19c3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 11:03:59 +00:00
Jakub Čajka 9941f71a57 Mention upstream issue in s390x-ignore... patch 2017-07-13 12:39:15 +02:00
Jakub Čajka c2d0ceffa4 Merge branch 'master' of ssh://pkgs.fedoraproject.org/golang 2017-07-12 17:43:58 +02:00
Jakub Čajka 3cc854f423 Improved s390x patch 2017-07-12 17:26:26 +02:00
Petr Písař c7375398e7 perl dependency renamed to perl-interpreter <https://fedoraproject.org/wiki/Changes/perl_Package_to_Install_Core_Modules> 2017-07-12 14:32:33 +02:00
Jakub Čajka 5767354120 Bump to 1.9beta2
Workaround build failure on s390x
2017-07-12 13:38:36 +02:00
Jakub Čajka 45041c89fe bump to 1.8.3
fix for CVE-2017-8932
make possible to use 31bit OID in ASN1
Resolves: BZ#1454978, BZ#14551
2017-05-26 14:45:09 +02:00
Jakub Čajka 0a43a1cbaf fix uint64 constant codegen on s390x
Resolves: BZ#1441078
2017-04-21 14:56:13 +02:00
Jakub Čajka 1344685ff3 Revert: Final modularity bootstrap 2017-04-12 12:28:20 +02:00
Jakub Čajka 5706a3480e Final modularity bootstrap 2017-04-12 12:20:02 +02:00
Jakub Čajka ab6ee497cb Revert: modularity bootstrap 2017-04-12 10:29:49 +02:00
Jakub Čajka 29646808b3 Modularity bootstrap :) 2017-04-12 10:26:16 +02:00
Vincent Batts d83d5139a6
Revert "spec: hard code the bootstrap for a modularity build"
This reverts commit 63fbc71112.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-04-11 10:14:48 -04:00
Vincent Batts 63fbc71112
spec: hard code the bootstrap for a modularity build
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-04-11 10:13:43 -04:00
Jakub Čajka 749ec62908 bump to Go 1.8.1
Resolves: BZ#1440345
2017-04-11 10:41:35 +02:00
Jakub Čajka a1ca3c96e0 avoid possibly stale packages due to chacha test file not being test file 2017-02-24 13:41:35 +01:00
Jakub Čajka 1bf7308023 Bump to released 1.8
Ignore ppc64 tests failure for time beeing, haven't managed to reproduce localy
2017-02-20 15:50:48 +01:00
Fedora Release Engineering 7dabca5bf2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 11:37:38 +00:00
Jakub Čajka b881112930 make possible to override default traceback level at build time
add sub-package race containing std lib built with -race enabled
Related: BZ#1411242
2017-01-31 15:11:25 +01:00
Jakub Čajka 100fcef237 rebase to go1.8rc3
Resolves: BZ#1411242
2017-01-27 11:39:40 +01:00
Jakub Cajka 0dbd49fdd7 Resolves: BZ#1404679
expose IfInfomsg.X__ifi_pad on s390x
2017-01-20 14:51:16 +01:00
Jakub Čajka 66c8bd8593 Bump to 1.7.4
Resolves: BZ#1400732
2016-12-02 12:06:39 +01:00
Tom Callaway 85dfe17917 re-enable the NIST P-224 curve 2016-11-17 16:08:36 -05:00
Jakub Čajka 663103c2f1 Resolves: BZ#1387067 - golang-1.7.3 is available
added fix for tests failing with latest tzdata
2016-10-20 12:21:38 +02:00
Jakub Čajka d978616527 fix link failure due to relocation overflows on PPC64X 2016-09-23 17:48:07 +02:00
Jakub Čajka 8bda509c5f rebase to 1.7.1
Resolves: BZ#1374103
2016-09-08 17:54:31 +02:00
Jakub Čajka 1fe9869398 update to released version 2016-08-26 12:22:53 +02:00
Jakub Čajka 6896a58aa3 Obsolete golang-vet and golang-cover from golang-googlecode-tools package vet/cover binaries are provided by golang-bin rpm (thanks to jchaloup) 2016-08-08 10:38:08 +02:00
Jakub Čajka cf2fb88587 rebase to go1.7rc5
Resolves: BZ#1342090
2016-08-03 13:47:09 +02:00
Fedora Release Engineering 00c920284f - https://fedoraproject.org/wiki/Changes/golang1.7 2016-07-21 12:33:14 +00:00
Jakub Čajka d36359a723 rebase to 1.7rc2
added s390x build
improved shared lib packaging
Resolves: bz1357602 - CVE-2016-5386
Resolves: bz1342090, bz1342090
2016-07-20 09:32:37 +02:00
Jakub Čajka 04b972ebf4 Rebase to 1.6.2 2016-04-26 17:36:25 +02:00
Jakub Čajka b2c2028475 rebase to 1.6.1
Resolves: bz1324344 - CVE-2016-3959
Resolves: bz1324951 - prelink is gone, /etc/prelink.conf.d/* is no longer used
Resolves: bz1326366 - wrong epoll_event struct for ppc64le/ppc64
2016-04-13 14:44:04 +02:00
Jakub Čajka 263126ff1b Resolves: bz1304701 - rebase to go1.6 release
Resolves: bz1304591 - fix possible stack miss-alignment in callCgoMmap
2016-02-22 16:02:43 +01:00
Dennis Gilmore 30a817d62b - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-03 22:43:43 +00:00
Jakub Čajka f031dfde9c disabled cgo and external linking on ppc64 2016-01-29 12:25:12 +01:00
Jakub Čajka d40cd88359 Resolves bz1292640, rebase to pre-release 1.6
bootstrap for PowerPC
fix rpmlint errors/warning
2016-01-28 14:38:35 +01:00
Jakub Čajka 672b8a1217 rebase to 1.5.3
resolves bz1293451, CVE-2015-8618
2016-01-14 15:13:23 +01:00
Jakub Čajka 85525165e1 Fix bz number from previous commit, should be bz1290543 2015-12-14 14:16:07 +01:00
Jakub Čajka 8b92652b24 bz1290472 Accept x509 certs with negative serial 2015-12-11 12:51:16 +01:00
Jakub Čajka c524af8454 Rebase to 1.5.2(bz1288263)
Spec file clean up
Added basic build options
2015-12-08 17:28:38 +01:00
18 changed files with 1022 additions and 2204 deletions

71
.gitignore vendored
View File

@ -24,3 +24,74 @@
/go1.5rc1.src.tar.gz
/go1.5.src.tar.gz
/go1.5.1.src.tar.gz
/go1.5.2.src.tar.gz
/Mark.Twain-Tom.Sawyer.txt.bz2
/go1.5.3.src.tar.gz
/go1.6rc1.src.tar.gz
/go1.6.src.tar.gz
/go1.6.1.src.tar.gz
/go1.6.2.src.tar.gz
/go1.7rc2.src.tar.gz
/go1.7rc5.src.tar.gz
/go1.7.src.tar.gz
/go1.7.1.src.tar.gz
/go1.7.3.src.tar.gz
/go1.7.4.src.tar.gz
/go1.8rc3.src.tar.gz
/go1.8.src.tar.gz
/go1.8.1.src.tar.gz
/go1.8.3.src.tar.gz
/go1.9beta2.src.tar.gz
/go1.9.src.tar.gz
/go1.9.1.src.tar.gz
/go1.9.2.src.tar.gz
/go1.10beta1.src.tar.gz
/go1.10beta2.src.tar.gz
/go1.10rc1.src.tar.gz
/go1.10rc2.src.tar.gz
/go1.10.src.tar.gz
/go1.10.1.src.tar.gz
/go1.10.2.src.tar.gz
/go1.10.3.src.tar.gz
/go1.11beta1.src.tar.gz
/go1.11beta2.src.tar.gz
/go1.11beta3.src.tar.gz
/go1.11rc1.src.tar.gz
/go1.11rc2.src.tar.gz
/go1.11.src.tar.gz
/go1.11.1.src.tar.gz
/go1.11.2.src.tar.gz
/go1.11.4.src.tar.gz
/go1.12beta2.src.tar.gz
/go1.12rc1.src.tar.gz
/go1.12.src.tar.gz
/go1.12.1.src.tar.gz
/go1.12.2.src.tar.gz
/go1.12.5.src.tar.gz
/go1.12.6.src.tar.gz
/go1.12.7.src.tar.gz
/go1.13beta1.src.tar.gz
/go1.13rc1.src.tar.gz
/go1.13rc2.src.tar.gz
/go1.13.src.tar.gz
/go1.13.1.src.tar.gz
/go1.13.3.src.tar.gz
/go1.13.4.src.tar.gz
/go1.13.5.src.tar.gz
/go1.13.6.src.tar.gz
/go1.14beta1.src.tar.gz
/go1.14rc1.src.tar.gz
/go1.14.src.tar.gz
/go1.14.2.src.tar.gz
/go1.14.3.src.tar.gz
/go1.14.4.src.tar.gz
/go1.14.6.src.tar.gz
/go1.15beta1.src.tar.gz
/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
/go1.15.3.src.tar.gz
/go1.15.4.src.tar.gz
/go1.15.5.src.tar.gz

View File

@ -0,0 +1,88 @@
From edce31a2904846ae74e3c011f2cf5fddc963459e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Thu, 22 Mar 2018 12:07:32 +0100
Subject: [PATCH 1/3] Don't use the bundled tzdata at runtime, except for the
internal test suite
---
src/time/internal_test.go | 7 +++++--
src/time/zoneinfo_test.go | 3 ++-
src/time/zoneinfo_unix.go | 2 --
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
index 76d5524124..e81ace5f64 100644
--- a/src/time/internal_test.go
+++ b/src/time/internal_test.go
@@ -4,13 +4,15 @@
package time
+import "runtime"
+
func init() {
// force US/Pacific for time zone tests
ForceUSPacificForTesting()
}
func initTestingZone() {
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
if err != nil {
panic("cannot load America/Los_Angeles for testing: " + err.Error())
}
@@ -21,8 +23,9 @@ func initTestingZone() {
var OrigZoneSources = zoneSources
func forceZipFileForTesting(zipOnly bool) {
- zoneSources = make([]string, len(OrigZoneSources))
+ zoneSources = make([]string, len(OrigZoneSources)+1)
copy(zoneSources, OrigZoneSources)
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if zipOnly {
zoneSources = zoneSources[len(zoneSources)-1:]
}
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
index 7a55d4f618..6063ca1195 100644
--- a/src/time/zoneinfo_test.go
+++ b/src/time/zoneinfo_test.go
@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"reflect"
+ "runtime"
"testing"
"time"
)
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
t.Fatal(err)
}
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if err != nil {
t.Fatal(err)
}
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index 88313aa0ed..d9596115ef 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -12,7 +12,6 @@
package time
import (
- "runtime"
"syscall"
)
@@ -22,7 +21,6 @@ var zoneSources = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}
func initLocal() {
--
2.14.3

View File

@ -0,0 +1,41 @@
From 817407fc2d6a861e65086388766f58082d38bc0b Mon Sep 17 00:00:00 2001
From: Michael Munday <munday@ca.ibm.com>
Date: Tue, 17 Jan 2017 11:33:38 -0500
Subject: [PATCH 2/3] syscall: expose IfInfomsg.X__ifi_pad on s390x
Exposing this field on s390x improves compatibility with the other
linux architectures, all of which already expose it.
Fixes #18628 and updates #18632.
Change-Id: I08e8e1eb705f898cd8822f8bee0d61ce11d514b5
---
src/syscall/ztypes_linux_s390x.go | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go
index 63c4a83b19..b5894255df 100644
--- a/src/syscall/ztypes_linux_s390x.go
+++ b/src/syscall/ztypes_linux_s390x.go
@@ -449,12 +449,12 @@ type RtAttr struct {
}
type IfInfomsg struct {
- Family uint8
- _ uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ X__ifi_pad uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {
--
2.14.3

View File

@ -0,0 +1,54 @@
From b38cd2374c2395f5a77802ef8ea3d7ac5b8a86ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Mon, 27 May 2019 15:12:53 +0200
Subject: [PATCH 3/3] cmd/go: disable Google's proxy and sumdb
---
src/cmd/go/internal/cfg/cfg.go | 10 +++++-----
src/cmd/go/testdata/script/mod_sumdb_golang.txt | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index 61dc6bdda6..e8658dc56c 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -245,11 +245,11 @@ var (
GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", objabi.GOPPC64))
GOWASM = envOr("GOWASM", fmt.Sprint(objabi.GOWASM))
- GOPROXY = envOr("GOPROXY", "https://proxy.golang.org,direct")
- GOSUMDB = envOr("GOSUMDB", "sum.golang.org")
- GOPRIVATE = Getenv("GOPRIVATE")
- GONOPROXY = envOr("GONOPROXY", GOPRIVATE)
- GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE)
+ GOPROXY = envOr("GOPROXY", "direct")
+ GOSUMDB = envOr("GOSUMDB", "off")
+ GOPRIVATE = Getenv("GOPRIVATE")
+ GONOPROXY = envOr("GONOPROXY", GOPRIVATE)
+ GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE)
GOINSECURE = Getenv("GOINSECURE")
)
diff --git a/src/cmd/go/testdata/script/mod_sumdb_golang.txt b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
index 40a07fc7e9..50436e32d7 100644
--- a/src/cmd/go/testdata/script/mod_sumdb_golang.txt
+++ b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
@@ -2,12 +2,12 @@
env GOPROXY=
env GOSUMDB=
go env GOPROXY
-stdout '^https://proxy.golang.org,direct$'
+stdout '^direct$'
go env GOSUMDB
-stdout '^sum.golang.org$'
+stdout '^off$'
env GOPROXY=https://proxy.golang.org
go env GOSUMDB
-stdout '^sum.golang.org$'
+stdout '^off$'
# download direct from github
[!net] skip
--
2.21.0

View File

@ -1,135 +0,0 @@
commit 117ddcb83d7f42d6aa72241240af99ded81118e9
Author: Brad Fitzpatrick <bradfitz@golang.org>
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 <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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 {

View File

@ -1,112 +0,0 @@
commit 143822585e32449860e624cace9d2e521deee62e
Author: Brad Fitzpatrick <bradfitz@golang.org>
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 <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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
}

View File

@ -1,225 +0,0 @@
commit 300d9a21583e7cf0149a778a0611e76ff7c6680f
Author: Brad Fitzpatrick <bradfitz@golang.org>
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 <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
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
}

7
fedora.go Normal file
View File

@ -0,0 +1,7 @@
// +build rpm_crashtraceback
package runtime
func init() {
setTraceback("crash")
}

View File

@ -1,21 +0,0 @@
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index ed9502d..c2569e7 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -32,14 +32,14 @@ var zoneDirs = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}
var origZoneDirs = zoneDirs
func forceZipFileForTesting(zipOnly bool) {
- zoneDirs = make([]string, len(origZoneDirs))
+ zoneDirs = make([]string, len(origZoneDirs)+1)
copy(zoneDirs, origZoneDirs)
+ zoneDirs = append(zoneDirs, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if zipOnly {
for i := 0; i < len(zoneDirs)-1; i++ {
zoneDirs[i] = "/XXXNOEXIST"

View File

@ -1,13 +0,0 @@
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() {
}
`
-func TestGdbPython(t *testing.T) {
+func testGdbPython(t *testing.T) {
if runtime.GOOS == "darwin" {
t.Skip("gdb does not work on darwin")
}

View File

@ -1,13 +0,0 @@
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index 60d2734..b16540f 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -89,7 +89,7 @@ func kernelVersion(t *testing.T) (int, int) {
return major, minor
}
-func TestCloneNEWUSERAndRemapNoRootDisableSetgroups(t *testing.T) {
+func testCloneNEWUSERAndRemapNoRootDisableSetgroups(t *testing.T) {
if os.Getuid() == 0 {
t.Skip("skipping unprivileged user only test")
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -153,12 +153,12 @@ 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 \
- "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+ "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
fi
echo "##### Building packages and commands for $GOOS/$GOARCH."
-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
rm -f "$GOTOOLDIR"/go_bootstrap

View File

@ -1,53 +0,0 @@
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() {
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("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.
- run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...")
+ run(workspace, ShowOutput|CheckExit, bingopath, "install", "-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.'
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
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)

View File

@ -1,309 +0,0 @@
commit a3156aaa121446c4136927f8c2139fefe05ba82c
Author: Brad Fitzpatrick <bradfitz@golang.org>
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 <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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)
+ }
+}

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
4adfbdfca523cc1c229be8a321f3602f go1.5.1.src.tar.gz
SHA512 (go1.15.5.src.tar.gz) = 8e1d71f628d364b949b1e124af8950a563bbe9d9ae73b94c66af6ce029f67c26e2654556c0c118d0bc8566af52a7e9ed736b4667bbef7ccdab2bd338c43e6eb4