Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.7

Bug #14507 go-pear fails creating directories.
Submitted: 2008-08-15 21:39 UTC
From: uli1448412 Assigned:
Status: Open Package: pearweb_gopear (version 1.1.2)
PHP Version: 4.4.4 OS: Debian/Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-08-15 21:39 UTC] uli1448412 (Uli Sc)
Description: ------------ go-pear creates all it's directories using mkdir("filename",mode). It therefore fails to access the dirs if umask is accidentally not 0000. The problem is wellknown, see the annotations in the php online documentation: ---8<---- 28-Jun-2003 01:00: You might notice that when you create a new directory using this code: mkdir($dir, 0777); The created folder actually has permissions of 0755, instead of the specified 0777. Why is this you ask? Because of umask(): http://www.php.net/umask The default value of umask, at least on my setup, is 18. Which is 22 octal, or 0022. This means that when you use mkdir() to CHMOD the created folder to 0777, PHP takes 0777 and substracts the current value of umask, in our case 0022, so the result is 0755 - which is not what you wanted, probably. The "fix" for this is simple, include this line: $old_umask = umask(0); Right before creating a folder with mkdir() to have the actual value you put be used as the CHMOD. If you would like to return umask to its original value when you're done, use this: umask($old_umask); -----8<---- You can easiely fix the script by adding the line $oldmask=umask(0000); at the very beginning. Test script: --------------- go-pear.php as shipped. Expected result: ---------------- working pear-installation Actual result: -------------- Errormessages like: FATAL ERROR! This directory exists, but we have no write permission in it. You can grant this permission by logging on to the server and issuing the following command: chmod 0777 /home/www/web2_226/html/pear_php5/temp The hint given does not work, too. I think the directory is destroyed if it exists before.

Comments

 [2009-04-17 22:25 UTC] kguest (Ken Guest)
Is anybody available to investigate and patch this script with the solution given here? QA Team calling ;-)