[sf-perl] Bug in perl (or does -r not do what I think?)
David Thompson
dat1965 at yahoo.com
Fri Jun 6 13:50:34 PDT 2008
--- Dan Boger <dan at peeron.com> wrote:
> I'm a little bit confused here, maybe one of you guys can spot what I'm
> missing.
>
> I have some files on an NFS filesystem, that is set to root_squash. The
> file is owned by my network id (dboger), while I'm logged in locally as dan:
>
> dan at dbdb$ ls -l somefile.png
> -r-------- 1 dboger 3813 2008-06-05 16:46 somefile.png
>
> I'm trying to figure out if a file is readable, so I do something like:
>
> dan at dbdb$ perl -le 'print "lies" if -r shift' somefile.png
> dan at dbdb$
>
> That is correct - the file is owned by a different UID, and is set to 0400.
>
> Now, I try the same thing as root:
>
> dan at dbdb$ sudo perl -le 'print "lies" if -r shift' somefile.png
> lies
I agree, I think this output is incorrect.
If you're using root_squash, you should be accessing this
file on the NFS server as user "nobody", right? What does
the "nobody" account look like on the NFS server?
> dan at dbdb$ sudo file somefile.png
> couldn't open file
> somefile.png: regular file, no read permission
>
> Is perl just assuming that if I'm root I can always read the file, even
> though the permissions say that's wrong?
>
> What am I missing?
More information about the SanFrancisco-pm
mailing list