Giter Club home page Giter Club logo

Comments (1)

p5pRT avatar p5pRT commented on August 28, 2024

From [email protected]

  tar (GNU tar) 1.12
  Copyright (C) 1988, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions. There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  Written by John Gilmore and Jay Fenlason.

  gzip 1.2.4 (18 Aug 93)
  Compilation options​:
  DIRENT UTIME STDC_HEADERS HAVE_UNISTD_H ASMV

untar fails with following error​:

//E/cygnus/cygwin-b20/H-i586-cygwin32/bin/tar.EXE​: Cannot execute remote shell​: No such file or directory
[main] E​:\cygnus\cygwin-b20\H-i586-cygwin32\bin\tar.EXE 1000 (0) handle_exceptions​: Exception​: STATUS_ACCESS_VIOLATION
[main] tar 1000 (0) handle_exceptions​: Dumping stack trace to tar.EXE.core
Couldn't untar D​:\Users\AichnerAd\.cpan\sources\authors\id\B\BB\BBIRTH\Win32-SerialPort-0.150.tar
cpan>

This is beacause Cygnus tar cannot handle DOS filenames including
drive letters.

So
tar xvf D​:\Users\AichnerAd\.cpan\sources\authors\id\B\BB\BBIRTH\Win32-SerialPort-0.150.tar
fails, while following would work​:

tar xvf //D/Users/AichnerAd/.cpan/sources/authors/id/B/BB/BBIRTH/Win32-SerialPort-0.150.tar

My proposed fix tries the gzip - tar pipe irregardless of OS and runs
commands separately if that fails.

Could someone please test this under MSwin32 with a tar uncapable of
piping?

Regards,

Adrian

1999-06-13 Adrian Aichner <aichner@​ecf.teradyne.com>

  * CPAN.pm (hosthardest)​: Initialize $netrcfile with $netrc->netrc.
  (untar)​: Attempt piping gzip output to tar irregardless of
  $OSNAME. Run commands separately in case of error.

Inline Patch
diff -u c:\perl\5.00557\lib\CPAN.pm.orig c:\perl\5.00557\lib\CPAN.pm
--- c:\perl\5.00557\lib\CPAN.pm.orig	Sun Jun 13 14:51:30 1999
+++ c:\perl\5.00557\lib\CPAN.pm	Sun Jun 13 14:51:30 1999
@@ -2241,12 +2241,12 @@
 	    next;
 	}
 	my($host,$dir,$getfile) = ($1,$2,$3);
-	my($netrcfile,$fh);
 	my $timestamp = 0;
 	my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
 	   $ctime,$blksize,$blocks) = stat($aslocal);
 	$timestamp = $mtime ||= 0;
 	my($netrc) = CPAN::FTP::netrc->new;
+	my($netrcfile) = $netrc->netrc;
 	my($verbose) = $CPAN::DEBUG{'FTP'} & $CPAN::DEBUG ? " -v" : "";
 	my $targetfile = File::Basename::basename($aslocal);
 	my(@dialog);
@@ -2259,7 +2259,7 @@
 	     "get $getfile $targetfile",
 	     "quit"
 	    );
-	if (! $netrc->netrc) {
+	if (! $netrcfile) {
 	    CPAN->debug("No ~/.netrc file found") if $CPAN::DEBUG;
 	} elsif ($netrc->hasdefault || $netrc->contains($host)) {
 	    CPAN->debug(sprintf("hasdef[%d]cont($host)[%d]",
@@ -4261,47 +4261,48 @@
   if (MM->maybe_command($CPAN::Config->{'gzip'})
       &&
       MM->maybe_command($CPAN::Config->{'tar'})) {
-    if ($^O =~ /win/i) { # irgggh
-	# people find the most curious tar binaries that cannot handle
-	# pipes
-	my $system = "$CPAN::Config->{'gzip'} --decompress $file";
-	if (system($system)==0) {
-	    $CPAN::Frontend->myprint(qq{Uncompressed $file successfully\n});
-	} else {
-	    $CPAN::Frontend->mydie(
-				   qq{Couldn\'t uncompress $file\n}
-				  );
-	}
-	$file =~ s/\.gz$//;
-	$system = "$CPAN::Config->{tar} xvf $file";
-	if (system($system)==0) {
-	    $CPAN::Frontend->myprint(qq{Untarred $file successfully\n});
-	} else {
-	    $CPAN::Frontend->mydie(qq{Couldn\'t untar $file\n});
-	}
-	return 1;
+    my $system = "$CPAN::Config->{'gzip'} --decompress --stdout " .
+      "< $file | $CPAN::Config->{tar} xvf -";
+    if (system($system) != 0) { # irgggh
+      # people find the most curious tar binaries that cannot handle
+      # pipes
+      my $system = "$CPAN::Config->{'gzip'} --decompress $file";
+      if (system($system)==0) {
+	$CPAN::Frontend->myprint(qq{Uncompressed $file successfully\n});
+      } else {
+	$CPAN::Frontend->mydie(
+			       qq{Couldn\'t uncompress $file\n}
+			      );
+      }
+      $file =~ s/\.gz$//;
+      $system = "$CPAN::Config->{tar} xvf $file";
+      $CPAN::Frontend->myprint(qq{USING TAR:$system:\n});
+      if (system($system)==0) {
+	$CPAN::Frontend->myprint(qq{Untarred $file successfully\n});
+      } else {
+	$CPAN::Frontend->mydie(qq{Couldn\'t untar $file\n});
+      }
+      return 1;
     } else {
-	my $system = "$CPAN::Config->{'gzip'} --decompress --stdout " .
-	    "< $file | $CPAN::Config->{tar} xvf -";
-	return system($system) == 0;
+      return 1;
     }
   } elsif ($CPAN::META->has_inst("Archive::Tar")
-      &&
-      $CPAN::META->has_inst("Compress::Zlib") ) {
+	   &&
+	   $CPAN::META->has_inst("Compress::Zlib") ) {
     my $tar = Archive::Tar->new($file,1);
     $tar->extract($tar->list_files); # I'm pretty sure we have nothing
                                      # that isn't compressed
-
+    
     ExtUtils::MM_MacOS::convert_files([$tar->list_files], 1)
-        if ($^O eq 'MacOS');
-
+      if ($^O eq 'MacOS');
+    
     return 1;
   } else {
     $CPAN::Frontend->mydie(qq{
-CPAN.pm needs either both external programs tar and gzip installed or
-both the modules Archive::Tar and Compress::Zlib. Neither prerequisite
-is available. Can\'t continue.
-});
+      CPAN.pm needs either both external programs tar and gzip installed or
+	both the modules Archive::Tar and Compress::Zlib. Neither prerequisite
+	  is available. Can\'t continue.
+	});
   }
 }
 

-- 

  Adrian Aichner Teradyne GmbH, European Design Center
  Integra Test Division Telephone +49/89/41861(0)-208
  Dingolfinger Strasse 2 Fax +49/89/41861-217 (What is a Fax?)
  D-81673 MUENCHEN E-mail adrian.aichner@​teradyne.com

from perl5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.