Darien Raymond [Wed, 31 Oct 2018 14:37:26 +0000 (14:37 +0000)]
crypto/tls: cache Leaf certificate during BuildNameToCertificate
I am working on a TLS server program, which issues new TLS certificates
on demand. The new certificates will be added into tls.Config.Certificates.
BuildNameToCertificate will be called to refresh the name table afterwards.
This change will reduce some workload on existing certificates.
Note that you can’t modify the Certificates field (or call BuildNameToCertificate)
on a Config in use by a Server. You can however modify an unused Config that gets
cloned in GetConfigForClient with appropriate locking.
Oliver Stenbom [Wed, 31 Oct 2018 10:55:24 +0000 (10:55 +0000)]
os: add support for long path names on unix RemoveAll
On unix systems, long enough path names will fail when performing syscalls
like `Lstat`. The current RemoveAll uses several of these syscalls, and so
will fail for long paths. This can be risky, as it can let users "hide"
files from the system or otherwise make long enough paths for programs
to fail. By using `Unlinkat` and `Openat` syscalls instead, RemoveAll is
safer on unix systems. Initially implemented for linux, darwin, dragonfly,
netbsd and openbsd. Not yet implemented on freebsd due to fstatat 64-bit
inode compatibility issues.
Fixes #27029
Co-authored-by: Giuseppe Capizzi <gcapizzi@pivotal.io> Co-authored-by: Julia Nedialkova <yulia.nedyalkova@sap.com>
Change-Id: I978a6a4986878fe076d3c7af86e7927675624a96
GitHub-Last-Rev: 9235489c81b90c228210144b7c25b28a46bb80b7
GitHub-Pull-Request: golang/go#28494
Reviewed-on: https://go-review.googlesource.com/c/146020
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Fri, 26 Oct 2018 07:44:17 +0000 (18:44 +1100)]
os: use Stat instead of Lstat in Symlink
Windows implementation of Symlink uses CreateSymbolicLink Windows
API. The API requires to identify the target type: file or
directory. Current Symlink implementation uses Lstat to determine
symlink type, but Lstat will not be able to determine correct
result if destination is symlink. Replace Lstat call with Stat.
Fixes #28432
Change-Id: Ibee6d8ac21e2246bf8d0a019c4c66d38b09887d4
Reviewed-on: https://go-review.googlesource.com/c/145217
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Rob Pike [Wed, 24 Oct 2018 02:33:14 +0000 (13:33 +1100)]
cmd/doc: allow -all to apply to individual items
It really only matters for types, and the code already worked but was
blocked by a usage check.
Fixes #25595
Change-Id: I823f313b682b37616ea555aee079e2fe39f914c2
Reviewed-on: https://go-review.googlesource.com/c/144357 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Clément Chigot [Mon, 29 Oct 2018 12:39:53 +0000 (13:39 +0100)]
cmd: allow build with gccgo on AIX
This commit adapts cmd/internal/buildid and cmd/go to allow the use of
gccgo on AIX.
Buildid is supported only for AIX archives.
Change-Id: I14c790a8994ae8d2ee629d8751e04189c30ffd94
Reviewed-on: https://go-review.googlesource.com/c/145417
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall [Tue, 30 Oct 2018 17:56:02 +0000 (10:56 -0700)]
strings: declare IndexByte as noescape
This lets []byte->string conversions which are used as arguments to
strings.IndexByte and friends have their backing store allocated on
the stack.
It only prevents allocation when the string is small enough (32
bytes), so it isn't perfect. But reusing the []byte backing store
directly requires a bunch more compiler analysis (see #2205 and
related issues).
Michael Anthony Knyszek [Mon, 1 Oct 2018 19:58:01 +0000 (19:58 +0000)]
runtime: add physical memory scavenging test
This change introduces a test to malloc_test which checks for overuse
of physical memory in the large object treap. Due to fragmentation,
there may be many pages of physical memory that are sitting unused in
large-object space.
Michael Anthony Knyszek [Thu, 4 Oct 2018 15:33:08 +0000 (15:33 +0000)]
runtime: scavenge large spans before heap growth
This change scavenges the largest spans before growing the heap for
physical pages to "make up" for the newly-mapped space which,
presumably, will be touched.
In theory, this approach to scavenging helps reduce the RSS of an
application by marking fragments in memory as reclaimable to the OS
more eagerly than before. In practice this may not necessarily be
true, depending on how sysUnused is implemented for each platform.
Michael Anthony Knyszek [Fri, 5 Oct 2018 18:11:02 +0000 (18:11 +0000)]
runtime: sysUsed spans after trimming
Currently, we mark a whole span as sysUsed before trimming, but this
unnecessarily tells the OS that the trimmed section from the span is
used when it may have been scavenged, if s was scavenged. Overall,
this just makes invocations of sysUsed a little more fine-grained.
It does come with the caveat that now heap_released needs to be managed
a little more carefully in allocSpanLocked. In this case, we choose to
(like before this change) negate any effect the span has on
heap_released before trimming, then add it back if the trimmed part is
scavengable.
Michael Anthony Knyszek [Mon, 15 Oct 2018 23:00:58 +0000 (23:00 +0000)]
runtime: extend ReadMemStatsSlow to re-compute HeapReleased
This change extends the test function ReadMemStatsSlow to re-compute
the HeapReleased statistic such that it is checked in testing to be
consistent with the bookkeeping done in the runtime.
Michael Anthony Knyszek [Thu, 4 Oct 2018 15:59:47 +0000 (15:59 +0000)]
runtime: remove npreleased in favor of boolean
This change removes npreleased from mspan since spans may now either be
scavenged or not scavenged; how many of its pages were actually scavenged
doesn't matter. It saves some space in mpsan overhead too, as the boolean
fits into what would otherwise be struct padding.
Michael Anthony Knyszek [Thu, 25 Oct 2018 18:18:53 +0000 (18:18 +0000)]
runtime: add successor method to treap
This change adds a method for computing a treap node's successor
to the treap, which will simplify the implementation of algorithms
used for heap growth scavenging.
Michael Anthony Knyszek [Thu, 25 Oct 2018 18:11:54 +0000 (18:11 +0000)]
runtime: add predecessor method to treap
This change adds a method for computing a treap node's predecessor
to the treap, which will simplify the implementation of algorithms
used for heap growth scavenging.
Oliver Stenbom [Tue, 30 Oct 2018 00:40:24 +0000 (00:40 +0000)]
os: add support for long path names on unix RemoveAll
On unix systems, long enough path names will fail when performing syscalls
like `Lstat`. The current RemoveAll uses several of these syscalls, and so
will fail for long paths. This can be risky, as it can let users "hide"
files from the system or otherwise make long enough paths for programs
to fail. By using `Unlinkat` and `Openat` syscalls instead, RemoveAll is
safer on unix systems. Initially implemented for linux, darwin, and several bsds.
Fixes #27029
Co-authored-by: Giuseppe Capizzi <gcapizzi@pivotal.io> Co-authored-by: Julia Nedialkova <yulia.nedyalkova@sap.com>
Change-Id: Id9fcdf4775962b021b7ff438dc51ee6d16bb5f56
GitHub-Last-Rev: b30a621fe359fa2acbb055445b54202b0c508167
GitHub-Pull-Request: golang/go#27871
Reviewed-on: https://go-review.googlesource.com/c/137442
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alan Donovan [Mon, 29 Oct 2018 17:49:32 +0000 (13:49 -0400)]
bufio: suggest io.ReadFull at (*Reader).Read
Many times when using bufio.Reader I imagine, incorrectly, that it
implements the retry loop itself, being a high-level buffered wrapper
around, say, a file descriptor prone to short reads. This comment
would have saved me much time.
Change-Id: I34c790e0d7c1515430a76d02ce4739b586a36ba7
Reviewed-on: https://go-review.googlesource.com/c/145577 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
BigMikes [Mon, 29 Oct 2018 10:45:16 +0000 (11:45 +0100)]
net/http: in Transport, don't error on non-chunked response with Trailer header
There are cases where HTTP message specifies the Trailer header
but not the Transfer-Encoding = chunked. The existing
implementation would return an error in those cases, without
returning also the message itself.
Instead, it would be preferable to let the library user decide when
the message is valid or not.
This change makes the fixTrailer() function not to return an error
and to keep the Trailer value in the Response.Header map but not
populate Response.Trailer.
Martin Möhrmann [Fri, 26 Oct 2018 16:09:42 +0000 (18:09 +0200)]
internal/cpu: remove unused and not required ppc64(le) feature detection
Minimum Go requirement for ppc64(le) architecture support is POWER8.
https://github.com/golang/go/wiki/MinimumRequirements#ppc64-big-endian
Reduce CPU features supported in internal/cpu to those needed to
test minimum requirements and cpu feature kernel support for ppc64(le).
Currently no internal/cpu feature variables are used to guard code
from using unsupported instructions. The IsPower9 feature variable
and detection is kept as it will soon be used to guard code execution.
Reducing the set of detected CPU features for ppc64(le) makes
implementing Go support for new operating systems easier as
CPU feature detection for ppc64(le) needs operating system support
(e.g. hwcap on Linux and getsystemcfg syscall on AIX).
Change-Id: Ic4c17b31610970e481cd139c657da46507391d1d
Reviewed-on: https://go-review.googlesource.com/c/145117
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Martin Möhrmann [Sun, 14 Oct 2018 20:28:58 +0000 (22:28 +0200)]
cmd/compile: move slice construction to callers of makeslice
Only return a pointer p to the new slices backing array from makeslice.
Makeslice callers then construct sliceheader{p, len, cap} explictly
instead of makeslice returning the slice.
Reduces go binary size by ~0.2%.
Removes 92 (~3.5%) panicindex calls from go binary.
Robert Griesemer [Mon, 29 Oct 2018 17:24:05 +0000 (10:24 -0700)]
math/big: shallow copies of Int/Rat/Float are not supported (documentation)
Fixes #28423.
Change-Id: Ie57ade565d0407a4bffaa86fb4475ff083168e79
Reviewed-on: https://go-review.googlesource.com/c/145537 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Daniel Martí [Tue, 29 May 2018 16:25:18 +0000 (18:25 +0200)]
cmd/compile: typecheck types and funcs before consts
This way, once the constant declarations are typechecked, all named
types are fully typechecked and have all of their methods added.
Usually this isn't important, as methods and interfaces cannot be used
in constant declarations. However, it can lead to confusing and
incorrect errors, such as:
$ cat f.go
package p
type I interface{ F() }
type T struct{}
const _ = I(T{})
func (T) F() {}
$ go build f.go
./f.go:6:12: cannot convert T literal (type T) to type I:
T does not implement I (missing F method)
The error is clearly wrong, as T does have an F method. If we ensure
that all funcs are typechecked before all constant declarations, we get
the correct error:
$ go build f2.go
# command-line-arguments
./f.go:6:7: const initializer I(T literal) is not a constant
Fixes #24755.
Change-Id: I182b60397b9cac521d9a9ffadb11b42fd42e42fe
Reviewed-on: https://go-review.googlesource.com/c/115096
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Filippo Valsorda [Thu, 25 Oct 2018 01:22:00 +0000 (21:22 -0400)]
crypto/tls: rewrite some messages with golang.org/x/crypto/cryptobyte
As a first round, rewrite those handshake message types which can be
reused in TLS 1.3 with golang.org/x/crypto/cryptobyte. All other types
changed significantly in TLS 1.3 and will require separate
implementations. They will be ported to cryptobyte in a later CL.
The only semantic changes should be enforcing the random length on the
marshaling side, enforcing a couple more "must not be empty" on the
unmarshaling side, and checking the rest of the SNI list even if we only
take the first.
Daniel Martí [Sun, 28 Oct 2018 20:46:58 +0000 (20:46 +0000)]
text/template/parse: simplify Tree.pipeline
The pipeline parsing code was unnecessarily complex. It used a for loop
with a trailing break, a complex switch, and up to seven levels of
indentation.
Instead, drop the loop in favor of a single named goto with a comment,
and flatten out the complex switch to be easier to follow. Two lines of
code are now duplicated, but they're simple and only three lines apart.
While at it, move the pipe initialization further up to remove the need
for three variables.
Change-Id: I07b29de195f4000336219aadeadeacaaa4285c58
Reviewed-on: https://go-review.googlesource.com/c/145285 Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
bill_ofarrell [Fri, 26 Oct 2018 21:33:51 +0000 (17:33 -0400)]
cmd/asm: add s390x VMSLG instruction variants
VMSLG has three variants on z14 and later machines. These variants are used in "limbified" squaring:
VMSLEG: Even Shift Indication -- the even-indexed intermediate result is doubled
VMSLOG: Odd Shift Indication -- the odd-indexed intermediate result is doubled
VMSLEOG: Even and Odd Shift Indication -- both intermediate results are doubled
Limbified squaring is very useful for high performance cryptographic algorithms, such as
elliptic curve. This change allows these instructions to be used in Go assembly.
Change-Id: Iaad577b07320205539f99b3cb37a2a984882721b
Reviewed-on: https://go-review.googlesource.com/c/145180 Reviewed-by: Michael Munday <mike.munday@ibm.com>
Alex Brainman [Sun, 28 Oct 2018 03:45:12 +0000 (14:45 +1100)]
os: remove sleep in windows Process.Wait
The wait was there, because we discovered that we could not remove
finished process executable without the wait on Windows XP. But
Windows XP is not supported by Go. Maybe we do not need the wait
with modern Windows versions. Remove the sleep.
Daniel Martí [Sun, 28 Oct 2018 16:23:00 +0000 (16:23 +0000)]
text/template/parse: error on bad range variables
The package used to accept invalid range pipelines, such as:
{{range $k, .}}
{{range $k, 123 := .}}
This is because the logic that allowed a range pipeline to declare
multiple variables was broken. When encountering a single comma inside a
range pipeline, it would happily continue parsing a second variable,
even if we didn't have a variable token at all.
Then, the loop would immediately break, and we'd parse the pipeline we'd
be ranging over. That is, we'd parse {{range $k, .}} as if it were
{{range $k = .}}.
To fix this, only allow the loop to continue if we know we're going to
parse another variable or a token that would end the pipeline. Also add
a few test cases for these error edge cases.
While at it, make use of T.Run, which was useful in debugging
Tree.pipeline via print statements.
Fixes #28437.
Change-Id: Idc9966bf643f0f3bc1b052620357e5b0aa2022ea
Reviewed-on: https://go-review.googlesource.com/c/145282
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> Reviewed-by: Rob Pike <r@golang.org>
Diogo Pinela [Sun, 28 Oct 2018 17:29:29 +0000 (17:29 +0000)]
os: ensure tests pass even if GOROOT is read-only
We achieve this by always running all tests that create files in a
fresh temporary directory, rather than just on darwin/{arm,arm64}.
As a bonus, this lets us simplify the cleanup code for these tests
and assume their working directory starts out empty.
During development and debugging, I often want to
write noteRule(fmt.Sprintf(...)), and end up
manually adding the import to the generated code.
Let's just make it always available instead.
Martin Möhrmann [Sun, 28 Oct 2018 14:37:13 +0000 (15:37 +0100)]
runtime: support GODEBUGCPU for more Unix-like operating systems
Adds AIX, DragonFly BSD, FreeBSD, NetBSD, OpenBSD and Solaris
to the list of operating systems where the GODEBUGCPU environment
variable will be parsed and interal/cpu features can be enabled
and disabled.
hearot [Sun, 28 Oct 2018 09:01:39 +0000 (10:01 +0100)]
math/big: fix a formula used as documentation
The function documentation was wrong, it was using a wrong parameter. This change
replaces it with the right parameter.
The wrong formula was: q = (u1<<_W + u0 - r)/y
The function has got a parameter "v" (of type Word), not a parameter "y".
So, the right formula is: q = (u1<<_W + u0 - r)/v
Fixes #28444
Change-Id: I82e57ba014735a9fdb6262874ddf498754d30d33
Reviewed-on: https://go-review.googlesource.com/c/145280 Reviewed-by: Robert Griesemer <gri@golang.org>
Martin Möhrmann [Fri, 26 Oct 2018 19:04:45 +0000 (21:04 +0200)]
internal/cpu: replace arch dependent with generic minimal feature test
Use information about required CPU features stored in the CPU feature
options slice to test if minimal CPU requirements are met instead
of hard coding this information in the tests directly.
Change-Id: I72d89b1cff305b8e751995d4230a2217e32f4236
Reviewed-on: https://go-review.googlesource.com/c/145118 Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Filippo Valsorda [Fri, 26 Oct 2018 15:41:02 +0000 (11:41 -0400)]
crypto/tls: bump test timeouts from 1s to 1m for slow builders
The arm5 and mips builders are can't-send-a-packet-to-localhost-in-1s
slow apparently. 1m is less useful, but still better than an obscure
test timeout panic.
Keith Randall [Fri, 26 Oct 2018 17:52:59 +0000 (10:52 -0700)]
cmd/compile: fix rule for combining loads with compares
Unlike normal load+op opcodes, the load+compare opcode does
not clobber its non-load argument. Allow the load+compare merge
to happen even if the non-load argument is used elsewhere.
Noticed when investigating issue #28417.
Change-Id: Ibc48d1f2e06ae76034c59f453815d263e8ec7288
Reviewed-on: https://go-review.googlesource.com/c/145097 Reviewed-by: Ainar Garipov <gugl.zadolbal@gmail.com> Reviewed-by: Ben Shi <powerman1st@163.com>
Clément Chigot [Fri, 26 Oct 2018 08:07:36 +0000 (10:07 +0200)]
runtime: remove instruction linked with AIX new stack layout
This instruction was linked with a new stack layout which might be
needed for AIX. This change might not be taken finally. So, this
instruction must be removed.
See https://go-review.googlesource.com/c/go/+/138733
Change-Id: Ic4a2566e2882696b437eb817d980b7c4bfc03b18
Reviewed-on: https://go-review.googlesource.com/c/144957
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Bryan C. Mills [Tue, 9 Oct 2018 21:03:48 +0000 (17:03 -0400)]
cmd/go/internal/modload: use vendorMap in findModule
The build list is very incomplete in vendor mode,
so we can't rely on it in general.
findModule may be called in modload.PackageModuleInfo, which
load.LoadImport invokes relatively early during a build.
Before this change, the accompanying test failed at 'go build
-mod=vendor' with the message:
build diamondpoint: cannot find module for path diamondpoint
Bryan C. Mills [Tue, 9 Oct 2018 18:23:34 +0000 (14:23 -0400)]
cmd/go: test that 'go mod tidy' uses transitive requirements from replacements
The existing mod_tidy test uses replacements, but doesn't replace
modules that can also be resolved by fetching from GOPROXY, and
doesn't check the differences between the internal and external views.
This new test clarifies that interaction with a more realistic example.
Robert Griesemer [Wed, 24 Oct 2018 21:43:52 +0000 (14:43 -0700)]
go/types: automatically ignore $GOROOT/test files that contain build tags
These files were already ignored via a hard-coded list of excluded files.
Instead of trying to interpret the build tags for these (few) files,
recognize the tags automatically and continue to exclude them.
Fixes #10370.
Change-Id: If7a112ede02e3fa90afe303473d9ea51c5c6609d
Reviewed-on: https://go-review.googlesource.com/c/144457 Reviewed-by: Alan Donovan <adonovan@google.com>
Larry Clapp [Fri, 26 Oct 2018 01:32:27 +0000 (01:32 +0000)]
syscall/js: add the Value.Truthy method
Truthy returns the JavaScript "truthiness" of the given value. In
JavaScript, false, 0, "", null, undefined, and NaN are "falsy", and
everything else is "truthy".
With https://golang.org/cl/135455, gccgo now uses a different mangling
scheme for package paths; add code to use this new scheme for function
and variable symbols. Since users sometimes use older versions of
gccgo with newer versions of go, perform a test at runtime to see
which mangling scheme is in effect for the version of 'gccgo' in the
path.
Updates #27534.
Change-Id: If7ecab06a72e1361129fe40ca6582070a3e8e737
Reviewed-on: https://go-review.googlesource.com/c/144418 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Keith Randall [Thu, 25 Oct 2018 16:18:48 +0000 (09:18 -0700)]
cmd/compile: fix Mul->Mul64 intrinsic alias
The alias declaration needs to come after the function it is aliasing.
It isn't a big deal in this case, as bits.Mul inlines and has as its
body bits.Mul64, so the desired code gets generated regardless.
The alias should only have an effect on inlining cost estimates
(for functions that call bits.Mul).
Change-Id: I0d814899ce7049a0fb36e8ce1ad5ababbaf6265f
Reviewed-on: https://go-review.googlesource.com/c/144597
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com>
Richard Musiol [Thu, 25 Oct 2018 21:11:10 +0000 (23:11 +0200)]
misc/wasm: improve detection of Node.js
This commit adds a check of "process.title" to detect Node.js.
The web app bundler Parcel sets "process" to an empty object. This
incorrectly got detected as Node.js, even though the script was
running in a browser.
Filippo Valsorda [Wed, 24 Oct 2018 17:16:04 +0000 (13:16 -0400)]
crypto/tls: replace custom equal implementations with reflect.DeepEqual
The equal methods were only there for testing, and I remember regularly
getting them wrong while developing tls-tris. Replace them with simple
reflect.DeepEqual calls.
The only special thing that equal() would do is ignore the difference
between a nil and a zero-length slice. Fixed the Generate methods so
that they create the same value that unmarshal will decode. The
difference is not important: it wasn't tested, all checks are
"len(slice) > 0", and all cases in which presence matters are
accompanied by a boolean.
Filippo Valsorda [Thu, 25 Oct 2018 01:31:18 +0000 (21:31 -0400)]
crypto/tls: add timeouts to recorded tests
If something causes the recorded tests to deviate from the expected
flows, they might wait forever for data that is not coming. Add a short
timeout, after which a useful error message is shown.
Clément Chigot [Thu, 25 Oct 2018 09:32:35 +0000 (11:32 +0200)]
syscall: fix TestForeground for AIX
On AIX, sys.Pgid must be a int32 and not a int64 as on Solaris for ioctl
syscall.
Pid_t type can be used to provide the same code in both OS. But pid_t
must be added to ztypes_solaris_amd64.go.
Russ Cox [Wed, 24 Oct 2018 16:01:13 +0000 (12:01 -0400)]
cmd/go, cmd/link: silence bogus Apple Xcode warning
Certain installations of Xcode are affected by a bug that causes
them to print an inconsequential link-time warning that looks like:
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
This has nothing to do with Go, and we've sent this repro case
to Apple:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
version: 10.0.0.0.1.1535735448
$ clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ cat > issue.c
int main() { return 0; }
^D
$ clang issue.c -framework CoreFoundation
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
$
Even if Apple does release a fixed Xcode, many people are seeing
this useless warning, and we might as well make it go away.
Eugene Kalinin [Wed, 20 Jun 2018 22:23:37 +0000 (01:23 +0300)]
net: make cgo resolver work more accurately with network parameter
Unlike the go resolver, the existing cgo resolver exchanges both DNS A
and AAAA RR queries unconditionally and causes unreasonable connection
setup latencies to applications using the cgo resolver.
This change adds new argument (`network`) in all functions through the
series of calls: from Resolver.internetAddrList to cgoLookupIPCNAME.
Benefit: no redundant DNS calls if certain IP version is used IPv4/IPv6
(no `AAAA` DNS requests if used tcp4, udp4, ip4 network. And vice
versa: no `A` DNS requests if used tcp6, udp6, ip6 network)
Brad Fitzpatrick [Thu, 25 Oct 2018 02:02:57 +0000 (02:02 +0000)]
net/http: fix comment change omitted between versions of CL 143177
Updates #23689
Change-Id: Icddec2fcc39802cacd651a9c94290e86cf1e48d1
Reviewed-on: https://go-review.googlesource.com/c/144517 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Thu, 15 Mar 2018 05:21:44 +0000 (08:21 +0300)]
crypto/tls, net/http: reject HTTP requests to HTTPS server
This adds a crypto/tls.RecordHeaderError.Conn field containing the TLS
underlying net.Conn for non-TLS handshake errors, and then uses it in
the net/http Server to return plaintext HTTP 400 errors when a client
mistakenly sends a plaintext HTTP request to an HTTPS server. This is the
same behavior as Apache.
Also in crypto/tls: swap two error paths to not use a value before
it's valid, and don't send a alert record when a handshake contains a
bogus TLS record (a TLS record in response won't help a non-TLS
client).
This commit adds AIX operating system to cmd/link package for ppc64
architecture.
Updates: #25893
Change-Id: I349e0a2658c31919b72117b62c4c9935c9af07c0
Reviewed-on: https://go-review.googlesource.com/c/138730
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Tobias Klauser [Wed, 24 Oct 2018 11:32:24 +0000 (13:32 +0200)]
internal/syscall/unix: omit unnecessary randomTrap check in GetRandom
The randomTrap const is initialized to a non-zero value for linux in
getrandom_linux_$GOARCH.go and for freebsd in getrandom_freebsd.go
directly since CL 16662. Thus, omit the unnecessary check.
Change-Id: Id20cd628dfe6fab9908fa5258c3132e3b422a6b4
Reviewed-on: https://go-review.googlesource.com/c/144108
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Daniel Martí [Thu, 11 Oct 2018 14:13:22 +0000 (15:13 +0100)]
cmd/go: use os.UserCacheDir for the default GOCACHE
This piece of code predates the addition of os.UserCacheDir, and it
looks like os.UserCacheDir was based on this piece of code.
The two behaved exactly the same, minus cmd/go's addition of AppData for
Windows XP in CL 87675. However, Go 1.11 dropped support for Windows XP,
so we can safely ignore that change now.
The only tweaks necessary are to return "off" if an error is
encountered, and to disable warnings if we're using "/.cache".
Change-Id: Ia00577d4575ce4870f7fb103eafaa4d2b630743e
Reviewed-on: https://go-review.googlesource.com/c/141538
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>