On Fri, Aug 30, 2002 at 10:52:15AM +1000, Ken Williams wrote:
> >Rather than try and go through the code and find all the places 
> >where it's
> >assuming canonicalization will happen, I think I'll just put File::Spec
> >wrappers back into MakeMaker and change all the File::Spec->foo 
> >calls to
> >$self->foo.  Seems like a step backwards after all the work we 
> >did to change over to File::Spec, but oh well.
> 
> Auuughh!  Is changing File::Spec not an option?  It doesn't seem 
> to specify one way or the other what the behavior is supposed to 
> be.

I take it back, File::Spec is performing the canonicalization *except* for
the case where you pass catfile() only one argument (which is what's
screwing up MakeMaker).

$ perl5.8.0 -MFile::Spec -wle 'print File::Spec->catfile("./Foo/Bar.pm")'
../Foo/Bar.pm

and it only canonicalizes the directory, not the filename.

$ perl5.8.0 -MFile::Spec -wle 'print File::Spec->catfile("./Foo", "./Bar.pm")'
Foo/./Bar.pm

catdir() always canonicalizes it's return value.  So I think it's just a
File::Spec implementation glitch which I'll fix.

The fix for MakeMaker is pretty easy.  Basically, if PARENT_NAME is empty
(which is ok) the resulting split will return an empty list so catfile()
will only get one argument, the $manpagename.

I'm sure there are other things like this.  Would someone mind examining
MakeMaker's calls to catfile() and note any that could wind up feeding
catfile() only a filename and no directories?


--- MM_Unix.pm  27 Aug 2002 01:18:59 -0000      1.77
+++ MM_Unix.pm  30 Aug 2002 06:45:43 -0000
@@ -1480,8 +1480,11 @@
            }
            my($manpagename) = $name;
            $manpagename =~ s/\.p(od|m|l)\z//;
-           unless ($manpagename =~ s!^\W*lib\W+!!s) { # everything below lib is ok
-               $manpagename = 
File::Spec->catfile(split(/::/,$self->{PARENT_NAME}),$manpagename);
+           # everything below lib is ok
+           if($self->{PARENT_NAME} && $manpagename !~ s!^\W*lib\W+!!s) {
+               $manpagename = File::Spec->catfile(
+                                split(/::/,$self->{PARENT_NAME}),$manpagename
+                               );
            }
            if ($pods{MAN3}) {
                $manpagename = $self->replace_manpage_separator($manpagename);


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
GOD made us funky!

Reply via email to