* Confusion with ACLs and Perl's file tests...maybe bug???
@ 2011-12-05 20:49 Marco Moreno
2011-12-05 21:18 ` Marco Moreno
0 siblings, 1 reply; 5+ messages in thread
From: Marco Moreno @ 2011-12-05 20:49 UTC (permalink / raw)
To: cygwin
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Confusion with ACLs and Perl's file tests...maybe bug???
2011-12-05 20:49 Confusion with ACLs and Perl's file tests...maybe bug??? Marco Moreno
@ 2011-12-05 21:18 ` Marco Moreno
2011-12-08 22:58 ` Reini Urban
0 siblings, 1 reply; 5+ messages in thread
From: Marco Moreno @ 2011-12-05 21:18 UTC (permalink / raw)
To: cygwin
[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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Confusion with ACLs and Perl's file tests...maybe bug???
2011-12-05 21:18 ` Marco Moreno
@ 2011-12-08 22:58 ` Reini Urban
2011-12-09 17:26 ` Marco Moreno
2011-12-17 21:52 ` Linda Walsh
0 siblings, 2 replies; 5+ messages in thread
From: Reini Urban @ 2011-12-08 22:58 UTC (permalink / raw)
To: cygwin
Thanks for the nice testcase. I'll try to take it upstream.
But I'm not too confident that p5p will fix it, e.g. they refused to
fix File::Copy::cp, keeping the perms as with /bin/cp for several
years.
I could recently fix the cygwin write check if you had admin rights though.
--
Reini Urban
http://cpanel.net/ http://www.perl-compiler.org/
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Confusion with ACLs and Perl's file tests...maybe bug???
2011-12-08 22:58 ` Reini Urban
@ 2011-12-09 17:26 ` Marco Moreno
2011-12-17 21:52 ` Linda Walsh
1 sibling, 0 replies; 5+ messages in thread
From: Marco Moreno @ 2011-12-09 17:26 UTC (permalink / raw)
To: cygwin
On Dec 8, 2011, at 5:57 PM, Reini Urban wrote:
> Thanks for the nice testcase. I'll try to take it upstream.
> But I'm not too confident that p5p will fix it, e.g. they refused to
> fix File::Copy::cp, keeping the perms as with /bin/cp for several
> years.
> I could recently fix the cygwin write check if you had admin rights though.
I've worked around the problem so I no longer have an urgent need for a fix. It would be good to fix it though so it doesn't show up again somewhere else and result in wasting another day tracking it down.
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Confusion with ACLs and Perl's file tests...maybe bug???
2011-12-08 22:58 ` Reini Urban
2011-12-09 17:26 ` Marco Moreno
@ 2011-12-17 21:52 ` Linda Walsh
1 sibling, 0 replies; 5+ messages in thread
From: Linda Walsh @ 2011-12-17 21:52 UTC (permalink / raw)
To: cygwin
Reini Urban wrote:
> Thanks for the nice testcase. I'll try to take it upstream.
> But I'm not too confident that p5p will fix it, e.g. they refused to
> fix File::Copy::cp, keeping the perms as with /bin/cp for several
> years.
> I could recently fix the cygwin write check if you had admin rights though.
---------------
I've noticed a distinct tendancy to want to keep broken, kludgy behavior, rather
than fix it, because broken and kludgy is what makes perl special to them.
OTOH, w/r/t/ the original problem, you have some calls that try to be 'posix
compliant', and other calls that try to conform to NEW posix behaviors that
aren't "officially" approved, but are adopted by most of the industry.
But then you have conservative types who want to uphold "THE" posix standard (as
if there is only 1). Last I counted, there were about 3 revisions that are not
wholly compatible with each other, so having one set of tools want to
stay stuck to one standard, while others try to move on, is a recipe for
headaches, and those who decided to bawk at Larry's new Perl6 idea (for good
reason, IM_personal_feeling), were also among the most conservative and least
likely to change crowd -- meaning, fixing things, and moving to modern
standards... That's a bit too scarey -- we don't know what might happen...
so we better not do anything...
Blech... Extremes are not usually good for humans...
So ACLS are one of those 'new fangled things' that aren't on the officially
approved list... so expecting those who want to adhere to the 15 year old
standard based on practices that were in place at the time dating back 10 years
prior, to actually move to the modern world, .. like expecting the Amish to
learn Break Dancing...
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-17 21:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 20:49 Confusion with ACLs and Perl's file tests...maybe bug??? Marco Moreno
2011-12-05 21:18 ` Marco Moreno
2011-12-08 22:58 ` Reini Urban
2011-12-09 17:26 ` Marco Moreno
2011-12-17 21:52 ` Linda Walsh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).