notwitch has asked for the wisdom of the Perl Monks concerning the following question:

My file test operators don't seem to respect the acl's. For example:
print "I can write!/n" if ( -w $file );
doesn't work if the user only has write rights in the acl's.
Perl version: 5.8.3 (installed with yum)
OS: Fedora Core 1

Do I have to compile Perl to get it to work? jji

Replies are listed 'Best First'.
Re: file test operators and acl
by sgifford (Prior) on Nov 02, 2005 at 19:09 UTC
    AFAIK, Perl's filetest operators just look at permission bits. To test an ACL, you'll need to either parse your system's ACLs (possibly using a module from CPAN) or else just try to read/write to the file and see if it fails with EPERM.
Re: file test operators and acl
by tirwhan (Abbot) on Nov 02, 2005 at 19:41 UTC

    AFAIK there are currently no perl modules which understand Linux ACL, but check out this email on the ACL-devel mailing list, someone claims to recently have written a rough-and-ready module and may be planning to flesh it out. Hope that helps.


    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
Re: file test operators and acl
by ambrus (Abbot) on Nov 03, 2005 at 08:45 UTC

    You could try the POSIX::access function.

Re: file test operators and acl
by notwitch (Acolyte) on Nov 03, 2005 at 21:11 UTC
    Thanks, I'm actually installing some software (Twiki) on my webserver and found this problem.
    This problem is mentioned in the Camel, I just read too quickly.

    jji
      Hi, if looking for file test functions taking into account the ACL take a look at the "filetest" pragma.