]> Cypherpunks repositories - gostls13.git/log
gostls13.git
14 years agogc: correctly handle fields of pointer type to recursive forward references
Lorenzo Stoakes [Thu, 28 Apr 2011 04:13:49 +0000 (00:13 -0400)]
gc: correctly handle fields of pointer type to recursive forward references

Previously, whether declaring a type which copied the structure of a type it was referenced in via a pointer field would work depended on whether you declared it before or after the type it copied, e.g. type T2 T1; type T1 struct { F *T2 } would work, however type T1 struct { F *T2 }; type T2 T1 wouldn't.

Fixes #667.

R=rsc
CC=golang-dev
https://golang.org/cl/4313064

14 years agoruntime: stack split + garbage collection bug
Russ Cox [Thu, 28 Apr 2011 03:21:12 +0000 (23:21 -0400)]
runtime: stack split + garbage collection bug

The g->sched.sp saved stack pointer and the
g->stackbase and g->stackguard stack bounds
can change even while "the world is stopped",
because a goroutine has to call functions (and
therefore might split its stack) when exiting a
system call to check whether the world is stopped
(and if so, wait until the world continues).

That means the garbage collector cannot access
those values safely (without a race) for goroutines
executing system calls.  Instead, save a consistent
triple in g->gcsp, g->gcstack, g->gcguard during
entersyscall and have the garbage collector refer
to those.

The old code was occasionally seeing (because of
the race) an sp and stk that did not correspond to
each other, so that stk - sp was not the number of
stack bytes following sp.  In that case, if sp < stk
then the call scanblock(sp, stk - sp) scanned too
many bytes (anything between the two pointers,
which pointed into different allocation blocks).
If sp > stk then stk - sp wrapped around.
On 32-bit, stk - sp is a uintptr (uint32) converted
to int64 in the call to scanblock, so a large (~4G)
but positive number.  Scanblock would try to scan
that many bytes and eventually fault accessing
unmapped memory.  On 64-bit, stk - sp is a uintptr (uint64)
promoted to int64 in the call to scanblock, so a negative
number.  Scanblock would not scan anything, possibly
causing in-use blocks to be freed.

In short, 32-bit platforms would have seen either
ineffective garbage collection or crashes during garbage
collection, while 64-bit platforms would have seen
either ineffective or incorrect garbage collection.
You can see the invalid arguments to scanblock in the
stack traces in issue 1620.

Fixes #1620.
Fixes #1746.

R=iant, r
CC=golang-dev
https://golang.org/cl/4437075

14 years agocgo: handle versioned ELF symbols
Russ Cox [Thu, 28 Apr 2011 03:21:03 +0000 (23:21 -0400)]
cgo: handle versioned ELF symbols

Fixes #1397.

R=iant
CC=golang-dev
https://golang.org/cl/4444064

14 years agoruntime: allow use of >512 MB on 32-bit platforms
Russ Cox [Thu, 28 Apr 2011 03:20:53 +0000 (23:20 -0400)]
runtime: allow use of >512 MB on 32-bit platforms

runtime: memory allocated by OS not in usable range
runtime: out of memory: cannot allocate 1114112-byte block (2138832896 in use)
throw: out of memory

runtime.throw+0x40 /Users/rsc/g/go/src/pkg/runtime/runtime.c:102
        runtime.throw(0x1fffd, 0x101)
runtime.mallocgc+0x2af /Users/rsc/g/go/src/pkg/runtime/malloc.c:60
        runtime.mallocgc(0x100004, 0x0, 0x1, 0x1, 0xc093, ...)
runtime.mal+0x40 /Users/rsc/g/go/src/pkg/runtime/malloc.c:289
        runtime.mal(0x100004, 0x20bc4)
runtime.new+0x26 /Users/rsc/g/go/src/pkg/runtime/malloc.c:296
        runtime.new(0x100004, 0x8fe84000, 0x20bc4)
main.main+0x29 /Users/rsc/x.go:11
        main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:93
        runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:178
        runtime.goexit()
----- goroutine created by -----
_rt0_386+0xbf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:80

R=iant, r
CC=golang-dev
https://golang.org/cl/4444073

14 years agomime/multipart: add ReadForm and associated types
Andrew Gerrand [Thu, 28 Apr 2011 03:14:35 +0000 (13:14 +1000)]
mime/multipart: add ReadForm and associated types

R=brad_danga_com, rsc, dfc, r, dchest, bradfitz
CC=golang-dev
https://golang.org/cl/4439075

14 years agotar: use ioutil.Discard
Brad Fitzpatrick [Wed, 27 Apr 2011 22:57:22 +0000 (15:57 -0700)]
tar: use ioutil.Discard

This one didn't come up in previous greps.

R=adg
CC=golang-dev
https://golang.org/cl/4430071

14 years agoioutil: add Discard, update tree.
Brad Fitzpatrick [Wed, 27 Apr 2011 22:47:04 +0000 (15:47 -0700)]
ioutil: add Discard, update tree.

This also removes an unnecessary allocation in
http/transfer.go

R=r, rsc1, r2, adg
CC=golang-dev
https://golang.org/cl/4426066

14 years agohttp: put a limit on POST size
Brad Fitzpatrick [Wed, 27 Apr 2011 22:36:39 +0000 (15:36 -0700)]
http: put a limit on POST size

R=rsc
CC=golang-dev
https://golang.org/cl/4432076

14 years agohttp: keep gzip reader inside eofsignaler
Brad Fitzpatrick [Wed, 27 Apr 2011 21:23:25 +0000 (14:23 -0700)]
http: keep gzip reader inside eofsignaler

Fixes #1725

R=rsc
CC=golang-dev
https://golang.org/cl/4442086

14 years agoreflect: Fix Copy of arrays
Gustavo Niemeyer [Wed, 27 Apr 2011 21:22:53 +0000 (18:22 -0300)]
reflect: Fix Copy of arrays

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4438077

14 years agocgi: improve Location response handling
Brad Fitzpatrick [Wed, 27 Apr 2011 21:07:13 +0000 (14:07 -0700)]
cgi: improve Location response handling

Add local URI path support, which isn't as fringe
as I originally thought. (it's supported by Apache)

Send an implicit 302 status on redirects (not 200).

Fixes #1597

R=rsc, r
CC=golang-dev
https://golang.org/cl/4442089

14 years agoruntime: fix mkversion to output valid path separators
Peter Mundy [Wed, 27 Apr 2011 19:47:12 +0000 (15:47 -0400)]
runtime: fix mkversion to output valid path separators

In a GOROOT path a backslash is a path separator
not an escape character. For example, `C:\go`.
Fixes gotest error:
version.go:3: unknown escape sequence: g

R=rsc
CC=golang-dev
https://golang.org/cl/4437076

14 years agohttp/fcgi: New package
Evan Shaw [Wed, 27 Apr 2011 19:34:34 +0000 (12:34 -0700)]
http/fcgi: New package

R=golang-dev, bradfitzgo, bradfitzwork, nigeltao, rog
CC=golang-dev
https://golang.org/cl/4271078

14 years agotutorial: replace the forever loops with finite counts in sieve programs.
Rob Pike [Wed, 27 Apr 2011 16:59:27 +0000 (09:59 -0700)]
tutorial: replace the forever loops with finite counts in sieve programs.
Fixes #1742.
I hope.

Also this picks up an update to go_tutorial.html that should already have happened.

R=brainman, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4452050

14 years agogopack: preserve safe flag when not adding unsafe objects to archive
Russ Cox [Wed, 27 Apr 2011 13:20:53 +0000 (09:20 -0400)]
gopack: preserve safe flag when not adding unsafe objects to archive

R=dsymonds
CC=golang-dev
https://golang.org/cl/4436060

14 years agodoc: mention make version in install.html
Russ Cox [Wed, 27 Apr 2011 01:39:22 +0000 (21:39 -0400)]
doc: mention make version in install.html

Fixes #1531.

R=adg
CC=golang-dev
https://golang.org/cl/4442088

14 years agogoinstall: support GOPATH; building and installing outside the Go tree
Andrew Gerrand [Wed, 27 Apr 2011 01:00:34 +0000 (11:00 +1000)]
goinstall: support GOPATH; building and installing outside the Go tree

For example, with GOPATH set like so
        GOPATH=/home/adg/gocode
And after creating some subdirectories
        mkdir /home/adg/gocode/{bin,pkg,src}

I can use goinstall to install the github.com/nf/goto web server,
which depends on the github.com/nf/stat package, with
        goinstall github.com/nf/goto

This downloads and installs all dependencies (that aren't already
installed) like so
        /home/adg/gocode/bin/goto
        /home/adg/gocode/pkg/darwin_amd64/github.com/nf/stat.a
        /home/adg/gocode/src/github.com/nf/goto/...
        /home/adg/gocode/src/github.com/nf/stat/...

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4438043

14 years agobuilder: build multiple targets in parallel
Andrew Gerrand [Wed, 27 Apr 2011 00:12:10 +0000 (10:12 +1000)]
builder: build multiple targets in parallel

R=rsc, dfc
CC=golang-dev
https://golang.org/cl/4452047

14 years agorpc: run benchmarks over HTTP as well as direct network connections.
Rob Pike [Tue, 26 Apr 2011 23:16:51 +0000 (16:16 -0700)]
rpc: run benchmarks over HTTP as well as direct network connections.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4442085

14 years agorpc: allow the argument (first arg of method) to be a value rather than a pointer.
Rob Pike [Tue, 26 Apr 2011 22:07:25 +0000 (15:07 -0700)]
rpc: allow the argument (first arg of method) to be a value rather than a pointer.
Can make the API nicer in some cases.

R=rsc, rog, r2
CC=golang-dev
https://golang.org/cl/4428064

14 years agohttp: new tests + panic hunting issue 1725
Brad Fitzpatrick [Tue, 26 Apr 2011 19:32:59 +0000 (12:32 -0700)]
http: new tests + panic hunting issue 1725

No bugs found yet, though.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4436058

14 years agocrypto/x509: memorize chain building.
Adam Langley [Tue, 26 Apr 2011 14:26:22 +0000 (10:26 -0400)]
crypto/x509: memorize chain building.

I ran the new verification code against a large number of certificates
with a huge (>1000) number of intermediates.

I had previously convinced myself that a cycle in the certificate
graph implied a cycle in the hash graph (and thus, a contradiction).
This is bogus because the signatures don't cover each other.

Secondly, I managed to drive the verification into a time explosion
with a fully connected graph of certificates. The code would try to
walk the factorial number of paths.

This change switches the CertPool to dealing with indexes of
certificates rather than pointers: this makes equality easy. (I didn't
want to compare pointers because a reasonable gc could move objects
around over time.)

Secondly, verification now memorizes the chains from a given
certificate. This is dynamic programming for the lazy, but there's a
solid reason behind it: dynamic programming would ignore the Issuer
hints that we can exploit by walking up the chain rather than down.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4439070

14 years agosyscall: Mlock, Munlock, Mlockall, Munlockall on Linux.
Albert Strasheim [Tue, 26 Apr 2011 13:41:19 +0000 (06:41 -0700)]
syscall: Mlock, Munlock, Mlockall, Munlockall on Linux.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4433070

14 years agoruntime: more graceful out-of-memory crash
Russ Cox [Tue, 26 Apr 2011 12:25:40 +0000 (08:25 -0400)]
runtime: more graceful out-of-memory crash

Used to fault trying to access l->list->next
when l->list == nil after MCentral_AllocList.
Now prints

runtime: out of memory: no room in arena for 65536-byte allocation (536870912 in use)
throw: out of memory

followed by stack trace.

Fixes #1650.

R=r, dfc
CC=golang-dev
https://golang.org/cl/4446062

14 years agoos: fix race in ReadAt/WriteAt on Windows
Alex Brainman [Tue, 26 Apr 2011 08:09:46 +0000 (18:09 +1000)]
os: fix race in ReadAt/WriteAt on Windows

R=bradfitzgo, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4441051

14 years ago8l: do not emit empty dwarf pe sections
Alex Brainman [Tue, 26 Apr 2011 07:12:16 +0000 (17:12 +1000)]
8l: do not emit empty dwarf pe sections

This change will allow to generate valid executable,
even if rsc disables dwarf generation, as it happend
at revision 9a64273f9d68.

R=rsc
CC=golang-dev, lvd, vcc
https://golang.org/cl/4425066

14 years agohttp: make Client redirect policy configurable
Brad Fitzpatrick [Tue, 26 Apr 2011 05:41:50 +0000 (22:41 -0700)]
http: make Client redirect policy configurable

Work on issue 155

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4435071

14 years agogc: fix order of operations for f() < g().
Russ Cox [Tue, 26 Apr 2011 04:57:03 +0000 (00:57 -0400)]
gc: fix order of operations for f() < g().

Also, 6g was passing uninitialized
Node &n2 to regalloc, causing non-deterministic
register collisions (but only when both left and
right hand side of comparison had function calls).

Fixes #1728.

R=ken2
CC=golang-dev
https://golang.org/cl/4425070

14 years agoall-qemu.bash: remove DISABLE_NET_TESTS
Russ Cox [Tue, 26 Apr 2011 04:16:12 +0000 (00:16 -0400)]
all-qemu.bash: remove DISABLE_NET_TESTS

It's no longer used.

R=adg
CC=golang-dev
https://golang.org/cl/4426061

14 years agodashboard: build most recent revision first
Russ Cox [Tue, 26 Apr 2011 03:48:06 +0000 (23:48 -0400)]
dashboard: build most recent revision first

Will fill dashboard down the screen instead of up
when builders get stuck and resume.  Already live.

Also delete dead benchmark code.
I think it is safe to say that if/when we bring
benchmarks back, we will use a different
data model.

Fixes #1228.

R=adg
CC=golang-dev
https://golang.org/cl/4449059

14 years agowebsocket: include *http.Request in websocket.Conn
Andrew Gerrand [Tue, 26 Apr 2011 00:47:49 +0000 (10:47 +1000)]
websocket: include *http.Request in websocket.Conn

This permits the websocket handler to inspect http headers and such.

Fixes #1726.

R=ukai, bradfitz, bradfitzgo
CC=golang-dev
https://golang.org/cl/4439069

14 years agoruntime: fix arm build
Dave Cheney [Mon, 25 Apr 2011 22:33:57 +0000 (15:33 -0700)]
runtime: fix arm build

R=rsc, r
CC=golang-dev
https://golang.org/cl/4438069

14 years agogc: explain why invalid receiver types are invalid
Russ Cox [Mon, 25 Apr 2011 21:16:44 +0000 (17:16 -0400)]
gc: explain why invalid receiver types are invalid

Fixes #1680.

R=ken2
CC=golang-dev
https://golang.org/cl/4446061

14 years agoruntime: turn "too many EPIPE" into real SIGPIPE
Russ Cox [Mon, 25 Apr 2011 20:58:00 +0000 (16:58 -0400)]
runtime: turn "too many EPIPE" into real SIGPIPE

Tested on Linux and OS X, amd64 and 386.

R=r, iant
CC=golang-dev
https://golang.org/cl/4452046

14 years agotime: Support Irix 6 location for zoneinfo files.
Ian Lance Taylor [Mon, 25 Apr 2011 19:37:00 +0000 (12:37 -0700)]
time: Support Irix 6 location for zoneinfo files.

R=rsc
CC=golang-dev
https://golang.org/cl/4440066

14 years agold: fix 6l -d on Mac, diagnose invalid use of -d
Russ Cox [Mon, 25 Apr 2011 17:57:52 +0000 (13:57 -0400)]
ld: fix 6l -d on Mac, diagnose invalid use of -d

R=r
CC=golang-dev
https://golang.org/cl/4430064

14 years agofix tree for reflect rename
Russ Cox [Mon, 25 Apr 2011 17:39:36 +0000 (13:39 -0400)]
fix tree for reflect rename

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067

14 years agoreflect: rename Typeof, NewValue -> TypeOf, ValueOf
Russ Cox [Mon, 25 Apr 2011 17:39:16 +0000 (13:39 -0400)]
reflect: rename Typeof, NewValue -> TypeOf, ValueOf

R=r, bradfitzgo
CC=golang-dev
https://golang.org/cl/4433066

14 years agogofix: add support for reflect rename
Russ Cox [Mon, 25 Apr 2011 17:39:00 +0000 (13:39 -0400)]
gofix: add support for reflect rename

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4450053

14 years ago8g,8l: fix "set but not used" gcc error
Fazlul Shahriar [Mon, 25 Apr 2011 16:14:30 +0000 (12:14 -0400)]
8g,8l: fix "set but not used" gcc error

$ gcc --version
gcc (GCC) 4.6.0 20110415 (prerelease)

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4442080

14 years agoruntime: correct out of memory error
Russ Cox [Mon, 25 Apr 2011 16:13:54 +0000 (12:13 -0400)]
runtime: correct out of memory error

Fixes #1511.

R=golang-dev, iant2
CC=golang-dev
https://golang.org/cl/4433065

14 years agocodereview: various fixes
Russ Cox [Mon, 25 Apr 2011 16:12:53 +0000 (12:12 -0400)]
codereview: various fixes

Set mailed bit correctly for self-clpatch.
Use repo.rollback correctly.
Allow leading spaces in some C code.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4438064

14 years agogc: fix import width bug
Russ Cox [Mon, 25 Apr 2011 16:08:48 +0000 (12:08 -0400)]
gc: fix import width bug

Fixes #1705.

R=ken2
CC=golang-dev
https://golang.org/cl/4443060

14 years agogc: allow complex types to be receiver types
Robert Hencke [Mon, 25 Apr 2011 16:02:54 +0000 (12:02 -0400)]
gc: allow complex types to be receiver types

Fixes #1716.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4439068

14 years agocrypto/tls: use time(), not Time().
Adam Langley [Mon, 25 Apr 2011 14:27:36 +0000 (10:27 -0400)]
crypto/tls: use time(), not Time().

The unexported version returns a sensible default when the user hasn't
set a value. The exported version crashes in that case.

R=bradfitzgo, rsc1
CC=golang-dev
https://golang.org/cl/4435070

14 years agojpeg: decode to a YCbCr image instead of an RGBA image.
Nigel Tao [Sun, 24 Apr 2011 09:25:49 +0000 (19:25 +1000)]
jpeg: decode to a YCbCr image instead of an RGBA image.

R=r
CC=golang-dev
https://golang.org/cl/4436053

14 years agorc/env.bash: fix for Go tool-chain build on windows under msys.
Joe Poirier [Sat, 23 Apr 2011 18:34:08 +0000 (11:34 -0700)]
rc/env.bash: fix for Go tool-chain build on windows under msys.

The path conversion is done automatically if msys' builtin
shell commands are used.

R=rsc1, peterGo, brainman, Mr_Dark, r
CC=golang-dev
https://golang.org/cl/4452042

14 years agofmt: tweak the doc for %U.
Rob Pike [Sat, 23 Apr 2011 18:25:27 +0000 (11:25 -0700)]
fmt: tweak the doc for %U.
Fixes #1727.

R=rsc
CC=golang-dev
https://golang.org/cl/4437069

14 years agogc: fix conversion of user-defined string type to []byte
Russ Cox [Sat, 23 Apr 2011 14:55:32 +0000 (10:55 -0400)]
gc: fix conversion of user-defined string type to []byte

Fixes #1709.

R=ken2
CC=golang-dev
https://golang.org/cl/4438068

14 years agogc: fix return variable named _
Russ Cox [Sat, 23 Apr 2011 14:54:19 +0000 (10:54 -0400)]
gc: fix return variable named _

Fixes #1712.

R=ken2
CC=golang-dev
https://golang.org/cl/4445055

14 years agogc: fix line number at EOF
Russ Cox [Sat, 23 Apr 2011 14:54:05 +0000 (10:54 -0400)]
gc: fix line number at EOF

Fixes #1474.

R=ken2
CC=golang-dev
https://golang.org/cl/4432061

14 years agold: fix Plan 9 symbol table
Anthony Martin [Sat, 23 Apr 2011 14:53:49 +0000 (10:53 -0400)]
ld: fix Plan 9 symbol table

Static symbols were not being marked as such.

I also made the 'z' symbols use the first byte of
the name instead of an explicit NUL so that if
the symbol table format is ever changed, the only
place that would need updating is addhist().

R=rsc
CC=golang-dev
https://golang.org/cl/4366047

14 years agoruntime: disable long test (fix arm build)
Russ Cox [Sat, 23 Apr 2011 14:03:51 +0000 (10:03 -0400)]
runtime: disable long test (fix arm build)

TBR=r
CC=golang-dev
https://golang.org/cl/4449051

14 years agofmt: decrease recursion depth
Ian Lance Taylor [Fri, 22 Apr 2011 23:59:21 +0000 (16:59 -0700)]
fmt: decrease recursion depth

This permits the test to run when using gccgo on system
without split-stack support.  See
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01420.html
http://gcc.gnu.org/PR48553

R=r
CC=golang-dev
https://golang.org/cl/4440062

14 years agogo spec: for map types, mention indexing operations
Robert Griesemer [Fri, 22 Apr 2011 23:26:51 +0000 (16:26 -0700)]
go spec: for map types, mention indexing operations
         (like we do for arrays and slices).

Suggested by mathieu.lonjaret@gmail.com .

R=r, rsc, iant
CC=golang-dev
https://golang.org/cl/4442074

14 years agocontainer/heap: fix circular dependency in test
David Symonds [Fri, 22 Apr 2011 20:29:05 +0000 (16:29 -0400)]
container/heap: fix circular dependency in test

Having the test be in the container/heap package yields a cycle
  container/heap (for the test)
  -> testing
  -> time
  -> container/heap (for timerHeap)

Occasionally the linker would get mixed up, resulting in a test panic
in a very weird place.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4395042

14 years agohttp: in ServerConn and ClientConn, rename Close to Hijack, add Close
Petar Maymounkov [Fri, 22 Apr 2011 19:56:27 +0000 (15:56 -0400)]
http: in ServerConn and ClientConn, rename Close to Hijack, add Close

R=rsc
CC=golang-dev
https://golang.org/cl/4372046

14 years agocrypto/rsa: add file that I forgot to add last time.
Adam Langley [Fri, 22 Apr 2011 19:46:49 +0000 (15:46 -0400)]
crypto/rsa: add file that I forgot to add last time.

R=rsc
CC=golang-dev
https://golang.org/cl/4452041

14 years agocrypto/rsa: support > 3 primes.
Adam Langley [Fri, 22 Apr 2011 19:33:41 +0000 (15:33 -0400)]
crypto/rsa: support > 3 primes.

With full multi-prime support we can support version 1 PKCS#1 private
keys. This means exporting all the members of rsa.PrivateKey, thus
making the API a little messy. However there has already been another
request to export this so it seems to be something that's needed.

Over time, rsa.GenerateMultiPrimeKey will replace rsa.GenerateKey, but
I need to work on the prime balance first because we're no longer
generating primes which are a multiples of 8 bits.

Fixes #987.

R=rsc
CC=golang-dev
https://golang.org/cl/4378046

14 years agoruntime: stop deadlock test properly (fix arm5 build)
Russ Cox [Fri, 22 Apr 2011 19:22:11 +0000 (15:22 -0400)]
runtime: stop deadlock test properly (fix arm5 build)

TBR=r
CC=golang-dev
https://golang.org/cl/4446058

14 years agosyscall: fix Ftruncate under linux/arm5
Dave Cheney [Fri, 22 Apr 2011 18:44:18 +0000 (14:44 -0400)]
syscall: fix Ftruncate under linux/arm5

Fixes #1714.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4441056

14 years agohttp/cgi: pass some default environment variables
Brad Fitzpatrick [Fri, 22 Apr 2011 18:02:33 +0000 (11:02 -0700)]
http/cgi: pass some default environment variables

This isn't really part of RFC 3875 but matches
the behavior of Apache, et al.

R=iant, iant2
CC=golang-dev
https://golang.org/cl/4435065

14 years agoos/user: new package to look up users
Brad Fitzpatrick [Fri, 22 Apr 2011 16:30:30 +0000 (09:30 -0700)]
os/user: new package to look up users

Only for Unix presently. Other operating systems
are stubbed out, as well as arm (lacks cgo).

R=rsc, r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4440057

14 years agohttp: fix FileServer's default text content type
Brad Fitzpatrick [Fri, 22 Apr 2011 16:09:37 +0000 (09:09 -0700)]
http: fix FileServer's default text content type

Fixes #1729

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4443057

14 years agohttp/cgi: copy some PATH environment variables to child
Ian Lance Taylor [Fri, 22 Apr 2011 15:53:52 +0000 (08:53 -0700)]
http/cgi: copy some PATH environment variables to child

R=bradfitz, bradfitzwork, iant2, bradfitzgo
CC=golang-dev
https://golang.org/cl/4444058

14 years agoos: Open with O_APPEND|O_CREATE to append to the end of file on Windows
Alex Brainman [Fri, 22 Apr 2011 05:31:25 +0000 (15:31 +1000)]
os: Open with O_APPEND|O_CREATE to append to the end of file on Windows

Credit for the fix goes to Hector, test by PeterGo.

Fixes #1655.

R=golang-dev, rsc1, peterGo
CC=golang-dev, hector
https://golang.org/cl/4436051

14 years agohttp: clarify docs on Request HTTP version
Brad Fitzpatrick [Fri, 22 Apr 2011 02:57:19 +0000 (19:57 -0700)]
http: clarify docs on Request HTTP version

Fixes #910

R=adg, rsc1
CC=golang-dev
https://golang.org/cl/4439062

14 years agohttp: close underlying gzip Reader too
Brad Fitzpatrick [Thu, 21 Apr 2011 23:01:29 +0000 (16:01 -0700)]
http: close underlying gzip Reader too

Fixes #1724

R=rsc
CC=golang-dev
https://golang.org/cl/4443056

14 years agoxml: Parser hook for non-UTF-8 charset converters
Brad Fitzpatrick [Thu, 21 Apr 2011 21:37:26 +0000 (14:37 -0700)]
xml: Parser hook for non-UTF-8 charset converters

Adds an optional hook to Parser to let charset
converters step in when a processing directive
with a non-UTF-8 encoding is specified.

(Open to alternative proposals too...)

R=rsc
CC=golang-dev
https://golang.org/cl/4437061

14 years ago8l/prof.c: #if 0 is not accepted by the Plan 9 native toolchain.
Lucio De Re [Thu, 21 Apr 2011 21:03:58 +0000 (17:03 -0400)]
8l/prof.c: #if 0 is not accepted by the Plan 9 native toolchain.

The solution may be a bit of a sledgehammer, but it looks like
a temporary situation anyway.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4400042

14 years agocgo: avoid "incompatible pointer type" warning
Albert Strasheim [Thu, 21 Apr 2011 21:02:52 +0000 (17:02 -0400)]
cgo: avoid "incompatible pointer type" warning

R=rsc
CC=golang-dev
https://golang.org/cl/4409041

14 years agosyscall: add BPF support for darwin/386, darwin/amd64
Mikio Hara [Thu, 21 Apr 2011 20:58:20 +0000 (16:58 -0400)]
syscall: add BPF support for darwin/386, darwin/amd64

note: due to issue 1466 the Msghdr and BpfProgram
struct for src/pkg/syscall/ztypes_darwin_386.go,
src/pkg/syscall/ztypes_darwin_amd64.go had to be
edited after the godefs generation.

R=rsc
CC=golang-dev
https://golang.org/cl/4403042

14 years agomime/multipart: limit line length to prevent abuse
Brad Fitzpatrick [Thu, 21 Apr 2011 17:45:49 +0000 (10:45 -0700)]
mime/multipart: limit line length to prevent abuse

Fixes #1528

R=rsc
CC=golang-dev
https://golang.org/cl/4425060

14 years agogc: fix copy([]int, string) error message
Quan Yong Zhai [Thu, 21 Apr 2011 16:09:29 +0000 (12:09 -0400)]
gc: fix copy([]int, string) error message

R=rsc
CC=golang-dev
https://golang.org/cl/4433064

14 years agoruntime: fix GOMAXPROCS vs garbage collection bug
Dmitriy Vyukov [Thu, 21 Apr 2011 16:09:25 +0000 (12:09 -0400)]
runtime: fix GOMAXPROCS vs garbage collection bug

Fixes #1715.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4434053

14 years agoCONTRIBUTORS: add Dmitriy Vyukov (Google CLA)
Russ Cox [Thu, 21 Apr 2011 16:09:19 +0000 (12:09 -0400)]
CONTRIBUTORS: add Dmitriy Vyukov (Google CLA)

R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4432055

14 years agoruntime: skip functions with no lines when building src line table
Ian Lance Taylor [Thu, 21 Apr 2011 15:32:58 +0000 (08:32 -0700)]
runtime: skip functions with no lines when building src line table

Avoid getting out of synch when a function, such as main.init,
has no associated line number information.  Without this the
function before main.init can skip the PC all the way to the
next function, which will cause the next function's line table
to be associated with main.init, and leave subsequent
functions with the wrong line numbers.

R=rsc
CC=golang-dev
https://golang.org/cl/4426055

14 years agosyscall: Madvise and Mprotect for Linux.
Albert Strasheim [Thu, 21 Apr 2011 14:23:11 +0000 (10:23 -0400)]
syscall: Madvise and Mprotect for Linux.

R=rsc
CC=golang-dev
https://golang.org/cl/4369047

14 years agonet: try /etc/hosts before loading DNS config.
Dmitry Chestnykh [Thu, 21 Apr 2011 14:23:03 +0000 (10:23 -0400)]
net: try /etc/hosts before loading DNS config.

On Mac X 10.6 /etc/resolv.conf is changed dynamically,
and may not exist at all when all network connections
are turned off, thus any lookup, even for "localhost"
would fail with "error reading DNS config: open
/etc/resolv.conf: no such file or directory". This
change avoids the error by trying to lookup addresses
in /etc/hosts before loading DNS config.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4431054

14 years agonet: fix EAI_BADFLAGS error on freebsd
Mikio Hara [Thu, 21 Apr 2011 14:22:53 +0000 (10:22 -0400)]
net: fix EAI_BADFLAGS error on freebsd

R=rsc
CC=golang-dev
https://golang.org/cl/4442072

14 years agosyscall : add a field to ProcAttr so that StartProcess can hide the executed applicat...
Vincent Vanackere [Thu, 21 Apr 2011 14:12:06 +0000 (00:12 +1000)]
syscall : add a field to ProcAttr so that StartProcess can hide the executed application on windows

The SW_HIDE parameter looks like the only way for a windows GUI application to execute a CLI subcommand without having a shell windows appearing.

R=brainman, golang-dev, bradfitzgo, rsc1
CC=golang-dev
https://golang.org/cl/4439055

14 years agoA+C: Vincent Vanackere (individual CLA)
Russ Cox [Thu, 21 Apr 2011 14:09:53 +0000 (10:09 -0400)]
A+C: Vincent Vanackere (individual CLA)

R=golang-dev, brainman
CC=golang-dev
https://golang.org/cl/4437065

14 years agogc: another pointer to interface message
Russ Cox [Thu, 21 Apr 2011 12:20:29 +0000 (08:20 -0400)]
gc: another pointer to interface message

R=ken2
CC=golang-dev
https://golang.org/cl/4444056

14 years agogc: correct handling of unexported method names in embedded interfaces
Russ Cox [Thu, 21 Apr 2011 12:14:50 +0000 (08:14 -0400)]
gc: correct handling of unexported method names in embedded interfaces
go/types: update for export data format change
reflect: require package qualifiers to match during interface check
runtime: require package qualifiers to match during interface check
test: fixed bug324, adapt to be silent

Fixes #1550.
Issue 1536 remains open.

R=gri, ken2, r
CC=golang-dev
https://golang.org/cl/4442071

14 years agosyscall: correct Windows CreateProcess input parameters
Alex Brainman [Thu, 21 Apr 2011 00:36:27 +0000 (10:36 +1000)]
syscall: correct Windows CreateProcess input parameters

Fixes #1718.

R=golang-dev, rsc, peterGo, r
CC=golang-dev
https://golang.org/cl/4435059

14 years agorun.bash: remove redundant rebuilds
Russ Cox [Wed, 20 Apr 2011 22:19:22 +0000 (18:19 -0400)]
run.bash: remove redundant rebuilds

R=r
CC=golang-dev
https://golang.org/cl/4449041

14 years agogob: have errorf always prefix the message with "gob: "
Rob Pike [Wed, 20 Apr 2011 21:22:52 +0000 (14:22 -0700)]
gob: have errorf always prefix the message with "gob: "
to regularize the errors.

R=rsc
CC=golang-dev
https://golang.org/cl/4446055

14 years agonet: fix windows build
Russ Cox [Wed, 20 Apr 2011 21:11:25 +0000 (17:11 -0400)]
net: fix windows build

TBR=r
CC=golang-dev
https://golang.org/cl/4425059

14 years agogob: use new Implements and AssignableTo methods in reflect
Rob Pike [Wed, 20 Apr 2011 21:07:13 +0000 (14:07 -0700)]
gob: use new Implements and AssignableTo methods in reflect
to improve the code and removea  TODO.

R=rsc
CC=golang-dev
https://golang.org/cl/4443054

14 years agohttp: don't proxy loopback addresses
Brad Fitzpatrick [Wed, 20 Apr 2011 20:53:34 +0000 (13:53 -0700)]
http: don't proxy loopback addresses

Fixes #1589

R=rsc
CC=golang-dev
https://golang.org/cl/4443053

14 years agold: remove MachoLoad limit
Russ Cox [Wed, 20 Apr 2011 20:25:00 +0000 (16:25 -0400)]
ld: remove MachoLoad limit

Fixes #1571.

R=ken2
CC=golang-dev
https://golang.org/cl/4443052

14 years agoreflect: add Type.Implements, Type.AssignableTo, Value.CallSlice; make Set match Go
Russ Cox [Wed, 20 Apr 2011 20:24:45 +0000 (16:24 -0400)]
reflect: add Type.Implements, Type.AssignableTo, Value.CallSlice; make Set match Go

This CL makes reflect require that values be assignable to the target type
in exactly the same places where that is the rule in Go.  It also adds
the Implements and AssignableTo methods so that callers can check
the types themselves so as to avoid a panic.

Before this CL, reflect required strict type identity.

This CL expands Call to accept and correctly marshal arbitrary
argument lists for variadic functions; it introduces CallSlice for use
in the case where the slice for the variadic argument is already known.

Fixes #327.
Fixes #1212.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4439058

14 years agogc: fix error for +string
Russ Cox [Wed, 20 Apr 2011 20:12:47 +0000 (16:12 -0400)]
gc: fix error for +string

Fixes #1710.

R=ken2
CC=golang-dev
https://golang.org/cl/4444054

14 years agonet: use C library resolver on FreeBSD, Linux, OS X / amd64, 386
Russ Cox [Wed, 20 Apr 2011 19:21:59 +0000 (15:21 -0400)]
net: use C library resolver on FreeBSD, Linux, OS X / amd64, 386

This CL makes it possible to resolve DNS names on OS X
without offending the Application-Level Firewall.

It also means that cross-compiling from one operating
system to another is no longer possible when using
package net, because cgo needs to be able to sniff around
the local C libraries.  We could special-case this one use
and check in generated files, but it seems more trouble
than it's worth.  Cross compiling is dead anyway.

It is still possible to use either GOARCH=amd64 or GOARCH=386
on typical Linux and OS X x86 systems.

It is also still possible to build GOOS=linux GOARCH=arm on
any system, because arm is for now excluded from this change
(there is no cgo for arm yet).

R=iant, r, mikioh
CC=golang-dev
https://golang.org/cl/4437053

14 years agoreflect: update CanAddr, CanSet documentation
Russ Cox [Wed, 20 Apr 2011 19:04:04 +0000 (15:04 -0400)]
reflect: update CanAddr, CanSet documentation

CanAddr was wrong, out of date; CanSet was incomplete.

R=r
CC=golang-dev
https://golang.org/cl/4442066

14 years agogofix, gofmt: update documentation
Robert Griesemer [Wed, 20 Apr 2011 18:01:21 +0000 (11:01 -0700)]
gofix, gofmt: update documentation

gofmt: also fix a typo in gofmt.go

R=rsc, r
CC=golang-dev
https://golang.org/cl/4431055

14 years agogofmt: add -diff
David Crawshaw [Wed, 20 Apr 2011 17:07:56 +0000 (10:07 -0700)]
gofmt: add -diff

Some code duplication with gofix.

R=rsc, gri, bradfitzgo, r2, adg, peterGo, r, brainman
CC=golang-dev
https://golang.org/cl/4430054

14 years agogoinstall: support building executable commands
Andrew Gerrand [Wed, 20 Apr 2011 02:02:29 +0000 (12:02 +1000)]
goinstall: support building executable commands

This CL gives goinstall the ability to build commands,
not just packages.

"goinstall foo.googlecode.com/hg/bar" will build the command named
"bar" and install it to GOBIN. "goinstall ." will use the name of the
local directory as the command name.

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4426045

14 years agosrc/pkg: make package doc comments consistently start with "Package foo".
Nigel Tao [Tue, 19 Apr 2011 23:57:05 +0000 (09:57 +1000)]
src/pkg: make package doc comments consistently start with "Package foo".

R=rsc
CC=golang-dev
https://golang.org/cl/4442064

14 years agogo spec: attempt at clarifying language for "append"
Robert Griesemer [Tue, 19 Apr 2011 21:38:49 +0000 (14:38 -0700)]
go spec: attempt at clarifying language for "append"

Specifically, fix a wrong comment.

Fixes #1717.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4445050