#46245 [Opn->Fbk]: is_writable() returns 'true' on read-only directories over NFS

From: Date: Sat, 21 Mar 2009 23:36:44 +0000
Subject: #46245 [Opn->Fbk]: is_writable() returns 'true' on read-only directories over NFS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-134978@lists.php.net to get a copy of this message
ID: 46245 Updated by: jani@php.net Reported By: gabe at mudbugmedia dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Gentoo Linux 2.6.22-hardened-r8 PHP Version: 5.2.9 New Comment: 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." Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2009-02-23 13:51:31] jani@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [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

« previous php.bugs (#134978) next »