Closed p5pRT closed 19 years ago
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?
-- Michael G Schwern schwern@pobox.com http://www.pobox.com/~schwern Don't try the paranormal until you know what's normal. -- "Lords and Ladies" by Terry Prachett
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 - paul@pjcj.net http://www.pjcj.net
The RT System itself - Status changed from 'new' to 'open'
Michael G Schwern (via RT) \perlbug\-followup@​perl\.org 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?
Yes: I can happily create and act on files and directories with spaces (even consisting only of spaces) as long as I protect them from the shell. This seems perfectly correct to me.
As far as I know a unix directory entry is one or more characters in the range \x1..\xff excluding '/'\, no other restrictions except for maximum length.
Hugo
Ok then\, I'll close this ticket up.
@schwern - Status changed from 'open' to 'resolved'
On Jul 12\, 2005\, at 1:40 AM\, 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?
The current behavior is correct. The space is just like any other filename. " /foo" is a file (or possibly a directory) called "foo" in a directory called " ".
-Ken
Migrated from rt.perl.org#36510 (status was 'resolved')
Searchable as RT36510$