Skip Menu |

This queue is for tickets about the CPANPLUS CPAN distribution.

Report information
The Basics
Id: 13358
Status: resolved
Priority: 0/
Queue: CPANPLUS

People
Owner: Nobody in particular
Requestors: trevor.schellhorn-perl [...] marketingtips.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.055
Fixed in: (no value)



Subject: chmod in CPANPLUS::Internals::Extract breaks installation of File::MMagic
Here is the section that I am referring to: 167: ### set them all to be +w for the owner, so we don't get permission 168: ### denied for overwriting files that are just +r 169: chmod 0755, map { File::Spec->rel2abs( File::Spec->catdir($to, $_) ) } 170: @{$ae->files}; This does more then change the file to be '+w' for the owner. It also sets the execute bit for the files also. Doing this breaks the installation of File::MMagic as it relies on the *.t files to not be executable. Doing so changes the output of the program. This will also break another other module that relies on the permissions being a certain mode. I think you need to come up with a better solution for this part. If you need to change the permissions so that you can write to them, just change the mode for the owner of the file so that it is writable. This is using CPANPLUS verison 0.055 on ActivePerl 5.8.7 running on CentOS 4.0.
[guest - Tue Jun 21 23:15:12 2005]: Show quoted text
> Here is the section that I am referring to: > > 167: ### set them all to be +w for the owner, so we don't get > permission > 168: ### denied for overwriting files that are just +r > 169: chmod 0755, map { File::Spec->rel2abs( File::Spec->catdir($to, > $_) ) } > 170: @{$ae->files}; > > This does more then change the file to be '+w' for the owner. It also > sets the execute bit for the files also.
I've applied the following patch to only set mode +w for the owner, as this is the bear minimum to make our functions work: -- Jos ==== //depot/cpanplus/devel/lib/CPANPLUS/Internals/Extract.pm#41 - /Users/kane/ sources/p4/cpanplus/devel/lib/CPANPLUS/Internals/Extract.pm ==== 169,170c169,178 < chmod 0755, map { File::Spec->rel2abs( File::Spec->catdir($to, $_) ) } < @{$ae->files}; --- Show quoted text
> > ### this is to rigurous -- just change to +w for the owner [cpan #13358] > #chmod 0755, map { File::Spec->rel2abs( File::Spec->catdir($to, $_) ) } > # @{$ae->files}; > > for my $file ( @{$ae->files} ) { > my $path = File::Spec->rel2abs( File::Spec->catdir($to, $file) ); > > $self->_mode_plus_w( file => $path ); > }
==== //depot/cpanplus/devel/lib/CPANPLUS/Internals/Utils.pm#21 - /Users/kane/ sources/p4/cpanplus/devel/lib/CPANPLUS/Internals/Utils.pm ==== 287a288,310 Show quoted text
> sub _mode_plus_w { > my $self = shift; > my %hash = @_; > > require File::stat; > > my $file; > my $tmpl = { > file => { required => 1, allow => IS_FILE, store => \$file }, > }; > > check( $tmpl, \%hash ) or return; > > my $x = File::stat::stat( $file ); > if( $x and chmod( $x->mode|0200, $file ) ) { > return 1; > > } else { > error(loc("Failed to '%1' '%2': '%3'", 'chmod +w', $file, $!)); > return; > } > } >
==== //depot/cpanplus/devel/t/00_CPANPLUS-Internals-Utils.t#10 - /Users/kane/ sources/p4/cpanplus/devel/t/00_CPANPLUS-Internals-Utils.t ==== 24c24 < use Test::More tests => 31; --- Show quoted text
> use Test::More tests => 36;
39a40 Show quoted text
> my $File = 'zot';
118a120,140 Show quoted text
> ### _mode_plus_w tests ### > { open my $fh, ">$File" or die "Could not open $File for writing: $!"; > close $fh; > > ### remove perms > ok( -e $File, "File '$File' created" ); > ok( chmod( 000, $File ), " File permissions set to 000" ); > > ok( $Class->_mode_plus_w( file => $File ), > " File permissions set to +w" ); > ok( -w $File, " File is writable" ); > > 1 while unlink $File; > > ok( !-e $File, " File removed" ); > } >