help with file test operator 
Author Message
 help with file test operator

We have a directory /xyz/man which has a protection of 770
It is an nfs mounted directory.
When I am root and try to access this directory with a script we have,
I get protection errors.  

I started to write a perl program to work around the protection
problems but: ran into a problem.

If I run the following program:
#!/bin/perl
if ( -r "/xyz/man" ) {
    print "Directory readable \n";

Quote:
}

else {
    print "DIRECTORY NOT READABLE\n";
Quote:
}

It prints Directory readable logged in as root.

If I do:
ll /xyz/man      is says
/xyz/man/unreadable

Here is an ll of /xyz showing only the man directory entry

drwxrwx---  6 user     eng           512 Apr  2  1993 man/

Here is a directory of /xyz/man

drwxrwx---  6 user     eng           512 Apr  2  1993 ./
drwxr-xr-x 43 user     eng          1024 Sep  9 17:44 ../
drwxrwx---  2 user     eng          1536 Sep 29 10:35 cat1/
drwxrwxr-x  2 user     eng           512 Apr 26  1993 cat8/
drwxrwx---  2 user     eng          1536 Sep 29 10:33 man1/
drwxrwx---  2 user     eng           512 Apr 26  1993 man8/
-rw-rw-rw-  1 user     eng          3247 Apr 26  1993 whatis

Why does perl say it is ok and unix doesn't???????

Guess: Unix is trying to read files in the directory when I do the ll

       Perl is only testing the directory.

If this is the case will I get the error condition in perl when I scan
the files in the directory?

--
 Warren L. Dodge, Electronic Engineer              phone - (503) 685-2283
 Tektronix, Inc., Network Displays Division (NWD)  fax   - (503) 682-1500
 PO Box 1000, MS 60-850, Wilsonville, OR 97070



Tue, 18 Jun 1996 11:32:12 GMT  
 help with file test operator

[Sigh, Larry's not been posting and I need to get at these that
I'm been M-ing for days and days.]

:We have a directory /xyz/man which has a protection of 770
:It is an nfs mounted directory.
:When I am root and try to access this directory with a script we have,
:I get protection errors.  
:
:I started to write a perl program to work around the protection
:problems but: ran into a problem.
:
:If I run the following program:
:#!/bin/perl
:if ( -r "/xyz/man" ) {
:    print "Directory readable \n";
:}
:else {
:    print "DIRECTORY NOT READABLE\n";
:}
:It prints Directory readable logged in as root.
:
:If I do:
:ll /xyz/man      is says
:/xyz/man/unreadable
:

:Why does perl say it is ok and unix doesn't???????
:
:Guess: Unix is trying to read files in the directory when I do the ll
:
:       Perl is only testing the directory.
:
:If this is the case will I get the error condition in perl when I scan
:the files in the directory?

It's because Perl is analysing owners and permissions to determine
readability, whereas the OS has other criteria, such as root mapping
to "nobody" over NFS.  AFS elicits the same problem.

--tom
--

      "Will Hack Perl for Fine Food and Fun"
        Boulder Colorado  303-444-3212



Fri, 21 Jun 1996 05:11:25 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help with file test operator problem

2. Help with file test operators

3. File test operators can't tell a file from a directory

4. File Test Operators and Speed

5. Wildcards allowed in file test operators?

6. File Test Operators

7. File test operator question

8. File Test Operators -B and -T

9. File test operators problem

10. -s file test operator failure

11. Where is -e (file test operator) in man?

12. Question about File test operators

 

 
Powered by phpBB® Forum Software