FAQ
https://codereview.appspot.com/6700047/diff/71008/src/pkg/archive/tar/writer.go
File src/pkg/archive/tar/writer.go (right):

https://codereview.appspot.com/6700047/diff/71008/src/pkg/archive/tar/writer.go#newcode210
src/pkg/archive/tar/writer.go:210: nlen := length - i - 1
On 2013/02/07 19:50:27, shanemhansen wrote:
You have an excellent point. I transliterated this algorithm from gnu tar since
our test suite requires we be compatible with a real world tar file.
Here's the
original source:
http://git.gag.com/?p=debian/tar;a=blob;f=src/create.c#l591
Did I make a mistake in transliterating, or do you think there's a bug in the
gnu implementation?
they use length to init the for loop, so if name ends with a slash, we
want to look for the 2nd last slash in effect. i think the equivalent
should be something like:

strings.LastIndex(name[:length], "/")

https://codereview.appspot.com/6700047/diff/71008/src/pkg/archive/tar/writer.go#newcode211
src/pkg/archive/tar/writer.go:211: if i == 0 || nlen > fileNameSize ||
nlen == 0 {
in addition, i think you need to check for i <= 0, because if i == -1,
we have a single really long name which can't be splitted.

https://codereview.appspot.com/6700047/

--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedFeb 8, '13 at 11:57p
activeFeb 8, '13 at 11:57p
posts1
users1
websitegolang.org

1 user in discussion

Chressie: 1 post

People

Translate

site design / logo © 2022 Grokbase