1
0
mirror of https://github.com/golang/go synced 2024-10-02 14:28:38 -06:00
Commit Graph

147 Commits

Author SHA1 Message Date
Dave Cheney
3d3d539083 path, path/filepath: remove dead code
Fixes #8503.

Thanks to no.smile.face for the original report.

LGTM=bradfitz, r, ruiu
R=bradfitz, ruiu, r
CC=golang-codereviews
https://golang.org/cl/132730043
2014-08-22 22:21:41 +10:00
Alex Brainman
e6f0b74667 path/filepath: make Abs handle paths like c:a.txt properly
Fixes #8145.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/126440043
2014-08-22 17:14:42 +10:00
Alex Brainman
a2d3669ef7 path/filepath: do not restore original working directory twice in test
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/122910043
2014-08-07 10:22:10 +10:00
Michael Fraenkel
cf521ce64f os: Implement symlink support for Windows
Fixes #5750.

https://code.google.com/p/go/issues/detail?id=5750

os: Separate windows from posix. Implement windows support.
path/filepath: Use the same implementation as other platforms
syscall: Add/rework new APIs for Windows

LGTM=alex.brainman
R=golang-codereviews, alex.brainman, gobot, rsc, minux
CC=golang-codereviews
https://golang.org/cl/86160044
2014-07-17 17:02:46 +10:00
Russ Cox
0c2a727477 build: make nacl pass
Add nacl.bash, the NaCl version of all.bash.
It's a separate script because it builds a variant of package syscall
with a large zip file embedded in it, containing all the input files
needed for tests.

Disable various tests new since the last round, mostly the ones using os/exec.

Fixes #7945.

LGTM=dave
R=golang-codereviews, remyoudompheng, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/100590044
2014-05-20 12:10:19 -04:00
Kay Zhu
07dc50b8f1 path/filepath: fixed misaligned comment.
The comment for 'Clean' function is prepended with spaces instead of
a single tab, resulting in visually misaligned comment in the generated
documentation.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/73840043
2014-03-11 14:34:07 -07:00
Kelsey Hightower
96c373f9e1 path/filepath: ensure Glob does not ignore broken symlinks
Fixes #6463.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/69870050
2014-03-04 09:00:45 -08:00
Dave Cheney
7c8280c9ef all: merge NaCl branch (part 1)
See golang.org/s/go13nacl for design overview.

This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come.

CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately.

The exact change lists included are

15050047: syscall: support for Native Client
15360044: syscall: unzip implementation for Native Client
15370044: syscall: Native Client SRPC implementation
15400047: cmd/dist, cmd/go, go/build, test: support for Native Client
15410048: runtime: support for Native Client
15410049: syscall: file descriptor table for Native Client
15410050: syscall: in-memory file system for Native Client
15440048: all: update +build lines for Native Client port
15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client
15570045: os: support for Native Client
15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32
15690044: net: support for Native Client
15690048: runtime: support for fake time like on Go Playground
15690051: build: disable various tests on Native Client

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/68150047
2014-02-25 09:47:42 -05:00
Aram Hăvărneanu
f952d45508 all: add solaris build tags
R=golang-codereviews, minux.ma, gobot, rsc, dave
CC=golang-codereviews
https://golang.org/cl/36040043
2014-01-07 23:53:30 -05:00
Brad Fitzpatrick
6a1a2170bc os, path/filepath: don't ignore Lstat errors in Readdir
os: don't ignore LStat errors in Readdir. If it's ENOENT,
on the second pass, just treat it as missing. If it's another
error, it's real.

path/filepath: use ReaddirNames instead of Readdir in Walk,
in order to obey the documented WalkFunc contract of returning
each walked item's LStat error, if any.

Fixes #6656
Fixes #6680

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/43530043
2013-12-17 12:19:01 -08:00
ChaiShushan
64379b854f all: add missing copyright
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/43290043
2013-12-17 06:52:32 -08:00
Russ Cox
5dc8c4dbfb path/filepath: fix race with other tests
Bug3486 tried to walk the entire file tree, but other tests might
be creating and removing files in that tree. In particular, package os
creates and removes files in the os directory, and issue 5863
reports failures due to seeing those files appear and then disappear.

Change the test to walk just the test tree, which should not be
changing.

Fixes #5863.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13467045
2013-09-09 16:42:18 -04:00
Joel Sing
4186e9d313 all: dragonfly support
Enable remaining packages (crypto, mime, path, time) to build on dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13190043
2013-08-24 02:22:52 +10:00
Rob Pike
f578726de1 all: protect alloc count tests by -testing.short
Update #5000
Should reduce the flakiness a little. Malloc counting is important
to general testing but not to the build dashboard, which uses -short.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12866047
2013-08-21 14:00:45 +10:00
Brad Fitzpatrick
d8e27db395 undo CL 12486043 / ab644299d124
Uglier.

««« original CL description
all: use strings.IndexByte instead of Index where possible

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/12485044
2013-08-05 16:27:24 -07:00
Brad Fitzpatrick
4c772cda54 all: use strings.IndexByte instead of Index where possible
R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
2013-08-05 15:46:06 -07:00
Pieter Droogendijk
27032fddee path/filepath: Panic in Match when parsing invalid character range.
Fixes #5668.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/12001056
2013-07-31 16:58:28 +10:00
Christopher Nielsen
ee78a707c0 path/filepath: Skip TestEvalSymlinks. Plan 9 doesn't have symlinks.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9713044
2013-05-24 11:01:04 -07:00
Albert Strasheim
0a71a5b029 all: Skip AllocsPerRun tests if GOMAXPROCS>1.
Fixes #4974.

R=rsc, bradfitz, r
CC=golang-dev
https://golang.org/cl/7545043
2013-03-06 15:52:32 -08:00
Alex Brainman
3889d8afe5 path/filepath: better error reporting during TestWinSplitListTestsAreValid
Fixes #4930.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7424043
2013-03-01 14:49:55 +11:00
Péter Surányi
b4109f801a path/filepath, os/exec: unquote PATH elements on Windows
On Windows, directory names in PATH can be fully or partially quoted
in double quotes ('"'), but the path names as used by most APIs must
be unquoted. In addition, quoted names can contain the semicolon
(';') character, which is otherwise used as ListSeparator.

This CL changes SplitList in path/filepath and LookPath in os/exec
to only	treat unquoted semicolons as separators, and to unquote the
separated elements.

(In addition, fix harmless test bug I introduced for LookPath on Unix.)

Related discussion thread:
https://groups.google.com/d/msg/golang-nuts/PXCr10DsRb4/sawZBM7scYgJ

R=rsc, minux.ma, mccoyst, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/7181047
2013-02-20 16:19:52 +11:00
Kamil Kisiel
0456729977 path/filepath: add examples for SplitList and Rel.
R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7291043
2013-02-19 10:41:35 -08:00
Russ Cox
6df181a7f0 path/filepath: document Dir better
This comment matches the one in path.

Fixes #4837.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305100
2013-02-19 13:24:03 -05:00
Robin Eklind
d137a2cb56 src: use internal tests if possible
If a test can be placed in the same package ("internal"), it is placed
there. This facilitates testing of package-private details. Because of
dependency cycles some packages cannot be tested by internal tests.

R=golang-dev, rsc, mikioh.mikioh
CC=golang-dev, r
https://golang.org/cl/7323044
2013-02-19 10:02:01 -05:00
Russ Cox
a60ffed9e7 path/filepath: document that Walk does not follow symlinks
Fixes #4759.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7304043
2013-02-04 22:59:30 -05:00
Kyle Lemons
9bfd3c3937 testing: add AllocsPerRun
This CL also replaces similar loops in other stdlib
package tests with calls to AllocsPerRun.

Fixes #4461.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7002055
2013-02-02 22:52:29 -05:00
Shenghou Ma
9e30b708a1 all: set GOMAXPROCS to 1 when counting mallocs
also fix an annoying test that relies on $GOROOT be set.
Fixes #3690.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6844086
2012-12-01 00:38:01 +08:00
Robert Griesemer
465b9c35e5 gofmt: apply gofmt -w src misc
Remove trailing whitespace in comments.
No other changes.

R=r
CC=golang-dev
https://golang.org/cl/6815053
2012-10-30 13:38:01 -07:00
Rob Pike
ec1ef16cea path/filepath: better documentation for WalkFunc
Define the properties of the arguments better. In particular,
explain that the path is (sort of) relative to the argument to
Walk.

Fixes #4119.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6721048
2012-10-17 16:00:09 +11:00
Rob Pike
b7627d3d1f path: improve documentation for Dir
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6495059
2012-08-30 11:16:41 -07:00
Alexey Borzenkov
a108369c83 syscall: return EINVAL when string arguments have NUL characters
Since NUL usually terminates strings in underlying syscalls, allowing
it when converting string arguments is a security risk, especially
when dealing with filenames. For example, a program might reason that
filename like "/root/..\x00/" is a subdirectory or "/root/" and allow
access to it, while underlying syscall will treat "\x00" as an end of
that string and the actual filename will be "/root/..", which might
be unexpected. Returning EINVAL when string arguments have NUL in
them makes sure this attack vector is unusable.

R=golang-dev, r, bradfitz, fullung, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6458050
2012-08-05 17:24:32 -04:00
Alex Brainman
c644a4ddfe path/filepath: avoid allocation in Clean of cleaned path even on windows (fix build)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6344049
2012-06-30 22:08:53 +10:00
Han-Wen Nienhuys
8907f94a51 path/filepath: add test case for rooted ".."
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6350047
2012-06-28 09:46:44 -07:00
Russ Cox
9525372e31 path/filepath: avoid allocation in Clean of cleaned path
Alternative to https://golang.org/cl/6330044.

Fixes #3681.

R=golang-dev, r, hanwen, iant
CC=golang-dev
https://golang.org/cl/6335056
2012-06-27 16:52:36 -04:00
Mikio Hara
24075d33a5 path/filepath: fix test
Make it possible to run test over symlinked GOROOT.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6268046
2012-06-04 09:57:03 +09:00
Jan Mercl
2b57a87678 path/filepath: implement documented SkipDir behavior
Currently walk() doesn't check for err == SkipDir when iterating
a directory list, but such promise is made in the docs for WalkFunc.

Fixes #3486.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6257059
2012-06-02 13:00:09 -04:00
Anthony Martin
0bad08cbbb path/filepath: fix typo
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6117063
2012-04-27 10:25:19 +10:00
Rob Pike
5fc2af1f77 path: document that Clean deletes trailing slashes.
Fixes #3492.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6112044
2012-04-24 13:17:05 +10:00
Alex Brainman
4b943bded8 path/filepath: move out of temp directory before deleting it in TestAbs
Fixes #3476.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5986045
2012-04-05 15:17:24 +10:00
Alex Brainman
48a2c50a18 path/filepath: correct comment in EvalSymlinks
R=golang-dev, r
CC=golang-dev, hcwfrichter
https://golang.org/cl/5934046
2012-03-28 12:27:36 +11:00
Alex Brainman
7a39654174 path/filepath: use windows GetShortPathName api to force GetLongPathName to do its work
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5928043
2012-03-27 15:53:08 +11:00
Alex Brainman
cf13bd3fab path/filepath: convert drive letter to upper case in windows EvalSymlinks
Fixes #3347.

R=golang-dev, aram, r, rsc
CC=golang-dev
https://golang.org/cl/5918043
2012-03-27 12:56:56 +11:00
Alex Brainman
f39ff80bea path/filepath: windows drive letter cannot be a digit
R=golang-dev, r
CC=golang-dev, mattn.jp
https://golang.org/cl/5885056
2012-03-23 15:57:19 +11:00
Alex Brainman
2ef4a84022 path/filepath: implement Match and Glob on windows
As discussed on golang-dev, windows will use
"\" as path separator. No escaping allowed.

R=golang-dev, r, mattn.jp, rsc, rogpeppe, bsiegert, r
CC=golang-dev
https://golang.org/cl/5825044
2012-03-19 16:51:06 +11:00
Robert Griesemer
56cae1c230 all: gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5781058
2012-03-08 10:48:51 -08:00
Alex Brainman
0029b0d207 path/filepath: retrieve real file name in windows EvalSymlinks
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5756049
2012-03-08 10:00:25 +11:00
Alex Brainman
7a3c6c950b os: fix SameFile to work for directories on windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756064
2012-03-07 11:01:23 +11:00
Rob Pike
aeefe0fa6e path/filepath: disable AbsTest on windows
SameFile has a bug.

R=golang-dev
TBR=rsc
CC=golang-dev
https://golang.org/cl/5754055
2012-03-07 08:14:12 +11:00
Rob Pike
2184137cf3 path/filepath/path_test.go: repair and enable TestAbs
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5759051
2012-03-07 07:54:56 +11:00
Russ Cox
fc268acf05 path/filepath: steer people away from HasPrefix
The strikes against it are:

1. It does not take path boundaries into account.
2. It assumes that Windows==case-insensitive file system
and non-Windows==case-sensitive file system, neither of
which is always true.
3. Comparing ToLower against ToLower is not a correct
implementation of a case-insensitive string comparison.
4. If it returns true on Windows you still don't know how long
the matching prefix is in bytes, so you can't compute what
the suffix is.

R=golang-dev, r, dsymonds, r
CC=golang-dev
https://golang.org/cl/5712045
2012-02-29 16:37:40 -05:00