Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ExtUtils-Manifest CPAN distribution.

Report information
The Basics
Id:
13079
Status:
resolved
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
SREZIC [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
(no value)
Fixed in:
(no value)



Subject: ExtUtils::Manifest::manicopy: no chmod done
If I do perl -MExtUtils::Manifest=manicopy,maniread -e 'manicopy(maniread(), "/tmp/destination", "cp")' then executables lose their x bit in the destination directory. The problem is that the copying is done through File::Copy::copy which does not preserve any file properties. There's even a function _manicopy_chmod which tries to fix the x bit, but which never suceeds (well, it probably does for the "ln" type of copying). Suggestion: after calling copy() in cp(), the permissions should be fixed, e.g. by adding my @stat = stat $srcFile; chmod $stat[2], $dstFile; I'm not sure about what to do on non-Unix platforms. Regards, Slaven
From: TONYC@cpan.org
This problem is a regression - ExtUtils::Manifest did copy these permissions correctly at one point. Upgrading to the current ExtUtils::MakeMaker broke an installation script for a project of mine. I've attached a patch that: - modifies the tests to actually test this case - there is a test that checks the source executable bit matches the destination, but since none of the source files are executable the test is ineffective - corrects the copying of the executable bit to check the source permissions when setting the destination permissions, instead of just looking at the destination
diff -ru ExtUtils-Manifest-1.50-orig/lib/ExtUtils/Manifest.pm ExtUtils-Manifest-1.50/lib/ExtUtils/Manifest.pm --- ExtUtils-Manifest-1.50-orig/lib/ExtUtils/Manifest.pm 2006-12-23 07:40:21.000000000 +1100 +++ ExtUtils-Manifest-1.50/lib/ExtUtils/Manifest.pm 2007-01-08 17:45:05.096279547 +1100 @@ -522,7 +522,7 @@ copy($srcFile,$dstFile); utime $access, $mod + ($Is_VMS ? 1 : 0), $dstFile; - _manicopy_chmod($dstFile); + _manicopy_chmod($srcFile, $dstFile); } @@ -531,7 +531,7 @@ return &cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95()); link($srcFile, $dstFile); - unless( _manicopy_chmod($dstFile) ) { + unless( _manicopy_chmod($srcFile, $dstFile) ) { unlink $dstFile; return; } @@ -542,10 +542,10 @@ # 2) Let everyone read it. # 3) If the owner can execute it, everyone can. sub _manicopy_chmod { - my($file) = shift; + my($srcFile, $dstFile) = @_; - my $perm = 0444 | (stat $file)[2] & 0700; - chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $file ); + my $perm = 0444 | (stat $srcFile)[2] & 0700; + chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $dstFile ); } # Files that are often modified in the distdir. Don't hard link them. diff -ru ExtUtils-Manifest-1.50-orig/t/Manifest.t ExtUtils-Manifest-1.50/t/Manifest.t --- ExtUtils-Manifest-1.50-orig/t/Manifest.t 2006-12-23 06:57:21.000000000 +1100 +++ ExtUtils-Manifest-1.50/t/Manifest.t 2007-01-08 17:43:56.275183144 +1100 @@ -19,6 +19,7 @@ use File::Spec; use File::Path; use File::Find; +use Config; my $Is_VMS = $^O eq 'VMS'; @@ -71,6 +72,12 @@ ok( chdir( 'mantest' ), 'chdir() to mantest' ); ok( add_file('foo'), 'add a temporary file' ); +# This ensures the -x check for manicopy means something +# Some platforms don't have chmod or an executable bit, in which case +# this call will do nothing or fail, but on the platforms where chmod() +# works, we test the executable bit is copied +chmod( 0744, 'foo') if $Config{'chmod'}; + # there shouldn't be a MANIFEST there my ($res, $warn) = catch_warning( \&mkmanifest ); # Canonize the order.
Thanks very much - this has been applied as r8530 at http://svn.perl.org/modules/ExtUtils-Manifest/trunk/


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.