1
0
mirror of https://github.com/golang/go synced 2024-09-25 13:20:13 -06:00
Commit Graph

17819 Commits

Author SHA1 Message Date
Russ Cox
a70cbf1329 runtime: fix freebsd build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13720044
2013-09-16 14:22:24 -04:00
Russ Cox
92dfbd3611 cmd/cgo: fix build (missing file from earlier CL)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13700045
2013-09-16 14:21:54 -04:00
Russ Cox
d9fdf88f34 net: make all.bat run for ordinary Windows users
This CL is required for all.bat to work out of the box on
my Windows 8 laptop.

These tests either require the firewall to be turned off
or require the user to be in the Administrators group.
I don't know which.

Alex may follow up with a refinement of the test to
allow them to run if the user is in the Administrators
group.

Fixes #6392.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13421049
2013-09-16 14:05:06 -04:00
Russ Cox
647eaed93b cmd/cgo: allow C.malloc(0) always
Because we can, and because it otherwise might crash
the program if we think we're out of memory.

Fixes #6390.

R=golang-dev, iant, minux.ma
CC=golang-dev
https://golang.org/cl/13345048
2013-09-16 14:04:55 -04:00
Russ Cox
b2794a1c2e runtime: make ARM integer div-by-zero traceback-friendly
The implementation of division in the 5 toolchain is a bit too magical.
Hide the magic from the traceback routines.

Also add a test for the results of the software divide routine.

Fixes #5805.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13239052
2013-09-16 14:04:45 -04:00
Russ Cox
555da73c56 runtime, syscall: work around FreeBSD/amd64 kernel bug
The kernel implementation of the fast system call path,
the one invoked by the SYSCALL instruction, is broken for
restarting system calls. A C program demonstrating this is below.

Change the system calls to use INT $0x80 instead, because
that (perhaps slightly slower) system call path actually works.

I filed http://www.freebsd.org/cgi/query-pr.cgi?pr=182161.

The C program demonstrating that it is FreeBSD's fault is below.
It reports the same "Bad address" failures from wait.

#include <sys/time.h>
#include <sys/signal.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static void handler(int);
static void* looper(void*);

int
main(void)
{
        int i;
        struct sigaction sa;
        pthread_cond_t cond;
        pthread_mutex_t mu;

        memset(&sa, 0, sizeof sa);
        sa.sa_handler = handler;
        sa.sa_flags = SA_RESTART;
        memset(&sa.sa_mask, 0xff, sizeof sa.sa_mask);
        sigaction(SIGCHLD, &sa, 0);

        for(i=0; i<2; i++)
                pthread_create(0, 0, looper, 0);

        pthread_mutex_init(&mu, 0);
        pthread_mutex_lock(&mu);
        pthread_cond_init(&cond, 0);
        for(;;)
                pthread_cond_wait(&cond, &mu);

        return 0;
}

static void
handler(int sig)
{
}

int
mywait4(int pid, int *stat, int options, struct rusage *rusage)
{
        int result;

        asm("movq %%rcx, %%r10; syscall"
                : "=a" (result)
                : "a" (7),
                  "D" (pid),
                  "S" (stat),
                  "d" (options),
                  "c" (rusage));
}

static void*
looper(void *v)
{
        int pid, stat, out;
        struct rusage rusage;

        for(;;) {
                if((pid = fork()) == 0)
                        _exit(0);
                out = mywait4(pid, &stat, 0, &rusage);
                if(out != pid) {
                        printf("wait4 returned %d\n", out);
                }
        }
}

Fixes #6372.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13582047
2013-09-16 14:04:32 -04:00
Rob Pike
29b4de25b3 cmd/go: document that "main" is a reserved import path
Fixes #6312.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13391049
2013-09-16 22:53:12 +10:00
Han-Wen Nienhuys
ab578e12ff net/rpc: log I/O and internal errors only if debugLog is set.
Fixes #6367.

R=rsc, r
CC=golang-dev
https://golang.org/cl/13395047
2013-09-16 16:29:04 +10:00
Nigel Tao
765479ccb0 doc/go1.2.html: add a "New packages" section similar to
http://golang.org/doc/go1.1#new_packages

R=r
CC=golang-dev
https://golang.org/cl/13368053
2013-09-16 16:26:07 +10:00
Rob Pike
2ec53b0705 cmd/nm: put the -S flag in the usage message
The -S flag reports symbol size, but is missing from the usage message.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13660046
2013-09-16 16:13:27 +10:00
Andrew Gerrand
5dd74175d4 doc: re-organize golang.org site content
Remove "References" section.
Remove most articles and redirect to blog.golang.org.
Move /ref/spec and /ref/mem to /doc/spec and /doc/mem.
Remove duplicate links from the remaining
"Documents", "The Project", and "Help" pages.
Defer to the wiki for more links and community content.
Update command reference and mention cover tool.
Add "Pop-out" text to the front page.
Pick one of four videos at random to feature on the front page.

Fixes #2547.
Fixes #5561.
Fixes #6321.

R=r, dominik.honnef
CC=golang-dev
https://golang.org/cl/13724043
2013-09-16 15:47:13 +10:00
Rob Pike
83da0fd989 doc/go1.2.html: compiler changes
Document the semantic changes within the gc toolchain.

Also delete the mention of unbalanced right delims in template
That change was rolled back.

Absent typos, things we've forgotten, and new things that happen,
the release notes are ready.

R=golang-dev, adg, dominik.honnef
CC=golang-dev
https://golang.org/cl/13368052
2013-09-16 13:03:00 +10:00
Andrew Gerrand
49eeef5927 sort: move example to package level and simplify further
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13634044
2013-09-16 13:02:01 +10:00
Andrew Gerrand
f43b6d470e doc: add uninstallation instructions
Fixes #5821.

R=golang-dev, kamil.kisiel
CC=golang-dev
https://golang.org/cl/13720043
2013-09-16 11:20:07 +10:00
Andrew Gerrand
d445b76331 cmd/gofmt: document -s transformations
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13721043
2013-09-16 11:19:39 +10:00
Rob Pike
d237f3ce6f doc/go1.2.html: net/http, encoding, performance, library changes
Everything is done except compiler changes and additional platforms, if any.

R=golang-dev, dominik.honnef, adg
CC=golang-dev
https://golang.org/cl/13484045
2013-09-16 10:28:53 +10:00
Rob Pike
1fba73de45 encoding/gob: ignore chan and func fields of structures
Previously, fields of type chan or func caused an error.
Now we just treat them like unexported fields and ignore them.
This makes it easier to guarantee long-term compatibilty since
a substructure from another package cannot break gob
encoding by adding a func or chan field.

Fixes #6071

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13693043
2013-09-16 10:26:23 +10:00
Russ Cox
6d68fc8eea runtime: fix CPU profiling on Windows
The test 'gp == m->curg' is not valid on Windows,
because the goroutine being profiled is not from the
current m.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13718043
2013-09-15 12:05:24 -04:00
Russ Cox
aa53b37fa6 go/build: add ctxt.MatchFile
Fixes #6369.

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/13708043
2013-09-15 11:29:47 -04:00
Russ Cox
1385e394cf encoding/xml: document behavior for undefined name space prefixes
Fixes #5626.

R=golang-dev, dominik.honnef
CC=golang-dev
https://golang.org/cl/13702043
2013-09-15 11:29:06 -04:00
Rob Pike
89dacb9cca fmt: %b for complex64 and complex128
Just an oversight they were missing.
Fixes #6387

R=golang-dev, dominik.honnef, rsc
CC=golang-dev
https://golang.org/cl/13715043
2013-09-15 10:45:36 +10:00
Rémy Oudompheng
04c40c97c3 cmd/gc: don't generate algs for internal map types.
Fake types describing the internal structure of hashmaps are
generated for use by precise GC.

Generating hash and eq functions for these fake types slows down
the build and wastes space: the go tool binary size is 13MB
instead of 12MB, and the package size on amd64 is 48.7MB instead
of 45.3MB.

R=golang-dev, daniel.morsing, r, khr, rsc, iant
CC=golang-dev
https://golang.org/cl/13698043
2013-09-14 09:30:36 +02:00
Russ Cox
22e8f82e8d os/exec: add more caveats to StdoutPipe, StderrPipe
(StdinPipe was taken care of by CL 13329043.)

Fixes #6008.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13606046
2013-09-13 15:43:54 -04:00
Russ Cox
439f9397fc runtime: avoid inconsistent goroutine state in profiler
Because profiling signals can arrive at any time, we must
handle the case where a profiling signal arrives halfway
through a goroutine switch. Luckily, although there is much
to think through, very little needs to change.

Fixes #6000.
Fixes #6015.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/13421048
2013-09-13 14:19:23 -04:00
Russ Cox
7fb3d8e45e reflect: document FieldByName shortcoming
Fixes #4876.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13701044
2013-09-13 13:56:39 -04:00
Dave Cheney
bd9cd6e30e syscall: add TCIOFLUSH family of constants
Fixes #6355.

zerrors_linux_{386,amd64,arm}.go were regenerated using mkerrors.sh but I opted to add the three TC.*FLUSH lines by hand to keep the diff smaller and avoid problems with the API checker.

I'll check freebsd and darwin, could I ask for help with net/open bsd.

R=mikioh.mikioh, jsing, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/13660043
2013-09-13 15:01:22 +10:00
Russ Cox
3acddba2ec cmd/5l: fix handling of RET.EQ in wrapper function
Keith is too clever for me.

R=ken2
CC=golang-dev, khr
https://golang.org/cl/13272050
2013-09-13 03:50:50 +00:00
Jamie Wilkinson
27cb23ceb1 goyacc: Fix debug printing of the lexed token's ID and name, and add whitespace in the 'stateX saw' message.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13352048
2013-09-13 13:18:02 +10:00
Rob Pike
3714d69b15 C: Jamie Wilkinson (Googler CLA)
R=golang-dev, dave, adg, dsymonds
CC=golang-dev
https://golang.org/cl/13692043
2013-09-13 13:17:47 +10:00
Rob Pike
c842e43ef6 text/template/parse: mostly roll back the error detection for unmatched right delimiters
It's too late to change this behavior: it breaks templates with minimized JavaScript.

Makes me sad because this common error can never be caught: "{foo}}".
Three cheers for compatibility.

(Leave in a fix to a broken test.)

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/13689043
2013-09-13 12:44:45 +10:00
Russ Cox
913f1f1557 cmd/go: do not support code.google.com/r/zzz projects
This reverts CL 13261048. I have just learned that these are
no longer supported on code.google.com (that is, it is impossible
to create them), so there is little reason to add support in
Go 1.2.

Update #5408

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/13317046
2013-09-12 21:47:56 -04:00
Andrew Gerrand
73790d407c misc/dist: include cover and vet, add -tool flag to specify go.tools tag
Fixes #6356.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13333052
2013-09-13 10:28:30 +10:00
Russ Cox
3c11dd8ebc encoding/xml: add Encoder.Flush
Fixes #6365.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13627046
2013-09-12 16:54:01 -04:00
Russ Cox
7276c02b41 runtime, cmd/gc, cmd/ld: ignore method wrappers in recover
Bug #1:

Issue 5406 identified an interesting case:
        defer iface.M()
may end up calling a wrapper that copies an indirect receiver
from the iface value and then calls the real M method. That's
two calls down, not just one, and so recover() == nil always
in the real M method, even during a panic.

[For the purposes of this entire discussion, a wrapper's
implementation is a function containing an ordinary call, not
the optimized tail call form that is somtimes possible. The
tail call does not create a second frame, so it is already
handled correctly.]

Fix this bug by introducing g->panicwrap, which counts the
number of bytes on current stack segment that are due to
wrapper calls that should not count against the recover
check. All wrapper functions must now adjust g->panicwrap up
on entry and back down on exit. This adds slightly to their
expense; on the x86 it is a single instruction at entry and
exit; on the ARM it is three. However, the alternative is to
make a call to recover depend on being able to walk the stack,
which I very much want to avoid. We have enough problems
walking the stack for garbage collection and profiling.
Also, if performance is critical in a specific case, it is already
faster to use a pointer receiver and avoid this kind of wrapper
entirely.

Bug #2:

The old code, which did not consider the possibility of two
calls, already contained a check to see if the call had split
its stack and so the panic-created segment was one behind the
current segment. In the wrapper case, both of the two calls
might split their stacks, so the panic-created segment can be
two behind the current segment.

Fix this by propagating the Stktop.panic flag forward during
stack splits instead of looking backward during recover.

Fixes #5406.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13367052
2013-09-12 14:00:16 -04:00
Josh Bleecher Snyder
1ea0c480dc go/token: rename RemoveLine to MergeLine, improve documentation
This is a follow-up to feedback from gri in
https://golang.org/cl/12837044/. Most of the wording
and naming improvements are lifted shamelessly from him.

R=gri
CC=golang-dev
https://golang.org/cl/13670043
2013-09-12 09:31:07 -07:00
Nicholas Sullivan
4874bc9b76 crypto/x509: allow ECDSA public keys to be marshaled.
The public key serialization from CreateCertificate is factored out to be
used in MarshalPKIXPublicKey.
Testcode with one P224 ECDSA keypair has been added.

R=golang-dev, agl
CC=agl, golang-dev
https://golang.org/cl/13427044
2013-09-12 12:23:34 -04:00
Adam Langley
4c56457d58 A+C: Nicholas Sullivan
Generated by addca.

R=golang-dev
CC=golang-dev
https://golang.org/cl/13678043
2013-09-12 11:17:37 -04:00
Han-Wen Nienhuys
1e71e74262 net/rpc: document thread safety requirements of codec types.
Fixes #6306.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13474043
2013-09-12 22:03:53 +10:00
Brad Fitzpatrick
1a819be590 net/http: document ServeMux handling of pattern "/"
Fixes #4799

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/13457047
2013-09-12 11:20:16 +01:00
Rob Pike
ea78a4a7a2 doc/go1.2.html: cover, template, vet
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13373053
2013-09-12 16:46:08 +10:00
Mikio Hara
28a8e9ba2f doc/go1.2.html: happy eyeballs on net
Also fix trivial nits.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13532046
2013-09-12 15:12:40 +09:00
Rob Pike
caa462137a text/template: catch unmatched right delimiter
It was simply a missing error case: when scanning plain text
outside of an action, a right delimiter should be an error.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13468045
2013-09-12 13:22:56 +10:00
Mikio Hara
fe62a1f1fe net: move mock ICMP into separate file
This is in prepartion for fixing issue 6320.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13611043
2013-09-12 11:59:18 +09:00
Mikio Hara
81737a9a51 net: make TestDialFailPDLeak shorter
Reduces a number of trials but it still can detect memory leak
when we make blunders in runtime-integarted network poller work,
like just forgetting to call runtime_pollClose in code paths.

Also disables the test on windows/386.

R=alex.brainman, r
CC=golang-dev
https://golang.org/cl/13022046
2013-09-12 11:10:25 +09:00
Dave Cheney
e38eddbfe4 cmd/8l: fix 386 builds
Remove set but unused variable.

R=rsc
CC=golang-dev
https://golang.org/cl/13490047
2013-09-12 11:18:34 +10:00
Russ Cox
1a6576db34 cmd/5l, cmd/6l, cmd/8l: refactor stack split code
Pull the stack split generation into its own function.
This will make an upcoming change to fix recover
easier to digest.

R=ken2
CC=golang-dev
https://golang.org/cl/13611044
2013-09-11 20:29:45 -04:00
Russ Cox
bab302dea2 undo CL 13348045 / 43675523c526
There is no reason to do this, and it's more work.

««« original CL description
net: make channel-based semaphore depend on receive, not send

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

»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13632047
2013-09-11 20:29:22 -04:00
Russ Cox
7f6a7e22a8 net/http: explain the "1.1" in the default User-Agent
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13263052
2013-09-11 20:28:14 -04:00
Robert Griesemer
e333b96529 spec: define s[i:j:k]
R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/10243046
2013-09-11 17:18:52 -07:00
Rob Pike
c0ac667531 doc/go1.2.html: status of gccgo's support for 1.2
R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/13669043
2013-09-12 10:12:26 +10:00