Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(114)

Issue 4950051: code review 4950051: path/filepath: filepath.Clean mangles UNC paths on Windows (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by mattn
Modified:
13 years, 11 months ago
Reviewers:
CC:
golang-dev_googlecode.com, r2, rsc, brainman, rh, jp, golang-dev
Visibility:
Public.

Description

path/filepath: make UNC file names work Fixes issue 2201

Patch Set 1 #

Patch Set 2 : diff -r f82589a5e747 http://go.googlecode.com/hg/ #

Patch Set 3 : diff -r f82589a5e747 http://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 4 : diff -r f845253df880 http://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 3fc0b72a3ad7 http://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 3fc0b72a3ad7 http://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 3fc0b72a3ad7 http://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 2a748f320ba5 http://go.googlecode.com/hg/ #

Patch Set 9 : diff -r 2a748f320ba5 http://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 10 : diff -r 2a748f320ba5 http://go.googlecode.com/hg/ #

Patch Set 11 : diff -r 2a748f320ba5 http://go.googlecode.com/hg/ #

Patch Set 12 : diff -r 2a748f320ba5 http://go.googlecode.com/hg/ #

Patch Set 13 : diff -r c0fea223bc90 http://go.googlecode.com/hg/ #

Patch Set 14 : diff -r c0fea223bc90 http://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 15 : diff -r d084dfee7dd3 http://go.googlecode.com/hg/ #

Patch Set 16 : diff -r 2bd37ba2bcbb http://go.googlecode.com/hg/ #

Total comments: 14

Patch Set 17 : diff -r 5323e969c66a http://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 18 : diff -r 2892d1e242e6 http://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+107 lines, -4 lines) Patch
M src/pkg/path/filepath/path.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +6 lines, -2 lines 0 comments Download
M src/pkg/path/filepath/path_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +68 lines, -0 lines 0 comments Download
M src/pkg/path/filepath/path_windows.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +33 lines, -2 lines 0 comments Download

Messages

Total messages: 46
mattn
Hello golang-dev@googlecode.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to http://go.googlecode.com/hg/
14 years ago (2011-08-30 06:33:31 UTC) #1
mattn
http://codereview.appspot.com/4950051/diff/5001/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/4950051/diff/5001/src/pkg/path/filepath/path.go#newcode61 src/pkg/path/filepath/path.go:61: vol = string(Separator) I'll add comment "workaround" in this ...
14 years ago (2011-08-30 06:37:26 UTC) #2
r2
Can a UNC path use "/" as well as "\"? I thought it could. -rob
14 years ago (2011-08-30 07:23:00 UTC) #3
mattn
Yes, for example, type in your command prompt C:\>dir "//host/share/" Note to add quote to ...
14 years ago (2011-08-30 07:27:44 UTC) #4
r2
But I don't see code for "/" in your implementation of IsUNC. -rob
14 years ago (2011-08-31 04:53:11 UTC) #5
mattn
os.IsPathSeparator is checking "\" or "/" in os/path_windows.go
14 years ago (2011-08-31 05:00:24 UTC) #6
r2
This is putting a Windows concept and name into the general API, which doesn't seem ...
14 years ago (2011-08-31 21:49:56 UTC) #7
rsc
I am concerned about the precedent set by putting windows-specific function names in the filepath ...
14 years ago (2011-08-31 21:49:59 UTC) #8
mattn
I renamed IsUNC to isUNC. and uploaded. > Windows paths are certainly messy. > Is ...
14 years ago (2011-08-31 23:59:43 UTC) #9
brainman
I think you need to fix filepath.Split and filepath.VolumeName as well: package main import ( ...
14 years ago (2011-09-02 02:22:30 UTC) #10
mattn
ok, what a point of fixing about Split() ?
14 years ago (2011-09-02 04:33:18 UTC) #11
brainman
On 2011/09/02 04:33:18, mattn wrote: > ok, what a point of fixing about Split() ? ...
14 years ago (2011-09-02 04:40:09 UTC) #12
mattn
Ah, my patch don't treat them as UNC C:\>dir \\foo The filename, directory name, or ...
14 years ago (2011-09-02 04:47:11 UTC) #13
brainman
On 2011/09/02 04:47:11, mattn wrote: > > ... Is this ok? > I don't know ...
14 years ago (2011-09-02 04:55:59 UTC) #14
mattn
I can't read/understand the english well. Please show me as test case. I don't mind ...
14 years ago (2011-09-02 06:07:25 UTC) #15
brainman
On 2011/09/02 06:07:25, mattn wrote: > I can't read/understand the english well. That makes 2 ...
14 years ago (2011-09-02 06:29:01 UTC) #16
mattn
Ok, I'm only thinking that go keep the spec of UNC. But I can't find ...
14 years ago (2011-09-02 06:35:42 UTC) #17
brainman
On 2011/09/02 06:35:42, mattn wrote: > > I uploaded new changes. > But you didn't ...
14 years ago (2011-09-02 06:39:34 UTC) #18
mattn
oops. plz wait.
14 years ago (2011-09-02 06:40:59 UTC) #19
brainman
On 2011/09/02 06:40:59, mattn wrote: > oops. plz wait. Sorry, no, it is beer time. ...
14 years ago (2011-09-02 06:43:03 UTC) #20
mattn
Have a good time! :)
14 years ago (2011-09-02 06:46:00 UTC) #21
brainman
On 2011/09/02 06:46:00, mattn wrote: > Have a good time! :) Same to you. Alex
14 years ago (2011-09-02 06:46:48 UTC) #22
rh
On 2011/09/02 06:35:42, mattn wrote: > Ok, I'm only thinking that go keep the spec ...
14 years ago (2011-09-02 13:49:38 UTC) #23
mattn
Great, Thanks!
14 years ago (2011-09-03 12:42:06 UTC) #24
mattn
Hello golang-dev@googlecode.com, r@google.com, rsc@golang.org, alex.brainman@gmail.com, robert.hencke@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 12 months ago (2011-09-06 00:41:14 UTC) #25
brainman
http://codereview.appspot.com/4950051/diff/8003/src/pkg/path/filepath/path_test.go File src/pkg/path/filepath/path_test.go (right): http://codereview.appspot.com/4950051/diff/8003/src/pkg/path/filepath/path_test.go#newcode5 src/pkg/path/filepath/path_test.go:5: package filepath Please, do not change package. Do not ...
13 years, 12 months ago (2011-09-06 07:07:18 UTC) #26
mattn
http://codereview.appspot.com/4950051/diff/8003/src/pkg/path/filepath/path_test.go File src/pkg/path/filepath/path_test.go (right): http://codereview.appspot.com/4950051/diff/8003/src/pkg/path/filepath/path_test.go#newcode5 src/pkg/path/filepath/path_test.go:5: package filepath No, isUNC is needed. VolumeName(`c:/foo`) should return ...
13 years, 12 months ago (2011-09-06 07:59:19 UTC) #27
mattn
Ah, very strange english. isUNC is used for whether "/" is needed at leader of ...
13 years, 12 months ago (2011-09-06 08:29:24 UTC) #28
mattn
Hello golang-dev@googlecode.com, r@google.com, rsc@golang.org, alex.brainman@gmail.com, robert.hencke@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 12 months ago (2011-09-08 02:49:03 UTC) #29
brainman
http://codereview.appspot.com/4950051/diff/9009/src/pkg/path/filepath/path_test.go File src/pkg/path/filepath/path_test.go (right): http://codereview.appspot.com/4950051/diff/9009/src/pkg/path/filepath/path_test.go#newcode80 src/pkg/path/filepath/path_test.go:80: {`//host/share/foo/../baz`, `\\host\share\baz`}, I have added this extra test {`\\a\b\..\c`, ...
13 years, 12 months ago (2011-09-08 06:25:41 UTC) #30
mattn
http://codereview.appspot.com/4950051/diff/9009/src/pkg/path/filepath/path_test.go File src/pkg/path/filepath/path_test.go (right): http://codereview.appspot.com/4950051/diff/9009/src/pkg/path/filepath/path_test.go#newcode80 src/pkg/path/filepath/path_test.go:80: {`//host/share/foo/../baz`, `\\host\share\baz`}, "\\\\a\\b\\" in "\\\\a\\b\\..\\c" is meaning volume name. ...
13 years, 12 months ago (2011-09-08 06:32:25 UTC) #31
brainman
On 2011/09/08 06:32:25, mattn wrote: > "\\\\a\\b\\" in "\\\\a\\b\\..\\c" is meaning volume name. What about ...
13 years, 12 months ago (2011-09-08 07:18:32 UTC) #32
mattn
On 2011/09/08 07:18:32, brainman wrote: > What about //a/b/../c? I think this could be interpreted ...
13 years, 12 months ago (2011-09-08 07:31:40 UTC) #33
jp
c:\..\c equals to c:\c \\a\b\..\c equals to \\a\b\c just try "dir c:\..\c" it does not ...
13 years, 12 months ago (2011-09-08 07:40:44 UTC) #34
jp
> > //a/b/../c is not UNC. Then it should be /a/c. Why? C:\>dir \\i\c$\..\Windows | ...
13 years, 12 months ago (2011-09-08 07:42:35 UTC) #35
mattn
Done. On 2011/09/08 07:42:35, jp wrote: > > > > //a/b/../c is not UNC. Then ...
13 years, 12 months ago (2011-09-08 08:17:55 UTC) #36
mattn
13 years, 12 months ago (2011-09-08 08:18:03 UTC) #37
jp
There are some invalids: \\i\..\c$ and \\i\..\i\c$ Should they panic or be leaved unchanged ?
13 years, 12 months ago (2011-09-08 08:29:02 UTC) #38
mattn
On 2011/09/08 08:29:02, jp wrote: > There are some invalids: \\i\..\c$ and \\i\..\i\c$ > Should ...
13 years, 12 months ago (2011-09-08 08:45:33 UTC) #39
jp
http://codereview.appspot.com/4950051/diff/14011/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/4950051/diff/14011/src/pkg/path/filepath/path.go#newcode114 src/pkg/path/filepath/path.go:114: } It can result in "C:." which is not ...
13 years, 12 months ago (2011-09-08 08:54:56 UTC) #40
mattn
http://codereview.appspot.com/4950051/diff/14011/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/4950051/diff/14011/src/pkg/path/filepath/path.go#newcode114 src/pkg/path/filepath/path.go:114: } If path as "C:", This part won't be ...
13 years, 12 months ago (2011-09-08 09:17:58 UTC) #41
brainman
I think we are getting somewhere! Please, change CL description to something simpler, like: >>> ...
13 years, 11 months ago (2011-09-09 06:20:59 UTC) #42
mattn
http://codereview.appspot.com/4950051/diff/14011/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/4950051/diff/14011/src/pkg/path/filepath/path.go#newcode45 src/pkg/path/filepath/path.go:45: if unc { On 2011/09/09 06:20:59, brainman wrote: > ...
13 years, 11 months ago (2011-09-09 06:41:17 UTC) #43
brainman
LGTM after you revert all unnecessary changes. http://codereview.appspot.com/4950051/diff/5009/src/pkg/path/filepath/path_plan9.go File src/pkg/path/filepath/path_plan9.go (right): http://codereview.appspot.com/4950051/diff/5009/src/pkg/path/filepath/path_plan9.go#newcode10 src/pkg/path/filepath/path_plan9.go:10: func isUNC(path ...
13 years, 11 months ago (2011-09-09 07:22:37 UTC) #44
mattn
http://codereview.appspot.com/4950051/diff/5009/src/pkg/path/filepath/path_plan9.go File src/pkg/path/filepath/path_plan9.go (right): http://codereview.appspot.com/4950051/diff/5009/src/pkg/path/filepath/path_plan9.go#newcode10 src/pkg/path/filepath/path_plan9.go:10: func isUNC(path string) (b bool) { On 2011/09/09 07:22:37, ...
13 years, 11 months ago (2011-09-09 07:35:28 UTC) #45
brainman
13 years, 11 months ago (2011-09-09 07:38:38 UTC) #46
*** Submitted as http://code.google.com/p/go/source/detail?r=bcd8c31b8a8d ***

path/filepath: make UNC file names work

Fixes issue 2201

R=golang-dev, r, rsc, alex.brainman, robert.hencke, jp
CC=golang-dev
http://codereview.appspot.com/4950051

Committer: Alex Brainman <alex.brainman@gmail.com>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b