Re: [PATCH 2/2] archive: support gzipped tar files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 14, 2011 at 01:30:47PM -0700, Junio C Hamano wrote:

> Jeff King <peff@xxxxxxxx> 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.

> > +	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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]