develooper Front page | perl.perl5.porters | Postings from August 2014

[perl #122635] Cwd::chdir fails on Cygwin for UNC paths

From:
James E Keenan via RT
Date:
August 28, 2014 23:24
Subject:
[perl #122635] Cwd::chdir fails on Cygwin for UNC paths
Message ID:
rt-4.0.18-23837-1409268271-1252.122635-15-0@perl.org
On Thu Aug 28 08:16:38 2014, roderich.schupp@gmail.com wrote:
> This is a bug report for perl from roderich.schupp@gmail.com,
> generated with the help of perlbug 1.39 running under perl 5.14.4.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> On Cygwin, Windows UNC paths like \\foo.com\users\jluser are
> represented using the POSIX "leading //" notation, e.g. //
> foo.com/users/jluser.
> 
> Cwd::chdir fails for these paths:
> 
> $ perl -MCwd -e 'Cwd::chdir("//foo.com/users/jluser") or die "chdir:
> $!";'
> chdir: No such file or directory at -e line 1.
> 
> CORE::chdir works as expected.
> 
> The reason is the following code in Cwd.pm:
> 
> sub chdir {
>     my $newdir = @_ ? shift : '';       # allow for no arg (chdir to
> HOME
> dir)
>     $newdir =~ s|///*|/|g unless $^O eq 'MSWin32';  # <----
>     ...
>     return 0 unless CORE::chdir $newdir;
> 
> This unconditionally replaces sequences of slashes with one slash,
> transforming //foo.com/users/jluser into /foo.com/users/jluser
> which is a totally different path on Cygwin.
> 
> Insted, it should leave a leading double slash untouched.
> 
> AFAICT this code is still present in Perl 5.20.0.
> 
> Cheers, Roderich
> 

Some references for people (like me!) who do not know what 'UNC' refers to:

#####
http://en.wikipedia.org/wiki/Path_%28computing%29#UNC_in_Windows

http://msdn.microsoft.com/en-us/library/gg465305.aspx
#####

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=122635



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About