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#newcode202
src/pkg/archive/tar/writer.go:202: func (tw *Writer)
splitUSTARLongName(name string) (prefix, suffix string, err error) {
it looks like the method is splitting also the file names < 100 chars..

if length <= 100 {
return "", name, nil
}

https://codereview.appspot.com/6700047/diff/71008/src/pkg/archive/tar/writer.go#newcode207
src/pkg/archive/tar/writer.go:207: length--
shouldn't this be length++ ? (explanation below)

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
if name ends with a slash and the length of name is <=
fileNamePrefixSize, nlen will be -2.

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

  • Shanemhansen at Feb 7, 2013 at 7:50 pm
    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#newcode202
    src/pkg/archive/tar/writer.go:202: func (tw *Writer)
    splitUSTARLongName(name string) (prefix, suffix string, err error) {
    It is, it assumes only long filenames are being passed to it.
    On 2013/02/07 08:03:39, chressie1 wrote:
    it looks like the method is splitting also the file names < 100 chars..
    if length <= 100 {
    return "", name, nil
    }
    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
    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?
    On 2013/02/07 08:03:39, chressie1 wrote:
    if name ends with a slash and the length of name is <=
    fileNamePrefixSize, nlen
    will be -2.
    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.
  • Chressie at Feb 8, 2013 at 8:43 am
    LGTM

    thanks!

    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.
  • Shanemhansen at Feb 8, 2013 at 9:32 am
    Hello dsymonds@golang.org, dave@cheney.net, rogpeppe@gmail.com,
    remyoudompheng@gmail.com, chressie@gmail.com, rsc@golang.org (cc:
    golang-dev@googlegroups.com),

    Please take another look.


    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.
  • Shanemhansen at Feb 8, 2013 at 10:14 am
    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/08 07:32:10, chressie1 wrote:
    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], "/")

    Done.

    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 {
    On 2013/02/08 07:32:10, chressie1 wrote:
    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.
    Done.

    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedFeb 7, '13 at 8:03a
activeFeb 8, '13 at 10:14a
posts5
users2
websitegolang.org

2 users in discussion

Shanemhansen: 3 posts Chressie: 2 posts

People

Translate

site design / logo © 2021 Grokbase