This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

canonpath in perl as it relates to cygwin


Hi all,

I've been lurking on this list for just about 5 years now.  Thanks everyone for a great piece of software.  

My question concerns the use of File::Spec->canonpath in perl (for cygwin).  I did a search of the relevant mailing list
archives, as well as google newsgroups, but did not seem to come across any hits that seem to discuss this specific
issue. 

As it currently stands, canonpath will not strip out multiple occurrences of // in file paths when the script is executed from
within a cygwin shell.  The relevant line from /usr/lib/perl5/5.6.1/File/Spec/Unix.pm that strips out multiple /'s is 

$path =~ s|/+|/|g unless ($^O eq 'cygwin');

I assume this regexp substitution is ignored for cygwin because we would not want to munge instances where // refers 
to a network share (something regular unix doesn't need to worry about), but is it wise to also ignore all multiple forward
slashes when they occur in the middle of a path?  Or is this simply a non-issue because, for the most part, it seems like 
most (if not all?)  programs don't really seem to care about multiple path separators?

For what it's worth, canonpath in ExtUtils::MM_Unix (and MM_Cygwin), uses

$path =~ s|(?<=[^/])/+|/|g;

which seems to do what I expect (leaves // at the front of a path alone, but replaces all remaining // with /).  The only weakness I see with this is that it will not replace ///shareName/path with //shareName/path, but that is a minor matter, at least as it concerns me.

Any thoughts on this matter would be most appreciated.
Thanks in advance,
Chris




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]