[Oops, trying again with fixed formatting (dratted gmail!)]

Forgive me if this is not a cygwin specific issue.  I have a problem I don't 
know
how to solve that involves ACLs on a remote server (via UNC) and Perl's file 
tests.
The following may best describe my problem:

   $ cd //webdev/e/Temp

   $ ls -l
   total 1
   -rwx------+ 1 Administrators Domain Users 14 Dec  5 12:55 foo.txt

   $ getfacl foo.txt
   # file: foo.txt
   # owner: Administrators
   # group: Domain Users
   user::rwx
   group::---
   group:SYSTEM:rwx
   group:Users:r-x
   mask:rwx
   other:---

   $ groups
   Domain Users Users

   $ cat foo.txt
   Hello world!

Bash sees the file as readable:

    $ [[ -r foo.txt ]] && echo "readable"
    readable

But Perl does not due to ACLs:

    $ perl -e 'print "readable\n" if -r "foo.txt"'

Workaround is to use "filetest" pragma:

    $ perl -e 'use filetest "access"; print "readable\n" if -r "foo.txt"'
    readable

But now use of stat()'s _ cache fails as documented in 'perldoc filetest':

    $ perl -e 'use filetest "access"; print "writable\n" if -w "foo.txt"; print 
"readable\n" if -r _'

Simple answer is "just don't do that", but what about modules?

    $ perl -e 'use Archive::Zip; $z = Archive::Zip->new(); 
$z->add_file("foo.txt")'
    Can't locate object method "add_file" via package "Archive::Zip::Archive" 
at -e line 1.

    $ perl -e 'use filetest "access"; use Archive::Zip; $z = 
Archive::Zip->new(); $z->add_file("foo.txt")'
    Can't locate object method "add_file" via package "Archive::Zip::Archive" 
at -e line 1.

Constructor in Archive::Zip::NewFileMember::_newFromFileNamed() fails due to:

    return undef unless ( stat($fileName) && -r _ && !-d _ );

So Archive::Zip is currently unusable, with or without 'use filetest'.

Now all this seems to me to be a bug in Perl.  The file test flags should not 
care
what filesystem is in use and/or whether 'use filetest' is in effect.  Seems to 
me
like the filetest pragma is an ugly hack that should never have been 
implemented.

In other words, -r (et al.) should return true if the file is
readable.  Period.

Am I wrong here?  Or missing something?

Having said that, I know Cygwin has hacked Perl in many places to "do the right 
thing".
Is this another case?  Or is this not Cygwin's problem to solve?  What is the 
best way
to address this?

Regards,

Marco Moreno


--
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

Reply via email to