]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoruntime: make NumGoroutine and Stack agree not to include system goroutines
Russ Cox [Thu, 7 Jan 2016 02:16:01 +0000 (21:16 -0500)]
runtime: make NumGoroutine and Stack agree not to include system goroutines

[Repeat of CL 18343 with build fixes.]

Before, NumGoroutine counted system goroutines and Stack (usually) didn't show them,
which was inconsistent and confusing.

To resolve which way they should be consistent, it seems like

package main
import "runtime"
func main() { println(runtime.NumGoroutine()) }

should print 1 regardless of internal runtime details. Make it so.

Fixes #11706.

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

9 years agomath/big: fix Exp(x, x, x) for certain large x
Russ Cox [Mon, 11 Jan 2016 14:52:56 +0000 (09:52 -0500)]
math/big: fix Exp(x, x, x) for certain large x

Fixes #13907.

Change-Id: Ieaa5183f399b12a9177372212adf481c8f0b4a0d
Reviewed-on: https://go-review.googlesource.com/18491
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Vlad Krasnov <vlad@cloudflare.com>
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocmd/cgo: document C.sizeof_T and zero-sized field restriction
Ian Lance Taylor [Tue, 12 Jan 2016 15:03:28 +0000 (07:03 -0800)]
cmd/cgo: document C.sizeof_T and zero-sized field restriction

Update #9401.
Update #11925.
Update #13919.

Change-Id: I52c679353693e8165b2972d4d3974ee8bb1207ef
Reviewed-on: https://go-review.googlesource.com/18542
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: support URLs without schemes in http.Redirect
Denys Honsiorovskyi [Wed, 2 Sep 2015 10:40:34 +0000 (13:40 +0300)]
net/http: support URLs without schemes in http.Redirect

Many browsers now support schemeless URLs in the Location headers
and also it is allowed in the draft HTTP/1.1 specification (see
http://stackoverflow.com/q/4831741#comment25926312_4831741), but
Go standard library lacks support for them.

This patch implements schemeless URLs support in http.Redirect().
Since url.Parse() correctly handles schemeless URLs, I've just added
an extra condition to verify URL's Host part in the absoulute/relative
check in the http.Redirect function.

Also I've moved oldpath variable initialization inside the block
of code where it is used.

Change-Id: Ib8a6347816a83e16576f00c4aa13224a89d610b5
Reviewed-on: https://go-review.googlesource.com/14172
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: mark greyobject go:nowritebarrierrec
Austin Clements [Tue, 24 Nov 2015 19:03:58 +0000 (14:03 -0500)]
runtime: mark greyobject go:nowritebarrierrec

It would certainly be a mistake to invoke a write barrier while
greying an object.

Change-Id: I34445a15ab09655ea8a3628a507df56aea61e618
Reviewed-on: https://go-review.googlesource.com/18533
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: remove out-of-date comment
Austin Clements [Mon, 11 Jan 2016 21:52:11 +0000 (16:52 -0500)]
runtime: remove out-of-date comment

It used to be the case that repeatedly getting one GC pointer and
enqueuing one GC pointer could cause contention on the work buffers as
each operation passed over the boundary of a work buffer. As of
b6c0934, we use a two buffer cache that prevents this sort of
contention.

Change-Id: I4f1111623f76df9c5493dd9124dec1e0bfaf53b7
Reviewed-on: https://go-review.googlesource.com/18532
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: fix incorrect comment
Austin Clements [Tue, 24 Nov 2015 18:52:28 +0000 (13:52 -0500)]
runtime: fix incorrect comment

This comment is probably a hold-over from when the heap bitmap was
interleaved and the shift was 0, 2, 4, or 6. Now the shift is 0, 1, 2,
or 3.

Change-Id: I096ec729e1ca31b708455c98b573dd961d16aaee
Reviewed-on: https://go-review.googlesource.com/18531
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agodoc: add Overview and other small edits to How To Write Go Code
Andrew Gerrand [Fri, 8 Jan 2016 01:06:45 +0000 (12:06 +1100)]
doc: add Overview and other small edits to How To Write Go Code

Fixes #9228

Change-Id: Ic4df4a39f6f363bdd6eb9228c8164e6e9dccee1b
Reviewed-on: https://go-review.googlesource.com/5561
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux
Michael Hudson-Doyle [Thu, 7 Jan 2016 23:57:02 +0000 (12:57 +1300)]
cmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux

Go fails to build on a system which has PIE enabled by default like this:

/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status

The only system I know that has this property right now is Ubuntu Xenial
running on s390x, which is hardly the most accessible system, but it's planned
to enable this on amd64 soon too. The fix is to pass -no-pie along with -Wl,-r
to the compiler, but unfortunately that flag is very new as well. So this does
a test compile of a trivial file to see if the flag is supported.

Change-Id: I1345571142b7c3a96212e43297d19e84ec4a3d41
Reviewed-on: https://go-review.googlesource.com/18359
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: disable sendfile on Solaris for now
Brad Fitzpatrick [Mon, 11 Jan 2016 20:27:37 +0000 (12:27 -0800)]
net: disable sendfile on Solaris for now

There are reports of corruption. Let's disable it for now (for Go 1.6,
especially) until we can investigate and fix properly.

Update #13892

Change-Id: I557275e5142fe616e8a4f89c00ffafb830eb3b78
Reviewed-on: https://go-review.googlesource.com/18540
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: fix ppc64le cgocallback code
Ian Lance Taylor [Mon, 11 Jan 2016 19:18:23 +0000 (11:18 -0800)]
runtime: fix ppc64le cgocallback code

Change-Id: I5a4a842cab2173357e8d3e349011c0c2b63be4f9
Reviewed-on: https://go-review.googlesource.com/18512
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: return full error for first test to be built
Ian Lance Taylor [Mon, 11 Jan 2016 17:34:38 +0000 (09:34 -0800)]
runtime: return full error for first test to be built

Change-Id: I5a0206e8074f3a2790954c45a217922b7b3fe851
Reviewed-on: https://go-review.googlesource.com/18487
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agogo/types: slightly better doc strings
Robert Griesemer [Mon, 11 Jan 2016 18:59:36 +0000 (10:59 -0800)]
go/types: slightly better doc strings

Per suggestion from adonovan.

Change-Id: Icbb4d2f201590bc94672b8d8141b6e7901e11dc5
Reviewed-on: https://go-review.googlesource.com/18510
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agogo/importer: use correct path for path->package map
Robert Griesemer [Sat, 9 Jan 2016 01:56:50 +0000 (17:56 -0800)]
go/importer: use correct path for path->package map

In the presence of vendored packages, the path found in a package
declaration may not be the path at which the package imported from
srcDir was found. Use the correct package path.

Change-Id: I74496c3cdf82a5dbd6a5bd189bb3cd0ca103fd52
Reviewed-on: https://go-review.googlesource.com/18460
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: fix arm/arm64/ppc64/mips64 to dropm when necessary
Ian Lance Taylor [Sat, 9 Jan 2016 00:56:02 +0000 (16:56 -0800)]
runtime: fix arm/arm64/ppc64/mips64 to dropm when necessary

Fixes #13881.

Change-Id: Idff77db381640184ddd2b65022133bb226168800
Reviewed-on: https://go-review.googlesource.com/18449
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agoruntime: eagerly share GC work buffers
Rick Hudson [Wed, 6 Jan 2016 22:07:58 +0000 (17:07 -0500)]
runtime: eagerly share GC work buffers

Currently, due to an oversight, we only balance work buffers
in background and idle workers and not in assists. As a
result, in assist-heavy workloads, assists are likely to tie
up large work buffers in per-P caches increasing the
likelihood that the global list will be empty. This increases
the likelihood that other GC workers will exit and assists
will block, slowing down the system as a whole. Fix this by
eagerly balancing work buffers as soon as the assists notice
that the global buffers are empty. This makes it much more
likely that work will be immediately available to other
workers and assists.

This change reduces the garbage benchmark time by 39% and
fixes the regresssion seen at CL 15893 golang.org/cl/15893.

Garbage benchmark times before and after this CL.
Before GOPERF-METRIC:time=4427020
After  GOPERF-METRIC:time=2721645

Fixes #13827

Change-Id: I9cb531fb873bab4b69ce9c1617e30df6c49cdcfe
Reviewed-on: https://go-review.googlesource.com/18341
Reviewed-by: Austin Clements <austin@google.com>
9 years agodoc: note GCM behaviour change in Go 1.6.
Adam Langley [Sun, 10 Jan 2016 03:10:33 +0000 (19:10 -0800)]
doc: note GCM behaviour change in Go 1.6.

This change documents the behaviour change caused by
https://go-review.googlesource.com/18480 in Go 1.6.

Updates #13886

Change-Id: I2daa08a62775bbc209f0f4cbeae21b8184ce7609
Reviewed-on: https://go-review.googlesource.com/18481
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/cipher: always zero dst buffer on GCM authentication failure.
Adam Langley [Sun, 10 Jan 2016 02:31:35 +0000 (18:31 -0800)]
crypto/cipher: always zero dst buffer on GCM authentication failure.

The AESNI GCM code decrypts and authenticates concurrently and so
overwrites the destination buffer even in the case of an authentication
failure.

This change updates the documentation to make that clear and also
mimics that behaviour in the generic code so that different platforms
act identically.

Fixes #13886

Change-Id: Idc54e51f01e27b0fc60c1745d50bb4c099d37e94
Reviewed-on: https://go-review.googlesource.com/18480
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/dist: restrict parallel tests to NumCPU on mips64x
Yao Zhang [Sun, 10 Jan 2016 03:22:58 +0000 (22:22 -0500)]
cmd/dist: restrict parallel tests to NumCPU on mips64x

mips64 builder and one machine of the mips64le builder has small amount
of memory. Since CL 18199, they have been running slowly, as more
processes were launched in running 'test' directory, and a lot of swap
were used. This CL brings all.bash from 5h back to 3h on Loongson 2E
with 512 MB memory.

Change-Id: I4a22e239a542a99ba5986753205d8cd1f4b3d3c6
Reviewed-on: https://go-review.googlesource.com/18483
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: update bundled http2
Brad Fitzpatrick [Sat, 9 Jan 2016 23:34:56 +0000 (15:34 -0800)]
net/http: update bundled http2

Updates http2 to x/net git rev 0e6d34ef942 for https://golang.org/cl/18472
which means we'll get to delete a ton of grpc-go code and just use the
standard library's HTTP client instead.

Also, the comments in this CL aren't entirely accurate it turns out.
RFC 2616 says:

"The Trailer header field can be used to indicate which header fields
are included in a trailer (see section 14.40)."

And 14.40:

"  An HTTP/1.1 message SHOULD include a Trailer header field in a
   message using chunked transfer-coding with a non-empty trailer. Doing
   so allows the recipient to know which header fields to expect in the
   trailer.

   If no Trailer header field is present, the trailer SHOULD NOT include
   any header fields. See section 3.6.1 for restrictions on the use of
   trailer fields in a "chunked" transfer-coding."

So it's really a SHOULD more than a MUST.

And gRPC (at least Google's server) doesn't predeclare "grpc-status"
ahead of time in a Trailer Header, so we'll be lenient. We were too
strict anyway. It's also not a concern for the Go client we have a
different place to populate the Trailers, and it won't confuse clients
which aren't looking for them. The ResponseWriter server side is more
complicated (and strict), though, since we don't want to widen the
ResponseWriter interface. So the Go server still requires that you
predeclare Trailers.

Change-Id: Ia2defc11a2469fb8570ecfabb8453537121084eb
Reviewed-on: https://go-review.googlesource.com/18473
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: don't remove Expect Request header in Server.
Harshavardhana [Sat, 9 Jan 2016 19:55:32 +0000 (11:55 -0800)]
net/http: don't remove Expect Request header in Server.

Fixes #13893

Change-Id: I2577b38fdb19299227dc146f707cf9df663dcdfc
Reviewed-on: https://go-review.googlesource.com/18471
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: improve ReadResponse test coverage
Emmanuel Odeke [Sun, 3 Jan 2016 14:32:52 +0000 (07:32 -0700)]
net/http: improve ReadResponse test coverage

Change-Id: I08d77d52b68b062c2eb1901fcfca34d45a210cce
Reviewed-on: https://go-review.googlesource.com/18142
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: fix typo in lookup_windows getprotobyname
Matt Robenolt [Sat, 9 Jan 2016 06:22:59 +0000 (22:22 -0800)]
net: fix typo in lookup_windows getprotobyname

Change-Id: Ia6d40ead1e54dd0b8998370cbabc2d7cd8b7aa0b
Reviewed-on: https://go-review.googlesource.com/18470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: stop scanning for domain name once the first label has been found
Mikio Hara [Fri, 8 Jan 2016 18:47:40 +0000 (03:47 +0900)]
net: stop scanning for domain name once the first label has been found

Change-Id: I95c6c85eecb53ffe52b64d521180148b624e9424
Reviewed-on: https://go-review.googlesource.com/18423
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: for c-archive/c-shared, install signal handlers synchronously
Ian Lance Taylor [Sat, 26 Dec 2015 17:51:59 +0000 (09:51 -0800)]
runtime: for c-archive/c-shared, install signal handlers synchronously

The previous behaviour of installing the signal handlers in a separate
thread meant that Go initialization raced with non-Go initialization if
the non-Go initialization also wanted to install signal handlers.  Make
installing signal handlers synchronous so that the process-wide behavior
is predictable.

Update #9896.

Change-Id: Ice24299877ec46f8518b072a381932d273096a32
Reviewed-on: https://go-review.googlesource.com/18150
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agogo/types, go/importer: importing package unsafe is responsibility of importer
Robert Griesemer [Fri, 8 Jan 2016 22:27:02 +0000 (14:27 -0800)]
go/types, go/importer: importing package unsafe is responsibility of importer

TBR adonovan

Fixes #13882.

Change-Id: I8664669f5d6adfec6f16e154263b1f0ea8988175
Reviewed-on: https://go-review.googlesource.com/18445
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime: clean up gctrace format
Austin Clements [Fri, 8 Jan 2016 19:57:26 +0000 (14:57 -0500)]
runtime: clean up gctrace format

Go 1.6 simplified the GC phases. The "synchronize Ps" phase no longer
exists and "root scan" and "mark" phases have been combined.

Update the gctrace line implementation and documentation to remove the
unused phases.

Fixes #13536.

Change-Id: I4fc37a3ce1ae3a99d48c0be2df64cbda3e05dee6
Reviewed-on: https://go-review.googlesource.com/18458
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agogo/types: provide Importer2 supporting the Go 1.5 vendor experiment
Robert Griesemer [Thu, 7 Jan 2016 00:07:27 +0000 (16:07 -0800)]
go/types: provide Importer2 supporting the Go 1.5 vendor experiment

Fixes #13688.

Change-Id: I53363aeeeba4560211d56d4571a8e058d5dbbd8a
Reviewed-on: https://go-review.googlesource.com/18308
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime/pprof: skip TestStackBarrierProfiling on FreeBSD, too
Austin Clements [Fri, 8 Jan 2016 19:32:52 +0000 (14:32 -0500)]
runtime/pprof: skip TestStackBarrierProfiling on FreeBSD, too

Sigh. Sleeps on FreeBSD also yield the rest of the time slice and
profiling signals are only delivered when a process completes a time
slice (worse, itimer time is only accounted to the process that
completes a time slice). It's less noticeable than the other BSDs
because the default tick rate is 1000Hz, but it's still failing
regularly.

Fixes #13846.

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

9 years agoapi: more go1.6 API additions
Brad Fitzpatrick [Fri, 8 Jan 2016 20:06:04 +0000 (20:06 +0000)]
api: more go1.6 API additions

Change-Id: Ib838d2b98e3f84ffd240849817cafc69415ba74e
Reviewed-on: https://go-review.googlesource.com/18376
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agomath/big: fix typo in comment
Robert Griesemer [Fri, 8 Jan 2016 19:33:17 +0000 (11:33 -0800)]
math/big: fix typo in comment

Fixes #13875.

Change-Id: Icbb85c858d0bc545499a2b31622e9e7abdd7e5f9
Reviewed-on: https://go-review.googlesource.com/18441
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoapi: fix build for go/build change
Russ Cox [Fri, 8 Jan 2016 19:51:50 +0000 (14:51 -0500)]
api: fix build for go/build change

Fixes build.

Change-Id: I5235deed7b93157854acb79c15e2e99cc28d300a
Reviewed-on: https://go-review.googlesource.com/18456
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime/testdata: gofmt
Mikio Hara [Fri, 8 Jan 2016 18:45:06 +0000 (03:45 +0900)]
runtime/testdata: gofmt

Change-Id: I728d4c709c4122fe4b96e1350be73696ac6fb1f7
Reviewed-on: https://go-review.googlesource.com/18422
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: apply -importmap to imports before checking for package unsafe
Russ Cox [Fri, 8 Jan 2016 16:36:36 +0000 (11:36 -0500)]
cmd/compile: apply -importmap to imports before checking for package unsafe

There are fewer special cases this way: the import map applies
to all import paths, not just the ones not spelled "unsafe".

This is also consistent with what the code in cmd/go and go/build expects.
They make no exception for "unsafe".

For #13703.

Change-Id: I622295261ca35a6c1e83e8508d363bddbddb6c0a
Reviewed-on: https://go-review.googlesource.com/18438
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet/http: fix validHeaderValue yet again, excluding the DEL CTL byte
Brad Fitzpatrick [Fri, 8 Jan 2016 18:30:04 +0000 (18:30 +0000)]
net/http: fix validHeaderValue yet again, excluding the DEL CTL byte

Third time's a charm.

Thanks to Ralph Corderoy for noticing the DEL omission.

Update #11207

Change-Id: I174fd01eaecceae1eb220f2c9136e12d40fbe943
Reviewed-on: https://go-review.googlesource.com/18375
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agogo/build: invert AllowVendor to IgnoreVendor
Russ Cox [Fri, 8 Jan 2016 17:38:41 +0000 (12:38 -0500)]
go/build: invert AllowVendor to IgnoreVendor

Looking for vendor directories is a better default.

Fixes #13772

Change-Id: Iabbaea71ccc67b72f14f1f412dc8ab70cb41996d
Reviewed-on: https://go-review.googlesource.com/18450
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agoruntime: save callee-saved regs in darwin-amd64 library init
Ian Lance Taylor [Fri, 8 Jan 2016 15:36:35 +0000 (07:36 -0800)]
runtime: save callee-saved regs in darwin-amd64 library init

We're only getting away with it today by luck.

Change-Id: I24d1cceee4d20c5181ca64fceda152e875f6ad81
Reviewed-on: https://go-review.googlesource.com/18440
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: add nowritebarrierrec to funcs called at signal time
Ian Lance Taylor [Fri, 8 Jan 2016 04:28:04 +0000 (20:28 -0800)]
runtime: add nowritebarrierrec to funcs called at signal time

Also nosplit where needed.

Change-Id: I1e3f6f8f76df9ee7e87ed1b8560cef145928314c
Reviewed-on: https://go-review.googlesource.com/18395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoRevert "net: ensure that malformed domain names report a consistent error"
Russ Cox [Fri, 8 Jan 2016 17:17:53 +0000 (17:17 +0000)]
Revert "net: ensure that malformed domain names report a consistent error"

This reverts commit bb8c2e19a7fe2ca2283eca44dba2047c9f4307fe.

Change-Id: I9bc089e9f2296805ef055b98e8c86ba73af30226
Reviewed-on: https://go-review.googlesource.com/18439
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: fix cgoTestSO on FreeBSD amd64 with GOHOSTARCH=386
Joel Sing [Fri, 8 Jan 2016 12:22:12 +0000 (23:22 +1100)]
cmd/dist: fix cgoTestSO on FreeBSD amd64 with GOHOSTARCH=386

The cgoTestSO test currently fails when run on FreeBSD amd64 with
GOHOSTARCH=386. This is due to it failing to find the shared object.

On FreeBSD 64-bit architectures, the linker for 32-bit objects
looks for a separate environment variable. Export both LD_LIBRARY_PATH
and LD_32_LIBRARY_PATH on FreeBSD when GOHOSTARCH=386.

Update issue #13873.

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

9 years agoos: read only 10,000 bytes at a time from Windows console
Russ Cox [Fri, 8 Jan 2016 16:23:25 +0000 (11:23 -0500)]
os: read only 10,000 bytes at a time from Windows console

Reading 32,767 is too many on some versions of Windows.
The exact upper bound is unclear.

For #13697, but may not fix the problem on all systems.

Change-Id: I197021ed60cbcd33c91ca6ceed456ec3d5a6c9d6
Reviewed-on: https://go-review.googlesource.com/18433
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoregexp/syntax: fix factoring of common prefixes in alternations
Paul Wankadia [Thu, 7 Jan 2016 07:55:18 +0000 (18:55 +1100)]
regexp/syntax: fix factoring of common prefixes in alternations

In the past, `a.*?c|a.*?b` was factored to `a.*?[bc]`. Thus, given
"abc" as its input string, the automaton would consume "ab" and
then stop (when unanchored) whereas it should consume all of "abc"
as per leftmost semantics.

Fixes #13812.

Change-Id: I67ac0a353d7793b3d0c9c4aaf22d157621dfe784
Reviewed-on: https://go-review.googlesource.com/18357
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/textproto: accept multi-line error messages
Daniel Speichert [Tue, 29 Dec 2015 15:46:40 +0000 (16:46 +0100)]
net/textproto: accept multi-line error messages

Ads documentation for both formats of messages accepted by
ReadResponse(). Validity of message should not be altered by
the validation process. On message with unexpected code,
a properly formatted message was not fully read.

Fixes #10230

Change-Id: Ic0b473059a68ab624ce0525e359d0f5d0b8d2117
Reviewed-on: https://go-review.googlesource.com/18172
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: ensure that malformed domain names report a consistent error
Russ Cox [Thu, 7 Jan 2016 01:50:11 +0000 (20:50 -0500)]
net: ensure that malformed domain names report a consistent error

Previously it depended on whether we were using the Go resolver or the Cgo resolver.

Fixes #12421.

Change-Id: Ib162e336f30f736d7244e29d96651c3be11fc3cd
Reviewed-on: https://go-review.googlesource.com/18383
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agointernal/syscall/windows: correct GetACP and MultiByteToWideChar
Alex Brainman [Mon, 21 Dec 2015 05:16:06 +0000 (16:16 +1100)]
internal/syscall/windows: correct GetACP and MultiByteToWideChar

CL 4310 introduced these functions, but their
implementation does not match with their published
documentation. Correct the implementation.

Change-Id: I285e41f9c7c5fc4e550ff59b0adb8b2bcbf6737a
Reviewed-on: https://go-review.googlesource.com/17997
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/json: doc: Decode only writes to exported fields
Ian Lance Taylor [Fri, 8 Jan 2016 02:48:42 +0000 (18:48 -0800)]
encoding/json: doc: Decode only writes to exported fields

Fixes #13867.

Change-Id: I6c0a6c64369681840df60f63036c2eece27de8b8
Reviewed-on: https://go-review.googlesource.com/18394
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodatabase/sql: guard against panics in driver.Stmt implementation
Russ Cox [Fri, 18 Dec 2015 17:16:05 +0000 (12:16 -0500)]
database/sql: guard against panics in driver.Stmt implementation

For #13677, but there is more to do.

Change-Id: Id1af999dc972d07cdfc771e5855a1a7dca47ca96
Reviewed-on: https://go-review.googlesource.com/18046
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: allow signal.Ignore of user-generated throwing signals
Russ Cox [Thu, 7 Jan 2016 15:19:55 +0000 (10:19 -0500)]
runtime: allow signal.Ignore of user-generated throwing signals

Today, signal.Ignore(syscall.SIGTRAP) does nothing
while signal.Notify(make(chan os.Signal), syscall.SIGTRAP)
correctly discards user-generated SIGTRAPs.
The same applies to any signal that we throw on.

Make signal.Ignore work for these signals.

Fixes #12906.

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

9 years agoruntime: fix up OS X kernel bug sending user-generated SIGTRAP
Russ Cox [Thu, 7 Jan 2016 04:00:08 +0000 (23:00 -0500)]
runtime: fix up OS X kernel bug sending user-generated SIGTRAP

OS X unconditionally sets si_code = TRAP_BRKPT when sending SIGTRAP,
even if it was generated by kill -TRAP and not a breakpoint.
Correct the si_code by looking to see if the PC is after a breakpoint.

For #12906.

Change-Id: I998c2499f7f12b338e607282a325b045f1f4f690
Reviewed-on: https://go-review.googlesource.com/18347
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoRevert "runtime: make NumGoroutine and Stack agree not to include system goroutines"
Russ Cox [Fri, 8 Jan 2016 15:31:09 +0000 (15:31 +0000)]
Revert "runtime: make NumGoroutine and Stack agree not to include system goroutines"

This reverts commit c5bafc828126c8fa057e1accaa448583c7ec145f.

Change-Id: Ie7030c978c6263b9e996d5aa0e490086796df26d
Reviewed-on: https://go-review.googlesource.com/18431
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: make NumGoroutine and Stack agree not to include system goroutines
Russ Cox [Thu, 7 Jan 2016 02:16:01 +0000 (21:16 -0500)]
runtime: make NumGoroutine and Stack agree not to include system goroutines

Before, NumGoroutine counted system goroutines and Stack (usually) didn't show them,
which was inconsistent and confusing.

To resolve which way they should be consistent, it seems like

package main
import "runtime"
func main() { println(runtime.NumGoroutine()) }

should print 1 regardless of internal runtime details. Make it so.

Fixes #11706.

Change-Id: I6bfe26a901de517728192cfb26a5568c4ef4fe47
Reviewed-on: https://go-review.googlesource.com/18343
Reviewed-by: Austin Clements <austin@google.com>
9 years agoencoding/base64: fix streaming decode of padding-free base64
Russ Cox [Wed, 6 Jan 2016 19:32:17 +0000 (14:32 -0500)]
encoding/base64: fix streaming decode of padding-free base64

Fixes #13384.

Change-Id: Id9e827acddc8de139f93c5de0c6486bc4334c7d4
Reviewed-on: https://go-review.googlesource.com/18330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoos/signal: clarify signal doc
Ian Lance Taylor [Thu, 7 Jan 2016 17:41:45 +0000 (09:41 -0800)]
os/signal: clarify signal doc

Based on comments from Thomas Bushnell.

Update #9896.

Change-Id: I603b1382d17dff00b5d18f17f8b5d011503e9e4c
Reviewed-on: https://go-review.googlesource.com/18365
Reviewed-by: Russ Cox <rsc@golang.org>
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>