develooper Front page | perl.perl5.porters | Postings from July 2001

Re: Followup to bug ID 20010627.004 : I have a diagnostic

Thread Previous | Thread Next
From:
Rudi Farkas
Date:
July 2, 2001 16:57
Subject:
Re: Followup to bug ID 20010627.004 : I have a diagnostic
Message ID:
85256A7D.007964DB.00@newyork-gwy.lecroy.com


Hi Nick

I wrote
>>1. Summary
>>I found that the failure of Perl filetest operator -x _ on Win2k
>>to report an executable file as executable after a -T _
>>is due to discrepancy in st_mode values returned by Microsoft
>>functions _stat() and _fstat(). Specifically, I found that _stat() sets
>> the 3
>>Execute bits (mask 0111 octal) to 1 when it sees an executable file, while
>>_fstat() sets these bits to 0 when looking at the same file.

You wrote
>This is understandable. On Win32 executable-ness is determined by
>file having an extension which is recognised as such e.g. .bat .com .exe
>_stat() gets a pathname so can set the bit. _fstat just gets a number
>and I am not certain there is a way to get name back given that number
>or even the Handle (which can be obtained).

Yes, can I see the difficulty.  But would a difficulty ever stop a perl porter
from doing the Right Thing?

I think that Perl on win32 should preserve the semantics of true Perl's stat()
and subseqent filetest operators,
come win32 or hailstorm.

From my limited poking around pp_sys.c and Perl_pp_stat(), it seems that the
filename is already cached
in PL_statname and that it could be used as necessary in implementing filetest
operators for win32.

Ugly, but IMHO better than not documenting the current flaw, or even documenting
it in some obscure corner
of win32 faq.

Rudi



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