|
Chressie |
at Nov 7, 2012 at 6:42 am
|
⇧ |
| |
https://codereview.appspot.com/6700047/diff/34007/src/pkg/archive/tar/writer.goFile src/pkg/archive/tar/writer.go (right):
https://codereview.appspot.com/6700047/diff/34007/src/pkg/archive/tar/writer.go#newcode192src/pkg/archive/tar/writer.go:192: dir, file := filepath.Split(hdr.Name)
On 2012/11/07 00:59:48, shanemhansen wrote:
According to my reading of the python tarfile implementation, they use
/.
exactly. and therefore you should use the path package (which handles /
separated paths) and not path/filepath (which uses os.PathSeparator
separated paths)
https://codereview.appspot.com/6700047/diff/34007/src/pkg/archive/tar/writer.go#newcode193src/pkg/archive/tar/writer.go:193: ext.Name = filepath.Join(dir,
On 2012/11/07 00:59:48, shanemhansen wrote:
Sorry, I'm not sure what you mean by cleaning the path.
From [0]: "Clean returns the shortest path name equivalent to path by
purely lexical processing."
that means if someone wants to have a path like "a/b/../../c///" in his
tarball, he'll get instead the cleaned path equivalent "c".
that is bad because of 2 things: (1) it's not what the tarball creator
expects, because its not documented; (2) the trailing slash is gone.
i think cleaning the path would make sense, but then it needs to be done
(1) for all hdr.Name (not only the ones which are >100 chars) and (2)
the trailing slash needs to be appended (that's what gnu tar 1.26
does).. but this might break go1 compatibility.
[0]:
http://golang.org/pkg/path/#Cleanhttps://codereview.appspot.com/6700047/