in reply to CPAN weirdness on Win32

Interesting excuse to go delving through the CPAN.pm source code. I also had alterior motives. I wanted to see how to change the order of which facility is used to fetch modules. I have CPAN 1.63 and ActivePerl build 5.6.1 633 on Windows 2000

My conclusion is that you may have differences in the Cygwin install on the machines. That is, the error comes from tar.exe or something it depends on.

Here is why I think that:

  • CPAN.pm relies on the external tar program. It executes the following code to untar a module
    5746 $system = "$CPAN::Config->{tar} xvf $file"; 5747 $CPAN::Frontend->myprint(qq{Using Tar:$system:\n}); 5748 if (system($system)==0) { 5749 $CPAN::Frontend->myprint(qq{Untarred $file successfull +y\n}); 5750 } else { 5751 $CPAN::Frontend->mydie(qq{Couldn\'t untar $file\n}); 5752 }
    As far as I know system() on win32 has no problems with people using either forward slashes or back slashes in paths
  • After doing all my reading of CPAN.pm I reread your post and realised that this line in the output gives it away
    /usr/bin/tar: F\:\\.cpan\\sources\\authors\\id\\M\\MS\\MSCHWERN\\Carp- +Assert-0.17.tar: Cannot open: I/O error

    tar.exe is saying cannot open due to I/O error

  • The next thing is my experiences with CPAN.pm on the win32 platform. I downloaded the Cygwin platform to do another project and I tried to use the tar.exe from it in my CPAN sessions. I get this
    Using Tar:c:\cygwin\bin\tar.exe xvf \.cpan\sources\authors\id\M\MS\MSC +HWERN\Carp -Assert-0.17.tar: Carp-Assert-0.17/ Carp-Assert-0.17/t/ Carp-Assert-0.17/t/30no_disabled.t /usr/bin/tar: Skipping to next header /usr/bin/tar: Error exit delayed from previous errors Couldn't untar \.cpan\sources\authors\id\M\MS\MSCHWERN\Carp-Assert-0.1 +7.tar cpan>

    After searching around I found an alterative tar.exe which I use now. It works OK except when you specify the full path to it. When you do you get an error locating cygwin.dll. <sigh>

    So basically tar.exe on Win32 with Cygwin sucks and I still wish I could throw Windows out and use linux (even better: Solaris on a Blade so I can finish my Sun Admin certification. :-)

    --blm--
  • Replies are listed 'Best First'.
    Re: Re: CPAN weirdness on Win32
    by demerphq (Chancellor) on Oct 24, 2002 at 11:38 UTC
      Actually the weird behaviour turns out to be due to this (thanks for prompting me to investigate deeper)
      my $is_compressed = $class->gtest($file); if ($is_compressed) { warn "Its compressed, using a pipe.\n"; $system = "$CPAN::Config->{gzip} --decompress --stdout " . "< $file | $CPAN::Config->{tar} xvf -"; } else { warn "Its not compressed, using tar directly.\n"; $system = "$CPAN::Config->{tar} xvf $file"; } if (system($system) != 0) {
      When tar.exe is called in the pipe using dos style filespec it works fine. When it is called with unix style paths it chokes with a
      'e:' is not recognized as an internal or external command, operable pr +ogram or batch file.
      And having failed that attempt CPAN tries several variations of gzip and tar before it finally gives up. These variations involve calling tar directly with the filename, which chokes because
      So basically tar.exe on Win32 with Cygwin sucks
      *ahem* :-)

      What a weird error. Anyway, im going to post to the cygwin people to see if anybody has plans to make tar a little more dosprompt friendly.

      Thanks for the reply.

      --- demerphq
      my friends call me, usually because I'm late....