]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agogo/importer: implement support for gccgo
Robert Griesemer [Wed, 17 Jun 2015 00:28:01 +0000 (17:28 -0700)]
go/importer: implement support for gccgo

Change-Id: I0e1aab2fe2340a1fbb7f377dbd7a72ea6f0477d8
Reviewed-on: https://go-review.googlesource.com/11153
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agogo/internal/gccgoimporter: adjust to std repo libraries (fix build)
Robert Griesemer [Tue, 16 Jun 2015 23:47:45 +0000 (16:47 -0700)]
go/internal/gccgoimporter: adjust to std repo libraries (fix build)

Change-Id: Ia9cbe3bfaa3e66c93d568d8beeed624b113d51a2
Reviewed-on: https://go-review.googlesource.com/11152
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agogo/internal/gccgoimporter: unmodified copy of x/tools/go/gccgoimporter
Robert Griesemer [Tue, 16 Jun 2015 23:28:57 +0000 (16:28 -0700)]
go/internal/gccgoimporter: unmodified copy of x/tools/go/gccgoimporter

This change will brake the build. The immediately following change
contains the necessary adjustments to make it work again. We're
doing this in two steps to expose the manual changes applied.

Change-Id: I225947da23e190b12e12cbd0c5e6e91628de7f53
Reviewed-on: https://go-review.googlesource.com/11151
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agomath/big: incorporate feedback by josharian (Example_fibonacci)
Robert Griesemer [Wed, 17 Jun 2015 20:19:33 +0000 (13:19 -0700)]
math/big: incorporate feedback by josharian (Example_fibonacci)

Change-Id: I376ff39594b532a5490f13e3985b7a6ff4b6761d
Reviewed-on: https://go-review.googlesource.com/11191
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agoruntime: fix race in scanvalid assertion
Russ Cox [Wed, 17 Jun 2015 17:56:03 +0000 (13:56 -0400)]
runtime: fix race in scanvalid assertion

Change-Id: I389b2e10fe667eaa55f87b71b1e004994694d4a3
Reviewed-on: https://go-review.googlesource.com/11173
Reviewed-by: Austin Clements <austin@google.com>
9 years agomath/big: Added small complete example of big.Int usage
ALTree [Wed, 17 Jun 2015 10:42:02 +0000 (12:42 +0200)]
math/big: Added small complete example of big.Int usage

Updates #11241

Change-Id: I9639c4f66cf805a57b087c9f648d3918df105d86
Reviewed-on: https://go-review.googlesource.com/11034
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet: fix build on netbsd
Mikio Hara [Wed, 17 Jun 2015 13:05:55 +0000 (22:05 +0900)]
net: fix build on netbsd

Change-Id: Ia5c6d9fb114be65d7c20c7eb97ed696977051031
Reviewed-on: https://go-review.googlesource.com/11167
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: fix races in stack scan
Russ Cox [Tue, 16 Jun 2015 23:20:18 +0000 (19:20 -0400)]
runtime: fix races in stack scan

This fixes a hang during runtime.TestTraceStress.
It also fixes double-scan of stacks, which leads to
stack barrier installation failures.

Both of these have shown up as flaky failures on the dashboard.

Fixes #10941.

Change-Id: Ia2a5991ce2c9f43ba06ae1c7032f7c898dc990e0
Reviewed-on: https://go-review.googlesource.com/11089
Reviewed-by: Austin Clements <austin@google.com>
9 years agomisc/cgo/testshared: make sure rebuilds occur as expected
Ian Lance Taylor [Tue, 16 Jun 2015 18:03:19 +0000 (11:03 -0700)]
misc/cgo/testshared: make sure rebuilds occur as expected

Adjust timestamps in TestABIChecking to make sure that the library and
executable are rebuilt when expected.

Change-Id: I3288c254ba8201b5b4255347b0cb056fa0908657
Reviewed-on: https://go-review.googlesource.com/11128
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Yves Junqueira <yves.junqueira@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/addr2line: simplify windows test
Russ Cox [Mon, 15 Jun 2015 18:25:13 +0000 (14:25 -0400)]
cmd/addr2line: simplify windows test

Change-Id: I0fcc35f43bc6059e6203af6134319cfc060c4b9a
Reviewed-on: https://go-review.googlesource.com/11085
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: introduce //go:systemstack annotation
Russ Cox [Mon, 8 Jun 2015 01:45:39 +0000 (21:45 -0400)]
cmd/compile: introduce //go:systemstack annotation

//go:systemstack means that the function must run on the system stack.

Add one use in runtime as a demonstration.

Fixes #9174.

Change-Id: I8d4a509cb313541426157da703f1c022e964ace4
Reviewed-on: https://go-review.googlesource.com/10840
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>

9 years agoruntime: fix typos in os_linux_arm.go
Yongjian Xu [Wed, 17 Jun 2015 04:33:03 +0000 (21:33 -0700)]
runtime: fix typos in os_linux_arm.go

Change-Id: I750900e0aed9ec528fea3f442c35196773e3ba5e
Reviewed-on: https://go-review.googlesource.com/11163
Reviewed-by: Minux Ma <minux@golang.org>
9 years agodoc/go1.5.txt: mention sequential and RFC 6555-compliant TCP dialing
Mikio Hara [Wed, 17 Jun 2015 00:03:08 +0000 (09:03 +0900)]
doc/go1.5.txt: mention sequential and RFC 6555-compliant TCP dialing

Change-Id: Ib0b0be901f2ed52e1b432ae62f0b1940eb27ecc3
Reviewed-on: https://go-review.googlesource.com/11137
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: replace references to {5..9}{g,l} with go tool compile and go tool link
Jeremy Jackins [Thu, 28 May 2015 07:13:23 +0000 (16:13 +0900)]
doc: replace references to {5..9}{g,l} with go tool compile and go tool link

I updated some references to 6g, 6l and friends that I came across, as those
programs don't exist anymore. I also fixed some echos in make.rc to match other make.* scripts while I was there.

Change-Id: Ib84532cd4688cf65174dd9869e5d42af98a20a48
Reviewed-on: https://go-review.googlesource.com/11162
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocompress/flate: make library RFC1951 compliant
Joe Tsai [Thu, 11 Jun 2015 23:33:52 +0000 (16:33 -0700)]
compress/flate: make library RFC1951 compliant

Corrected several issues:
 * RFC1951 section 3.2.7 dictates that it is okay for the HDist tree to have a
single code of zero bits. Furthermore, the behavior of the C zlib library
permits empty trees even when there are more than one codes.
 * RFC1951 section 3.2.5 shows that HLit codes 286 and 287 are invalid. Thus,
Go's implementation should choke on inputs using these codes.
 * RFC1951 section 3.2.5 and 3.2.7 are ambiguous about whether the number of
HDist codes can be greater than 30. The C zlib library (which is the canonical
reference implementation) performs this check here:
https://github.com/madler/zlib/blob/62d6112a7981ad7c34f3b43cffdf00d4662a4f25/inflate.c#L906

In addition, a number of test cases were added to the unit tests that exercises
these edge cases. The test cases listed in TestStreams will either fail or
succeed in a manner matching the behaviour of the C zlib version. Given that the
C zlib implementation is the reference for the world, Go's implementation should
match C zlib behaviour.

Fixes #11030

Change-Id: Ic24e4e40ce5832c7e1930249246e86d34bfedaa6
Reviewed-on: https://go-review.googlesource.com/11000
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agodoc/articles/wiki: remove generated final-test.go after test
Alex Brainman [Wed, 17 Jun 2015 02:46:06 +0000 (12:46 +1000)]
doc/articles/wiki: remove generated final-test.go after test

Change-Id: If6dc3acdc023ac78f63e257974cd2d2e9f1cca10
Reviewed-on: https://go-review.googlesource.com/11161
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: run escape analysis after method wrapper generation
David Chase [Tue, 16 Jun 2015 22:28:01 +0000 (18:28 -0400)]
cmd/compile: run escape analysis after method wrapper generation

Also modified test/run.go to ignore messages prefixed <autogenerated>
because those cannot be described with "// ERROR ...", and backed out
patch from issue #9537 because it is no longer necessary.  The reasons
described in the 9537 discussion for why escape analysis cannot run
late no longer hold, happily.

Fixes #11053.

Change-Id: Icb14eccdf2e8cde3d0f8fb8a216b765400a96385
Reviewed-on: https://go-review.googlesource.com/11088
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>

9 years agocmd/dist: add new misc/cgo/testsovar test
Alex Brainman [Tue, 16 Jun 2015 05:36:06 +0000 (15:36 +1000)]
cmd/dist: add new misc/cgo/testsovar test

This change reintroduces CL 8523. CL 8523 was reverted because
it broke darwin and netbsd builds. Now that this test is part
of "go tool dist test" command we could skip OSes that fail.

Updates #10360

Change-Id: Iaaeb5b800126492f36415a439c333a218fe4ab67
Reviewed-on: https://go-review.googlesource.com/11119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: vary executable names in tests
Alex Brainman [Wed, 17 Jun 2015 00:22:03 +0000 (10:22 +1000)]
cmd/go: vary executable names in tests

So the tests don't interfere with each other on windows.

Fixes #11217

Change-Id: I4b3936bc64c95c7274298d6f137b24a28876b625
Reviewed-on: https://go-review.googlesource.com/11138
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: allow LookupAddr to use getnameinfo when cgo is enabled
Mikio Hara [Wed, 28 Jan 2015 11:08:41 +0000 (20:08 +0900)]
net: allow LookupAddr to use getnameinfo when cgo is enabled

This change allows LookupAddr to use getnameinfo through cgo for working
together with various name services other than DNS.

Fixes #7855.

Change-Id: I5b3b4aefe3d1b904541c3350865734d8cbb1c1c4
Reviewed-on: https://go-review.googlesource.com/3420
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: hints on how to cross-bootstrap
Michael Hudson-Doyle [Wed, 10 Jun 2015 10:13:39 +0000 (22:13 +1200)]
doc: hints on how to cross-bootstrap

Change-Id: I854a093b9e1a62d2515ca114ee84956510925921
Reviewed-on: https://go-review.googlesource.com/10839
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: don't export gcCompatibilityMode flag
Robert Griesemer [Tue, 16 Jun 2015 22:21:39 +0000 (15:21 -0700)]
go/types: don't export gcCompatibilityMode flag

This flag is not needed in the std repo because we don't have
tests requiring it. Remove it before it's frozen into the API.

Change-Id: I18b861eea146ad67e7a3c26ee8be681d8065ef12
Reviewed-on: https://go-review.googlesource.com/11150
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/link: when reading symbols from a shared library, allow duplicates when they...
Michael Hudson-Doyle [Tue, 16 Jun 2015 01:41:11 +0000 (13:41 +1200)]
cmd/link: when reading symbols from a shared library, allow duplicates when they are both in bss

This makes the behaviour match what happens when duplicate symbols are read
from regular object files and fixes errors about cgoAlwaysFalse when linking
an executable that uses cgo against a shared library.

Change-Id: Ibb8cd8fe3f7813cde504b7483f1e857868d7e063
Reviewed-on: https://go-review.googlesource.com/11117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoos: skip TestHostname on Plan 9
David du Colombier [Tue, 16 Jun 2015 21:42:23 +0000 (23:42 +0200)]
os: skip TestHostname on Plan 9

TestHostname was re-enabled in CL 10753.
However, on Plan 9 the hostname is not obtained
by executing a "hostname" command, but by reading
the #c/sysname file.

Change-Id: I80c0e303f4983fe39ceb300ad64e2c4a8392b695
Reviewed-on: https://go-review.googlesource.com/11033
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: account for stack guard when shrinking the stack
Austin Clements [Thu, 4 Jun 2015 21:28:02 +0000 (17:28 -0400)]
runtime: account for stack guard when shrinking the stack

Currently, when shrinkstack computes whether the halved stack
allocation will have enough room for the stack, it accounts for the
stack space that's actively in use but fails to leave extra room for
the stack guard space. As a result, *if* the minimum stack size is
small enough or the guard large enough, it may shrink the stack and
leave less than enough room to run nosplit functions. If the next
function called after the stack shrink is a nosplit function, it may
overflow the stack without noticing and overwrite non-stack memory.

We don't think this is happening under normal conditions right now.
The minimum stack allocation is 2K and the guard is 640 bytes. The
"worst case" stack shrink is from 4K (4048 bytes after stack barrier
array reservation) to 2K (2016 bytes after stack barrier array
reservation), which means the largest "used" size that will qualify
for shrinking is 4048/4 - 8 = 1004 bytes. After copying, that leaves
2016 - 1004 = 1012 bytes of available stack, which is significantly
more than the guard space.

If we were to reduce the minimum stack size to 1K or raise the guard
space above 1012 bytes, the logic in shrinkstack would no longer leave
enough space.

It's also possible to trigger this problem by setting
firstStackBarrierOffset to 0, which puts stack barriers in a debug
mode that steals away *half* of the stack for the stack barrier array
reservation. Then, the largest "used" size that qualifies for
shrinking is (4096/2)/4 - 8 = 504 bytes. After copying, that leaves
(2096/2) - 504 = 8 bytes of available stack; much less than the
required guard space. This causes failures like those in issue #11027
because func gc() shrinks its own stack and then immediately calls
casgstatus (a nosplit function), which overflows the stack and
overwrites a free list pointer in the neighboring span. However, since
this seems to require the special debug mode, we don't think it's
responsible for issue #11027.

To forestall all of these subtle issues, this commit modifies
shrinkstack to correctly account for the guard space when considering
whether to halve the stack allocation.

Change-Id: I7312584addc63b5bfe55cc384a1012f6181f1b9d
Reviewed-on: https://go-review.googlesource.com/10714
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: detect and print corrupted free lists
Austin Clements [Thu, 4 Jun 2015 22:14:57 +0000 (18:14 -0400)]
runtime: detect and print corrupted free lists

Issues #10240, #10541, #10941, #11023, #11027 and possibly others are
indicating memory corruption in the runtime. One of the easiest places
to both get corruption and detect it is in the allocator's free lists
since they appear throughout memory and follow strict invariants. This
commit adds a check when sweeping a span that its free list is sane
and, if not, it prints the corrupted free list and panics. Hopefully
this will help us collect more information on these failures.

Change-Id: I6d417bcaeedf654943a5e068bd76b58bb02d4a64
Reviewed-on: https://go-review.googlesource.com/10713
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

9 years agoruntime: implement GOTRACEBACK=crash for linux/386
Russ Cox [Tue, 16 Jun 2015 20:37:48 +0000 (16:37 -0400)]
runtime: implement GOTRACEBACK=crash for linux/386

Change-Id: I401ce8d612160a4f4ee617bddca6827fa544763a
Reviewed-on: https://go-review.googlesource.com/11087
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: fix build
Mikio Hara [Tue, 16 Jun 2015 18:49:07 +0000 (03:49 +0900)]
cmd/go: fix build

Change-Id: I2cd58a665d9df26583128c633c443325dcc3f288
Reviewed-on: https://go-review.googlesource.com/11131
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoall: extract "can I exec?" check from tests into internal/testenv
Russ Cox [Fri, 5 Jun 2015 15:01:53 +0000 (11:01 -0400)]
all: extract "can I exec?" check from tests into internal/testenv

Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d
Reviewed-on: https://go-review.googlesource.com/10753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: remove obsolete TestLookupHost
Mikio Hara [Sat, 13 Jun 2015 22:50:17 +0000 (07:50 +0900)]
net: remove obsolete TestLookupHost

The motivation of TestLookupHost was to test codepaths on LookupHost,
LookupIP when we set CGO_ENABLED=1. Now we have serveral tests on those
APIs and their codepaths such as TestLookupGooglePublicDNSAddr,
TestCgoLookupIP, TestGoLookupIP, and the test using the ambiguous source
"localhost" is unnecessary.

Fixes #11182.

Change-Id: I397c823e1648114d91a229b316477bff2948b4f9
Reviewed-on: https://go-review.googlesource.com/11057
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: disable example on darwin/arm
David Crawshaw [Tue, 16 Jun 2015 17:23:42 +0000 (13:23 -0400)]
go/types: disable example on darwin/arm

Sadly examples cannot use the new internal/testenv, so this is
extends the crude build tag restriction in this file.

Change-Id: I49646ca71e45074a917813ae8e612cc715c78be8
Reviewed-on: https://go-review.googlesource.com/11086
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet: skip TestProtocolDialError on solaris
Mikio Hara [Sun, 14 Jun 2015 00:01:23 +0000 (09:01 +0900)]
net: skip TestProtocolDialError on solaris

Unfortunately there's no simple, easy way to make Dial{TCP,UDP} fail
consistently across all platforms. Fow now we skip the test on Solaris.

Change-Id: Ib3c55f670ac6a174fe9ea682dac7aab96b1e9dfb
Reviewed-on: https://go-review.googlesource.com/11058
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: show compiler panics when -d panic=1
Shenghou Ma [Sun, 24 May 2015 07:58:03 +0000 (03:58 -0400)]
cmd/compile: show compiler panics when -d panic=1

Fixes #10683.

Change-Id: I4cce3f298b787c736dbabe544a11a9215bcd3671
Reviewed-on: https://go-review.googlesource.com/10336
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: add sequential and RFC 6555-compliant TCP dialing.
Paul Marks [Fri, 10 Apr 2015 21:15:54 +0000 (14:15 -0700)]
net: add sequential and RFC 6555-compliant TCP dialing.

dialSerial connects to a list of addresses in sequence.  If a
timeout is specified, then each address gets an equal fraction of the
remaining time, with a magic constant (2 seconds) to prevent
"dial a million addresses" from allotting zero time to each.

Normally, net.Dial passes the DNS stub resolver's output to dialSerial.
If an error occurs (like destination/port unreachable), it quickly skips
to the next address, but a blackhole in the network will cause the
connection to hang until the timeout elapses.  This is how UNIXy clients
traditionally behave, and is usually sufficient for non-broken networks.

The DualStack flag enables dialParallel, which implements Happy Eyeballs
by racing two dialSerial goroutines, giving the preferred family a
head start (300ms by default).  This allows clients to avoid long
timeouts when the network blackholes IPv4 xor IPv6.

Fixes #8453
Fixes #8455
Fixes #8847

Change-Id: Ie415809c9226a1f7342b0217dcdd8f224ae19058
Reviewed-on: https://go-review.googlesource.com/8768
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: support -buildmode=shared with gccgo
Michael Hudson-Doyle [Mon, 11 May 2015 01:39:28 +0000 (13:39 +1200)]
cmd/go: support -buildmode=shared with gccgo

Change-Id: Id93b8ab42fa311ce32209734ec9a0813f8736e25
Reviewed-on: https://go-review.googlesource.com/9914
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agodoc: update install-source.html to cover new architectures
Michael Hudson-Doyle [Wed, 10 Jun 2015 09:56:01 +0000 (21:56 +1200)]
doc: update install-source.html to cover new architectures

Change-Id: I09b99eb36e550d92bd865cc4749058a398fa00cb
Reviewed-on: https://go-review.googlesource.com/10838
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agogo/types: fix Eval to use correct file set when evaluating an expression
Robert Griesemer [Mon, 15 Jun 2015 19:49:45 +0000 (12:49 -0700)]
go/types: fix Eval to use correct file set when evaluating an expression

This is https://go-review.googlesource.com/10999 which we could not apply
in x/tools/go/types because we must not rely on 1.5 features in that repo
yet.

Change-Id: I9a57cdb7ad4051df278d1fbed90c736df50f426f
Reviewed-on: https://go-review.googlesource.com/11125
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agogo/types: port recent x/tools/go/types fixes
Robert Griesemer [Mon, 15 Jun 2015 18:06:59 +0000 (11:06 -0700)]
go/types: port recent x/tools/go/types fixes

The main change is:

golang.org/cl/10800  add pos parameter to Eval; remove New, EvalNode

followed by several cleanups/follow-up fixes:

golang.org/cl/10992  remove global vars in test
golang.org/cl/10994  remove unused scope parameter from NewSignature
golang.org/cl/10995  provide full source file extent to file scope
golang.org/cl/10996  comment fix in resolver.go
golang.org/cl/11004  updated cmd/vet
golang.org/cl/11042  be robust in the presence of incorrect/missing position info

Fixes #9980.

Change-Id: Id4aff688f6a399f76bf92b84c7e793b8da8baa48
Reviewed-on: https://go-review.googlesource.com/11122
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/go: fix typo
Brad Fitzpatrick [Mon, 15 Jun 2015 19:46:04 +0000 (12:46 -0700)]
cmd/go: fix typo

Change-Id: I171a1125e25b13c934c2cd545bd03f49f642910d
Reviewed-on: https://go-review.googlesource.com/11113
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agosyscall: fix TestCloneNEWUSERAndRemapNoRootDisableSetgroups the right way
Ian Lance Taylor [Mon, 15 Jun 2015 18:35:56 +0000 (11:35 -0700)]
syscall: fix TestCloneNEWUSERAndRemapNoRootDisableSetgroups the right way

The problem was not the kernel version as I thought before, it was
that the test used the same number for both the UID and the GID.
Thanks to Chris Siebenmann for debugging this.

Fixes #11220.

Change-Id: Ib5077e182497155e84044683209590ee0f7c9dde
Reviewed-on: https://go-review.googlesource.com/11124
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: make -a apply to the standard library, like in Go 1.3
Russ Cox [Fri, 5 Jun 2015 03:47:01 +0000 (23:47 -0400)]
cmd/go: make -a apply to the standard library, like in Go 1.3

This CL adds a very long comment explaining how isStale and
the new build IDs work. As part of writing the comment I realized:

// When the go command makes the wrong build decision and does not
// rebuild something it should, users fall back to adding the -a flag.
// Any common use of the -a flag should be considered prima facie evidence
// that isStale is returning an incorrect false result in some important case.
// Bugs reported in the behavior of -a itself should prompt the question
// ``Why is -a being used at all? What bug does that indicate?''

The two uses of -a that are most commonly mentioned in bugs filed
against the go command are:

go install -a ./...
go build -tags netgo -a myprog

Both of these commands now do the right thing without needing -a.

The -a exception we introduced in Go 1.4 was for the first form, and
it broke the second form. Again, neither needs -a anymore, so restore
the old, simpler, easier to explain, less surprising meaning used in Go 1.3:
if -a is given, rebuild EVERYTHING.

See the comment for more justification and history.

Summary of recent CLs (to link bugs to this one):

Fixes #3036. Now 'go install ./...' works.
Fixes #6534. Now 'go install ./...' works.
Fixes #8290. Now 'go install ./...' works.
Fixes #9369. Now 'go build -tags netgo myprog' works.
Fixes #10702. Now using one GOPATH with Go 1.5 and Go 1.6 works.
  (Each time you switch, everything needed gets rebuilt.
  Switching from Go 1.4 to Go 1.5 will rebuild properly.
  Switching from Go 1.5 back to Go 1.4 still needs -a when
  invoking the Go 1.4 go command.)

Change-Id: I19f9eb5286efaa50de7c8326602e94604ab572eb
Reviewed-on: https://go-review.googlesource.com/10761
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: include Go toolchain information in build ID
Russ Cox [Thu, 4 Jun 2015 19:35:58 +0000 (15:35 -0400)]
cmd/go: include Go toolchain information in build ID

This causes packages and binaries built by Go 1.5 to look
out of date to Go 1.6 and vice versa, so that when you flip
between different Go versions but keep the same GOPATH,
the right rebuilding happens at each flip.

Go 1.4 binaries will also look out of date to Go 1.5,
but Go 1.5 binaries will not look out of date to Go 1.4
(since Go 1.4 doesn't have anything like this).
People flipping between Go 1.4 and Go 1.5 will still
need to use go install -a every time to flip to Go 1.4,
but not when they flip back to Go 1.5.

Fixes #6534.
Fixes #10702.

Change-Id: I0ae7f268f822d483059a938a4f22846ff9275b4c
Reviewed-on: https://go-review.googlesource.com/10760
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: raise maxmem to 512 GB
Russ Cox [Mon, 8 Jun 2015 04:14:08 +0000 (00:14 -0400)]
runtime: raise maxmem to 512 GB

A workaround for #10460.

Change-Id: I607a556561d509db6de047892f886fb565513895
Reviewed-on: https://go-review.googlesource.com/10819
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: force-overwrite destination files when installing cgo headers
Srdjan Petrovic [Tue, 9 Jun 2015 21:36:05 +0000 (14:36 -0700)]
cmd/go: force-overwrite destination files when installing cgo headers

Fixes #11131

When running 'go install -buildmode=c-shared', under the circumstances
described in issue #11131, the install command would fail trying to
install cgo headers if they have already been installed (by a previous
call to 'go install -buildmode=c-shared').

Since it's safe to overwrite said headers (according to iant@), this CL
introduces a parameter to builder's 'copy' and 'move' functions that,
if set to 'true', would force the overwriting of already installed
files.

This parameter value is set to 'true' only when installing cgo headers,
for now.

Change-Id: I5bda17ee757066a8e5d2b39f2e8f3a389eb1e4a2
Reviewed-on: https://go-review.googlesource.com/10870
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agotesting: don't print CPU count for tests, only benchmarks
Rob Pike [Mon, 15 Jun 2015 17:59:00 +0000 (10:59 -0700)]
testing: don't print CPU count for tests, only benchmarks

The number of CPUs is of value when benchmarking but mostly
noise when testing. The recent change to default to the number
of CPUs available has made the tests noisier and confusing.

Fixes #11200

Change-Id: Ifc87d9ccb4177d73e304fb7ffcef4367bd163c9e
Reviewed-on: https://go-review.googlesource.com/11121
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/cgo: make sure pointers passed to C escape to heap
Russ Cox [Mon, 8 Jun 2015 02:14:04 +0000 (22:14 -0400)]
cmd/cgo: make sure pointers passed to C escape to heap

Fixes #10303.

Change-Id: Ia68d3566ba3ebeea6e18e388446bd9b8c431e156
Reviewed-on: https://go-review.googlesource.com/10814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: gofmt
Russ Cox [Mon, 15 Jun 2015 17:35:56 +0000 (13:35 -0400)]
runtime: gofmt

Change-Id: I539bdc438f694610a7cd373f7e1451171737cfb3
Reviewed-on: https://go-review.googlesource.com/11084
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: add GODEBUG gcshrinkstackoff, gcstackbarrieroff, and gcstoptheworld variables
Russ Cox [Fri, 5 Jun 2015 15:51:49 +0000 (11:51 -0400)]
runtime: add GODEBUG gcshrinkstackoff, gcstackbarrieroff, and gcstoptheworld variables

While we're here, update the documentation and delete variables with no effect.

Change-Id: I4df0d266dff880df61b488ed547c2870205862f0
Reviewed-on: https://go-review.googlesource.com/10790
Reviewed-by: Austin Clements <austin@google.com>
9 years agoruntime: use type-based write barrier for remote stack write during chansend
Russ Cox [Mon, 8 Jun 2015 02:47:59 +0000 (22:47 -0400)]
runtime: use type-based write barrier for remote stack write during chansend

A send on an unbuffered channel to a blocked receiver is the only
case in the runtime where one goroutine writes directly to the stack
of another. The garbage collector assumes that if a goroutine is
blocked, its stack contains no new pointers since the last time it ran.
The send on an unbuffered channel violates this, so it needs an
explicit write barrier. It has an explicit write barrier, but not one that
can handle a write to another stack. Use one that can (based on type bitmap
instead of heap bitmap).

To make this work, raise the limit for type bitmaps so that they are
used for all types up to 64 kB in size (256 bytes of bitmap).
(The runtime already imposes a limit of 64 kB for a channel element size.)

I have been unable to reproduce this problem in a simple test program.

Could help #11035.

Change-Id: I06ad994032d8cff3438c9b3eaa8d853915128af5
Reviewed-on: https://go-review.googlesource.com/10815
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: stop early in disallowInternal on erroneous packages
Andrew Gerrand [Mon, 15 Jun 2015 03:19:39 +0000 (13:19 +1000)]
cmd/go: stop early in disallowInternal on erroneous packages

Fixes #11201

Change-Id: I80d8fcfcb5c856aaf9d0e73d756d86018e2bec3b
Reviewed-on: https://go-review.googlesource.com/11110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc/articles/wiki: don't run tests when 'patch' command unavailable
Andrew Gerrand [Mon, 15 Jun 2015 02:52:07 +0000 (12:52 +1000)]
doc/articles/wiki: don't run tests when 'patch' command unavailable

Change-Id: I21cfea3eadb37904252900324c23e2664b121bbb
Reviewed-on: https://go-review.googlesource.com/11099
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agosyscall: correct comment on where compileCallback is defined
Ian Lance Taylor [Mon, 15 Jun 2015 02:48:45 +0000 (19:48 -0700)]
syscall: correct comment on where compileCallback is defined

Fixes #11216.

Change-Id: Iad1f4894c2258909484eaf975b08e0f47a82788e
Reviewed-on: https://go-review.googlesource.com/11098
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agowiki article: remove "flag" import from the code
Alex Schroeder [Sun, 14 Jun 2015 10:54:05 +0000 (12:54 +0200)]
wiki article: remove "flag" import from the code

When reading along the article, the extra code added in the final
version is not explained. The main function calls flag.Parse(), for
example, which will cause an error, unless the readers looks at the
entirety of final.go to see the import added.

The file shown to the users no longer has the extra flags. The testing
code is now in a patch that gets applied to final.go in order to create
final-test.go. This is the file that will be used to test the code,
matching final.go as much as possible.

Change-Id: I022f5f6c88e107c8ba5623661d74a8d260d05266
Reviewed-on: https://go-review.googlesource.com/11061
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/trace: fix panic in goroutine profile
Dmitry Vyukov [Sun, 14 Jun 2015 20:58:54 +0000 (22:58 +0200)]
cmd/trace: fix panic in goroutine profile

In generateTrace we check that event timestamp is within the interesting range.
Then later in traceContext.time we double check event time.
However, for some events (e.g. emitSlice) we convert time of ev.Link (slice end) rather than ev itself (slice begin).
Slice end can be outside of the interesting time range, and so traceContext.time crashes.
Remove the check in traceContext.time, check in generateTrace loop is sufficient.

Change-Id: If94e93b5653c5816c0a8dcdd920f15df97616835
Reviewed-on: https://go-review.googlesource.com/11100
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agomisc/trace: update trace viewer
Dmitry Vyukov [Sun, 14 Jun 2015 19:52:57 +0000 (21:52 +0200)]
misc/trace: update trace viewer

Update to tip to fix #11003 (not possible to select events in chromium).
Fixed #11003

Change-Id: Ibba5d39ca809cfd5cb79c9e6d152b00899d49e08
Reviewed-on: https://go-review.googlesource.com/11062
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoarchive/zip: fix returned error on truncated data descriptor
Michael Gehring [Sat, 13 Jun 2015 09:38:34 +0000 (11:38 +0200)]
archive/zip: fix returned error on truncated data descriptor

Return io.ErrUnexpectedEOF instead of io.EOF when reading a truncated
data descriptor.

Fixes #11146.

Change-Id: Ia1905955165fd38af3c557d1fa1703ed8be893e2
Reviewed-on: https://go-review.googlesource.com/11070
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocrypto/tls: fix parsing of SNI extension.
Adam Langley [Sun, 14 Jun 2015 15:15:41 +0000 (08:15 -0700)]
crypto/tls: fix parsing of SNI extension.

The previous code had a brain fart: it took one of the length prefixes
as an element count, not a length. This didn't actually affect anything
because the loop stops as soon as it finds a hostname element, and the
hostname element is always the first and only element. (No other element
types have ever been defined.)

This change fixes the parsing in case SNI is ever changed in the future.

Fixes #10793.

Change-Id: Iafdf3381942bc22b1f33595315c53dc6cc2e9f0f
Reviewed-on: https://go-review.googlesource.com/11059
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoregexp: small correction to test comment
Michael Matloob [Sun, 14 Jun 2015 16:57:46 +0000 (09:57 -0700)]
regexp: small correction to test comment

s/Backtrace/Backtrack/

Change-Id: I062aab18f23f2bc2110cf7210c2e7264747e02cf
Reviewed-on: https://go-review.googlesource.com/11091
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agosyscall: skip TestCloneNEWUSERAndRemapNoRootDisableSetgroups before 3.19
Ian Lance Taylor [Sat, 13 Jun 2015 20:46:10 +0000 (13:46 -0700)]
syscall: skip TestCloneNEWUSERAndRemapNoRootDisableSetgroups before 3.19

The test fails on Ubuntu Trusty for some reason, probably because of
some set of kernel patches.

Change-Id: I52f7ca50b96fea5725817c9e9198860d419f9313
Reviewed-on: https://go-review.googlesource.com/11055
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agogo/types: exclude some example tests for arm64, nacl (fix build)
Robert Griesemer [Sat, 13 Jun 2015 04:11:34 +0000 (21:11 -0700)]
go/types: exclude some example tests for arm64, nacl (fix build)

TBR: bradfitz, adonovan

Change-Id: Ifc8574494848503c979d11e2766ba8da0f374068
Reviewed-on: https://go-review.googlesource.com/11043
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet: don't return non-nil interface values as Source, Addr in OpError
Mikio Hara [Fri, 29 May 2015 22:33:16 +0000 (07:33 +0900)]
net: don't return non-nil interface values as Source, Addr in OpError

Fixes #10992.

Change-Id: Ia376e4de118993b43e5813da57ab25fea8122048
Reviewed-on: https://go-review.googlesource.com/10476
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/asn1: check bounds when parsing tag and length
Kyle Isom [Thu, 4 Jun 2015 20:23:25 +0000 (13:23 -0700)]
encoding/asn1: check bounds when parsing tag and length

This was found while fuzzing another program, triggering a panic in
x509.ParseECPrivateKey.

Fixes #11154

Change-Id: Ief35ead38adf14caec4d37b9eacf8a92e67cd1e6
Reviewed-on: https://go-review.googlesource.com/10712
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agofmt: scanning widths apply after leading spaces
Rob Pike [Fri, 12 Jun 2015 23:17:08 +0000 (16:17 -0700)]
fmt: scanning widths apply after leading spaces

When scanning with a width, as in %5s, C skips leading spaces
brefore counting the 5 characters. We should do the same.

Reword the documentation about widths to make this clear.

Fixes #9444

Change-Id: I443a6441adcf1c834057ef3977f9116a987a79cd
Reviewed-on: https://go-review.googlesource.com/10997
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/vet: extend copylocks to anonymous functions
Josh Bleecher Snyder [Sat, 13 Jun 2015 02:49:45 +0000 (19:49 -0700)]
cmd/vet: extend copylocks to anonymous functions

Running -copylocks over a large corpus generates 1507 warnings.
Of those, only 3 are from the new anonymous function check,
but they are all bugs.

Fixes #10927.

Change-Id: I2672f6871036bed711beec5f88bc39aa8b3b6a94
Reviewed-on: https://go-review.googlesource.com/11051
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/parser: add ParseExprFrom function
Robert Griesemer [Fri, 12 Jun 2015 23:33:49 +0000 (16:33 -0700)]
go/parser: add ParseExprFrom function

This is needed for code that relies on having the correct file set
when parsing an expression only. There's currently no other way to
get to the file set otherwise or to invoke the parser correctly to
work on an expression only with a given file set.

Change-Id: I325f174cb34b69284e627f59fe8334efa4eaa45c
Reviewed-on: https://go-review.googlesource.com/10998
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agodoc/go1.5.txt: mention GidMappingsEnableSetgroups in linux SysProcAttr
Ian Lance Taylor [Fri, 12 Jun 2015 23:41:46 +0000 (16:41 -0700)]
doc/go1.5.txt: mention GidMappingsEnableSetgroups in linux SysProcAttr

Change-Id: I412621497902fa36f4939df392b10ca7040fc36e
Reviewed-on: https://go-review.googlesource.com/11003
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agosyscall: add GidMappingsEnableSetgroups to Linux SysProcAttr
Alexander Morozov [Wed, 3 Jun 2015 17:50:39 +0000 (10:50 -0700)]
syscall: add GidMappingsEnableSetgroups to Linux SysProcAttr

Linux 3.19 made a change in the handling of setgroups and the 'gid_map' file to
address a security issue.
The upshot of the 3.19 changes is that in order to update the 'gid_maps' file,
use of the setgroups() system call in this user namespace must first be disabled
by writing "deny" to one of the /proc/PID/setgroups files for this namespace.

Also added tests for remapping uid_map and gid_map inside new user
namespace.

Fixes #10626

Change-Id: I4d2539acbab741a37092d277e10f31fc39a8feb7
Reviewed-on: https://go-review.googlesource.com/10670
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: add Example of API usage
Alan Donovan [Thu, 11 Jun 2015 20:44:08 +0000 (16:44 -0400)]
go/types: add Example of API usage

Change-Id: I9d3253b80508d733053789d6cb9645e029bf52e4
Reviewed-on: https://go-review.googlesource.com/10927
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoarchive/tar: fix slice bounds out of range
Michael Gehring [Fri, 12 Jun 2015 20:49:42 +0000 (22:49 +0200)]
archive/tar: fix slice bounds out of range

Sanity check the pax-header size field before using it.

Fixes #11167.

Change-Id: I9d5d0210c3990e6fb9434c3fe333be0d507d5962
Reviewed-on: https://go-review.googlesource.com/10954
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agodoc/effective_go: fix grammatical error
Brandon Gilmore [Fri, 12 Jun 2015 18:32:22 +0000 (11:32 -0700)]
doc/effective_go: fix grammatical error

Change-Id: Ib52854169f3dd18f54d3ae9263c897d3f45ea869
Reviewed-on: https://go-review.googlesource.com/10982
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agofmt: require newlines to match when scanning with a format
Rob Pike [Fri, 5 Jun 2015 21:23:54 +0000 (14:23 -0700)]
fmt: require newlines to match when scanning with a format

The documentation says that newlines behave like this:

Scan etc.: newlines are spaces.
Scanln etc.: newlines terminate the scan.
Scanf etc.: newlines must match in input and format.

The code did not implement this behavior in all cases,
especially for Scanf. Make it behave:

- Fix the handling of spaces and newlines in ss.Advance.
The code is longer but now behaves as it should.

- Delete the reuse of the current ss in newScanState.
There is really no need, since it's only used in recursive
calls to Scan etc., and the flags are likely wrong. Simpler
just to allocate a new one every time, and likelier to
be correct.

Fixes #10862.

Change-Id: If060ac021017346723b0d62de4e5a305da898f68
Reviewed-on: https://go-review.googlesource.com/10991
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoencoding/csv: skip blank lines when FieldsPerRecord >= 0
Damien Neil [Wed, 3 Jun 2015 23:04:01 +0000 (16:04 -0700)]
encoding/csv: skip blank lines when FieldsPerRecord >= 0

Fixes #11050.

Change-Id: Ie5d16960a1f829af947d82a63fe414924cd02ff6
Reviewed-on: https://go-review.googlesource.com/10666
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agomime: add mime.types paths for BSDs
Michael Gehring [Thu, 11 Jun 2015 09:51:54 +0000 (11:51 +0200)]
mime: add mime.types paths for BSDs

Change-Id: I22ac23e7e180071de4443291e0a644675200d642
Reviewed-on: https://go-review.googlesource.com/10950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/go: fix documentation
Alexandre Cesaro [Fri, 12 Jun 2015 10:16:07 +0000 (12:16 +0200)]
cmd/go: fix documentation

The command "go tool pprof help" does not work:

    $ go tool pprof help
    open help: no such file or directory

The right command is "go tool pprof -h".

Change-Id: Icef5d4ab76774905854e46665ac1166d26d35f46
Reviewed-on: https://go-review.googlesource.com/10970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: convert testso test into Go
Alex Brainman [Tue, 2 Jun 2015 03:46:28 +0000 (13:46 +1000)]
cmd/dist: convert testso test into Go

I would like to re-apply reverted http://golang.org/cl/8523.
Reverted tests still fail in some environments (see issue #10360).
It is easier to run tests selectively when in Go.
This CL prepares for the changes.

Updates #10360

Change-Id: Iefeb1d71cb3d1cfa653a6ccd9f6e35686c0c5b24
Reviewed-on: https://go-review.googlesource.com/10608
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: clean up after 'go build' even on windows
Alex Brainman [Thu, 11 Jun 2015 02:20:42 +0000 (12:20 +1000)]
cmd/go: clean up after 'go build' even on windows

This CL makes CL 10682 work on windows.

Fixes #9645 (again)

Change-Id: Ie9b9af8b041c483a236b46adad4a50aa6e598c92
Reviewed-on: https://go-review.googlesource.com/10930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agospec: clarify meaning of x op= y
Robert Griesemer [Thu, 11 Jun 2015 20:21:46 +0000 (13:21 -0700)]
spec: clarify meaning of x op= y

Suggested by mdempsky (see also issue #11161).

Change-Id: I1ab28febe19b7a092029499015073ce8749b4d99
Reviewed-on: https://go-review.googlesource.com/10960
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: add some parallelism to the testsuite
Ian Lance Taylor [Wed, 10 Jun 2015 21:40:47 +0000 (14:40 -0700)]
cmd/go: add some parallelism to the testsuite

As these tests were originally in bash, they are not designed to be
particularly hermetic.  This CL adds various protective mechanisms to
try to catch cases where the tests can not run in parallel.

Change-Id: I983bf7b6ffba04eda58b4939eb89b0bdfcda8eff
Reviewed-on: https://go-review.googlesource.com/10911
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: in testsuite, sleep for less than one second if possible
Ian Lance Taylor [Thu, 11 Jun 2015 17:40:20 +0000 (10:40 -0700)]
cmd/go: in testsuite, sleep for less than one second if possible

Examine the mtime of an existing file to guess a length of time to
sleep to ensure a different mtime.

Change-Id: I9e8b5c9486f5c3c8bd63125e3ed4763ce1ba767d
Reviewed-on: https://go-review.googlesource.com/10932
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: wait to update arena_used until after mapping bitmap
Russ Cox [Mon, 8 Jun 2015 02:59:29 +0000 (22:59 -0400)]
runtime: wait to update arena_used until after mapping bitmap

This avoids a race with gcmarkwb_m that was leading to faults.

Fixes #10212.

Change-Id: I6fcf8d09f2692227063ce29152cb57366ea22487
Reviewed-on: https://go-review.googlesource.com/10816
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/vet: skip another test on Android
Brad Fitzpatrick [Thu, 11 Jun 2015 15:22:56 +0000 (08:22 -0700)]
cmd/vet: skip another test on Android

Forgot this one in my previous commit.

Change-Id: Ief089e99bdad24b3bcfb075497dc259d06cc727c
Reviewed-on: https://go-review.googlesource.com/10913
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/go: reject relative paths that don't start with a dot (.)
Chris Broadfoot [Thu, 4 Jun 2015 23:16:14 +0000 (16:16 -0700)]
cmd/go: reject relative paths that don't start with a dot (.)

Change-Id: Idc4a7fdb561ba5b3b52094d895deaf3fcdf475bf
Reviewed-on: https://go-review.googlesource.com/10716
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go, cmd/vet: skip tests on Android
Brad Fitzpatrick [Thu, 11 Jun 2015 14:26:44 +0000 (07:26 -0700)]
cmd/go, cmd/vet: skip tests on Android

Might get the Android build passing, or at least going further.

Change-Id: I08f97156a687abe5a3d95203922f4ffd84fbb212
Reviewed-on: https://go-review.googlesource.com/10924
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoall: fix misprints in comments
Ainar Garipov [Thu, 11 Jun 2015 13:49:38 +0000 (16:49 +0300)]
all: fix misprints in comments

These were found by grepping the comments from the go code and feeding
the output to aspell.

Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: remove Stat workaround for Plan 9
David du Colombier [Thu, 11 Jun 2015 05:50:59 +0000 (07:50 +0200)]
cmd/go: remove Stat workaround for Plan 9

This issue was fixed in CL 10900.

Change-Id: I88f107cb73c8a515f39e02506ddd2ad1e286b1fb
Reviewed-on: https://go-review.googlesource.com/10940
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: fix error returned by dirstat on Plan 9
David du Colombier [Wed, 10 Jun 2015 20:32:14 +0000 (22:32 +0200)]
os: fix error returned by dirstat on Plan 9

When the Stat or Fstat system calls return -1,
dirstat incorrectly returns ErrShortStat.

However, the error returned by Stat or Fstat
could be different. For example, when the
file doesn't exist, they return "does not exist".

Dirstat should return the error returned by
the system call.

Fixes #10911.
Fixes #11132.

Change-Id: Icf242d203d256f12366b1e277f99b1458385104a
Reviewed-on: https://go-review.googlesource.com/10900
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: fix a race between Process.signal() and wait() on Windows
Patrick Mezard [Sun, 10 May 2015 13:35:52 +0000 (15:35 +0200)]
os: fix a race between Process.signal() and wait() on Windows

Process.handle was accessed without synchronization while wait() and
signal() could be called concurrently.

A first solution was to add a Mutex in Process but it was probably too
invasive given Process.handle is only used on Windows.

This version uses atomic operations to read the handle value. There is
still a race between isDone() and the value of the handle, but it only
leads to slightly incorrect error codes. The caller may get a:

  errors.New("os: process already finished")

instead of:

  syscall.EINVAL

which sounds harmless.

Fixes #9382

Change-Id: Iefcc687a1166d5961c8f27154647b9b15a0f748a
Reviewed-on: https://go-review.googlesource.com/9904
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: rewrite testsuite from bash to Go
Ian Lance Taylor [Tue, 9 Jun 2015 17:30:08 +0000 (10:30 -0700)]
cmd/go: rewrite testsuite from bash to Go

Change-Id: I8473e3f7653d5389d5fcd94862f0831049b8266e
Reviewed-on: https://go-review.googlesource.com/10809
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/zip: clarify that CreateHeader takes ownership of FileHeader
Brad Fitzpatrick [Wed, 10 Jun 2015 18:19:14 +0000 (11:19 -0700)]
archive/zip: clarify that CreateHeader takes ownership of FileHeader

Fixes #11144

Change-Id: I1da0b72ef00a84c9b5751be0e72ad07d664bc98b
Reviewed-on: https://go-review.googlesource.com/10883
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoencoding/csv: fix comment in parseRecord
Ainar Garipov [Wed, 10 Jun 2015 13:28:51 +0000 (16:28 +0300)]
encoding/csv: fix comment in parseRecord

Change-Id: I82edd9364e1b4634006f5e043202a69f383dcdbe
Reviewed-on: https://go-review.googlesource.com/10826
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: stop linker crashing with -s flag on windows
Alex Brainman [Tue, 9 Jun 2015 06:16:42 +0000 (16:16 +1000)]
cmd/link: stop linker crashing with -s flag on windows

Update #10254

Change-Id: I3ddd26607813ca629e3ab62abf87dc5ab453e36f
Reviewed-on: https://go-review.googlesource.com/10835
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: correct a drifted comment in referencing m->locked.
Yongjian Xu [Wed, 10 Jun 2015 05:51:25 +0000 (22:51 -0700)]
runtime: correct a drifted comment in referencing m->locked.

Change-Id: Ida4b98aa63e57594fa6fa0b8178106bac9b3cd19
Reviewed-on: https://go-review.googlesource.com/10837
Reviewed-by: Minux Ma <minux@golang.org>
9 years ago.gitignore: ignore y.output
Josh Bleecher Snyder [Tue, 9 Jun 2015 21:15:41 +0000 (14:15 -0700)]
.gitignore: ignore y.output

Change-Id: I95b72b6be39fbb923b5f0743d17d7f8bd3ee3814
Reviewed-on: https://go-review.googlesource.com/10860
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/ios: document the external binary and the required env variables
Burcu Dogan [Mon, 4 May 2015 16:41:41 +0000 (12:41 -0400)]
misc/ios: document the external binary and the required env variables

Change-Id: I1ec2460758b19e5315be061033c1bb5ed9ead4a8
Reviewed-on: https://go-review.googlesource.com/9688
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile: fix builtin generation
Josh Bleecher Snyder [Tue, 9 Jun 2015 21:12:39 +0000 (14:12 -0700)]
cmd/compile: fix builtin generation

This was a refactoring bug during
'go tool compile', CL 10289.

Change-Id: Ibfd333be39ec72bba331fdf352df619cc21851a9
Reviewed-on: https://go-review.googlesource.com/10849
Reviewed-by: Minux Ma <minux@golang.org>
9 years agodoc/go1.5.txt: mention that 1.5 supports non-standard GCM lengths.
Adam Langley [Tue, 9 Jun 2015 18:47:45 +0000 (11:47 -0700)]
doc/go1.5.txt: mention that 1.5 supports non-standard GCM lengths.

Change-Id: I7cad3f7af2452e29b3dae3da87cbd24013f6dae6
Reviewed-on: https://go-review.googlesource.com/10850
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/cipher: Support unusual GCM nonce lengths
Carl Jackson [Fri, 17 Apr 2015 07:52:40 +0000 (00:52 -0700)]
crypto/cipher: Support unusual GCM nonce lengths

GCM is traditionally used with a 96-bit nonce, but the standard allows
for nonces of any size. Non-standard nonce sizes are required in some
protocols, so add support for them in crypto/cipher's GCM
implementation.

Change-Id: I7feca7e903eeba557dcce370412b6ffabf1207ab
Reviewed-on: https://go-review.googlesource.com/8946
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agodoc: updated language about the AUTHORS/CONTRIBUTORS update
Dmitry Savintsev [Tue, 9 Jun 2015 10:01:38 +0000 (12:01 +0200)]
doc: updated language about the AUTHORS/CONTRIBUTORS update

Reflect the process changes where AUTHORS and CONTRIBUTORS
files are updated automatically based on commit logs
and Google committers no longer need to do it manually
on the first contributors.

The documentation update will help to avoid requests to be
added from new contributors.

Change-Id: I67daae5bd21246cf79fe3724838889b929bc5e66
Reviewed-on: https://go-review.googlesource.com/10824
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: use generated temps in bool codegen
Josh Bleecher Snyder [Mon, 8 Jun 2015 23:21:50 +0000 (16:21 -0700)]
cmd/compile: use generated temps in bool codegen

Bool codegen was generating a temp for function calls
and other complex expressions, but was not using it.

This was a refactoring bug introduced by CL 7853.
The cmp code used to do (in short):

l, r := &n1, &n2

It was changed to:

l, r := nl, nr

But the requisite assignments:

nl, nr = &n1, &n2

were only introduced on one of two code paths.

Fixes #10654.

Change-Id: Ie8de0b3a333842a048d4308e02911bb10c6915ce
Reviewed-on: https://go-review.googlesource.com/10844
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: don't require an explicit client-auth EKU.
Adam Langley [Mon, 8 Jun 2015 21:24:18 +0000 (14:24 -0700)]
crypto/tls: don't require an explicit client-auth EKU.

Previously we enforced both that the extended key usages of a client
certificate chain allowed for client authentication, and that the
client-auth EKU was in the leaf certificate.

This change removes the latter requirement. It's still the case that the
chain must be compatible with the client-auth EKU (i.e. that a parent
certificate isn't limited to another usage, like S/MIME), but we'll now
accept a leaf certificate with no EKUs for client-auth.

While it would be nice if all client certificates were explicit in their
intended purpose, I no longer feel that this battle is worthwhile.

Fixes #11087.

Change-Id: I777e695101cbeba069b730163533e2977f4dc1fc
Reviewed-on: https://go-review.googlesource.com/10806
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>