[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: FAIL File-Spec-0.810_01 MacOS_PPC 9.0.4



schinder@pobox.com wrote, in part:
> The single test that failed that I care about is this:
>
> not ok 243 # Mac->rel2abs('','t1:t2:t3'): got 't1:t2:t3', expected ''
>
> This path is already absolute, so I would expect the thing actually
> returned, 't1:t2:t3', rather than ''.

Turns out that

   File::Spec::MacOS->file_name_is_absolute( '' ) ;

does

   return !-e ':' ;

in this case and so reports that '' is relative.  That seems a little
degenerate to me.  With Paul's input, here's a patch so that '' is always
absolute.

Is this a bug fix (I hope) or a bug introduction?

I'm releasing the next File::Spec later this week, FWIW, which will be
a minor re-sync with bleedperl and a documentation fixup (rel2abs, abs2rel
really do check the filesystem occasionally under MacOS).

- Barrie

--- /var/perls/perl/lib/File/Spec/Mac.pm        Thu May  4 22:15:13 2000
+++ Spec/Mac.pm Sun Jun 25 23:30:23 2000
@@ -4,7 +4,7 @@
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;

-$VERSION = '1.1';
+$VERSION = '1.2';

 @ISA = qw(File::Spec::Unix);

@@ -192,12 +192,16 @@
 relative wins.  Use ":" in the appropriate place in the path if you want to
 distinguish unambiguously.

+As a special case, the file name '' is always considered to be absolute.
+
 =cut

 sub file_name_is_absolute {
     my ($self,$file) = @_;
     if ($file =~ /:/) {
        return ($file !~ m/^:/s);
+    } elsif ( $file eq '' ) {
+        return 1 ;
     } else {
        return (! -e ":$file");
     }
@@ -307,6 +311,12 @@

 =item abs2rel

+See L<File::Spec::Unix/abs2rel> for general documentation.
+
+Unlike C<File::Spec::Unix->abs2rel()>, this function will make
+checks against the local filesystem if necessary.  See
+L</file_name_is_absolute> for details.
+
 =cut

 sub abs2rel {
@@ -344,27 +354,11 @@

 =item rel2abs

-Converts a relative path to an absolute path.
-
-    $abs_path = File::Spec->rel2abs( $destination ) ;
-    $abs_path = File::Spec->rel2abs( $destination, $base ) ;
-
-If $base is not present or '', then L<cwd()> is used. If $base is relative,
-then it is converted to absolute form using L</rel2abs()>. This means that it
-is taken to be relative to L<cwd()>.
-
-On systems with the concept of a volume, this assumes that both paths
-are on the $base volume, and ignores the $destination volume.
-
-On systems that have a grammar that indicates filenames, this ignores the
-$base filename as well. Otherwise all path components are assumed to be
-directories.
-
-If $path is absolute, it is cleaned up and returned using L</canonpath()>.
-
-Based on code written by Shigio Yamaguchi.
+See L<File::Spec::Unix/rel2abs> for general documentation.

-No checks against the filesystem are made.
+Unlike C<File::Spec::Unix->rel2abs()>, this function will make
+checks against the local filesystem if necessary.  See
+L</file_name_is_absolute> for details.

 =cut

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org