Re: [PATCH 2/2] archive: support gzipped tar files
- From
Jeff King <peff@github.com>
- Date
- Jun 14, 2011, 20:49 UTC
- Message-ID
- <20110614204950.GB12776@sigill.intra.peff.net>
- In-Reply-To
- <7vaadkkvew.fsf@alter.siamese.dyndns.org>
On Tue, Jun 14, 2011 at 01:30:47PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes: > > I didn't know it was that easy (primarily because I didn't know zlib had a > ready-to-eat interface to do this).
Yes, though I think it may be worth doing the more flexible, external-filters approach. See elsewhere in the thread.
Show 12 quoted lines
> > + if (!strcasecmp(ext, "tgz"))
> > + return "--format=tgz";
> > + if (!strcasecmp(ext, "gz") &&
> > + ext - 4 >= filename &&
> > + !strcasecmp(ext - 4, "tar.gz"))
>
> Shouldn't this be
>
> if (!strcasecmp(ext, "gz") && filename < ext - 5 &&
> !strcasecmp(ext - 5, ".tar.gz"))
>
> to exclude "hellotar.gz" and possibly ".tar.gz" ("<=" vs "<")?Yeah, definitely. I think the right way forward is to make this less hard-coded, to allow people to configure new filters, so this bit of code will get rewritten in my next version. But I'll make sure it is a little more strict on extension matching.
-Peff