git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] import-tars: use Archive::Tar instead of unpack()

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 15, 2007, 02:51 UTC
Message-ID
<20070215025159.GA29944@spearce.org>
In-Reply-To
<1171468992.629.68.camel@ibook.zvpunry.de>
Michael Loeffler <zvpunry@zvpunry.de> wrote:
Show 25 quoted lines
> In the Archive::Tar manpage they use gunzip and uncompress instead of
> zcat or gzcat, so what do you think about the following patch?
> 
> diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
> index 990c9e7..5585a8b 100755
> --- a/contrib/fast-import/import-tars.perl
> +++ b/contrib/fast-import/import-tars.perl
> @@ -25,11 +25,14 @@ foreach my $tar_file (@ARGV)
>  	my $tar_name = $1;
>  
>  	if ($tar_name =~ s/\.(tar\.gz|tgz)$//) {
> -		open(I, '-|', 'gzcat', $tar_file) or die "Unable to gzcat $tar_file: $!\n";
> +		open(I, '-|', 'gunzip', '-c', $tar_file)
> +			or die "Unable to gunzip -c $tar_file: $!\n";
>  	} elsif ($tar_name =~ s/\.(tar\.bz2|tbz2)$//) {
> -		open(I, '-|', 'bzcat', $tar_file) or die "Unable to bzcat $tar_file: $!\n";
> +		open(I, '-|', 'bunzip2', '-c', $tar_file)
> +			or die "Unable to bunzip2 -c $tar_file: $!\n";
>  	} elsif ($tar_name =~ s/\.tar\.Z$//) {
> -		open(I, '-|', 'zcat', $tar_file) or die "Unable to zcat $tar_file: $!\n";
> +		open(I, '-|', 'uncompress', '-c', $tar_file)
> +			or die "Unable to uncompress -c $tar_file: $!\n";
>  	} elsif ($tar_name =~ s/\.tar$//) {
>  		open(I, $tar_file) or die "Unable to open $tar_file: $!\n";
>  	} else {

Yes, that's what I should have done initially. Thanks. How about the following message and sbo?

commit 908387056949c0fb8153fbb84f4dbeb6695611e6
Author: Michael Loeffler <zvpunry@zvpunry.de>
Date:   Wed Feb 14 17:03:12 2007 +0100
    Use gunzip -c over gzcat in import-tars example.
    
    Not everyone has gzcat or bzcat installed on their system, but
    gunzip -c and bunzip2 -c perform the same task and are available
    if the user has installed gzip support or bzip2 support.
    
    Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-- 
Shawn.
Previous: Michael LoefflerNext: Karl Hasselström
Message 5 of 7 in “import-tars: use Archive::Tar instead of unpack()”
  1. import-tars: use Archive::Tar instead of unpack()Michael Loeffler, Feb 12, 2007
  2. Johannes SchindelinFeb 12, 2007
  3. Shawn O. PearceFeb 12, 2007
  4. Michael LoefflerFeb 14, 2007
  5. Shawn O. PearceFeb 15, 2007
  6. Karl HasselströmApr 24, 2007
  7. Sam VilainApr 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.