develooper Front page | perl.perl5.porters | Postings from June 2008

[perl #30622] -e tests not reliable under Win32

From:
Steve Peters via RT
Date:
June 5, 2008 08:06
Subject:
[perl #30622] -e tests not reliable under Win32
Message ID:
rt-3.6.HEAD-11257-1212678363-1241.30622-15-0@perl.org
On Wed Jul 07 03:30:57 2004, yves.orton@de.mci.com wrote:
> 
> This is a bug report for perl from yves.orton@de.mci.com,
> generated with the help of perlbug 1.33 running under perl v5.6.1.
> 
> 
> -----------------------------------------------------------------
> The following script produces incorrect results on Win32, Cygwin build or
> ActiveState builds. This occurs under all 5.8.x as well as 5.6.x, and
> possibly earlier.
> 
> Original report raised in Perlmonks:
> http://perlmonks.org/index.pl?node_id=371904
> Some trace analysis of the cause is present there FWIW.
> 
> 
> use strict;
> use warnings;
> 
> my @files = (' ', ' . . ', ' .. ', '         ', ' .      ');
> 
> foreach (@files) {
>   print "[$_] - ", -e $_ ? "yes\n" : "no\n";
> }
> 
> Produces on the two different versions i have handy:
> 
> C:\Temp>perl test_file_exists.pl
> [ ] - yes
> [ . . ] - yes
> [ .. ] - yes
> [         ] - yes
> [ .      ] - yes
> 
> This is perl, v5.6.1 built for MSWin32-x86-multi-thread
> (with 1 registered patch, see perl -V for more detail)
> 
> Copyright 1987-2001, Larry Wall
> 
> Binary build 633 provided by ActiveState Corp. http://www.ActiveState.com
> Built 21:33:05 Jun 17 2002
> 
> 
> C:\Temp>perl5.8.0 test_file_exists.pl
> [ ] - yes
> [ . . ] - yes
> [ .. ] - yes
> [         ] - yes
> [ .      ] - yes
> 
> This is perl, v5.8.0 built for cygwin-multi-64int
> 
> Copyright 1987-2002, Larry Wall
> 
> 

It appears that this is OK on Cygwin now, although not on Windows.

$ perl rt_30622.pl
[ ] - no
[ . . ] - no
[ .. ] - no
[ ] - no
[ . ] - no
$ perl -v

This is perl, v5.8.8 built for cygwin-thread-multi-64int



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