Subject: | IO::Compress::Base::Common returns that it cannot read readable files in NFS |
In the function:
359 sub IO::Compress::Base::Validator::validateInputFilenames
The "-r" flag is used to see if the input file is readable:
380 if (! -r _ )
381 {
382 return $self->saveErrorString("cannot open file
'$filename': $!");
383 }
However, as noted in the perl documentation, this call is not reliable:
The interpretation of the file permission operators -r , -R , -w , -W ,
-x , and -X is by default based solely on the mode of the file and the
uids and gids of the user. There may be other reasons you can't actually
read, write, or execute the file: for example network filesystem access
controls, ACLs (access control lists), read-only filesystems, and
unrecognized executable formats. Note that the use of these six specific
operators to verify if some operation is possible is usually a mistake,
because it may be open to race conditions.
This causes problems when trying to use IO::Compress to compress files
stored in NFS that may be fully accessible to the reader making the
call, but not have a matching UID.
Example:
zimbra@mail:~$ ./libexec/zmbackupldap --outdir /backup/qtest --zip
gzip failed: cannot open file '/backup/qtest/ldap.bak':
zimbra@mail:~$ ls -l /backup/qtest/
total 848
-rw-r----- 1 99 99 641551 Nov 7 2012 ldap-config.bak
-rw-r----- 1 99 99 224569 Nov 7 2012 ldap.bak
zimbra@mail:~$ cd /backup/qtest/
zimbra@mail:/backup/qtest$ gzip ldap.bak
zimbra@mail:/backup/qtest$ ls -l
total 680
-rw-r----- 1 99 99 641551 Nov 7 18:38 ldap-config.bak
-rw-r----- 1 99 99 52855 Nov 7 18:38 ldap.bak.gz