develooper Front page | perl.perl5.porters | Postings from May 2015

[perl #124443] Function lstat behavior case differs between Windows and Unix

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
May 4, 2015 00:36
Subject:
[perl #124443] Function lstat behavior case differs between Windows and Unix
Message ID:
rt-4.0.18-32172-1430699783-736.124443-15-0@perl.org
On Sat May 02 11:30:43 2015, rich@richelberger.com wrote:
> Please refer to RT 90452 for background and original symptom.
> #NYCHackathon
> 
> In regular shells, the path expression ‘foo/…’ should fail and return
> an empty list.
> 
> <code>
> use strict; use warnings; use 5.10.00;
> mkdir a;
> my @result = lstat ‘a/…’;
> say for @result;
> </code>
> 
> In Linux / Mac, it results in an empty array since it is file not
> found.
> On Windows, the result is:
> 
> $VAR1 = 0;
> $VAR2 = 0;
> $VAR3 = 16832;
> $VAR4 = 0;
> $VAR5 = 0;
> $VAR6 = 0;
> $VAR7 = 0;
> $VAR8 = 0;
> $VAR9 = 0;
> $VAR10 = 0;
> $VAR11 = 0;
> $VAR12 = '';
> $VAR13 = '';

This looks like a bug in Windows, I tested

  .\miniperl -le "print for stat 'win32/...'"

under the debugger, the call:

  DWORD r = GetFileAttributesA(path);

in win32_stat() is returning 16 rather than 0xFFFFFFFF indicating that win32/...
is a directory.

Tony

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

Thread Previous | Thread Next


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