On Mon, Jul 11, 2005 at 11:41:04PM -0700, Michael G Schwern wrote:

> rt.perl.org 24691 is about CPAN.pm saying that a path with a leading space 
> is not absolute.  The issue is File::Spec... maybe.  file_name_is_absolute() i
> does not recognize " /foo" as being absolute.
> 
> $ perl -wle 'use File::Spec;  print File::Spec->file_name_is_absolute(" 
> /foo")'
> 
> $ perl -wle 'use File::Spec;  print File::Spec->file_name_is_absolute("/foo")'
> 1
> 
> canonpath() does not clean up leading or trailing space.
> 
> $ perl -wle 'use File::Spec;  print File::Spec->canonpath("/foo")'
> /foo
> 
> $ perl -wle 'use File::Spec;  print File::Spec->canonpath(" /foo")'
>  /foo
> $ perl -wle 'use File::Spec;  print q["].File::Spec->canonpath(" /foo ").q["]'
> " /foo "
> 
> Should it?  Does leading and trailing space have any meaning in a Unix path?

Certainly.

$ mkdir ' '
$ touch ' /foo '
$ ls -lRQ
".":
total 4
drwxrwxr-x  2 pjcj pjcj 4096 2005-07-12 11:01 " "

"./ ":
total 0
-rw-rw-r--  1 pjcj pjcj 0 2005-07-12 11:01 "foo "

So it seems to me that File:Spec is doing the right thing here.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to