Shenghou Ma [Wed, 1 Aug 2012 03:26:33 +0000 (23:26 -0400)]
test/run.go: fix compiledir test on windows
we can't import "./bug0" on windows, as it will trigger
"import path contains invalid character ':'" error.
instead, we pass "-D." and "-I." to gc to override this
behavior. this idea is due to remyoudompheng.
Andrew Balholm [Tue, 31 Jul 2012 23:35:02 +0000 (09:35 +1000)]
exp/html: tokenize attributes of end tags
If an end tag has an attribute that is a quoted string containing '>',
the tokenizer would end the tag prematurely. Now it reads the attributes
on end tags just as it does on start tags, but the high-level interface
still doesn't return them, because their presence is a parse error.
Shenghou Ma [Mon, 30 Jul 2012 22:44:48 +0000 (18:44 -0400)]
cmd/cgo: use 1 as last entry for __cgodebug_data
LLVM-based gcc will place all-zero data in a zero-filled
section, but our debug/macho can't handle that.
Fixes #3821.
Rob Pike [Mon, 30 Jul 2012 22:11:20 +0000 (15:11 -0700)]
text/template/parse: fix data race
The situation only affects diagnostics but is easy to fix.
When computing lineNumber, use the position of the last item
returned by nextItem rather than the current state of the lexer.
This is internal only and does not affect the API.
The compiledir pattern compiles all files xxx.dir/*.go
in lexicographic order (which is assumed to coincide with
the topological order of dependencies).
misc/dashboard/codereview: add LastUpdate field to CL
To be filled in by a later CL. I deployed a test version to
App Engine to work on setting the values, so there are
a few records that have this field set already.
That field is breaking the live version, so I have pushed
a new copy with this 1-line change to the live version
I assumed that appengine/datastore was like every other
marshaling and unmarshaling package we have in Go
(for example, encoding/gob, encoding/json, encoding/xml,
and protobuf) and that if it loaded an unknown field it would
just ignore it. Apparently not. Sorry.
This fixes a data race (usually just harmlessly updating
"GET" to "GET"), but also follows RFC 2616 Sec 5.1.1 which
says that the request method is case-sensitive.
Darwin kernels have a bug in accept() where error result from
an internal call is not checked and socket is accepted instead
of ECONNABORTED error. However, such sockets have no sockaddr,
which results in EAFNOSUPPORT error from anyToSockaddr, making
Go http servers running on Mac OS X easily susceptible to
denial of service from simple port scans with nmap.
Fixes #3849.
David Symonds [Sun, 29 Jul 2012 22:48:51 +0000 (08:48 +1000)]
misc/vim: fix :Import insertion heuristic.
If a factored import group has a blank line, assume it is dividing
separate groups of imports (e.g. standard library vs. site-specific).
import (
"bytes"
"io"
"mycorp/package"
)
The most common case is inserting new standard library imports,
which are usually (stylistically) the first group, so we should drop
"net" in the above example immediately after "io".
Since this logic is getting non-trivial, add a test.
exp/locale/collate: changed trie in first step towards support for multiple locales.
- Allow handles into the trie for different locales. Multiple tables share the same
try to allow for reuse of blocks.
- Significantly improved memory footprint and reduced allocations of trieNodes.
This speeds up generation by about 30% and allows keeping trieNodes around
for multiple locales during generation.
- Renamed print method to fprint.
Ian Lance Taylor [Fri, 27 Jul 2012 05:46:20 +0000 (22:46 -0700)]
runtime: ignore signal 33 == SIGSETXID on GNU/Linux
When a cgo program calls setuid, setgid, etc., the GNU/Linux
pthread library sends signal SIGSETXID to each thread to tell
it to update its UID info. If Go is permitted to intercept
the default SIGSETXID signal handler, the program will hang.
This patch tells the runtime package to not try to intercept
SIGSETXID on GNU/Linux. This will be odd if a Go program
wants to try to use that signal, but it means that cgo
programs that call setuid, etc., won't hang.
Robert Griesemer [Fri, 27 Jul 2012 00:09:11 +0000 (17:09 -0700)]
go/printer: don't crash if ast.FuncType.Params is nil
The go/ast comment for FuncType.Params says that the field may be nil.
Make sure the printer accepts such a value. The go/parser always sets
the field (to provide parenthesis position information), but a program
creating a Go AST from scatch may not.
Added corresponding test case.
Fixes #3870.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6448060
Rob Pike [Mon, 23 Jul 2012 23:19:12 +0000 (16:19 -0700)]
text/template: fix bug in map indexing
If the key is not present, return value of the type of the element
not the type of the key. Also fix a test that should have caught this case.
Rob Pike [Mon, 23 Jul 2012 20:34:46 +0000 (13:34 -0700)]
encoding/gob: revert 6348067, which broke compatibility
Add commentary to explain better what's going on, but the
code change is a simple one-line reversal to the previous
form.
build: add few tests with GOMAXPROCS=32 to run.bash
Some class of bugs (data races, runtime bugs) can be found
only with real parallelism.
Note that GOMAXPROCS=32 is somewhat different from go test -cpu=32,
this intentionally uses GOMAXPROCS to stress program bootstrap,
testing code, garbage collections, etc.
Package selection is mostly random.
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6346070
Rob Pike [Fri, 13 Jul 2012 21:23:51 +0000 (14:23 -0700)]
encoding/gob: disable fuzz tests unless command-line flag is set
They can generate huge amounts of memory, causing failure on
small machines. Also they can be very slow. So slow that one test
was commented out! We uncomment it and use a flag.
exp/locale/collate: This CL includes the following changes:
- Changed the representation of colElem to support a few cases
for some languages not supported by the current format.
- Changed offsets for implicit primary values. This makes the
values both easier to read and debug (last 4 nibbles are identical to
implicit primary value) and also results in better packing.
- Fixed bug in weight conversion code that did not pop up yet by
sheer luck.
Note that tables.go also includes changes to the contraction trie
from CL 6346092.
exp/locale/collate: adjusted contraction trie to support Myanmar (Burmese),
which has a rather large contraction table. The value of the next state
offset now starts after the current block, instead of before. This is
slightly less efficient (on extra addition per state change), but gives
some extra range for the offsets.
Also introduced constants for final (0) and noIndex (0xFF).
tables.go is updated in a separate CL.
Rob Pike [Fri, 13 Jul 2012 03:53:17 +0000 (20:53 -0700)]
encoding/gob: reduce decoder memory
Gob decoding reads a whole message into memory and then
copies it into a bytes.Buffer. For large messages this wastes
an entire copy of the message. In this CL, we use a staging
buffer to avoid the large temporary.
Update #2539
RSS drops to 775MB from 1GB.
Active memory drops to 858317048 from 1027878136,
essentially the size of one copy of the input file.
math/big: correct quadratic space complexity in Mul.
The previous implementation used to have a O(n) recursion
depth for unbalanced inputs. A test is added to check that a
reasonable amount of bytes is allocated in this case.
Adam Langley [Wed, 11 Jul 2012 16:47:12 +0000 (12:47 -0400)]
crypto/rsa: left-pad PKCS#1 v1.5 outputs.
OpenSSL requires that RSA signatures be exactly the same byte-length
as the modulus. Currently it'll reject ~1/256 of our signatures: those
that end up a byte shorter.
Fixes #3796.
R=golang-dev, edsrzf, r
CC=golang-dev
https://golang.org/cl/6352093