demerphq has asked for the wisdom of the Perl Monks concerning the following question:

This is partly a heads up and partly a question

Today i had the weirdest thing happen with CPAN. Basically I have two machines that are for all intents and purposes of this node identical. They both have VS DotNet, they both have the latest and same versions of the Cygwin tools. Etc. But for some reason one of them was choking:

cpan> force install Carp::Assert Running install for module Carp::Assert Running make for M/MS/MSCHWERN/Carp-Assert-0.17.tar.gz Checksum for F:\.cpan\sources\authors\id\M\MS\MSCHWERN\Carp-Assert-0.1 +7.tar.gz ok 'F:' is not recognized as an internal or external command, operable program or batch file. Uncompressed F:\.cpan\sources\authors\id\M\MS\MSCHWERN\Carp-Assert-0.1 +7.tar.gz successfully Using Tar:F:/Cygwin/bin/tar.EXE xvf F:\.cpan\sources\authors\id\M\MS\M +SCHWERN\Carp-Assert-0.17.tar: F: Unknown Host /usr/bin/tar: F\:\\.cpan\\sources\\authors\\id\\M\\MS\\MSCHWERN\\Carp- +Assert-0.17.tar: Cannot open: I/O error /usr/bin/tar: Error is not recoverable: exiting now Couldn't untar F:\.cpan\sources\authors\id\M\MS\MSCHWERN\Carp-Assert-0 +.17.tar
(The reason i did a force install with that module was that I know the module is pure perl, and that i had installed it fine previously.)

Yet when i did the exact same thing on the second machine it worked just fine.

So after checking everything I could for differences, I realized that the only thing I could see was that in the CPAN/Config.pm the paths were forward slashed on the error box and backslashed on the proper box. Ie:

#Error box tar F:/Cygwin/bin/tar.EXE #Ok box tar F:\Cygwin\bin\tar.EXE
And when I changed the unix style paths to Win32 style paths everything magically started working.

I have no idea what the cause of this is, cygwin or CPAN itself. I could see it being either really. But if CPAN starts doing something weird on a W32 box, I personally would check those paths...

Cheers,

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

Replies are listed 'Best First'.
Re: CPAN weirdness on Win32
by blm (Hermit) on Oct 24, 2002 at 09:29 UTC

    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--
      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....