]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoos: fix rename on Plan 9
David du Colombier [Thu, 7 Jan 2016 06:45:59 +0000 (07:45 +0100)]
os: fix rename on Plan 9

Rename should remove newname if the file already exists
and is not a directory.

Fixes #13844.

Change-Id: I85a5cc28e8d161637a8bc1de33f4a637d9154cd1
Reviewed-on: https://go-review.googlesource.com/18291
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoA+C: manual updates
Brad Fitzpatrick [Thu, 7 Jan 2016 20:25:09 +0000 (12:25 -0800)]
A+C: manual updates

Add Colin Cross (Google CLA)
Add Quentin Perez (Individual CLA)
Add Andy Balholm (Individual CLA)
Add Dirk Gadsden (Individual CLA)
Add Derek Che (Yahoo CLA)

And:

Add CL Sung (Individual CLA), but where gerrit is using personal email
address with CLA signed, but the git commit itself is using an
unverified htc.com address. The commit is:
    https://github.com/golang/oauth2/commit/099e4f0
For github user https://github.com/clsung which says "Self-Employed"
and "clsung@gmail.com". Perhaps the self-employed part is new
since Sep 10, 2014.

Change-Id: Ic1130fb79d167259a9bb76e3be56b9c8ad6b95ca
Reviewed-on: https://go-review.googlesource.com/18369
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: fix too-strict validation of server header values
Brad Fitzpatrick [Fri, 8 Jan 2016 01:06:00 +0000 (01:06 +0000)]
net/http: fix too-strict validation of server header values

As Andy Balholm noted in #11207:

"RFC2616 §4.2 says that a header's field-content can consist of *TEXT,
and RFC2616 §2.2 says that TEXT is <any OCTET except CTLs, but
including LWS>, so that would mean that bytes greater than 128 are
allowed."

This is a partial rollback of the strictness from
https://golang.org/cl/11207 (added in the Go 1.6 dev cycle, only
released in Go 1.6beta1)

Fixes #11207

Change-Id: I3a752a7941de100e4803ff16a5d626d5cfec4f03
Reviewed-on: https://go-review.googlesource.com/18374
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agogo/doc: don't drop "factory" functions with dot-imported result types
Robert Griesemer [Fri, 8 Jan 2016 02:40:40 +0000 (18:40 -0800)]
go/doc: don't drop "factory" functions with dot-imported result types

Fixes #13742.

Change-Id: I7c8b51b60e31402bf708bf8d70e07fd06295e8ce
Reviewed-on: https://go-review.googlesource.com/18393
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/cgo, runtime: recognize unsafe.Pointer(&s[0]) in cgo pointer checks
Ian Lance Taylor [Thu, 7 Jan 2016 23:22:39 +0000 (15:22 -0800)]
cmd/cgo, runtime: recognize unsafe.Pointer(&s[0]) in cgo pointer checks

It's fairly common to call cgo functions with conversions to
unsafe.Pointer or other C types.  Apply the simpler checking of address
expressions when possible when the address expression occurs within a
type conversion.

Change-Id: I5187d4eb4d27a6542621c396cad9ee4b8647d1cd
Reviewed-on: https://go-review.googlesource.com/18391
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotime: restore old error text for day out of range
Russ Cox [Thu, 7 Jan 2016 20:36:54 +0000 (15:36 -0500)]
time: restore old error text for day out of range

Go 1.5 and earlier said "day out of range".
As part of working on this code it morphed into "day of month out of range".
To avoid churn in the output restore the old text.

This fixes some tests reported privately.

Change-Id: If179676cd49f9a471a9441fec2f5220c85eb0799
Reviewed-on: https://go-review.googlesource.com/18386
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: LookupAddr("127.0.0.1") is "localhost" not "localhost."
Russ Cox [Thu, 7 Jan 2016 01:37:05 +0000 (20:37 -0500)]
net: LookupAddr("127.0.0.1") is "localhost" not "localhost."

Fixes #13564.

Change-Id: I30c827ef4a112fee21b8493a67d0227109e35072
Reviewed-on: https://go-review.googlesource.com/18384
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: document GODEBUG settings, update bundled http2
Brad Fitzpatrick [Thu, 7 Jan 2016 23:43:52 +0000 (23:43 +0000)]
net/http: document GODEBUG settings, update bundled http2

Document the three GODEBUG environment variables in the package doc.

Updates the bundled http2 to x/net git rev 415f1917
for https://golang.org/cl/18372.

Fixes #13611

Change-Id: I3116c5d7de70d3d15242d7198f3758b1fb7d94b9
Reviewed-on: https://go-review.googlesource.com/18373
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: add some tests around sending & receiving star requests
Brad Fitzpatrick [Thu, 7 Jan 2016 19:57:49 +0000 (11:57 -0800)]
net/http: add some tests around sending & receiving star requests

I thought there was still work to do in http2 for this, but I guess
not: the work for parsing them is in net/url (used by http2) and the
handling of OPTIONS * is already in net/http serverHandler, also used
by http2.

But keep the tests.

Change-Id: I566dd0a03cf13c9ea8e735c6bd32d2c521ed503b
Reviewed-on: https://go-review.googlesource.com/18368
Reviewed-by: Blake Mizerany <blake.mizerany@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/compile: recognize !typedbool is typed
Matthew Dempsky [Thu, 7 Jan 2016 11:06:49 +0000 (03:06 -0800)]
cmd/compile: recognize !typedbool is typed

Adding the evconst(n) call for OANDAND and OOROR in
golang.org/cl/18262 was originally just to parallel the above iscmp
branch, but upon further inspection it seemed odd that removing it
caused test/fixedbugs/issue6671.go's

    var b mybool
    // ...
    b = bool(true) && true // ERROR "cannot use"

to start failing (i.e., by not emitting the expected "cannot use"
error).

The problem is that evconst(n)'s settrue and setfalse paths always
reset n.Type to idealbool, even for logical operators where n.Type
should preserve the operand type.  Adding the evconst(n) call for
OANDAND/OOROR inadvertantly worked around this by turning the later
evconst(n) call at line 2167 into a noop, so the "n.Type = t"
assignment at line 739 would preserve the operand type.

However, that means evconst(n) was still clobbering n.Type for ONOT,
so declarations like:

    const _ bool = !mybool(true)

were erroneously accepted.

Update #13821.

Change-Id: I18e37287f05398fdaeecc0f0d23984e244f025da
Reviewed-on: https://go-review.googlesource.com/18362
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix sigprof stack barrier locking
Austin Clements [Tue, 5 Jan 2016 20:21:27 +0000 (15:21 -0500)]
runtime: fix sigprof stack barrier locking

f90b48e intended to require the stack barrier lock in all cases of
sigprof that walked the user stack, but got it wrong. In particular,
if sp < gp.stack.lo || gp.stack.hi < sp, tracebackUser would be true,
but we wouldn't acquire the stack lock. If it then turned out that we
were in a cgo call, it would walk the stack without the lock.

In fact, the whole structure of stack locking is sigprof is somewhat
wrong because it assumes the G to lock is gp.m.curg, but all three
gentraceback calls start from potentially different Gs.

To fix this, we lower the gcTryLockStackBarriers calls much closer to
the gentraceback calls. There are now three separate trylock calls,
each clearly associated with a gentraceback and the locked G clearly
matches the G from which the gentraceback starts. This actually brings
the sigprof logic closer to what it originally was before stack
barrier locking.

This depends on "runtime: increase assumed stack size in
externalthreadhandler" because it very slightly increases the stack
used by sigprof; without this other commit, this is enough to blow the
profiler thread's assumed stack size.

Fixes #12528 (hopefully for real this time!).

For the 1.5 branch, though it will require some backporting. On the
1.5 branch, this will *not* require the "runtime: increase assumed
stack size in externalthreadhandler" commit: there's no pcvalue cache,
so the used stack is smaller.

Change-Id: Id2f6446ac276848f6fc158bee550cccd03186b83
Reviewed-on: https://go-review.googlesource.com/18328
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: increase assumed stack size in externalthreadhandler
Austin Clements [Wed, 6 Jan 2016 17:17:46 +0000 (12:17 -0500)]
runtime: increase assumed stack size in externalthreadhandler

On Windows, externalthreadhandler currently sets the assumed stack
size for the profiler thread and the ctrlhandler threads to 8KB. The
actual stack size is determined by the SizeOfStackReserve field in the
binary set by the linker, which is currently at least 64KB (and
typically 128KB).

It turns out the profiler thread is running within a few words of the
8KB-(stack guard) bound set by externalthreadhandler. If it overflows
this bound, morestack crashes unceremoniously with an access
violation, which we then fail to handle, causing the whole process to
exit without explanation.

To avoid this problem and give us some breathing room, increase the
assumed stack size in externalthreadhandler to 32KB (there's some
unknown amount of stack already in use, so it's not safe to increase
this all the way to the reserve size).

We also document the relationships between externalthreadhandler and
SizeOfStackReserve to make this more obvious in the future.

Change-Id: I2f9f9c0892076d78e09827022ff0f2bedd9680a9
Reviewed-on: https://go-review.googlesource.com/18304
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: don't ignore success of cgo profiling tracebacks
Austin Clements [Wed, 6 Jan 2016 19:02:50 +0000 (14:02 -0500)]
runtime: don't ignore success of cgo profiling tracebacks

If a sigprof happens during a cgo call, we traceback from the entry
point of the cgo call. However, if the SP is outside of the G's stack,
we'll then ignore this traceback, even if it was successful, and
overwrite it with just _ExternalCode.

Fix this by accepting any successful traceback, regardless of whether
we got it from a cgo entry point or from regular Go code.

Fixes #13466.

Change-Id: I5da9684361fc5964f44985d74a8cdf02ffefd213
Reviewed-on: https://go-review.googlesource.com/18327
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: document ":port" syntax in Dial, Listen, ListenPacket
Russ Cox [Thu, 7 Jan 2016 01:55:59 +0000 (20:55 -0500)]
net: document ":port" syntax in Dial, Listen, ListenPacket

Change-Id: Ideb4bd9ffb1b5f1aef7d94ff791a262f54a650d5
Reviewed-on: https://go-review.googlesource.com/18344
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: add pointer to net and net/http for more GODEBUG settings
Russ Cox [Thu, 7 Jan 2016 03:04:06 +0000 (22:04 -0500)]
runtime: add pointer to net and net/http for more GODEBUG settings

net has GODEBUG text already.
net/http still needs it (leaving for Brad).

For #13611.

Change-Id: Icea1027924a23a687cbbe4001985e8c6384629d7
Reviewed-on: https://go-review.googlesource.com/18346
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: update bundled http2, fixes TestConcurrentReadWriteReqBody_h2
Brad Fitzpatrick [Thu, 7 Jan 2016 04:59:25 +0000 (04:59 +0000)]
net/http: update bundled http2, fixes TestConcurrentReadWriteReqBody_h2

Updates http2 to x/net git rev 520af5de654d for
https://golang.org/cl/18370

Fixes #13659

Change-Id: I920eaff6036ac22c500a97449826c6b12f873d7f
Reviewed-on: https://go-review.googlesource.com/18371
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: Minor fix to error messages in test.
Michael McGreevy [Thu, 7 Jan 2016 02:32:46 +0000 (13:32 +1100)]
net/http: Minor fix to error messages in test.

Change-Id: I995ac0559f89110662d79d136d710ef3a0bb1505
Reviewed-on: https://go-review.googlesource.com/18351
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: mention that Go no longer calls timeBeginPeriod(1) on Windows
Russ Cox [Thu, 7 Jan 2016 02:28:06 +0000 (21:28 -0500)]
doc: mention that Go no longer calls timeBeginPeriod(1) on Windows

Fixes #13731.

Change-Id: Iaf70a8b41c947f0d86013808564112ab676136e3
Reviewed-on: https://go-review.googlesource.com/18345
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agodoc: update 1.6 release notes with buildmode progress
Michael Hudson-Doyle [Wed, 6 Jan 2016 23:50:13 +0000 (12:50 +1300)]
doc: update 1.6 release notes with buildmode progress

Fixes #13358

Change-Id: I57ed50c2610cab11fb3d9749f9e7d4a37daa7977
Reviewed-on: https://go-review.googlesource.com/18276
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: remove note about installing from source for ARM
Russ Cox [Wed, 6 Jan 2016 20:47:47 +0000 (15:47 -0500)]
doc: remove note about installing from source for ARM

Now there are ARM downloads too.

Change-Id: I236381508c69d56748e672d184b92caa715e81ae
Reviewed-on: https://go-review.googlesource.com/18342
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: update bundled http2; fixes TestTransportAndServerSharedBodyRace_h2
Brad Fitzpatrick [Thu, 7 Jan 2016 00:51:13 +0000 (00:51 +0000)]
net/http: update bundled http2; fixes TestTransportAndServerSharedBodyRace_h2

Update bundled http2 to git rev d1ba260648 (https://golang.org/cl/18288).

Fixes the flaky TestTransportAndServerSharedBodyRace_h2.

Also adds some debugging to TestTransportAndServerSharedBodyRace_h2
which I hope won't ever be necessary again, but I know will be.

Fixes #13556

Change-Id: Ibcf2fc23ec0122dcac8891fdc3bd7f8acddd880e
Reviewed-on: https://go-review.googlesource.com/18289
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodoc: show relevant test instructions on install page
Andrew Gerrand [Wed, 6 Jan 2016 23:53:07 +0000 (10:53 +1100)]
doc: show relevant test instructions on install page

Fixes golang/go#12490

Change-Id: I0861e62aaa589fc63217c83e9c227c17e35cda75
Reviewed-on: https://go-review.googlesource.com/18277
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomisc/cgo/testcarchive,testcshared: deflake tests
Ian Lance Taylor [Thu, 7 Jan 2016 00:43:21 +0000 (16:43 -0800)]
misc/cgo/testcarchive,testcshared: deflake tests

After a failure on the build dashboard I tested testcarchive test 2 and
found that it failed an average of 1 in 475 runs on my laptop.  With
this change it ran over 50,000 times without failing.  I bumped up the
other iteration limits to correspond.

Change-Id: I0155c68161a2c2a09ae25c91e9269f1e8702628d
Reviewed-on: https://go-review.googlesource.com/18309
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/dist: improve isGitRepo to handle git "worktree"s
Tamir Duberstein [Wed, 30 Dec 2015 16:15:38 +0000 (11:15 -0500)]
cmd/dist: improve isGitRepo to handle git "worktree"s

Simply checking the exit code of `git rev-parse --git-dir` should
suffice here, but that requires deviating from the infrastructure
provided by `run`, so I've left that for a future change.

Originally by Tamir Duberstein but updated by iant & rsc to add
the filepath.Join logic.

Fixes #11211 (again).

Change-Id: I6d29b5ae39ba456088ae1fb5d41014cb91c86897
Reviewed-on: https://go-review.googlesource.com/18323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: for go get -insecure, skip TLS certificate checking
Russ Cox [Wed, 6 Jan 2016 18:52:48 +0000 (13:52 -0500)]
cmd/go: for go get -insecure, skip TLS certificate checking

The flag is already named -insecure. Make it more so.

If we're willing to accept HTTP, it's not much worse to accept
HTTPS man-in-the-middle attacks too. This allows servers
with self-signed certificates to work.

Fixes #13197.

Change-Id: Ia5491410bc886da0a26ef3bce4bf7d732f5e19e4
Reviewed-on: https://go-review.googlesource.com/18324
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http, net/http/httputil: fix nits found by vet
Mikio Hara [Thu, 7 Jan 2016 00:36:52 +0000 (09:36 +0900)]
net/http, net/http/httputil: fix nits found by vet

Change-Id: Idf02428591f61dc58f654fdaf0e3a55f8b8a1060
Reviewed-on: https://go-review.googlesource.com/18350
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/zip: fix reading, writing of zip64 archives
Russ Cox [Wed, 6 Jan 2016 17:22:16 +0000 (12:22 -0500)]
archive/zip: fix reading, writing of zip64 archives

Read zip files that contain only 64-bit header offset, not 64-bit sizes.
Fixes #13367.

Read zip files that contain completely unexpected Extra fields,
provided we do not need to find 64-bit size or header offset information there.
Fixes #13166.

Write zip file entries with 0xFFFFFFFF uncompressed data bytes
correctly (must use zip64 header, since that's the magic indicator).
Fixes new TestZip64EdgeCase. (Noticed while working on the CL.)

Change-Id: I84a22b3995fafab8052b99de8094a9f35a25de5b
Reviewed-on: https://go-review.googlesource.com/18317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: document that Rename overwrites existing file
Russ Cox [Wed, 6 Jan 2016 19:43:16 +0000 (14:43 -0500)]
os: document that Rename overwrites existing file

Fixes #13673.

Change-Id: I60d1603ca0dfd2ae136117e0f89cee4b6fc6c3d3
Reviewed-on: https://go-review.googlesource.com/18332
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/build: allow @ in #cgo directives for OS X
Russ Cox [Wed, 6 Jan 2016 19:33:25 +0000 (14:33 -0500)]
go/build: allow @ in #cgo directives for OS X

Fixes #13720.

Change-Id: I2e48454696f37db419370630f913590c435cd9f0
Reviewed-on: https://go-review.googlesource.com/18331
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agodoc: fix incorrect example in asm.html
Ian Lance Taylor [Wed, 6 Jan 2016 22:58:54 +0000 (14:58 -0800)]
doc: fix incorrect example in asm.html

Fixes #13845.

Change-Id: Ie83179b2d20c47a0296645d9e2fdc43271be495a
Reviewed-on: https://go-review.googlesource.com/18307
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: set new m signal mask to program startup mask
Ian Lance Taylor [Sat, 19 Dec 2015 18:17:10 +0000 (10:17 -0800)]
runtime: set new m signal mask to program startup mask

We were setting the signal mask of a new m to the signal mask of the m
that created it.  That failed when that m happened to be the one created
by ensureSigM, which sets its signal mask to only include the signals
being caught by os/signal.Notify.

Fixes #13164.
Update #9896.

Change-Id: I705c196fe9d11754e10bab9e9b2e7530ecdfa367
Reviewed-on: https://go-review.googlesource.com/18064
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: preserve signal stack when calling Go on C thread
Ian Lance Taylor [Thu, 24 Dec 2015 02:38:18 +0000 (18:38 -0800)]
runtime: preserve signal stack when calling Go on C thread

When calling a Go function on a C thread, if the C thread already has an
alternate signal stack, use that signal stack instead of installing a
new one.

Update #9896.

Change-Id: I62aa3a6a4a1dc4040fca050757299c8e6736987c
Reviewed-on: https://go-review.googlesource.com/18108
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime/pprof: skip TestStackBarrierProfiling on dragonfly too
Brad Fitzpatrick [Wed, 6 Jan 2016 21:10:22 +0000 (13:10 -0800)]
runtime/pprof: skip TestStackBarrierProfiling on dragonfly too

Just saw a few dragonfly failures here.

I'm tempted to preemptively add plan9 here too, but I'll wait until
I see it fail.

Change-Id: Ic99fc088dbfd1aa21f509148aee98ccfe7f640bf
Reviewed-on: https://go-review.googlesource.com/18306
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: document release support policy
Russ Cox [Wed, 6 Jan 2016 20:41:37 +0000 (15:41 -0500)]
doc: document release support policy

Fixes #12790.

Change-Id: I0f231d198c76632c23692fc1337b57cfeafaf4c7
Reviewed-on: https://go-review.googlesource.com/18338
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc: document linux/ppc64 kernel requirement (2.6.37 or later)
Russ Cox [Wed, 6 Jan 2016 20:51:01 +0000 (15:51 -0500)]
doc: document linux/ppc64 kernel requirement (2.6.37 or later)

Fixes #13269.

Change-Id: I960d1825bda9d8873c2a9005872c45e4c7d30111
Reviewed-on: https://go-review.googlesource.com/18339
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: fix source link in gdb docs
Russ Cox [Wed, 6 Jan 2016 20:26:45 +0000 (15:26 -0500)]
doc: fix source link in gdb docs

Fixes #12059.

Change-Id: Ib5caf8133cd3ed888f9102dfbfeca11c506f3b5b
Reviewed-on: https://go-review.googlesource.com/18337
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: do not force use of git master branch (again)
Russ Cox [Wed, 6 Jan 2016 20:14:05 +0000 (15:14 -0500)]
cmd/go: do not force use of git master branch (again)

This time with a test.
Also adjust another test to skip when hg is not present,
and delete no longer needed fixDetachedHead code.

Fixes #9032 (again).

Change-Id: I481717409e1d44b524f83c70a8dc377699d1a2a5
Reviewed-on: https://go-review.googlesource.com/18334
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: discuss copyright changes in contribute.html
Russ Cox [Wed, 6 Jan 2016 20:23:47 +0000 (15:23 -0500)]
doc: discuss copyright changes in contribute.html

Fixes #12542.

Change-Id: Icd0fa84d891d6b1feab9b4d4dd319cdf1e6d6c48
Reviewed-on: https://go-review.googlesource.com/18336
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: check /etc/hosts for modifications every 5 seconds, not 5 minutes
Russ Cox [Tue, 5 Jan 2016 02:04:01 +0000 (21:04 -0500)]
net: check /etc/hosts for modifications every 5 seconds, not 5 minutes

But also cache the previous parsed form and don't reread if the
size and modification time are both unchanged from before.

On systems with stable /etc/hosts this should result in more stat calls
but only a single parsing of /etc/hosts.

On systems with variable /etc/hosts files (like some Docker systems)
this should result in quicker adoption of changes.

Fixes #13340.

Change-Id: Iba93b204be73d6d903cd17c58038a4fcfd0952b9
Reviewed-on: https://go-review.googlesource.com/18258
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: fix flaky TestTransportCancelBeforeResponseHeaders test
Brad Fitzpatrick [Wed, 6 Jan 2016 19:52:51 +0000 (19:52 +0000)]
net/http: fix flaky TestTransportCancelBeforeResponseHeaders test

Add a couple more cases where we convert random network I/O errors
into errRequestCanceled if the request was forcefully aborted.

It failed ~1/1000 times without -race, or very easily with -race.
(due to -race randomizing some scheduling)

Fixes #11894

Change-Id: Ib1c123ce1eebdd88642da28a5948ca4f30581907
Reviewed-on: https://go-review.googlesource.com/18287
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: add mechanism for marking flaky http tests
Brad Fitzpatrick [Wed, 6 Jan 2016 19:19:39 +0000 (19:19 +0000)]
net/http: add mechanism for marking flaky http tests

This shouldn't need to exist in general, but in practice I want something
like this a few times per year.

Change-Id: I9c220e58be44b7726f75d776f714212c570cf8bb
Reviewed-on: https://go-review.googlesource.com/18286
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/play: update URL for concurrent pi
Russ Cox [Wed, 6 Jan 2016 20:12:43 +0000 (15:12 -0500)]
doc/play: update URL for concurrent pi

The old link died; replace with an archive.org copy.

Fixes #13345.

Change-Id: Ic4a7fdcf258e1ff3b4a02ecb4f237ae7db2686c7
Reviewed-on: https://go-review.googlesource.com/18335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: update bundled http2, add test for Transport's User-Agent behavior
Brad Fitzpatrick [Wed, 6 Jan 2016 07:14:49 +0000 (07:14 +0000)]
net/http: update bundled http2, add test for Transport's User-Agent behavior

Adds a test that both http1 and http2's Transport send a default
User-Agent, with the same behavior.

Updates bundled http2 to golang.org/x/net git rev 1ade16a545 (for
https://go-review.googlesource.com/18285)

The http1 behavior changes slightly: if req.Header["User-Agent"] is
defined at all, even if it's nil or a zero-length slice, then the
User-Agent header is omitted. This is a slight behavior change for
http1, but is consistent with how http1 & http2 do optional headers
elsewhere (such as "Date", "Content-Type"). The old behavior (set it
explicitly to "", aka []string{""}) still works as before. And now
there are even tests.

Fixes #13685

Change-Id: I5786a6913b560de4a5f1f90e595fe320ff567adf
Reviewed-on: https://go-review.googlesource.com/18284
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/importer: always handle forward-declared imports in export data
Robert Griesemer [Wed, 6 Jan 2016 01:21:09 +0000 (17:21 -0800)]
go/importer: always handle forward-declared imports in export data

The textual export data generated by gc sometimes contains forward
references of packages. In rare cases such forward-referenced packages
were not created when needed because no package name was present.

Create unnamed packages in this case and set the name later when it
becomes known.

Fixes #13566.

Change-Id: I193e0ec712e874030b194ab8ecb3fca140f7997a
Reviewed-on: https://go-review.googlesource.com/18301
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agotesting: move comment inside T.Parallel
Russ Cox [Tue, 29 Dec 2015 17:10:01 +0000 (12:10 -0500)]
testing: move comment inside T.Parallel

This was supposed to be in CL 18204 but I submitted from the web
instead of my computer and lost this final edit.

Change-Id: I41598e936bb088d77f5e44752eda74222a4208c7
Reviewed-on: https://go-review.googlesource.com/18310
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: fix timeout test bug
Russ Cox [Wed, 6 Jan 2016 15:53:16 +0000 (10:53 -0500)]
net: fix timeout test bug

This was supposed to be in CL 18205 but I submitted via the web
instead of from my computer, so it got lost.
May deflake some things.

Change-Id: I880fb74b5943b8a17f952a82639c60126701187a
Reviewed-on: https://go-review.googlesource.com/18259
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime/pprof: point to new docs about kernel bugs
Russ Cox [Wed, 6 Jan 2016 15:50:52 +0000 (10:50 -0500)]
runtime/pprof: point to new docs about kernel bugs

Change-Id: I8ee338c1244fc4e2fb75deec752a7f83239c33ea
Reviewed-on: https://go-review.googlesource.com/18257
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: assume amd64 on OS X, don't run sysctl
Russ Cox [Wed, 6 Jan 2016 16:12:10 +0000 (11:12 -0500)]
cmd/dist: assume amd64 on OS X, don't run sysctl

Fixes #13425.

Change-Id: I82f49d07841e89fc4f3fde9ea41e710a634579d0
Reviewed-on: https://go-review.googlesource.com/18313
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotime: document that RFC1123 is wrong for times in UTC
Russ Cox [Wed, 6 Jan 2016 16:23:03 +0000 (11:23 -0500)]
time: document that RFC1123 is wrong for times in UTC

Fixes #13781.

Change-Id: Icfac8f2bfc3a4106f646409cfdc053df1e0cd76a
Reviewed-on: https://go-review.googlesource.com/18314
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoos/exec: document that examples assume Unix
Russ Cox [Wed, 6 Jan 2016 16:27:14 +0000 (11:27 -0500)]
os/exec: document that examples assume Unix

Fixes #13693.

Change-Id: Ieb89d8a8874ee8c6b304de99dceb07193c26b60e
Reviewed-on: https://go-review.googlesource.com/18315
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotest/bench/shootout: delete
Russ Cox [Wed, 6 Jan 2016 17:29:10 +0000 (12:29 -0500)]
test/bench/shootout: delete

We don't use these for benchmarking anymore.
Now we have the go1 dir and the benchmarks subrepo.
Some have problematic copyright notices, so move out of main repo.

Preserved in golang.org/x/exp/shootout.

Fixes #12688.
Fixes #13584.

Change-Id: Ic0b71191ca1a286d33d7813aca94bab1617a1c82
Reviewed-on: https://go-review.googlesource.com/18320
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoRevert "cmd/dist: improve isGitRepo to handle git "worktree"s"
Russ Cox [Wed, 6 Jan 2016 17:39:34 +0000 (17:39 +0000)]
Revert "cmd/dist: improve isGitRepo to handle git "worktree"s"

This reverts commit ab096d587f9bb5dcdf895511ee6d213aade7e30f.

Change-Id: Icf366aa43acc41b4f8474edae0297e554368bf14
Reviewed-on: https://go-review.googlesource.com/18321
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/dsa: adjust GenerateParameters comment
Russ Cox [Wed, 6 Jan 2016 16:44:09 +0000 (11:44 -0500)]
crypto/dsa: adjust GenerateParameters comment

Fixes #13725.

Change-Id: I5fe46851b238fc9ab301da8f8fc37bd1b7871748
Reviewed-on: https://go-review.googlesource.com/18316
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agointernal/syscall/windows/registry: adjust TestGetMUIStringValue
Alex Brainman [Mon, 21 Dec 2015 06:44:58 +0000 (17:44 +1100)]
internal/syscall/windows/registry: adjust TestGetMUIStringValue

Do not check DaylightName if DynamicDaylightTimeDisabled is false.

Fixes #13502

Change-Id: I03e01ec0afdeb0037a5d3ee243674e5a6b559da5
Reviewed-on: https://go-review.googlesource.com/17998
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: improve isGitRepo to handle git "worktree"s
Tamir Duberstein [Wed, 30 Dec 2015 16:15:38 +0000 (11:15 -0500)]
cmd/dist: improve isGitRepo to handle git "worktree"s

Simply checking the exit code of `git rev-parse --git-dir` should
suffice here, but that requires deviating from the infrastructure
provided by `run`, so I've left that for a future change.

Fixes #11211.

Change-Id: I7cbad86a8a06578f52f66f734f5447b597ddc962
Reviewed-on: https://go-review.googlesource.com/18213
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: recognize bool(true) as a constant expression
Matthew Dempsky [Tue, 5 Jan 2016 20:26:55 +0000 (12:26 -0800)]
cmd/compile: recognize bool(true) as a constant expression

Fixes #13821.

Change-Id: I4a28a92d137edac3061537af25ac9d7aba411a66
Reviewed-on: https://go-review.googlesource.com/18262
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoos/signal: Stop restores original signal handling
Ian Lance Taylor [Tue, 5 Jan 2016 00:19:38 +0000 (16:19 -0800)]
os/signal: Stop restores original signal handling

Since Stop was introduced, it would revert to the system default for the
signal, rather than to the default Go behavior.  Change it to revert to
the default Go behavior.

Change-Id: I345467ece0e49e31b2806d6fce2f1937b17905a6
Reviewed-on: https://go-review.googlesource.com/18229
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: better documentation for Transport
Andrew Gerrand [Wed, 6 Jan 2016 04:45:16 +0000 (15:45 +1100)]
net/http: better documentation for Transport

Mention that:
- connection pooling is enabled by default,
- the Transport is safe for concurrent use, and
- the Client type should be used for high-level stuff.

Change-Id: Idfd8cc852e733c44211e77cf0e22720b1fdca39b
Reviewed-on: https://go-review.googlesource.com/18273
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http/pprof: stop profiling if client's connection closes
Brad Fitzpatrick [Wed, 6 Jan 2016 00:25:24 +0000 (00:25 +0000)]
net/http/pprof: stop profiling if client's connection closes

Fixes #13833

Change-Id: If0bd5f7dcfc39d34680d11eb998050f0900d5a26
Reviewed-on: https://go-review.googlesource.com/18283
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agonet/http: update bundled copied of x/net/http2 to git rev 961116aee
Brad Fitzpatrick [Wed, 6 Jan 2016 00:06:09 +0000 (16:06 -0800)]
net/http: update bundled copied of x/net/http2 to git rev 961116aee

Update net/http's copy of http2 (sync as of x/net git rev 961116aee,
aka https://golang.org/cl/18266)

Also adds some CONNECT tests for #13717 (mostly a copy of http2's
version of test, but in the main repo it also tests that http1 behaves
the same)

Fixes #13668
Fixes #13717

Change-Id: I7db93fe0b7c42bd17a43ef32953f2d20620dd3ea
Reviewed-on: https://go-review.googlesource.com/18269
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: note the net/http CloseNotifier changes in go1.6.html
Brad Fitzpatrick [Tue, 5 Jan 2016 17:29:16 +0000 (17:29 +0000)]
doc: note the net/http CloseNotifier changes in go1.6.html

Also reference the new Transport.ExpectContinueTimeout after the
mention of 100-continue.

Fixes #13721

Change-Id: I3445c011ed20f29128092c801c7a4bb4dd2b8351
Reviewed-on: https://go-review.googlesource.com/18281
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc: mention new SIGPIPE behavior in 1.6 release notes
Ian Lance Taylor [Tue, 5 Jan 2016 01:18:14 +0000 (17:18 -0800)]
doc: mention new SIGPIPE behavior in 1.6 release notes

Update #11845.

Change-Id: I1c248dc48abc62e51836b9ba50d6deb89706c730
Reviewed-on: https://go-review.googlesource.com/18226
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: call msanwrite on object passed to runtime/cgo
Ian Lance Taylor [Tue, 5 Jan 2016 22:06:58 +0000 (14:06 -0800)]
runtime: call msanwrite on object passed to runtime/cgo

Avoids an msan error when runtime/cgo is explicitly rebuilt with
-fsanitize=memory.

Fixes #13815.

Change-Id: I70308034011fb308b63585bcd40b0d1e62ec93ef
Reviewed-on: https://go-review.googlesource.com/18263
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/hmac: update link to FIPS HMAC spec
Brad Fitzpatrick [Tue, 5 Jan 2016 16:56:16 +0000 (16:56 +0000)]
crypto/hmac: update link to FIPS HMAC spec

Thanks to Kevin Kirsche (github kkirsche).

Change-Id: Ia0017371f56065a5e88d1ebb800a6489136ee9b1
Reviewed-on: https://go-review.googlesource.com/18280
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocrypto/x509: handle ECC private keys with the wrong length.
Adam Langley [Mon, 21 Dec 2015 22:40:23 +0000 (14:40 -0800)]
crypto/x509: handle ECC private keys with the wrong length.

SEC-1 says: “The component privateKey is the private key defined to be
the octet string of length ⌊log₂(n)/8⌋ (where n is the order of the
curve)”.

Previously the code for parsing ECC private keys would panic (on
non-amd64) when the private was too long. It would also pass a too-short
private key to crypto/elliptic, possibly resulting in undesirable
behaviour.

This change makes the parsing function handle both too much and too
little padding because GnuTLS does the former and OpenSSL did the latter
until 30cd4ff294252c4b6a4b69cbef6a5b4117705d22. It also causes
serialisation to pad private keys correctly.

Fixes #13699

Change-Id: If9c2faeaeb45af8a4d7770d784f3d2633e7f8290
Reviewed-on: https://go-review.googlesource.com/18094
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile/internal/gc: fix initialization logic
Kevin Vu [Mon, 4 Jan 2016 02:44:15 +0000 (18:44 -0800)]
cmd/compile/internal/gc: fix initialization logic

Also add relevant test.

Fixes #13343.

Change-Id: Ib1e65af1d643d501de89adee3618eddbf6c69c9e
Reviewed-on: https://go-review.googlesource.com/18159
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/dist: correct run's comment
Tamir Duberstein [Wed, 30 Dec 2015 16:10:47 +0000 (11:10 -0500)]
cmd/dist: correct run's comment

Change-Id: I45b026f4b4bf23b222a81669280cbe245048022b
Reviewed-on: https://go-review.googlesource.com/18212
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: special case shared library name when passed "$prefix/..."
Michael Hudson-Doyle [Wed, 23 Dec 2015 02:33:55 +0000 (15:33 +1300)]
cmd/go: special case shared library name when passed "$prefix/..."

Before golang.org/cl/13921, "go install -buildmode=shared prefix/..." created a
file called "libprefix.so", which was obviously a problem when prefix was
something like "." or "../".  However, now it expands the ... into all the
matched packages, joins them with -, which can clearly be a very long name
indeed. Because I plan to build shared libraries for Ubuntu by running commands
exactly like "go install -buildmode=shared prefix/...", this special cases this
to produce the old behaviour (but de-relativises prefix first).

Fixes #13714

Change-Id: I4fd8d4934279f9a18cc70a13e4ef3e23f6abcb6e
Reviewed-on: https://go-review.googlesource.com/18114
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/asn1: fix off-by-one in parseBase128Int.
David Benjamin [Tue, 5 Jan 2016 00:16:28 +0000 (16:16 -0800)]
encoding/asn1: fix off-by-one in parseBase128Int.

parseBase128Int compares |shifted| with four, seemingly to ensure the result
fits in an int32 on 32-bit platforms where int is 32-bit. However, there is an
off-by-one in this logic, so it actually allows five shifts, making the maximum
tag number or OID component 2^35-1.

Fix this so the maximum is 2^28-1 which should be plenty for OID components and
tag numbers while not overflowing on 32-bit platforms.

Change-Id: If825b30cc53a0fc08e68ea1a24d265e7eb1a13a4
Reviewed-on: https://go-review.googlesource.com/18225
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoA+C: automated update
Brad Fitzpatrick [Tue, 5 Jan 2016 22:19:10 +0000 (14:19 -0800)]
A+C: automated update

These are the easy, automated cases. There were some more where we
need to fight Gerrit and the CLA system to extract the appropriate
metadata.

Updates #12042

Change-Id: Id63ae635ee7efeec4cd372c7d85bb5b1f557951b
Reviewed-on: https://go-review.googlesource.com/18264
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agolog/syslog: document that syslog is frozen
Brad Fitzpatrick [Mon, 4 Jan 2016 17:12:31 +0000 (09:12 -0800)]
log/syslog: document that syslog is frozen

Try to reduce feature request bug reports.

Change-Id: I713bb715d25d23e084b054aea8e1c3197dde90d4
Reviewed-on: https://go-review.googlesource.com/18222
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: make Client use Request.Cancel for timeouts instead of CancelRequest
Brad Fitzpatrick [Tue, 5 Jan 2016 04:59:05 +0000 (20:59 -0800)]
net/http: make Client use Request.Cancel for timeouts instead of CancelRequest

In the beginning, there was no way to cancel an HTTP request.

We later added Transport.CancelRequest to cancel an in-flight HTTP
request by breaking its underlying TCP connection, but it was hard to
use correctly and didn't work in all cases. And its error messages
were terrible. Some of those issues were fixed over time, but the most
unfixable problem was that it didn't compose well. All RoundTripper
implementations had to choose to whether to implement CancelRequest
and both decisions had negative consequences.

In Go 1.5 we added Request.Cancel, which composed well, worked in all
phases, had nice error messages, etc. But we forgot to use it in the
implementation of Client.Timeout (a timeout which spans multiple
requests and reading request bodies).

In Go 1.6 (upcoming), we added HTTP/2 support, but now Client.Timeout
didn't work because the http2.Transport didn't have a CancelRequest
method.

Rather than add a CancelRequest method to http2, officially deprecate
it and update the only caller (Client, for Client.Cancel) to use
Request.Cancel instead.

The http2 Client timeout tests are enabled now.

For compatibility, we still use CancelRequest in Client if we don't
recognize the RoundTripper type. But documentation has been updated to
tell people that CancelRequest is deprecated.

Fixes #13540

Change-Id: I15546b90825bb8b54905e17563eca55ea2642075
Reviewed-on: https://go-review.googlesource.com/18260
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agospec: New year, new spec update (to refer to Unicode 8.0).
Robert Griesemer [Tue, 5 Jan 2016 22:15:49 +0000 (14:15 -0800)]
spec: New year, new spec update (to refer to Unicode 8.0).

Slightly rephrased sentence to emphasize the contents of the
Unicode categories w/o repeating the full category name each
time.

Fixes #13414.

Change-Id: Icd32ff1547fa81e866c5937a631c3344bb6087c6
Reviewed-on: https://go-review.googlesource.com/18265
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http: tighten protocol between Transport.roundTrip and persistConn.readLoop
Brad Fitzpatrick [Tue, 5 Jan 2016 19:40:25 +0000 (19:40 +0000)]
net/http: tighten protocol between Transport.roundTrip and persistConn.readLoop

In debugging the flaky test in #13825, I discovered that my previous
change to tighten and simplify the communication protocol between
Transport.roundTrip and persistConn.readLoop in
https://golang.org/cl/17890 wasn't complete.

This change simplifies it further: the buffered-vs-unbuffered
complexity goes away, and we no longer need to re-try channel reads in
the select case. It was trying to prioritize channels in the case that
two were readable in the select. (it was only failing in the race builder
because the race builds randomize select scheduling)

The problem was that in the bodyless response case we had to return
the idle connection before replying to roundTrip. But putIdleConn
previously both added it to the free list (which we wanted), but also
closed the connection, which made the caller goroutine
(Transport.roundTrip) have two readable cases: pc.closech, and the
response. We guarded against similar conditions in the caller's select
for two readable channels, but such a fix wasn't possible here, and would
be overly complicated.

Instead, switch to unbuffered channels. The unbuffered channels were only
to prevent goroutine leaks, so address that differently: add a "callerGone"
channel closed by the caller on exit, and select on that during any unbuffered
sends.

As part of the fix, split putIdleConn into two halves: a part that
just returns to the freelist, and a part that also closes. Update the
four callers to the variants each wanted.

Incidentally, the connections were closing on return to the pool due
to MaxIdleConnsPerHost (somewhat related: #13801), but this bug
could've manifested for plenty of other reasons.

Fixes #13825

Change-Id: I6fa7136e2c52909d57a22ea4b74d0155fdf0e6fa
Reviewed-on: https://go-review.googlesource.com/18282
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime/pprof: skip TestStackBarrierProfiling
Austin Clements [Tue, 5 Jan 2016 16:33:25 +0000 (11:33 -0500)]
runtime/pprof: skip TestStackBarrierProfiling

This test triggers a large number of usleep(100)s. linux/arm, openbsd,
and solaris have very poor timer resolution on the builders, so
usleep(100) actually gives up the whole scheduling quantum. On Linux
and OpenBSD (and probably Solaris), profiling signals are only
generated when a process completes a whole scheduling quantum, so this
test often gets zero profiling signals and fails.

Until we figure out what to do about this, skip this test on these
platforms.

Updates #13405.

Change-Id: Ica94e4a8ae7a8df3e5a840504f83ee2ec08727df
Reviewed-on: https://go-review.googlesource.com/18252
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

9 years agoruntime: fix exit status when killed by signal
Ian Lance Taylor [Fri, 1 Jan 2016 23:44:12 +0000 (15:44 -0800)]
runtime: fix exit status when killed by signal

Previously, when a program died because of a SIGHUP, SIGINT, or SIGTERM
signal it would exit with status 2.  This CL fixes the runtime to exit
with a status indicating that the program was killed by a signal.

Change-Id: Ic2982a2562857edfdccaf68856e0e4df532af136
Reviewed-on: https://go-review.googlesource.com/18156
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agoruntime: set SIGCONT to _SigNotify + _SigDefault
Ian Lance Taylor [Thu, 31 Dec 2015 20:06:31 +0000 (12:06 -0800)]
runtime: set SIGCONT to _SigNotify + _SigDefault

Use the current ability to say that we don't do anything with SIGCONT by
default, but programs can catch it using signal.Notify if they want.

Fixes #8953.

Change-Id: I67d40ce36a029cbc58a235cbe957335f4a58e1c5
Reviewed-on: https://go-review.googlesource.com/18185
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: suppress export of Note field within exported bodies
David Chase [Thu, 31 Dec 2015 00:47:36 +0000 (19:47 -0500)]
cmd/compile: suppress export of Note field within exported bodies

Added a format option to inhibit output of .Note field in
printing, and enabled that option during export.
Added test.

Fixes #13777.

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

9 years agonet: run all timeout tests in parallel
Russ Cox [Tue, 29 Dec 2015 17:10:38 +0000 (12:10 -0500)]
net: run all timeout tests in parallel

For #10571.

Change-Id: I9a42226078b9c52dbe0c65cb101b5f452233e911
Reviewed-on: https://go-review.googlesource.com/18205
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agomisc/cgo/testcshared: print a little more about GOROOT on failure
Russ Cox [Mon, 4 Jan 2016 20:08:03 +0000 (15:08 -0500)]
misc/cgo/testcshared: print a little more about GOROOT on failure

For #13789.

Change-Id: I83973298a35afcf55627f0a72223098306a51f4b
Reviewed-on: https://go-review.googlesource.com/18233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: wait for pending tests before exiting
Russ Cox [Mon, 4 Jan 2016 20:03:45 +0000 (15:03 -0500)]
cmd/dist: wait for pending tests before exiting

When 'go tool dist test' stops, it was intended that it first wait for
pending background tests, like a failed compilation waits for pending
background compiles. But these three lines prevented that.
Fix by deleting them. (The actual loop already contains the correct
logic to avoid running the others and to wait for what's left.)

Change-Id: I4e945495ada903fb0af567910626241bc1c52ba6
Reviewed-on: https://go-review.googlesource.com/18232
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: relax recently-updated rules and behavior of CloseNotifier
Brad Fitzpatrick [Mon, 4 Jan 2016 20:38:20 +0000 (20:38 +0000)]
net/http: relax recently-updated rules and behavior of CloseNotifier

The CloseNotifier implementation and documentation was
substantially changed in https://golang.org/cl/17750 but it was a bit
too aggressive.

Issue #13666 highlighted that in addition to breaking external
projects, even the standard library (httputil.ReverseProxy) didn't
obey the new rules about not using CloseNotifier until the
Request.Body is fully consumed.

So, instead of fixing httputil.ReverseProxy, dial back the rules a
bit. It's now okay to call CloseNotify before consuming the request
body. The docs now say CloseNotifier may wait to fire before the
request body is fully consumed, but doesn't say that the behavior is
undefined anymore. Instead, we just wait until the request body is
consumed and start watching for EOF from the client then.

This CL also adds a test to ReverseProxy (using a POST request) that
would've caught this earlier.

Fixes #13666

Change-Id: Ib4e8c29c4bfbe7511f591cf9ffcda23a0f0b1269
Reviewed-on: https://go-review.googlesource.com/18144
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/internal/obj: fix PCSP table at runtime.morestack calls
Matthew Dempsky [Wed, 30 Dec 2015 23:19:54 +0000 (15:19 -0800)]
cmd/internal/obj: fix PCSP table at runtime.morestack calls

Fixes #13346.

Change-Id: Ic903ee90575e8dbe23905d0678d3295745d1d47f
Reviewed-on: https://go-review.googlesource.com/18154
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoos: remove unused import to fix build
Ian Lance Taylor [Tue, 5 Jan 2016 01:21:05 +0000 (17:21 -0800)]
os: remove unused import to fix build

Change-Id: Ia8c1c77590115a5ffda144962436d489ed77a423
Reviewed-on: https://go-review.googlesource.com/18227
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoos, runtime: better EPIPE behavior for command line programs
Ian Lance Taylor [Mon, 28 Dec 2015 19:29:22 +0000 (11:29 -0800)]
os, runtime: better EPIPE behavior for command line programs

Old behavior: 10 consecutive EPIPE errors on any descriptor cause the
program to exit with a SIGPIPE signal.

New behavior: an EPIPE error on file descriptors 1 or 2 cause the
program to raise a SIGPIPE signal.  If os/signal.Notify was not used to
catch SIGPIPE signals, this will cause the program to exit with SIGPIPE.
An EPIPE error on a file descriptor other than 1 or 2 will simply be
returned from Write.

Fixes #11845.
Update #9896.

Change-Id: Ic85d77e386a8bb0255dc4be1e4b3f55875d10f18
Reviewed-on: https://go-review.googlesource.com/18151
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: disable a signal by restoring the original disposition
Ian Lance Taylor [Fri, 18 Dec 2015 23:29:51 +0000 (15:29 -0800)]
runtime: disable a signal by restoring the original disposition

Fixes #13034.
Fixes #13042.
Update #9896.

Change-Id: I189f381090223dd07086848aac2d69d2c00d80c4
Reviewed-on: https://go-review.googlesource.com/18062
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: update out of date help text about vendoring
Aaron Jacobs [Mon, 21 Dec 2015 02:01:00 +0000 (13:01 +1100)]
cmd/go: update out of date help text about vendoring

Change-Id: I2b61f3b3ecf28d8f6a8dff94d194b6d3d450ea22
Reviewed-on: https://go-review.googlesource.com/17996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotesting: add clear panic for duplicate call to t.Parallel
Russ Cox [Tue, 29 Dec 2015 17:10:01 +0000 (12:10 -0500)]
testing: add clear panic for duplicate call to t.Parallel

Change-Id: I155633b58e1823344a26c3edf11f5626fae080ee
Reviewed-on: https://go-review.googlesource.com/18204
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime/pprof: shorten a few tests
Russ Cox [Tue, 29 Dec 2015 17:33:16 +0000 (12:33 -0500)]
runtime/pprof: shorten a few tests

For #10571.

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

9 years agocmd/link: use current GOROOT for source file paths for standard library
Russ Cox [Tue, 29 Dec 2015 15:16:40 +0000 (10:16 -0500)]
cmd/link: use current GOROOT for source file paths for standard library

This CL changes the source file information in the
standard library's .a files to say "$GOROOT/src/runtime/chan.go"
(with a literal "$GOROOT") instead of spelling out the actual directory.
The linker then substitutes the actual $GOROOT (or $GOROOT_FINAL)
as appropriate.

If people download a binary distribution to an alternate location,
following the instructions at https://golang.org/doc/install#install,
the code before this CL would end up with source paths pointing to
/usr/local/go no matter where the actual sources were.
Now the source paths for built binaries will point to the actual sources
(hopefully).

The source line information in distributed binaries is not affected:
those will still say /usr/local/go. But binaries people build themselves
(their own programs, not the go distribution programs) will be correct.

Fixing this path also fixes the lookup of the runtime-gdb.py file.

Fixes #5533.

Change-Id: I03729baae3fbd8cd636e016275ee5ad2606e4663
Reviewed-on: https://go-review.googlesource.com/18200
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agobuild: prevent the entire repo to be wiped out by cgo test scripts
Didier Spezia [Sat, 2 Jan 2016 14:26:13 +0000 (14:26 +0000)]
build: prevent the entire repo to be wiped out by cgo test scripts

Following the parallelization of some tests, a race condition can
occur in testcarchive, testshared and testcshared.

In some cases, it can result in the go env GOROOT command returning
corrupted data, which are then passed to a rm command.

Make the shell script more robust by not trusting the result of
the go env GOROOT command. It does not really fix the issue, but
at least prevent the entire repository to be deleted.

Updates #13789

Change-Id: Iaf04a7bd078ed3a82e724e35c4b86e6f756f2a2f
Reviewed-on: https://go-review.googlesource.com/18173
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: deflake tests in full mode after t.Parallel additions
Brad Fitzpatrick [Mon, 4 Jan 2016 18:27:51 +0000 (18:27 +0000)]
net/http: deflake tests in full mode after t.Parallel additions

https://golang.org/cl/18087 added a bunch of t.Parallel calls, which
aren't compatible with the afterTest func. But in short mode, afterTest
is a no-op. To keep all.bash (short mode) fast, conditionally set
t.Parallel when in short mode, but keep it unset for compatibility with
afterFunc otherwise.

Fixes #13804

Change-Id: Ie841fbc2544e1ffbee43ba1afbe895774e290da0
Reviewed-on: https://go-review.googlesource.com/18143
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: remove now-unused test string constants
Ian Lance Taylor [Fri, 1 Jan 2016 23:50:23 +0000 (15:50 -0800)]
runtime: remove now-unused test string constants

Change-Id: I491197e1505d02cd107a8788e5377cf1d0a9828c
Reviewed-on: https://go-review.googlesource.com/18157
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: implement setsigstack for Solaris
Ian Lance Taylor [Sun, 3 Jan 2016 03:39:37 +0000 (19:39 -0800)]
runtime: implement setsigstack for Solaris

Change-Id: I0280d478b7d0a59d8e2082aa87fab6d7d9f36a18
Reviewed-on: https://go-review.googlesource.com/18158
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agodoc: fix typo in install-source.html.
Benny Siegert [Sun, 3 Jan 2016 20:34:49 +0000 (21:34 +0100)]
doc: fix typo in install-source.html.

Change-Id: I6ea7339ff9412111319e46f2962c6b3880987a1e
Reviewed-on: https://go-review.googlesource.com/18174
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: treat SIGTSTP/SIGCANCEL on Solaris as we do on GNU/Linux
Ian Lance Taylor [Thu, 31 Dec 2015 20:09:49 +0000 (12:09 -0800)]
runtime: treat SIGTSTP/SIGCANCEL on Solaris as we do on GNU/Linux

Change-Id: I617abd53f5fc883b972a1ef090886b85607e00bb
Reviewed-on: https://go-review.googlesource.com/18155
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agodoc: fix typo
Shenghou Ma [Thu, 31 Dec 2015 16:25:51 +0000 (11:25 -0500)]
doc: fix typo

Fixes #13780.

Change-Id: I629e2ba79b74d693e04c3747812c9a686cae5335
Reviewed-on: https://go-review.googlesource.com/18218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: 2016 is the Year of the Gopher.
David Symonds [Thu, 31 Dec 2015 13:00:00 +0000 (00:00 +1100)]
doc: 2016 is the Year of the Gopher.

Change-Id: I85caba8c743dcd82954de75df947053b3d206bdc
Reviewed-on: https://go-review.googlesource.com/18117
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoos: change Open(`C:`) to open current directory on C:
Alex Brainman [Wed, 30 Dec 2015 01:13:21 +0000 (12:13 +1100)]
os: change Open(`C:`) to open current directory on C:

Open(`C:`) currently opens root directory on C:. Change that to open
current directory on C:. Just like cmd.exe's "dir C:" command does.
Just like FindFirstFile("C:*") Windows API does. It is also consistent
with what filepath.Join("C:", "a") currently does.

Fixes #13763

Change-Id: I60b6e7d80215d110bbbb6265c9f32717401638c6
Reviewed-on: https://go-review.googlesource.com/18184
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>

9 years agodatabase/sql: fix doc typos
Evan Shaw [Wed, 30 Dec 2015 00:23:11 +0000 (13:23 +1300)]
database/sql: fix doc typos

Change-Id: I374dabed6bf9783839d637e9d7fd6f4e61c7eecf
Reviewed-on: https://go-review.googlesource.com/18183
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>