Subject: | Errors if using POSIX ACLs |
I'm using POSIX ACLs on an NFS-mount.
My directory is this:
$ pwd
/tstnfs01/fts/t_ftsadm/in/test2
$ ll
total 4
-rwxr-x---+ 1 t_ftsadm t_ftsadm 458 Apr 30 10:44 gzip.pl
-rw-rw----+ 1 blankt itopbs 2806 Apr 30 10:08 info.log
And I'm currently working as user t_ftsadm:
$ id -a
uid=20261(t_ftsadm) gid=20286(t_ftsadm)
These are the ACL entries on the directory and the file info.log:
$ getfacl .
# file: .
# owner: t_ftsadm
# group: t_ftsadm
user::rwx
user:t_ftsadm:rwx #effective:rwx
group::rwx #effective:rwx
group:t_ftsadm:rwx #effective:rwx
mask:rwx
other:---
default:user::rwx
default:user:t_ftsadm:rwx
default:group::rwx
default:group:t_ftsadm:rwx
default:mask:rwx
default:other:---
$ getfacl info.log
# file: info.log
# owner: blankt
# group: itopbs
user::rw-
user:t_ftsadm:rwx #effective:rw-
group::rwx #effective:rw-
group:t_ftsadm:rwx #effective:rw-
mask:rw-
other:---
As you can see, t_ftsadm is the owner of the directory, I am owner of
info.log. Both users have full permissions on them. By the way, user
blankt is a member of group t_ftsadm.
I use the following script to gzip the file info.log:
$ cat gzip.pl
#!/usr/local/bin/perl
use strict;
use filetest 'access';
use IO::Compress::Gzip qw(gzip $GzipError) ;
my $input = "./info.log";
my $output = "./info.log.gz";
my $status = gzip $input => $output, AutoClose => 1, BinModeIn => 1
or die "gzip failed: $GzipError\n";
If I execute this, I get the following error:
$ ./gzip.pl
gzip failed: cannot open file './info.log':
As expected, no gz file is there:
$ ll
total 4
-rwxr-x---+ 1 t_ftsadm t_ftsadm 273 Apr 30 11:29 gzip.pl
-rw-rw----+ 1 blankt itopbs 2806 Apr 30 10:08 info.log
Nothing more to see with truss:
[...]
3033: stat64("./info.log", 0x00123920) = 0
3033: stat64("./info.log", 0x00123920) = 0
3033: getgroups(0, 0x00000000) = 3
3033: getgroups(3, 0x003066B8) = 3
3033: fstat64(2, 0xFFBFF310) = 0
gzip failed: cannot open file './info.log':
3033: write(2, " g z i p f a i l e d :".., 45) = 45
[...]
I already know this problem with ACLs, therefore I use "use filetest
'access'" which normally solves this issue. But not in this case.
But if I add this pragma to the beginning of IO/Compress/Base/Common.pm,
it works:
# head /usr/local/lib/perl5/site_perl/5.8.8/IO/Compress/Base/Common.pm
package IO::Compress::Base::Common;
use strict ;
use warnings;
use bytes;
use Carp;
use Scalar::Util qw(blessed readonly);
use File::GlobMapper;
use filetest 'access';
require Exporter;
[...]
Executing gzip.pl again, it works as expected:
$ ./gzip.pl
$ ll
total 5
-rwxr-x---+ 1 t_ftsadm t_ftsadm 273 Apr 30 11:29 gzip.pl
-rw-rw----+ 1 blankt itopbs 2806 Apr 30 10:08 info.log
-rw-rw----+ 1 t_ftsadm t_ftsadm 358 Apr 30 11:44 info.log.gz
So please add the pragma "use filetest 'access'" to IO::Compress::Base,
maybe more modules are affected.
My system: SunOS strsun11a 5.10 Generic_118833-36 sun4u sparc
SUNW,Sun-Fire-V240 Solaris
Perl version: This is perl, v5.8.8 built for sun4-solaris
Module version: IO::Compress::Base 2.004