When run with "ulimit -s unlimited", the misc/cgo/test test binary
finds a stack size of 0x3000 returned by getcontext, causing the
runtime to try to stay within those bounds and then fault when
called back in the test after 64 kB has been used by C.
I suspect that Solaris is doing something clever like reporting the
current stack size and growing the stack as faults happen.
On all the other systems, getcontext reports the maximum stack size.
And when the ulimit is not unlimited, even Solaris reports the
maximum stack size.
Work around this by assuming that any stack on Solaris must be at least 1 MB.
Fixes#12210.
Change-Id: I0a6ed0afb8a8f50aa1b2486f32b4ae470ab47dbf
Reviewed-on: https://go-review.googlesource.com/17452
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Motivation:
* Previous implementation did not detect integer overflow when
parsing a base-256 encoded field.
* Previous implementation did not treat the integer as a two's
complement value as specified by GNU.
The relevant GNU specification says:
<<<
GNU format uses two's-complement base-256 notation to store values
that do not fit into standard ustar range.
>>>
Fixes#12435
Change-Id: I4639bcffac8d12e1cb040b76bd05c9d7bc6c23a8
Reviewed-on: https://go-review.googlesource.com/17424
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Motivation:
* Previous implementation silently failed when an integer overflow
occurred. Now, we report an ErrFieldTooLong.
* Previous implementation did not encode in two's complement format and was
unable to encode negative numbers.
The relevant GNU specification says:
<<<
GNU format uses two's-complement base-256 notation to store values
that do not fit into standard ustar range.
>>>
Fixes#12436
Change-Id: I09c20602eabf8ae3a7e0db35b79440a64bfaf807
Reviewed-on: https://go-review.googlesource.com/17425
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Revert "Revert "sort: improve average quicksort performance""
This reverts commit 30b87bb9aa.
See https://golang.org/cl/15688 for the CL being replayed.
Change-Id: I2ba36334003f4971f95a10536adfdd86be9a50de
Reviewed-on: https://go-review.googlesource.com/17389
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Currently only one blank line is checked to be removed.
Changing sort.Sort may lead to more blank lines.
Let's remove them all.
It fixes a bug found by https://golang.org/cl/15688
Change-Id: I682cc23ecd7b10d9b6feb160da040a155297f578
Reviewed-on: https://go-review.googlesource.com/17440
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This is an example of converting an old HTTP/1-only test to test
against both HTTP/1 and HTTP/2.
Please send more of these!
Also, for comparing the http.Transport's responses between HTTP/1 and
HTTP/2, see clientserver_test.go's h12Compare type and tests using
h12Compare. Sometimes that's the more appropriate option.
Change-Id: Iea24d844481efd5849173b60e15dcc561a32b88f
Reviewed-on: https://go-review.googlesource.com/17409
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Followup to CL 12250.
For #10281.
Change-Id: If25d9cac92f10327bb355f2d11b00c625b464661
Reviewed-on: https://go-review.googlesource.com/17199
Reviewed-by: Ian Lance Taylor <iant@golang.org>
RFC 2047 tokens like =?utf-8?B?whatever?= can only appear
unquoted, but this code was trying to decode them even when
they came out of quoted strings. Quoted strings must be left alone.
Fixes#11294.
Change-Id: I41b371f5b1611f1e56d93623888413d07d4ec878
Reviewed-on: https://go-review.googlesource.com/17381
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- change way of protection from O(N^2) on duplicate values.
Previous algorithm does additional comparisons and swaps
on every split pass.
Changed algorithm does one ordinal quicksort split pass,
and if distribution is skewed, then additional pass to
separate pivot's duplicates.
Changed algorithm could be slower on very ununique slice,
but it is still protected from O(N^2).
- increase small slice size and do simple shell sort pass
to amortize worst case on small slices.
Small slice has higher probability to have skewed
distribution, so lets sort it with simpler algorithm.
benchmark old ns/op new ns/op delta
BenchmarkSortString1K 458374 388641 -15.21%
BenchmarkSortInt1K 217851 181796 -16.55%
BenchmarkSortInt64K 20539264 16730340 -18.54%
BenchmarkSort1e2 98668 95554 -3.16%
BenchmarkSort1e4 20278500 18316829 -9.67%
BenchmarkSort1e6 3215724392 2795999911 -13.05%
number of operations:
Size: Total: Swap: Less:
% % %
Sort 100 Avg -5.98% -18.43% -1.90%
Sort 100 Max -14.43% -16.02% -4.51%
Sort 300 Avg -7.50% -12.76% -5.96%
Sort 300 Max -11.29% -9.60% -4.30%
Sort 1000 Avg -12.13% -11.65% -12.25%
Sort 1000 Max -13.81% -11.77% -11.89%
Sort 3000 Avg -14.61% -9.30% -15.86%
Sort 3000 Max -15.81% -8.66% -15.19%
Sort 10000 Avg -16.10% -8.47% -17.80%
Sort 10000 Max -17.13% -7.63% -16.97%
Sort 30000 Avg -17.46% -7.56% -19.57%
Sort 30000 Max -18.24% -7.62% -17.68%
Sort 100000 Avg -18.83% -6.64% -21.33%
Sort 100000 Max -19.72% -6.70% -20.96%
Sort 300000 Avg -19.61% -6.16% -22.30%
Sort 300000 Max -20.69% -6.15% -21.81%
Sort 1000000 Avg -20.42% -5.58% -23.31%
Sort 1000000 Max -21.54% -5.56% -23.61%
Change-Id: I23868e8b52b5841b358cd5403967c9a97871e4d5
Reviewed-on: https://go-review.googlesource.com/15688
Reviewed-by: Russ Cox <rsc@golang.org>
Parsing literal IPv6 address with zone identifier is already supported
when not using cgo. This change enables it when using cgo too.
Fixes#12241.
Change-Id: I3ed78c9e750e75eff0dae76ba8608df39503cf85
Reviewed-on: https://go-review.googlesource.com/17215
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Change-Id: Ic704a2614e310bc7aa3bdee89a020c27f4292efa
Reviewed-on: https://go-review.googlesource.com/17410
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This change returns rooted DNS names on Plan 9,
for consistency with other operating systems.
Updates #12193.
Change-Id: If983920c5b9a8f67d4ccb51bb295fac8dfb87e88
Reviewed-on: https://go-review.googlesource.com/15581
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
This makes TestTransportResponseCloseRace much faster and no longer
flaky.
In the process it also cleans up test hooks in net/http which were
inconsistent and scattered.
Change-Id: Ifd0b11dbc7e8915c24eb5bdc36731ed6751dd7ec
Reviewed-on: https://go-review.googlesource.com/17316
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
The call "poptemp(t, order)" at line 906 should match up with the
assignment "t := marktemp(order)" at line 770, so use a new temporary
variable for stripping the ODCL nodes from a "case x := <-ch" node's
Ninit list.
Fixes#13469.
Passes toolstash/buildall.
Change-Id: Ia7eabd40c79cfdcb83df00b6fbd0954e0c44c5c7
Reviewed-on: https://go-review.googlesource.com/17393
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Fix a typo in de5b386; using `$ver` to determine linux major/minor
versions would produce those for clang, use `$linuxver` instead.
Updates #12898.
Change-Id: I2c8e84ad02749fceaa958afd65e558bb0b08dddb
Reviewed-on: https://go-review.googlesource.com/17323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This adds support for compressed ELF sections. This compression is
treated as a framing issue and hence the package APIs all
transparently decompress compressed sections. This requires some
subtlety for (*Section).Open, which returns an io.ReadSeeker: since
the decompressed data comes from an io.Reader, this commit introduces
a Reader-to-ReadSeeker adapter that is efficient for common uses of
Seek and does what it can otherwise.
Fixes#11773.
Change-Id: Ic0cb7255a85cadf4c1d15fb563d5a2e89dbd3c36
Reviewed-on: https://go-review.googlesource.com/17341
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
GCC and LLVM support zlib-compressing DWARF debug sections (and
there's some evidence that this may be happening by default in some
circumstances now).
Add support for reading compressed DWARF sections. Since ELF
relocations apply to the decompressed data, decompression is done
before applying relocations. Since relcations are applied by
debug/elf, decompression must also be handled there.
Note that this is different from compressed ELF sections, which is a
more general mechanism used by very recent versions of GCC.
Updates #11773.
Change-Id: I3f4bf1b04d0802cc1e8fcb7c2a5fcf6c467c5089
Reviewed-on: https://go-review.googlesource.com/17340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Until now we've used ErrUnknownAlgorithm but that's a bit confusing
when it is returned for obviously-known things like MD5.
Fixes#10431.
Change-Id: Ief8a8ef46e5b99bd4fd18e1acd7ae398a484bac3
Reviewed-on: https://go-review.googlesource.com/17380
Reviewed-by: Adam Langley <agl@golang.org>
The flags are used in OpenFile, not Open.
Change-Id: I45c1639e36694529cb29c2b580c43a22e6fd10ac
Reviewed-on: https://go-review.googlesource.com/17352
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
These are simply incompatible. Clang fixed the bug but not in older versions.
Fixes#12898.
Change-Id: I74a3fd9134dadab6d0f074f8fd09e00d64558d7a
Reviewed-on: https://go-review.googlesource.com/17254
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Followup to CL 16047.
For #12963.
Change-Id: I596cd5109b25a4079b966427411860fde8b9b54a
Reviewed-on: https://go-review.googlesource.com/17232
Reviewed-by: David Crawshaw <crawshaw@golang.org>
stackBarrier on amd64 sanity checks that it's unwinding the correct
entry in the stack barrier array. However, this check is wrong in two
ways that make it unlikely to catch anything, right or wrong:
1) It checks that savedLRPtr == SP, but, in fact, it should be that
savedLRPtr+8 == SP because the RET that returned to stackBarrier
popped the saved LR. However, we didn't notice this check was wrong
because,
2) the sense of the conditional branch is also wrong.
Fix both of these.
Change-Id: I38ba1f652b0168b5b2c11b81637656241262af7c
Reviewed-on: https://go-review.googlesource.com/17039
Reviewed-by: Russ Cox <rsc@golang.org>
This CL also changes windows LookupSRV to return
_xmpp-server._tcp.google.com. as cname instead of google.com
similar to linux. Otherwise TestLookupDots still fails.
Updates #12193 (with plan9 still to do)
Change-Id: Id225e15bee95037cdb4226803506cce690c5d341
Reviewed-on: https://go-review.googlesource.com/13887
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Add the test index so it is easier to find which test case failed.
Change-Id: Ic04682651b26b137355950ff0c51bdbdb1d85a9c
Reviewed-on: https://go-review.googlesource.com/17351
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Also, enable test misc/cgo/testcshared for android/arm64.
c/17245 and c/17246 provide the missing pieces for making
this test work.
"androidtest.bash" now passes on a Nexus 9 (volantis)
device running Android build "LMY48T".
Change-Id: Icb9fd2d17d97e0f04cb18d0cd91640c80fbd3fb4
Reviewed-on: https://go-review.googlesource.com/17333
Reviewed-by: Ian Lance Taylor <iant@golang.org>
On android, runtime.tls_g is a normal variable.
TLS offset is computed in x_cgo_inittls.
Change-Id: I18bc9a736d5fb2a89d0f798956c754e3c10d10e2
Reviewed-on: https://go-review.googlesource.com/17246
Reviewed-by: David Crawshaw <crawshaw@golang.org>
On android, runtime.tls_g is a normal variable.
TLS offset is computed in x_cgo_inittls.
Change-Id: I64cfd3543040776dcdf73cad8dba54fc6aaf6f35
Reviewed-on: https://go-review.googlesource.com/17245
Reviewed-by: David Crawshaw <crawshaw@golang.org>
runtime.stackBarrier is a strange function: it is only ever "called" by
smashing its address into a LR slot on the stack. Calling it like this
certainly does not adhere to the rule that r12 is set to the global entry point
before calling it and the prologue instrutions that compute r2 from r12 in fact
just corrupt r2, which is bad because the function that stackBarrier returns to
probably uses r2 to access global data.
Fortunately stackBarrier itself does not access any global data and so does not
depend on the value of r2, meaning we can ignore the ABI rules and simply skip
inserting the prologue instructions into this specific function.
Fixes 64bit.go, append.go and fixedbugs/issue13169.go from "cd test; go run
run.go -linkshared".
Change-Id: I606864133a83935899398e2d42edd08a946aab24
Reviewed-on: https://go-review.googlesource.com/17281
Reviewed-by: Austin Clements <austin@google.com>
Move test for isblank into addmethod so that most of the type checking
for methods is also performed for blank methods.
Fixes#11366.
Change-Id: I13d554723bf96d906d0b3ff390d7b7c87c1a5020
Reviewed-on: https://go-review.googlesource.com/16866
Reviewed-by: Robert Griesemer <gri@golang.org>
Long lived connections may make some DB operation difficult.
(e.g. retiring load balanced DB server.)
So SetConnMaxLifetime closes long lived connections.
It can be used to limit maximum idle time, too.
Closing idle connections reduces active connections while application is idle
and avoids connections are closed by server side (cause errBadConn while querying).
fixes#9851
Change-Id: I2e8e824219c1bee7f4b885d38ed96d11b7202b56
Reviewed-on: https://go-review.googlesource.com/6580
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>