delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,TW_RW |
X-Spam-Check-By: | sourceware.org |
Mime-Version: | 1.0 (Apple Message framework v1084) |
Subject: | Confusion with ACLs and Perl's file tests...maybe bug??? |
From: | Marco Moreno <mmoreno AT pobox DOT com> |
In-Reply-To: | <CAJfRpHpWHGQuM9oU3sza1zVhxTgM6z4a3071T4r9C_o-n7mdJA@mail.gmail.com> |
Date: | Mon, 5 Dec 2011 16:17:52 -0500 |
Message-Id: | <450C452D-4BC5-4298-8A31-DA9621FA725F@pobox.com> |
References: | <CAJfRpHpWHGQuM9oU3sza1zVhxTgM6z4a3071T4r9C_o-n7mdJA AT mail DOT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-Pobox-Relay-ID: | 9869A9F8-1F86-11E1-A18F-9DB42E706CDE-99441528!b-pb-sasl-quonix.pobox.com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id pB5LIDIo025758 |
[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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |