1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:41:21 -06:00
Commit Graph

20821 Commits

Author SHA1 Message Date
Michael Hudson-Doyle
cd9fc3ebfb cmd/link: allow symbols from .a files to override those from .so files
https://golang.org/s/execmodes defines rules for how multiple codes of a go
package work when they end up in the address space of a single process, but
currently the linker blows up in this situation. Fix that by loading all .a
files before any .so files and ignoring duplicate symbols found when loading
shared libraries.

I know this is very very late for 1.6 but at least it should clearly not have
any effect when shared libraries are not in use.

Change-Id: I512ac912937e7502ff58eb5628b658ecce3c38e5
Reviewed-on: https://go-review.googlesource.com/18714
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-01-20 19:53:53 +00:00
Shenghou Ma
97266969d8 cmd/dist: pass -tags race to go list in -race mode
so that runtime/race tests are included in the race builder.

Update #14011.

Change-Id: I04ac6e47366fdb1fe84ba89da556c6d38f7d4a47
Reviewed-on: https://go-review.googlesource.com/18686
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-20 06:10:20 +00:00
Robert Griesemer
5395846890 cmd/compile: don't print (empty) package name in errors referring to built-ins
Fixes #14010.

Change-Id: Idfd4b063eecf453fe00f3e798099023707a65963
Reviewed-on: https://go-review.googlesource.com/18738
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-01-20 04:43:43 +00:00
Michael Hudson-Doyle
df2a9e4a33 runtime/race: fix test so it compiles
I'm not sure what the convert function was intended to be.

Fixes #14011

Change-Id: I29d905bc1827936b9433b20b13b7a0b0ac5f502e
Reviewed-on: https://go-review.googlesource.com/18712
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-20 03:08:07 +00:00
Keith Randall
d9b32f0c7d cmd/compile: add VARLIVE to opnames list
Change-Id: Ie8cb7c7428ae9026c11643b22f9ecf7977e25f5f
Reviewed-on: https://go-review.googlesource.com/18737
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-19 21:56:09 +00:00
Robert Griesemer
7ce2402bae cmd/compile: don't crash on invalid labeled statement
Fixes #14006.

Change-Id: Ia819073677ad6993c02255e23760ee21598427b4
Reviewed-on: https://go-review.googlesource.com/18736
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 21:34:28 +00:00
Robert Griesemer
92ba69d216 cmd/compile: set importpkg.Direct correctly when using binary imports
Fixes #13977.

Change-Id: Icf54b4d2d746d30da207d1e17c975d18188b1cf8
Reviewed-on: https://go-review.googlesource.com/18702
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-19 18:28:08 +00:00
OneOfOne
5e7110b92b cmd/link: fix elf64phdr to allow using upx (and other broken ELF loaders).
The linker already applies the fix for elf32, so this just extends it to elf64.

Inspired by https://github.com/pwaller/goupx

Fixes #13974

Change-Id: I65d92b5be9590657060a0e8e80ff5b86ba40017f
Reviewed-on: https://go-review.googlesource.com/18690
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 18:01:33 +00:00
Michael Munday
c7754c8f54 net: add timeout to DNS requests sent by TestSpecialDomainName
The timeout means that TestSpecialDomainName will not hang if
the DNS server does not respond to the request.

Fixes #13939

Change-Id: I46e30bbd3c11b6c560656134e704331cf6f8af3f
Reviewed-on: https://go-review.googlesource.com/18661
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 06:20:36 +00:00
Brad Fitzpatrick
c40a73d80c net/http: make hidden http2 Transport respect remaining Transport fields
Updates x/net/http2 to git rev 72aa00c6 for https://golang.org/cl/18721
(but actually at https://golang.org/cl/18722 now)

Fixes #14008

Change-Id: If05d5ad51ec0ba5ba7e4fe16605c0a83f0484bc8
Reviewed-on: https://go-review.googlesource.com/18723
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 05:31:38 +00:00
Shenghou Ma
3208d92b78 build: test linux/mips64 and linux/mips64le with buildall.bash
Both mips64 architectures share the same runtime/rt0 file, so
we have to hardcode them in buildall.bash.

Ideally we should have cmd/dist report all supported platforms,
see #12270.

Change-Id: I08ce35cfe0a831af5e1e8255b305efd38386fa52
Reviewed-on: https://go-review.googlesource.com/18687
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 04:43:44 +00:00
Shenghou Ma
14aacc2fd8 runtime: print address as hex in messages
Change-Id: I7ccf1b5001d77c4390479f53c0137ab02f98595b
Reviewed-on: https://go-review.googlesource.com/18685
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-18 23:48:06 +00:00
Brad Fitzpatrick
3092a63a64 net/http: clarify docs on Request.Proto field
No need to say "by default" because there is no alternative and no way
to override. Always HTTP/2.0 is officially spelled HTTP/2 these days.

Fixes #13985 harder

Change-Id: Ib1ec03cec171ca865342b8e7452cd4c707d7b770
Reviewed-on: https://go-review.googlesource.com/18720
Reviewed-by: Rob Pike <r@golang.org>
2016-01-18 23:42:56 +00:00
Brad Fitzpatrick
5b588e6682 net/http: make http2 Transport send Content Length
Updates x/net/http2 to git rev 5c0dae8 for https://golang.org/cl/18709

Fixes #14003

Change-Id: I8bc205d6d089107b017e3458bbc7e05f6d0cae60
Reviewed-on: https://go-review.googlesource.com/18730
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-18 23:35:54 +00:00
Brad Fitzpatrick
49234ee2db net/http: panic on bogus use of CloseNotifier or Hijacker
Fixes #14001

Change-Id: I6f9bc3028345081758d8f537c3aaddb2e254e69e
Reviewed-on: https://go-review.googlesource.com/18708
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-18 22:11:00 +00:00
Mikio Hara
5c94f1ae8f net: disable TestInterfaceAddrsWithNetsh on windows
Updates #13981.

Change-Id: Id8f3cd56a81a7a993cea5c757e619407da491fed
Reviewed-on: https://go-review.googlesource.com/18710
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-18 22:02:21 +00:00
Ian Lance Taylor
9270973a5b runtime: don't run TestEnsureDropM on windows or plan9
This is testing code in asm_GOARCH.s, so it's not necessary to run the
test on systems where it doesn't build.

Fixes #13991.

Change-Id: Ia7a2d3a34b32e6987dc67428c1e09e63baf0518a
Reviewed-on: https://go-review.googlesource.com/18707
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-18 18:40:45 +00:00
Brad Fitzpatrick
01b86400d9 net/http: update bundled http2, pass through Transport.CloseIdleConnections
Wire up Transport.CloseIdleConnections to http2.Transport.CloseIdleConnections.

Updates x/net/http2 to git rev c92cdcb0 for https://golang.org/cl/18678

Fixes #13975

Change-Id: I1183a31256104ff95ae7621e5788cfeee741b1aa
Reviewed-on: https://go-review.googlesource.com/18679
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-16 03:35:23 +00:00
Austin Clements
b05f18e3f7 runtime: fix sleep/wakeup race for GC assists
GC assists check gcBlackenEnabled under the assist queue lock to avoid
going to sleep after gcWakeAllAssists has already woken all assists.
However, currently we clear gcBlackenEnabled shortly *after* waking
all assists, which opens a window where this exact race can happen.

Fix this by clearing gcBlackenEnabled before waking blocked assists.
However, it's unlikely this actually matters because the world is
stopped between waking assists and clearing gcBlackenEnabled and there
aren't any obvious allocations during this window, so I don't think an
assist could actually slip in to this race window.

Updates #13645.

Change-Id: I7571f059530481dc781d8fd96a1a40aadebecb0d
Reviewed-on: https://go-review.googlesource.com/18682
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-01-16 02:40:00 +00:00
Mikio Hara
aea4de80f9 runtime: readjust signal code for dragonfly-2.6 and above
Also adds missing nosplit to unminit.

Fixes #13964.

Change-Id: I07d93a8c872a255a89f91f808b66c889f0a6a69c
Reviewed-on: https://go-review.googlesource.com/18658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-16 00:47:55 +00:00
Brad Fitzpatrick
91b910b7e2 net/http: update bundled http2
If a user starts two HTTP requests when no http2 connection is
available, both end up creating new TCP connections, since the
server's protocol (h1 or h2) isn't yet known. Once it turns out that
the server supports h2, one of the connections is useless. Previously
we kept upgrading both TLS connections to h2 (SETTINGS frame exchange,
etc).  Now the unnecessary connections are closed instead, before the
h2 preface/SETTINGS.

Updates x/net/http2 to git rev a8e212f3d for https://golang.org/cl/18675

This CL contains the tests for https://golang.org/cl/18675

Semi-related change noticed while writing the tests: now that we have
TLSNextProto in Go 1.6, which consults the TLS
ConnectionState.NegotiatedProtocol, we have to gurantee that the TLS
handshake has been done before we look at the ConnectionState. So add
that check after the DialTLS hook. (we never documented that users
have to call Handshake, so do it for them, now that it matters)

Updates #13957

Change-Id: I9a70e9d1282fe937ea654d9b1269c984c4e366c0
Reviewed-on: https://go-review.googlesource.com/18676
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-15 18:06:34 +00:00
Austin Clements
1556c317f1 runtime: use at least "system" traceback level for runtime tests
While the default behavior of eliding runtime frames from tracebacks
usually makes sense, this is not the case when you're trying to test
the runtime itself. Fix this by forcing the traceback level to at
least "system" in the runtime tests.

This will specifically help with debugging issue #13645, which has
proven remarkably resistant to reproduction outside of the build
dashboard itself.

Change-Id: I2a8356ba6c3c5badba8bb3330fc527357ec0d296
Reviewed-on: https://go-review.googlesource.com/18648
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-01-15 02:22:46 +00:00
Matthew Dempsky
c5a2f364d3 runtime: fix darwin/arm64 build
Fixes #13916.

Change-Id: If2cad5473a749460909519ac20aca19dea8a2e7a
Reviewed-on: https://go-review.googlesource.com/18671
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-14 20:57:21 +00:00
Russ Cox
383d817e02 cmd/go: fix vendor directory check on Windows
Fixes build.

Change-Id: Idd7d87f0bf3fe553b3ab00dd32eee4925a4fe3ff
Reviewed-on: https://go-review.googlesource.com/18647
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-01-14 20:41:14 +00:00
Ian Lance Taylor
28f9d96c75 runtime: remove erroneous go:noescape declaration
Change-Id: I6b1dc789e54a385c958961e7ba16bfd9d0f3b313
Reviewed-on: https://go-review.googlesource.com/18629
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-14 17:11:48 +00:00
Brad Fitzpatrick
38ca0466d3 net/http: fix flaky TestServerValidatesHostHeader
Passes with go test -race -count=1000 -name=TestServerValidatesHostHeader now
without hanging.

Fixes #13950

Change-Id: I41c3a555c642595c95c8c52f19a05a4c68e67630
Reviewed-on: https://go-review.googlesource.com/18660
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-14 15:23:41 +00:00
Ian Lance Taylor
efd93a412e runtime: minimize time between lockextra/unlockextra
This doesn't fix a bug, but may improve performance in programs that
have many concurrent calls from C to Go.  The old code made several
system calls between lockextra and unlockextra.  That could be happening
while another thread is spinning acquiring lockextra.  This changes the
code to not make any system calls while holding the lock.

Change-Id: I50576478e478670c3d6429ad4e1b7d80f98a19d8
Reviewed-on: https://go-review.googlesource.com/18548
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-14 05:55:43 +00:00
Russ Cox
f36ee8c249 cmd/go: respect internal directories during 'go run'
Fixes #12217.

Change-Id: I5ee6cb18eaa66bdec1affe689aa531c05e719fc9
Reviewed-on: https://go-review.googlesource.com/18645
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-14 04:01:47 +00:00
Austin Clements
8319c57890 runtime: fix several issues in TestFutexsleep
TestFutexsleep is supposed to clean up before returning by waking up
the goroutines it started and left blocked in futex sleeps. However,
it currently fails at this in several ways:

1. Both the sleep and wakeup are done on the address of tt.mtx, but in
   both cases tt is a *local copy* of the futexsleepTest created by a
   loop, so the sleep and wakeup happen on completely different
   addresses. Fix this by making them both use the address of the
   global tt.mtx.

2. If the sleep happens after the wakeup (not likely, but not
   impossible), it won't wake up. Fix this by using the futex protocol
   properly: sleep if the mutex's value is 0, and set the mutex's
   value to non-zero before doing the wakeup.

3. If TestFutexsleep runs more than once, channels and mutex values
   left over from the first run will interfere with later runs. Fix
   this by clearing the mutex value and creating a new channel for
   each test and waiting for goroutines to finish before returning
   (lest they send their completion to the channel for the next run).

As an added bonus, this test now actually tests that futex
sleep/wakeup work. Previously this test would have been satisfied if
futexsleep was an infinite loop and futexwakeup was a no-op.

Change-Id: I1cbc6871cc9dcb8f4601b3621913bec2b79b0fc3
Reviewed-on: https://go-review.googlesource.com/18617
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-01-14 03:47:49 +00:00
Russ Cox
8534429181 cmd/go, go/build: ignore vendor directories with no Go source files
Otherwise it is impossible to vendor a/b/c without hiding the real a/b.
I also updated golang.org/s/go15vendor.

Fixes #13832.

Change-Id: Iee3d53c11ea870721803f6e8e67845b405686e79
Reviewed-on: https://go-review.googlesource.com/18644
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-14 03:43:57 +00:00
Shenghou Ma
b73d8fbedf build: use consistent shebang line
Fixes #13948.

Change-Id: I37d734c1241f3d72d8fe33dfdf79b573e5476b1f
Reviewed-on: https://go-review.googlesource.com/18643
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-14 03:16:20 +00:00
Austin Clements
535741a69a debug/dwarf: fix nil pointer dereference in cyclic type structures
Currently readType simultaneously constructs a type graph and resolves
the sizes of the types. However, these two operations are
fundamentally at odds: the order we parse a cyclic structure in may be
different than the order we need to resolve type sizes in. As a
result, it's possible that when readType attempts to resolve the size
of a typedef, it may dereference a nil Type field of another typedef
retrieved from the type cache that's only partially constructed.

To fix this, we delay resolving typedef sizes until the end of the
readType recursion, when the full type graph is constructed.

Fixes #13039.

Change-Id: I9889af37fb3be5437995030fdd61e45871319d07
Reviewed-on: https://go-review.googlesource.com/18459
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-14 02:05:31 +00:00
Russ Cox
5f23bc8903 cmd/compile: add AVARLIVE to peep for arm, arm64, mips64, ppc64
Fixes build on those systems.

Also fix printing of AVARLIVE.

Change-Id: I1b38cca0125689bc08e4e1bdd0d0c140b1ea079a
Reviewed-on: https://go-review.googlesource.com/18641
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-14 02:04:50 +00:00
Russ Cox
ed03dab853 cmd/internal/obj: separate code layout from object writing
This will allow the compiler to crunch Prog lists down to code as each
function is compiled, instead of waiting until the end, which should
reduce the working set of the compiler. But not until Go 1.7.

This also makes it easier to write some machine code output tests
for the assembler, which is why it's being done now.

For #13822.

Change-Id: I0811123bc6e5717cebb8948f9cea18e1b9baf6f7
Reviewed-on: https://go-review.googlesource.com/18311
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-14 01:51:27 +00:00
Russ Cox
1ac637c766 cmd/compile: recognize Syscall-like functions for liveness analysis
Consider this code:

	func f(*int)

	func g() {
		p := new(int)
		f(p)
	}

where f is an assembly function.
In general liveness analysis assumes that during the call to f, p is dead
in this frame. If f has retained p, p will be found alive in f's frame and keep
the new(int) from being garbage collected. This is all correct and works.
We use the Go func declaration for f to give the assembly function
liveness information (the arguments are assumed live for the entire call).

Now consider this code:

	func h1() {
		p := new(int)
		syscall.Syscall(1, 2, 3, uintptr(unsafe.Pointer(p)))
	}

Here syscall.Syscall is taking the place of f, but because its arguments
are uintptr, the liveness analysis and the garbage collector ignore them.
Since p is no longer live in h once the call starts, if the garbage collector
scans the stack while the system call is blocked, it will find no reference
to the new(int) and reclaim it. If the kernel is going to write to *p once
the call finishes, reclaiming the memory is a mistake.

We can't change the arguments or the liveness information for
syscall.Syscall itself, both for compatibility and because sometimes the
arguments really are integers, and the garbage collector will get quite upset
if it finds an integer where it expects a pointer. The problem is that
these arguments are fundamentally untyped.

The solution we have taken in the syscall package's wrappers in past
releases is to insert a call to a dummy function named "use", to make
it look like the argument is live during the call to syscall.Syscall:

	func h2() {
		p := new(int)
		syscall.Syscall(1, 2, 3, uintptr(unsafe.Pointer(p)))
		use(unsafe.Pointer(p))
	}

Keeping p alive during the call means that if the garbage collector
scans the stack during the system call now, it will find the reference to p.

Unfortunately, this approach is not available to users outside syscall,
because 'use' is unexported, and people also have to realize they need
to use it and do so. There is much existing code using syscall.Syscall
without a 'use'-like function. That code will fail very occasionally in
mysterious ways (see #13372).

This CL fixes all that existing code by making the compiler do the right
thing automatically, without any code modifications. That is, it takes h1
above, which is incorrect code today, and makes it correct code.

Specifically, if the compiler sees a foreign func definition (one
without a body) that has uintptr arguments, it marks those arguments
as "unsafe uintptrs". If it later sees the function being called
with uintptr(unsafe.Pointer(x)) as an argument, it arranges to mark x
as having escaped, and it makes sure to hold x in a live temporary
variable until the call returns, so that the garbage collector cannot
reclaim whatever heap memory x points to.

For now I am leaving the explicit calls to use in package syscall,
but they can be removed early in a future cycle (likely Go 1.7).

The rule has no effect on escape analysis, only on liveness analysis.

Fixes #13372.

Change-Id: I2addb83f70d08db08c64d394f9d06ff0a063c500
Reviewed-on: https://go-review.googlesource.com/18584
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-14 01:16:45 +00:00
Brad Fitzpatrick
66330d8c6c go/types: rename Importer2 to ImporterFrom
Per https://groups.google.com/forum/#!topic/golang-dev/javNmryAh0I

Change-Id: I08d7cbc94da4fc61c848f3dbee4637bf8fcfeb01
Reviewed-on: https://go-review.googlesource.com/18630
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-13 23:40:13 +00:00
Keith Randall
8c9ef9dd0a runtime: don't use CMOV for 386
CMOVs were not introduced until P6.  We need 386 to run on
Pentium MMX.

Fixes #13923

Change-Id: Iee9572cd83e64c3a1336bc1e6b300b048fbcc996
Reviewed-on: https://go-review.googlesource.com/18621
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-13 23:07:40 +00:00
Brad Fitzpatrick
608ddc38bd net/http: update bundled http2
Updates x/net/http2 to git rev 341cd08 for https://golang.org/cl/18576

Change-Id: If5dcb60ac449b798c34fe332ede5ec74e66eb9db
Reviewed-on: https://go-review.googlesource.com/18579
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-13 22:27:38 +00:00
Brad Fitzpatrick
aba6250250 net/http: clarify ConnState StateActive docs for HTTP/2
Update #13925

Change-Id: I7cd0625fad841eb0e3f364629f9bc225aa2fdce9
Reviewed-on: https://go-review.googlesource.com/18575
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-13 22:11:37 +00:00
Robert Griesemer
66a7097ca9 go/importer: fix field/method package for binary importer
This is the equivalent of https://golang.org/cl/18549 for
the binary importer (which is usually not used because by
default the gc compiler produces the traditional textual
export format).

For #13898.

Change-Id: Idb6b515f2ee49e6d0362c71846994b0bd4dae8f7
Reviewed-on: https://go-review.googlesource.com/18598
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-01-13 19:41:32 +00:00
Ian Lance Taylor
7ec5508810 cmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0
GCC 4.8 exits 1 on an unrecognized option, but GCC 4.4 and 4.5 exit 0.
I didn't check other versions, or try to figure out just when this
changed.

Fixes #13937.

Change-Id: If193e9053fbb535999c9bde99f430f465a8c7c57
Reviewed-on: https://go-review.googlesource.com/18597
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-13 19:29:22 +00:00
Robert Griesemer
00c0a3a677 go/importer: revert incorrect change that slipped in prior CL
The package of anonymous fields is the package in which they were
declared, not the package of the anonymous field's type. Was correct
before and incorrectly changed with https://golang.org/cl/18549.

Change-Id: I9fd5bfbe9d0498c8733b6ca7b134a85defe16113
Reviewed-on: https://go-review.googlesource.com/18596
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-13 19:10:31 +00:00
Russ Cox
4a0eee2faa cmd/link: add LC_VERSION_MIN_MACOSX to linkmode=internal OS X binaries
This makes lldb willing to debug them.
The minimum version is hard-coded at OS X 10.7,
because that is the minimum that Go requires.
For more control over the version, users can
use linkmode=external and pass the relevant flags to the host linker.

Fixes #12941.

Change-Id: I20027be8aa034d07dd2a3326828f75170afe905f
Reviewed-on: https://go-review.googlesource.com/18588
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-13 19:06:40 +00:00
Russ Cox
dd6753a6f2 runtime: allow for C pointers between arena_start and arena_used in cgo check
Fixes #13928.

Change-Id: Ia04c6bdef5ae6924d03982682ee195048f8f387f
Reviewed-on: https://go-review.googlesource.com/18611
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-13 19:06:28 +00:00
Russ Cox
166cfd2c87 runtime: arrange to show a few local variables when cgoCheckUnknownPointer panics
For #13934.

Change-Id: Id399e35598def96f8bb89b9fcd1bf14ee06e2e62
Reviewed-on: https://go-review.googlesource.com/18612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-13 18:51:43 +00:00
Robert Griesemer
756088549f go/importer: associate exported field and interface methods with correct package
In gc export data, exported struct field and interface method names appear
in unqualified form (i.e., w/o package name). The (gc)importer assumed that
unqualified exported names automatically belong to the package being imported.
This is not the case if the field or method belongs to a struct or interface
that was declared in another package and re-exported.

The issue becomes visible if a type T (say an interface with a method M)
is declared in a package A, indirectly re-exported by a package B (which
imports A), and then imported in C. If C imports both A and B, if A is
imported before B, T.M gets associated with the correct package A. If B
is imported before A, T.M appears to be exported by B (even though T itself
is correctly marked as coming from A). If T.M is imported again via the
import of A if gets dropped (as it should) because it was imported already.

The fix is to pass down the parent package when we parse imported types
so that the importer can use the correct package when creating fields
and methods.

Fixes #13898.

Change-Id: I7ec2ee2dda15859c582b65db221c3841899776e1
Reviewed-on: https://go-review.googlesource.com/18549
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-13 18:34:14 +00:00
Joe Sylve
9efc46f1cb cmd/go: -buildmode=c-shared should work on darwin/386
* Enable c-shared buildmode on darwin/386
* dyld does not support text relocation on i386. Add -read_only_relocs suppress flag to linker

Fixes #13904

Change-Id: I9adbd20d3f36ce9bbccf1bffb746b391780d088f
Reviewed-on: https://go-review.googlesource.com/18500
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 18:24:38 +00:00
Brad Fitzpatrick
4206e9d343 net/http: update bundled http2
Updates x/net/http2 to git rev c93a9b4f2a for https://golang.org/cl/18474

Forgot to submit this four days ago.

Change-Id: Id96ab164ec765911c31874cca39b44aa55e80153
Reviewed-on: https://go-review.googlesource.com/18574
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-13 18:15:52 +00:00
Brad Fitzpatrick
e405c29ce7 database/sql/driver: clarify DefaultParameterConverter docs
Fixes #11489

Change-Id: I887ebac2dcb772e73ee393891c487f694028aaf2
Reviewed-on: https://go-review.googlesource.com/18520
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 18:15:38 +00:00
Brad Fitzpatrick
70ee525261 net/http: fix Transport crash when abandoning dial which upgrades protos
When the Transport was creating an bound HTTP connection (protocol
unknown initially) and then ends up deciding it doesn't need it, a
goroutine sits around to clean up whatever the result was. That
goroutine made the false assumption that the result was always an
HTTP/1 connection or an error. It may also be an alternate protocol
in which case the *persistConn.conn net.Conn field is nil, and the
alt field is non-nil.

Fixes #13839

Change-Id: Ia4972e5eb1ad53fa00410b3466d4129c753e0871
Reviewed-on: https://go-review.googlesource.com/18573
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-13 17:52:50 +00:00
Emmanuel Odeke
46069bed06 net/http: reject non three digit status codes in ReadResponse
Change-Id: If4a90c4017ef4b5c9f497cf117c8ad62b7e15c62
Reviewed-on: https://go-review.googlesource.com/18501
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-13 17:38:50 +00:00
Keith Randall
3d01f28e47 cmd/compile: stop using fucomi* ops for 387 builds
The fucomi* opcodes were only introduced for the Pentium Pro.
They do not exist for an MMX Pentium.  Use the fucom* instructions
instead and move the condition codes from the fp flags register to
the integer flags register explicitly.

The use of fucomi* opcodes in ggen.go was introduced in 1.5 (CL 8738).
The bad ops were generated for 64-bit floating-point comparisons.

The use of fucomi* opcodes in gsubr.go dates back to at least 1.1.
The bad ops were generated for float{32,64} to uint64 conversions.

Fixes #13923

Change-Id: I5290599f5edea8abf8fb18036f44fa78bd1fc9e6
Reviewed-on: https://go-review.googlesource.com/18590
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 16:23:13 +00:00
Ian Lance Taylor
f3ce054a44 cmd/go: fixes for -compiler=gccgo -buildmode=c-shared
Install pkg.h rather than libpkg.h.

Link against -lc.

Fixes #13860.

Change-Id: I4e429426f8363712a5dbbd2655b9aab802ab2888
Reviewed-on: https://go-review.googlesource.com/18592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 15:14:04 +00:00
Ilya Tocar
1d1f2fb4c6 cmd/internal/obj/x86: add new instructions, cleanup.
Add several instructions that were used via BYTE and use them.
Instructions added: PEXTRB, PEXTRD, PEXTRQ, PINSRB, XGETBV, POPCNT.

Change-Id: I5a80cd390dc01f3555dbbe856a475f74b5e6df65
Reviewed-on: https://go-review.googlesource.com/18593
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 14:04:44 +00:00
Mikio Hara
ceeb52d862 net: LookupAddr("127.0.0.1") is "localhost" not "localhost." on Plan 9 and Windows
This change applies the fix for #13564 to Plan 9 and Windows.
Also enables Lookup API test cases on builders.

Updates #13564.

Change-Id: I863f03c7cb6fbe58b3a55223bfa0ac5f9bf9c3df
Reviewed-on: https://go-review.googlesource.com/18559
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 14:02:22 +00:00
Brad Fitzpatrick
771da53958 net/http2: update bundled http2
Update bundled http2 to git rev 76365a4 for https://golang.org/issue/18571

Fixes golang/go#13924

Change-Id: Ibb48cd6935b35d9965df70fb8761be5986d79ffc
Reviewed-on: https://go-review.googlesource.com/18591
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-13 04:52:24 +00:00
Brad Fitzpatrick
4ffba76855 crypto/tls: don't block in Conn.Close if Writes are in-flight
Conn.Close sends an encrypted "close notify" to signal secure EOF.
But writing that involves acquiring mutexes (handshake mutex + the
c.out mutex) and writing to the network. But if the reason we're
calling Conn.Close is because the network is already being
problematic, then Close might block, waiting for one of those mutexes.

Instead of blocking, and instead of introducing new API (at least for
now), distinguish between a normal Close (one that sends a secure EOF)
and a resource-releasing destructor-style Close based on whether there
are existing Write calls in-flight.

Because io.Writer and io.Closer aren't defined with respect to
concurrent usage, a Close with active Writes is already undefined, and
should only be used during teardown after failures (e.g. deadlines or
cancelations by HTTP users). A normal user will do a Write then
serially do a Close, and things are unchanged for that case.

This should fix the leaked goroutines and hung net/http.Transport
requests when there are network errors while making TLS requests.

Change-Id: If3f8c69d6fdcebf8c70227f41ad042ccc3f20ac9
Reviewed-on: https://go-review.googlesource.com/18572
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-13 04:49:19 +00:00
David Chase
e779bfa5d2 cmd/compile: better modeling of escape across loop levels
Brief background on "why heap allocate".  Things can be
forced to the heap for the following reasons:

1) address published, hence lifetime unknown.
2) size unknown/too large, cannot be stack allocated
3) multiplicity unknown/too large, cannot be stack allocated
4) reachable from heap (not necessarily published)

The bug here is a case of failing to enforce 4) when an
object Y was reachable from a heap allocation X forced
because of 3).  It was found in the case of a closure
allocated within a loop (X) and assigned to a variable
outside the loop (multiplicity unknown) where the closure
also captured a map (Y) declared outside the loop (reachable
from heap). Note the variable declared outside the loop (Y)
is not published, has known size, and known multiplicity
(one). The only reason for heap allocation is that it was
reached from a heap allocated item (X), but because that was
not forced by publication, it has to be tracked by loop
level, but escape-loop level was not tracked and thus a bug
results.

The fix is that when a heap allocation is newly discovered,
use its looplevel as the minimum loop level for downstream
escape flooding.

Every attempt to generalize this bug to X-in-loop-
references-Y-outside loop succeeded, so the fix was aimed
to be general.  Anywhere that loop level forces heap
allocation, the loop level is tracked.  This is not yet
tested for all possible X and Y, but it is correctness-
conservative and because it caused only one trivial
regression in the escape tests, it is probably also
performance-conservative.

The new test checks the following:
1) in the map case, that if fn escapes, so does the map.
2) in the map case, if fn does not escape, neither does the map.
3) in the &x case, that if fn escapes, so does &x.
4) in the &x case, if fn does not escape, neither does &x.

Fixes #13799.

Change-Id: Ie280bef2bb86ec869c7c206789d0b68f080c3fdb
Reviewed-on: https://go-review.googlesource.com/18234
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 04:01:00 +00:00
Michael Hudson-Doyle
040932869e runtime/internal/atomic: use //go:noinline to prevent inlining, not assembly nop
A bit cleanuppy for 1.6 maybe, but something I happened to notice.

Change-Id: I70f3b48445f4f527d67f7b202b6171195440b09f
Reviewed-on: https://go-review.googlesource.com/18550
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 01:51:48 +00:00
Russ Cox
fac8202c3f 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>
2016-01-13 01:46:01 +00:00
Russ Cox
1e066cad1b 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>
2016-01-13 01:43:35 +00:00
Ian Lance Taylor
505fa7b423 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>
2016-01-12 17:31:01 +00:00
Denys Honsiorovskyi
eca3618fd3 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>
2016-01-12 16:49:07 +00:00
Austin Clements
27df2e3f76 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>
2016-01-12 02:01:01 +00:00
Austin Clements
7b1f055eb1 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>
2016-01-12 02:00:55 +00:00
Austin Clements
352e287bf7 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>
2016-01-12 02:00:48 +00:00
Michael Hudson-Doyle
b80b098bc5 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>
2016-01-11 21:20:00 +00:00
Brad Fitzpatrick
ba593d6ab8 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>
2016-01-11 20:34:12 +00:00
Ian Lance Taylor
3dda43c6aa runtime: fix ppc64le cgocallback code
Change-Id: I5a4a842cab2173357e8d3e349011c0c2b63be4f9
Reviewed-on: https://go-review.googlesource.com/18512
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-11 19:19:51 +00:00
Ian Lance Taylor
e13a082284 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>
2016-01-11 19:10:54 +00:00
Robert Griesemer
37c29c5f6c 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>
2016-01-11 19:01:12 +00:00
Robert Griesemer
918edf433b 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>
2016-01-11 18:54:56 +00:00
Ian Lance Taylor
c02aa463db 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>
2016-01-11 18:46:54 +00:00
Rick Hudson
9439fa1078 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>
2016-01-11 18:23:56 +00:00
Adam Langley
13eabea0f7 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>
2016-01-10 19:03:42 +00:00
Yao Zhang
30919fe978 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>
2016-01-10 06:18:22 +00:00
Brad Fitzpatrick
9ee72f424c 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>
2016-01-10 01:37:18 +00:00
Harshavardhana
2747ca351e 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>
2016-01-10 01:35:01 +00:00
Emmanuel Odeke
64e2a71701 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>
2016-01-09 18:27:32 +00:00
Matt Robenolt
a1ebb37687 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>
2016-01-09 18:26:23 +00:00
Mikio Hara
57b1e55a0c 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>
2016-01-09 03:30:40 +00:00
Ian Lance Taylor
21b4f234c7 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>
2016-01-09 00:58:38 +00:00
Robert Griesemer
0b3807a2a3 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>
2016-01-09 00:19:02 +00:00
Austin Clements
1f26864f88 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>
2016-01-08 21:25:03 +00:00
Robert Griesemer
73c2080ace 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>
2016-01-08 21:10:01 +00:00
Austin Clements
903c307c2b 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>
2016-01-08 20:49:26 +00:00
Robert Griesemer
5e059d1c31 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>
2016-01-08 20:18:10 +00:00
Mikio Hara
a62a62d5b4 runtime/testdata: gofmt
Change-Id: I728d4c709c4122fe4b96e1350be73696ac6fb1f7
Reviewed-on: https://go-review.googlesource.com/18422
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-08 19:40:00 +00:00
Russ Cox
a8fc547f78 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>
2016-01-08 19:16:50 +00:00
Brad Fitzpatrick
39ad0fd078 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>
2016-01-08 19:01:32 +00:00
Russ Cox
ecc01a7ddf 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>
2016-01-08 18:49:01 +00:00
Ian Lance Taylor
ca4ea81d86 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>
2016-01-08 17:27:28 +00:00
Ian Lance Taylor
84a95be922 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>
2016-01-08 17:26:28 +00:00
Russ Cox
a120beaa8d Revert "net: ensure that malformed domain names report a consistent error"
This reverts commit bb8c2e19a7.

Change-Id: I9bc089e9f2296805ef055b98e8c86ba73af30226
Reviewed-on: https://go-review.googlesource.com/18439
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-08 17:18:00 +00:00
Joel Sing
beb1741ae3 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>
2016-01-08 17:00:53 +00:00
Russ Cox
29eea94abe 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>
2016-01-08 16:52:37 +00:00
Paul Wankadia
5ccaf0255b 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>
2016-01-08 16:41:46 +00:00
Daniel Speichert
8ae584f21e 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>
2016-01-08 16:32:42 +00:00
Russ Cox
bb8c2e19a7 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>
2016-01-08 16:19:20 +00:00
Alex Brainman
d75acd67ec 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>
2016-01-08 16:15:59 +00:00
Ian Lance Taylor
5755c011de 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>
2016-01-08 16:15:25 +00:00
Russ Cox
99ed71a02c 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>
2016-01-08 15:49:12 +00:00
Russ Cox
81adfa508a 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>
2016-01-08 15:34:03 +00:00
Russ Cox
331a6055ab 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>
2016-01-08 15:33:48 +00:00
Russ Cox
6da608206c Revert "runtime: make NumGoroutine and Stack agree not to include system goroutines"
This reverts commit c5bafc8281.

Change-Id: Ie7030c978c6263b9e996d5aa0e490086796df26d
Reviewed-on: https://go-review.googlesource.com/18431
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-08 15:31:15 +00:00
Russ Cox
c5bafc8281 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>
2016-01-08 15:25:00 +00:00
Russ Cox
20d745c57c 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>
2016-01-08 15:07:45 +00:00
Ian Lance Taylor
8971d61835 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>
2016-01-08 15:01:09 +00:00
David du Colombier
161f2e85ee 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>
2016-01-08 14:22:47 +00:00
Brad Fitzpatrick
0421e78f05 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>
2016-01-08 06:01:23 +00:00
Robert Griesemer
ee566d53ad 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>
2016-01-08 04:10:51 +00:00
Ian Lance Taylor
d91ec5bb40 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>
2016-01-08 03:56:30 +00:00
Russ Cox
e84dad3f6e 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>
2016-01-08 03:15:20 +00:00
Russ Cox
6b9298a2c5 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>
2016-01-08 03:14:47 +00:00
Brad Fitzpatrick
acc7161320 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>
2016-01-08 00:56:28 +00:00
Brad Fitzpatrick
40a26c9281 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>
2016-01-07 23:06:17 +00:00
Matthew Dempsky
27691fa467 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>
2016-01-07 21:43:47 +00:00
Austin Clements
3f22adecc7 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>
2016-01-07 19:40:38 +00:00
Austin Clements
fdf9b3c994 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>
2016-01-07 19:40:32 +00:00
Austin Clements
b50b24837d 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>
2016-01-07 19:40:26 +00:00
Russ Cox
ebf1f0fcbe 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>
2016-01-07 19:14:43 +00:00
Russ Cox
cd91c3b036 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>
2016-01-07 19:14:12 +00:00
Brad Fitzpatrick
305b4baf41 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>
2016-01-07 06:07:06 +00:00
Michael McGreevy
002e658a91 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>
2016-01-07 05:00:50 +00:00
Brad Fitzpatrick
67fa7970c5 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>
2016-01-07 01:49:37 +00:00
Tamir Duberstein
24ef1d60f0 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>
2016-01-07 01:23:05 +00:00
Russ Cox
fb142ee9b9 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>
2016-01-07 01:22:59 +00:00
Mikio Hara
c063e342f8 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>
2016-01-07 01:01:33 +00:00
Russ Cox
4aedbf5be4 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>
2016-01-07 00:44:04 +00:00
Russ Cox
5d8442aeaa 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>
2016-01-07 00:41:10 +00:00
Russ Cox
dba926d7a3 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>
2016-01-07 00:38:58 +00:00
Ian Lance Taylor
70c9a8187a 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>
2016-01-06 23:14:46 +00:00
Ian Lance Taylor
a7cad52e04 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>
2016-01-06 23:11:42 +00:00
Brad Fitzpatrick
62c280ac1c 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>
2016-01-06 22:15:37 +00:00
Russ Cox
4220659867 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>
2016-01-06 21:57:20 +00:00
Russ Cox
b598a7fc5d 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>
2016-01-06 21:42:19 +00:00
Brad Fitzpatrick
fb394017f1 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>
2016-01-06 21:01:08 +00:00
Brad Fitzpatrick
af768fdd34 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>
2016-01-06 21:00:48 +00:00
Brad Fitzpatrick
194a5c3e61 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>
2016-01-06 18:53:46 +00:00
Robert Griesemer
a4f10bddc3 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>
2016-01-06 18:19:53 +00:00
Russ Cox
f034b62c85 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>
2016-01-06 17:59:55 +00:00
Russ Cox
aec2f0cf85 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>
2016-01-06 17:59:46 +00:00
Russ Cox
13ba968d75 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>
2016-01-06 17:59:35 +00:00
Russ Cox
6866f5e143 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>
2016-01-06 17:59:25 +00:00
Russ Cox
39c3e0f642 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>
2016-01-06 17:59:15 +00:00
Russ Cox
901810ae55 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>
2016-01-06 17:58:48 +00:00
Russ Cox
bb91a7e2fd 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>
2016-01-06 17:58:27 +00:00
Russ Cox
91ba9f45c2 Revert "cmd/dist: improve isGitRepo to handle git "worktree"s"
This reverts commit ab096d587f.

Change-Id: Icf366aa43acc41b4f8474edae0297e554368bf14
Reviewed-on: https://go-review.googlesource.com/18321
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-06 17:39:43 +00:00
Russ Cox
7f0b4a879b 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>
2016-01-06 16:58:21 +00:00
Alex Brainman
a8f8d550e8 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>
2016-01-06 16:13:50 +00:00
Tamir Duberstein
ab096d587f 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>
2016-01-06 15:04:13 +00:00
Matthew Dempsky
be20948e27 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>
2016-01-06 14:38:33 +00:00
Ian Lance Taylor
e24b2445b4 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>
2016-01-06 14:25:39 +00:00
Andrew Gerrand
91f997be72 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>
2016-01-06 06:08:34 +00:00
Brad Fitzpatrick
c799e4a577 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>
2016-01-06 05:51:38 +00:00
Brad Fitzpatrick
a4f27c4225 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>
2016-01-06 05:50:07 +00:00
Ian Lance Taylor
934e055f41 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>
2016-01-06 04:04:42 +00:00
Brad Fitzpatrick
17ce03725c 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>
2016-01-06 02:17:06 +00:00
Adam Langley
9338f39459 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>
2016-01-06 02:16:54 +00:00
Kevin Vu
aaabe3d849 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>
2016-01-06 02:10:52 +00:00
Tamir Duberstein
7e24e89944 cmd/dist: correct run's comment
Change-Id: I45b026f4b4bf23b222a81669280cbe245048022b
Reviewed-on: https://go-review.googlesource.com/18212
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-06 02:02:07 +00:00
Michael Hudson-Doyle
ae8e55860b 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>
2016-01-06 01:46:39 +00:00
David Benjamin
7f96e266ec 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>
2016-01-06 01:41:27 +00:00
Brad Fitzpatrick
ddc25081d2 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>
2016-01-05 22:56:07 +00:00
Brad Fitzpatrick
7de71c8526 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>
2016-01-05 22:55:22 +00:00
Brad Fitzpatrick
7fa9846749 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>
2016-01-05 22:33:16 +00:00
Austin Clements
59ca8789fb 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>
2016-01-05 18:48:19 +00:00
Ian Lance Taylor
2c67c8c303 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>
2016-01-05 18:00:33 +00:00
Ian Lance Taylor
81b35117d9 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>
2016-01-05 17:44:46 +00:00
David Chase
ab5d2bf92f 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>
2016-01-05 15:42:12 +00:00
Russ Cox
d731315cdb 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>
2016-01-05 14:19:39 +00:00
Russ Cox
906f979119 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>
2016-01-05 14:18:38 +00:00
Brad Fitzpatrick
4b0bc7c3a1 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>
2016-01-05 04:39:11 +00:00
Matthew Dempsky
66f1f89dc0 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>
2016-01-05 01:48:31 +00:00
Ian Lance Taylor
b80ea53200 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>
2016-01-05 01:21:26 +00:00
Ian Lance Taylor
58c73de7d0 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>
2016-01-05 00:32:50 +00:00
Ian Lance Taylor
a7d2b4d7ce 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>
2016-01-05 00:25:50 +00:00
Aaron Jacobs
6c8a141a6d 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>
2016-01-04 20:50:18 +00:00
Russ Cox
7f4443d5fa 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>
2016-01-04 20:10:17 +00:00
Russ Cox
9d549b5b62 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>
2016-01-04 20:10:10 +00:00
Russ Cox
83746fd55a 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>
2016-01-04 20:09:57 +00:00
Brad Fitzpatrick
28b95edff2 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>
2016-01-04 19:23:17 +00:00
Ian Lance Taylor
fa8384dfb9 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>
2016-01-04 19:07:26 +00:00
Ian Lance Taylor
956535f5cb 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>
2016-01-04 16:33:58 +00:00
Ian Lance Taylor
3fd19fdc51 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>
2016-01-02 17:34:25 +00:00
Alex Brainman
ca47157395 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>
2015-12-31 00:20:54 +00:00
Evan Shaw
e35901fd65 database/sql: fix doc typos
Change-Id: I374dabed6bf9783839d637e9d7fd6f4e61c7eecf
Reviewed-on: https://go-review.googlesource.com/18183
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-30 07:27:12 +00:00
Hiroshi Ioka
4601776901 os: fix race condition between (*os.File).Stat and os.Chdir on windows
Fixes #13752

Change-Id: I53cfc4ecae90c35b6f1074f3be08489c408a6464
Reviewed-on: https://go-review.googlesource.com/18181
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-30 06:37:08 +00:00
Russ Cox
8d5ff2e182 runtime: move test programs out of source code, coalesce
Now there are just three programs to compile instead of many,
and repeated tests can reuse the compilation result instead of
rebuilding it.

Combined, these changes reduce the time spent testing runtime
during all.bash on my laptop from about 60 to about 30 seconds.
(All.bash itself runs in 5½ minutes.)

For #10571.

Change-Id: Ie2c1798b847f1a635a860d11dcdab14375319ae9
Reviewed-on: https://go-review.googlesource.com/18085
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2015-12-29 21:16:59 +00:00
Brad Fitzpatrick
a699320512 net/http: update docs on Request.Proto, ProtoMajor, ProtoMinor
Change-Id: I4a6928b4674b6aaab3611cad7526347923a0015f
Reviewed-on: https://go-review.googlesource.com/18153
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-12-29 18:54:39 +00:00
Russ Cox
f034ee8c22 cmd/dist: apply final edits from CL 18199.
I broke the rule: never click the Submit button on the web.

Change-Id: If81a5cc31c1f28664960bad124cc596f5cab1222
Reviewed-on: https://go-review.googlesource.com/18203
Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-29 17:25:06 +00:00
Russ Cox
d513ee774c cmd/dist: run shards of test dir in parallel
Saves 15 seconds from all.bash on my laptop (3:20 -> 3:05).

Change-Id: Ic5dc3c7804e78b584789dd856a3dada94000a8e2
Reviewed-on: https://go-review.googlesource.com/18199
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-29 17:18:04 +00:00
Russ Cox
b6473ff132 cmd/dist: run wiki, shootout etc tests only on builders
These find approximately nothing.
Takes 5% off my all.bash run time.

For #10571.

Change-Id: I21d3a844af756eb37f59bba0064f24995626da0d
Reviewed-on: https://go-review.googlesource.com/18198
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-29 16:26:50 +00:00
Russ Cox
baa928a782 cmd/dist: run various one-off tests in parallel
Takes 15% off my all.bash run time
(after this and earlier CLs, now down to 3½ from 5½ minutes).

For #10571.

Change-Id: Iac316ffb730c9ff0a0faa7cc3b82ed4f7e6d4361
Reviewed-on: https://go-review.googlesource.com/18088
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-12-29 15:50:04 +00:00
Russ Cox
f41378e225 cmd/dist: run limited tests in race and libgcc=none modes
Mostly we just care that the test binaries link and start up.
No need to run the full test suites.

Takes 12% off my all.bash run time.

For #10571.

Change-Id: I01af618f3d51deb841ea638424e1389a2df7d746
Reviewed-on: https://go-review.googlesource.com/18086
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-12-29 15:48:04 +00:00
Russ Cox
04d732b4c2 build: shorten a few packages with long tests
Takes 3% off my all.bash run time.

For #10571.

Change-Id: I8f00f523d6919e87182d35722a669b0b96b8218b
Reviewed-on: https://go-review.googlesource.com/18087
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-12-29 15:46:44 +00:00
Russ Cox
f70f277875 cmd/dist: make test default to --no-rebuild
I'm tired of having to remember it on every command.
Rebuilding everything is the wrong default.

This CL updates the build script, but the builders may
(or may not) need work, depending on whether they
rebuild using the test command (I doubt it).

Change-Id: I21f202a2f13e73df3f6bd54ae6a317c467b68151
Reviewed-on: https://go-review.googlesource.com/18084
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-29 15:20:00 +00:00
Mikio Hara
6766a293ef os: add missing copyright notice
Change-Id: I496b701e2fcc944c764002643c7b0b2ce9e08806
Reviewed-on: https://go-review.googlesource.com/18182
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-12-29 09:02:28 +00:00
Austin Clements
c7c7c7031d runtime: fix, simplify, and improve scan state in goroutine header
Currently goroutineheader goes through some convolutions to *almost*
print the scan state of a G. However, the code path that would print
the scan state of the G refers to gStatusStrings where it almost
certainly meant to refer to gScanStatusStrings (which is unused), so
it winds up printing the regular status string without the scan state
either way. Furthermore, if the G is in _Gwaiting, we override the
status string and lose where this would indicate the scan state if it
worked.

This commit fixes this so the runtime prints the scan state. However,
rather than using a parallel list of status strings, this simply adds
a conditional print if the scan bit is set. This lets us remove the
string list, prints the scan state even in _Gwaiting, and lets us
strip off the scan bit at the beginning of the function, which
simplifies the rest of it.

Change-Id: Ic0adbe5c05abf4adda93da59f93b578172b28e3d
Reviewed-on: https://go-review.googlesource.com/18092
Reviewed-by: Keith Randall <khr@golang.org>
2015-12-28 01:12:24 +00:00
Ian Lance Taylor
f7e51c1320 runtime: adjust gsignal stack to current signal stack
If non-Go code calls sigaltstack before a signal is received, use
sigaltstack to determine the current signal stack and set the gsignal
stack to use it.  This makes the Go runtime more robust in the face of
non-Go code.  We still can't handle a disabled signal stack or a signal
triggered with SA_ONSTACK clear, but we now give clear errors for those
cases.

Fixes #7227.
Update #9896.

Change-Id: Icb1607e01fd6461019b6d77d940e59b3aed4d258
Reviewed-on: https://go-review.googlesource.com/18102
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-12-24 17:00:04 +00:00