This is the mail archive of the cygwin 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]

Re: Existence check fails on Cygwin Perl


On 17 Aug 2010 10:20:41 +0200, Corinna Vinschen wrote:
>On Aug 16 18:13, Andrew DeFaria wrote:
>>  This is strange. I usually tend to use Cygwin's Perl as it is more
>> full featured and works well but there are times when I am forced to
>> use "cqperl" - a Perl that comes with Rational Clearquest - at my
>> clients. Here it seems that Cygwin's Perl utterly fails the test
>> where as cqperl - a derivative of ActiveuuState - works.
>> 
>> This is using the existence check (-e) for a file. The file happens
>> to be on a share thus we are using UNC notation. It doesn't even
>> matter if "server" is a real server or not, nor whether the share
>> and path exist. Use anything you like. In fact use "server" and
>> "path" and "file". Either way Cygwin's Perl reports that the file
>> exists even when it doesn't, or the path is wrong or even if the
>> server does not exist!
>> 
>> $ cat test.pl'
>> use warnings;
>> use strict;
>> 
>> # Obviously non-existant server and file
>> my $file = "\\\\server\\path\\file";
>> 
>> # Check for existance returns true for Cygwin - false for ActiveState
>> if (-e $file) {
>>   print "true\n"
>> } else {
>>   print "false\n"
>> }
>> $ perl test.pl
>> true
>> $ cqperl test.pl
>> false
>> $
>
>I can not reproduce your problem.  I used "\\\\server\\path\\file"
>unchanged, as well as valid server and share names and just a
>non-existant file name.  In both cases the script prints "false".
>And it prints "true" for an existing file, just as expected.

Hm, I can reproduce it and it's even simpler, no perl involved:

pc> [ -e //server/junk ] && date
Tue Aug 17 10:28:14 WEDT 2010
pc> ls -ls //server/junk
0 -rw-r--r-- 1 lemkemch Domain Users 0 Dec  1  2006 //server/junk

Here's no server called server.

pc> uname -a
CYGWIN_NT-5.1 p01080268 1.7.5(0.225/5/3) 2010-04-12 19:07 i686 Cygwin
pc> mount
C:/MyStuff/1.7cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/MyStuff/1.7cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/MyStuff/cygwin/home on /home type ntfs (text)
C:/MyStuff/1.7cygwin on / type ntfs (binary,auto)
U: on /u type ntfs (text)
C: on /c type ntfs (text,posix=0,user,noumount,auto)
I: on /i type vfat (text,posix=0,user,noumount,auto)
J: on /j type ntfs (text,posix=0,user,noumount,auto)
K: on /k type unknown (text,posix=0,user,noumount,auto)
Q: on /q type ntfs (text,posix=0,user,noumount,auto)
S: on /s type ntfs (text,posix=0,user,noumount,auto)
V: on /v type ntfs (text,posix=0,user,noumount,auto) 

Michael

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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