#46245 [Ana->Fbk]: is_writable() returns 'true' on read-only directories over NFS
ID: 46245
Updated by: jani@php.net
Reported By: gabe at mudbugmedia dot com
-Status: Analyzed
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Gentoo Linux 2.6.22-hardened-r8
PHP Version: 5.2.9
New Comment:
Can you try this:
# CFLAGS=getconf LFS_CFLAGS ./config.nice
# make clean && make
This is from bug #45040 which I think this is kind of duplicate report
now. :)
Previous Comments:
------------------------------------------------------------------------
[2009-03-23 13:47:22] gabe at mudbugmedia dot com
We are using UID mapping on this share (maps all users to the 'nobody'
user), so it sounds like access(2) is definitely the root cause. If
it's
not feasible to work around access(2) for NFS paths, perhaps this
should
just be a documentation fix?
------------------------------------------------------------------------
[2009-03-21 23:36:43] jani@php.net
Since is_writable() uses access(2) underneath, this might be the
reason for the false positive:
"access() may not work correctly on NFS file systems with UID mapping
enabled, because UID mapping is done on the server and hidden from
the client, which checks permissions."
------------------------------------------------------------------------
[2009-02-23 14:49:31] gabe at mudbugmedia dot com
nightly build did not fix behavior. However, I want to clarify that
this behavior is only occurring with directories, and not regular
files.
------------------------------------------------------------------------
[2008-10-06 19:54:46] gabe at mudbugmedia dot com
Description:
------------
When using is_writable() on a read-only file mounted over NFS, it
incorrectly returns true. In our environment, the NFS server is
running
MacOSX Server 10.5 mounted with the following fstab options:
10.10.10.10:/Volumes/Sack /sack nfs
rw,rsize=32768,soft,intr,tcp,nosuid 0 1
Reproduce code:
---------------
gabebug@proto /tmp $ ls -ld /sack/test
dr-xr-xr-x 2 joshbug mudbug 68 Oct 6 14:45 /sack/test/
gabebug@proto /tmp $ ls -ld /tmp/test
dr-xr-xr-x 2 joshbug mudbug 4096 Oct 6 14:44 /tmp/test/
gabebug@proto /tmp $ cat is_writable_test.php
<?php
var_dump(
is_writable('/sack/test'), // /sack is the NFS mount
is_writable('/tmp/test')
);
gabebug@proto /tmp $ php -f is_writable_test.php
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(true)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46245&edit=1
Thread (8 messages)