I believe this is *only* on an NFS filesystem with root_squash.&nbsp; I guess it counts as a local-filesystem according to the manpage:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Also note that, for the superuser on the local filesystems, the &quot;-r&quot;, &quot;-R&quot;, &quot;-w&quot;, and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;-W&quot; tests always return 1, and &quot;-x&quot; and &quot;-X&quot; return 1 if any execute bit is set in the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mode.&nbsp; Scripts run by the superuser may thus need to do a stat() to determine the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; actual mode of the file, or temporarily set their effective uid to something else.<br><br>Dan<br><br><div class="gmail_quote">On Fri, Jun 6, 2008 at 1:14 PM, frosty &lt;<a href="mailto:biztos@mac.com">biztos@mac.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">My first suspicion was that something funny is going on with either the NFS or the &quot;file&quot; command, most likely the former.<br>

<br>
I just checked and on a local filesystem it&#39;s consistent, at least in my world (Perl 5.8.6 on RHEL 4.5 i386).<br>
<br>
 &nbsp; &nbsp;user@localhost ~ $ ls -l somefile<br>
 &nbsp; &nbsp;-r-------- &nbsp;1 postgres postgres 4 May 27 17:46 somefile<br>
 &nbsp; &nbsp;user@localhost ~ $ sudo perl -le &#39;print &quot;lies&quot; if -r shift&#39; somefile<br>
 &nbsp; &nbsp;lies<br>
 &nbsp; &nbsp;user@localhost ~ $ sudo file somefile<br>
 &nbsp; &nbsp;somefile: ASCII text<br>
 &nbsp; &nbsp;user@localhost ~ $ file somefile<br>
 &nbsp; &nbsp;somefile: regular file, no read permission<br>
 &nbsp; &nbsp;user@localhost ~ $ cat somefile<br>
 &nbsp; &nbsp;cat: somefile: Permission denied<br>
 &nbsp; &nbsp;user@localhost ~ $ sudo cat somefile<br>
 &nbsp; &nbsp;yep<br>
 &nbsp; &nbsp;user@localhost ~ $<br>
<font color="#888888"><br>
-- f.<br>
</font><div><div></div><div class="Wj3C7c"><br>
On Friday, June 06, 2008, at 01:04PM, &quot;Dan Boger&quot; &lt;<a href="mailto:dan@peeron.com">dan@peeron.com</a>&gt; wrote:<br>
&gt;I&#39;m a little bit confused here, maybe one of you guys can spot what I&#39;m<br>
&gt;missing.<br>
&gt;<br>
&gt;I have some files on an NFS filesystem, that is set to root_squash. &nbsp;The<br>
&gt;file is owned by my network id (dboger), while I&#39;m logged in locally as dan:<br>
&gt;<br>
&gt;dan@dbdb$ ls -l somefile.png<br>
&gt;-r-------- 1 dboger 3813 2008-06-05 16:46 somefile.png<br>
&gt;<br>
&gt;I&#39;m trying to figure out if a file is readable, so I do something like:<br>
&gt;<br>
&gt;dan@dbdb$ perl -le &#39;print &quot;lies&quot; if -r shift&#39; somefile.png<br>
&gt;dan@dbdb$<br>
&gt;<br>
&gt;That is correct - the file is owned by a different UID, and is set to 0400.<br>
&gt;<br>
&gt;Now, I try the same thing as root:<br>
&gt;<br>
&gt;dan@dbdb$ sudo perl -le &#39;print &quot;lies&quot; if -r shift&#39; somefile.png<br>
&gt;lies<br>
&gt;dan@dbdb$ sudo file somefile.png<br>
&gt;couldn&#39;t open file<br>
&gt;somefile.png: regular file, no read permission<br>
&gt;<br>
&gt;Is perl just assuming that if I&#39;m root I can always read the file, even<br>
&gt;though the permissions say that&#39;s wrong?<br>
&gt;<br>
&gt;What am I missing?<br>
&gt;<br>
&gt;Dan<br>
&gt;<br>
&gt;--<br>
&gt;Dan Boger<br>
&gt;<br>
</div></div><div><div></div><div class="Wj3C7c">_______________________________________________<br>
SanFrancisco-pm mailing list<br>
<a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Dan Boger