Subject: | CPAN 1.70 fails if any file of module being installed is unwriteable |
If CPAN 1.70 is used to install a module which has one or more files which are unwriteable by the owner (e.g. SOAP-Lite-0.55) it fails (ignore
the line numbers; I'd added - harmless - debugging code by this time):
Couldn't rename SOAP-Lite-0.55 to /usr/local/pkg/perl-5.8.0/lib/.cpan/build/SOAP-Lite-0.55: Permission denied at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 3877
CPAN::Distribution::get('CPAN::Distribution=HASH(0x944b8cc)') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 4391
CPAN::Distribution::make('CPAN::Distribution=HASH(0x944b8cc)') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 4630
CPAN::Distribution::test('CPAN::Distribution=HASH(0x944b8cc)') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 4735
CPAN::Distribution::install('CPAN::Distribution=HASH(0x944b8cc)') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 5427
CPAN::Module::rematein('CPAN::Module=HASH(0x402f9600)','install') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 5484
CPAN::Module::install('CPAN::Module=HASH(0x402f9600)') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 2075
CPAN::Shell::rematein('CPAN::Shell','install','SOAP::Lite') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 2102
CPAN::Shell::install('CPAN::Shell','SOAP::Lite') called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 186
eval {...} called at /usr/local/pkg/perl-5.8.0/lib/5.8.0/CPAN.pm line 186
CPAN::shell() called at -e line 1
One possible fix is:
3770a3771,3779
Show quoted text
> use Cwd;
> use File::Find;
>
> sub makewriteable {
> my $mode;
> $mode = (stat($File::Find::name))[2] or die "can't stat \"$File::Find::name\" ($!)";
> chmod $mode | 0200, $File::Find::name;
> }
>
3867a3877
Show quoted text> find(\&makewriteable, cwd()."/".$distdir);
John A. Murdie
Department of Computer Science
University of York
England