php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46245 is_writable() returns 'true' on read-only directories over NFS
Submitted: 2008-10-06 19:54 UTC Modified: 2009-05-14 01:00 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: gabe at mudbugmedia dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.2.9 OS: Gentoo Linux 2.6.22-hardened-r8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gabe at mudbugmedia dot com
New email:
PHP Version: OS:

 

 [2008-10-06 19:54 UTC] 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-23 14:49 UTC] 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-03-21 23:36 UTC] 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-03-23 13:47 UTC] 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-05-06 18:53 UTC] jani@php.net
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. :)
 [2009-05-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC