Skip Menu |

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

Report information
The Basics
Id: 413
Status: resolved
Priority: 0/
Queue: ExtUtils-MakeMaker

People
Owner: Nobody in particular
Requestors: ken [...] mathforum.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 5.52_01
Fixed in: (no value)



Subject: [PATCH] Re: Underspecified MANIFEST.SKIP behavior
See recent messages with same subject line on MakeMaker mailing list. Patch is against 5.52_01.
--- lib/ExtUtils/Manifest-old.pm Tue Mar 26 17:06:49 2002 +++ lib/ExtUtils/Manifest.pm Tue Mar 26 21:47:08 2002 @@ -67,17 +67,24 @@ close M; } +# Geez, shouldn't this use File::Spec or File::Basename or something? Why so careful about dependencies? +sub clean_up_filename { + my $filename = shift; + $filename =~ s|^\./||; + $filename =~ s/^:([^:]+)$/$1/ if $Is_MacOS; + return $filename; +} + sub manifind { my $p = shift || {}; my $skip = _maniskip(warn => $p->{warn_on_skip}); my $found = {}; my $wanted = sub { - return if $skip->($_) or -d $_; - - (my $name = $File::Find::name) =~ s|^\./||; - $name =~ s/^:([^:]+)$/$1/ if $Is_MacOS; + my $name = clean_up_filename($File::Find::name); warn "Debug: diskfile $name\n" if $Debug; + return if $skip->($name) or -d $name; + if( $Is_VMS ) { $name =~ s#(.*)\.$#\L$1#; $name = uc($name) if $name =~ /^MANIFEST(\.SKIP)?$/i; @@ -85,8 +92,11 @@ $found->{$name} = ""; }; + # We have to use "$File::Find::dir/$_" in preprocess, because $File::Find::name is unavailable. + # Also, it's okay to use / here, because MANIFEST files use Unix-style paths. find({wanted => $wanted, - preprocess => sub {grep {!$skip->($_)} @_}, + preprocess => sub {grep {!$skip->( clean_up_filename("$File::Find::dir/$_") )} @_}, + no_chdir => 1, }, $Is_MacOS ? ":" : ".");
[KWILLIAMS - Tue Mar 26 21:24:33 2002]: Show quoted text
> See recent messages with same subject line on MakeMaker mailing list. > Patch is against 5.52_01.
Not to look a gift horse in the mouth, but I don't suppose you could provide a patch to manifest.t that shows the breakage & fix? I'm a little bothered that this problem wasn't caught by the existing tests. +# Geez, shouldn't this use File::Spec or File::Basename or something? Why so careful about dependencies? +sub clean_up_filename { + my $filename = shift; + $filename =~ s|^\./||; + $filename =~ s/^:([^:]+)$/$1/ if $Is_MacOS; + return $filename; +} Talking to ourselves? :) ExtUtils::Manifest already pulls in File::Spec and File::Basename. Just go ahead and use them, and whatever other core module you need to clean up that portability rat's nest. You can consolodate all the conditional requires into one use if you like (I suspect somewhere along the line someone said "MakeMaker's using too much memory!" and decided some microoptimization was in order.) PS A better way to deal with File::Find may be to Unixify the paths when you put them into File::Find (although all you need in this case is File::Spec->curdir) and then localize them when you pull them out. VMS has VMS::Filespec::vmsify and I think MacOS has something similar.
Patched accepted, in CVS. Waiting for tests & File::Spec/Basename cleanup.
From: ken [...] mathforum.org
Okey doke, here's a patch to t/Manifest.t . Test #27 fails with revision 1.7 of lib/ExtUtils/Manifest.t and succeeds with revision 1.8 . I also did some cleanup in Manifest.t - some localizing of $Quiet and $MANIFEST so we don't have to worry about SAAAD, some other stuff. Unless there are objections, this should close this ticket. -Ken
Index: t/Manifest.t =================================================================== RCS file: /home/schwern/cvs/ExtUtils-MakeMaker/t/Manifest.t,v retrieving revision 1.4 diff -u -r1.4 Manifest.t --- t/Manifest.t 25 Mar 2002 07:35:04 -0000 1.4 +++ t/Manifest.t 28 Mar 2002 08:43:33 -0000 @@ -11,8 +11,10 @@ } chdir 't'; +use strict; + # these files help the test run -use Test::More tests => 31; +use Test::More tests => 32; use Cwd; # these files are needed for the module itself @@ -21,13 +23,13 @@ use Carp::Heavy; # keep track of everything added so it can all be deleted -my @files; +my %files; sub add_file { my ($file, $data) = @_; $data ||= 'foo'; open( my $T, '>', $file) or return; print $T $data; - push @files, $file; + ++$files{$file}; } sub read_manifest { @@ -48,7 +50,7 @@ # use module, import functions BEGIN { use_ok( 'ExtUtils::Manifest', - qw( mkmanifest manicheck filecheck fullcheck maniread manicopy) ); } + qw( mkmanifest manicheck filecheck fullcheck maniread manicopy skipcheck ) ); } my $cwd = Cwd::getcwd(); @@ -62,9 +64,9 @@ # there shouldn't be a MANIFEST there my ($res, $warn) = catch_warning( \&mkmanifest ); # Canonize the order. -$warn = join("", map { "$_|" } sort { lc $a cmp lc $b } split /\r?\n/, $warn); +$warn = join("", map { "$_|" } sort { lc($a) cmp lc($b) } split /\r?\n/, $warn); is( $warn, "Added to MANIFEST: foo|Added to MANIFEST: MANIFEST|", - "mkmanifest() displayed it's additions" ); + "mkmanifest() displayed its additions" ); # and now you see it ok( -e 'MANIFEST', 'create MANIFEST file' ); @@ -84,36 +86,35 @@ is( $res, 'bar', 'bar reported as new' ); # now quiet the warning that bar was added and test again -{ package ExtUtils::Manifest; use vars qw($Quiet); $Quiet = 1; } -($res, $warn) = catch_warning( \&ExtUtils::Manifest::skipcheck ); -cmp_ok( $warn, ,'eq', '', 'disabled warnings' ); +($res, $warn) = do { local $ExtUtils::Manifest::Quiet = 1; catch_warning( \&skipcheck ) }; +cmp_ok( $warn, 'eq', '', 'disabled warnings' ); -# add a skip file with a rule to skip itself +# add a skip file with a rule to skip itself (and the nonexistent glob '*baz*') add_file( 'MANIFEST.SKIP', "baz\n.SKIP" ); # this'll skip the new file -($res, $warn) = catch_warning( \&ExtUtils::Manifest::skipcheck ); +($res, $warn) = catch_warning( \&skipcheck ); like( $warn, qr/^Skipping MANIFEST\.SKIP/i, 'got skipping warning' ); # I'm not sure why this should be... shouldn't $missing be the only one? my ($found, $missing ); catch_warning( sub { - ( $found, $missing ) = ExtUtils::Manifest::skipcheck() + ( $found, $missing ) = skipcheck() }); # nothing new should be found, bar should be skipped is( @$found, 0, 'no output here' ); is( join( ' ', @$missing ), 'bar', 'listed skipped files' ); -is( join(' ', filecheck() ), 'bar', 'listing skipped with filecheck()' ); +{ + local $ExtUtils::Manifest::Quiet = 1; + is( join(' ', filecheck() ), 'bar', 'listing skipped with filecheck()' ); +} # add a subdirectory and a file there that should be found ok( mkdir( 'moretest', 0777 ), 'created moretest directory' ); -my $quux = File::Spec->catfile( 'moretest', 'quux' ); -$quux =~ s#\\#/#g; -$quux = VMS::Filespec::unixify($quux) if $^O eq 'VMS'; -add_file( $quux, 'quux' ); -ok( exists( ExtUtils::Manifest::manifind()->{$quux} ), "manifind found $quux" ); +add_file( File::Spec->catfile('moretest', 'quux'), 'quux' ); +ok( exists( ExtUtils::Manifest::manifind()->{'moretest/quux'} ), "manifind found moretest/quux" ); # only MANIFEST and foo are in the manifest my $files = maniread(); @@ -140,20 +141,27 @@ like($warn, qr/^Skipping MANIFEST.SKIP/i, 'warned about MANIFEST.SKIP' ); # tell ExtUtils::Manifest to use a different file -{ package ExtUtils::Manifest; - use vars qw($MANIFEST); - $MANIFEST = 'albatross'; +{ + local $ExtUtils::Manifest::MANIFEST = 'albatross'; + ($res, $warn) = catch_warning( \&mkmanifest ); + like( $warn, qr/Added to albatross: /, 'using a new manifest file' ); + + # add the new file to the list of files to be deleted + $files{'albatross'}++; } -($res, $warn) = catch_warning( \&mkmanifest ); -like( $warn, qr/Added to albatross: /, 'using a new manifest file' ); -# add the new file to the list of files to be deleted -push @files, 'albatross'; +# Make sure MANIFEST.SKIP is using complete relative paths +add_file( 'MANIFEST.SKIP' => "^moretest/q\n" ); + +# This'll skip moretest/quux +($res, $warn) = catch_warning( \&skipcheck ); +like( $warn, qr{^Skipping moretest/quux}i, 'got skipping warning again' ); + END { - # the arrays are evaluated in scalar context - is( unlink( @files ), @files, 'remove all added files' ); + # the args are evaluated in scalar context + is( unlink( keys %files ), keys %files, 'remove all added files' ); remove_dir( 'moretest', 'copy' ); # now get rid of the parent directory
Ok, in.