ID: 41822 Comment by: ab5602 at wayne dot edu Reported By: ian at onlineloop dot com Status: Assigned Bug Type: *Directory/Filesystem functions Operating System: Solaris 10 PHP Version: 5.2CVS-20070627 Assigned To: tony2001 New Comment:
No, the above NFS issues is a side-effect of: 1) Solaris getcwd() not functioning properly with (--x) directories and 2) PHP not properly allowing relative include()'s when #1 is the case #2 is probably solvable w/ a bug fix, #1 is obviously not. Previous Comments: ------------------------------------------------------------------------ [2007-10-02 11:11:49] [EMAIL PROTECTED] So this is only an issue with NFS shares? If so, please indicate that in the summary. ------------------------------------------------------------------------ [2007-10-02 06:54:42] ab5602 at wayne dot edu I figured out what the issue was with the NFS shares and the "permission denied error" in our Solaris environment. It was related to the same (--x) permission issue that you are having. As it turns out, if you mount an NFS share in: /mylocaldir/nfsmount/ The /nfsmount/ directory permissions, *before* you mount the share, need to be (r-x) or better, even though these permissions are hidden after the mount in order to avoid the Solaris+PHP include() bug. Now include() and getcwd() work just fine! It is very clear that this all goes back to two options: 1) Either make all the subdirs underneath (r-x) OR 2) If it is possible (which I'm not yet sure of), the PHP binary needs to "tell" Solaris that it already knows the current path by doing a chdir(/absolute/path/) or the like before trying getcwd() in order to make the "include() cause permission denied error" go away. ------------------------------------------------------------------------ [2007-10-01 23:53:16] ab5602 at wayne dot edu correction: a) Execute a program that implements getcwd() that is suid-root. ------------------------------------------------------------------------ [2007-10-01 23:41:38] ab5602 at wayne dot edu Wow, this is strange. I'm very much closer to seeing what is going on with PHP+Solaris that is causing the issue here Ian. I've tested pwd/getcwd() with every combination I could think of and this is how Solaris feels about permissions: If you are not root AND you want to get your current working directory that has parents with exclusively 'x' permissions, you must do one of two things: a) Execute a getuid() program that is suid-root. OR: And this is the strange one... b) Tell Solaris that you already know where you are!! If it is feasible, I'll see if I can come up with a patch to implement (b) if your architecture is Solaris and send it to the PHP internals list. See below for how this works: ----- # uname -a SunOS opteron 5.10 Generic_118855-14 i86pc i386 i86pc # pwd / # find ./dirtest/ -ls 449393 1 d--x--x--x 3 root root 512 Oct 1 19:29 ./dirtest/ 449394 1 d--x--x--x 2 root root 512 Oct 1 19:29 ./dirtest/dirtest2 # cd /dirtest/dirtest2 # pwd /dirtest/dirtest2 # su nobody # pwd cannot determine current directory # cd /dirtest/dirtest2/ # pwd /dirtest/dirtest2 # ------------------------------------------------------------------------ [2007-10-01 17:33:08] ab5602 at wayne dot edu Hi, the 'pwd' command works just fine for me too on any platform. However, suid'd use of the getcwd() function I think is the issue. The below demonstrates what I think is the going on with how Solaris behaves vs. how PHP expects the getcwd() command to behave. The following code was compiled and run on both Linux and Solaris platforms under a local filesystem and called cwdtest: #include <stdio.h> main() { char str[200]; if (getcwd(str, sizeof(str)) == NULL) printf("getcwd failed!!!\n"); else printf("CWD = %s\n",str); } ------ Linux ------ # uname -a Linux messaging2.wayne.edu 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 athlon i386 GNU/Linux # find ./localfs -ls 32001 8 d--x--x--x 3 nobody nobody 4096 Oct 1 13:05 ./localfs 32002 8 d--x--x--x 2 nobody nobody 4096 Oct 1 13:12 ./localfs/test123 32004 12 -rwsr-xr-x 1 nobody nobody 4878 Oct 1 13:06 ./localfs/test123/cwdtest # su nobody # cd /localfs/test123 # ./cwdtest CWD = /localfs/test123 # pwd /localfs/test123 # ------ Solaris 10 ------ # uname -a SunOS opteron 5.10 Generic_118855-14 i86pc i386 i86pc # find ./localfs -ls 449384 1 d--x--x--x 3 nobody nobody 512 Oct 1 13:13 ./localfs 449386 1 d--x--x--x 2 nobody nobody 512 Oct 1 13:13 ./localfs/test123 449388 7 -rwsr-xr-x 1 nobody nobody 6552 Oct 1 12:57 ./localfs/test123/cwdtest # su nobody # cd /localfs/test123 # ./cwdtest getcwd failed!!! # pwd /localfs/test123 # ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41822 -- Edit this bug report at http://bugs.php.net/?id=41822&edit=1