From: beckera at softrends dot com Operating system: Linux (CentOS 5.1) PHP version: 5.2.6 PHP Bug Type: dBase related Bug description: Database create function ignores umask
Description: ------------ Running CentOS 5.1 w/ Apache 2.2.3. Set Apache's umask to 002, ran a dbase create function to create a new dbase file. When finished, the file permissions were 644 instead of 664. Initially found this under version 5.1.6, tracked it down in source code, then checked 5.2.6 and the problem is still there. In the source file php-5.2.6/ext/dbase/dbase.c, find the function "dbase_create". About 30 lines into the function there is a function call VCWD_OPEN_MODE(Z_STRVAL_PP(filename), O_BINARY|O_RDWR|O_CREAT, 0644) which is responsible for creating the new file. The error is in the hard-coded third parameter 0644. This will fail to create the file with expected permissions unless umask is set to 022 (which is normally the default). This code needs to obtain the umask in effect at the time of the function call, compute the correct mode value, and use that in place of the current hard value 0644. CentOS 5 PHP is not compiled with dbase enabled by default. I obtained and installed the source RPM, modified the spec file to add " --enable-dbase" to the options used both for building the command-line and Apache module forms of PHP. -- Edit bug report at http://bugs.php.net/?id=45383&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45383&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45383&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45383&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45383&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45383&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45383&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45383&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45383&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45383&r=support Expected behavior: http://bugs.php.net/fix.php?id=45383&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45383&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45383&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45383&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45383&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45383&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45383&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45383&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45383&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45383&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45383&r=mysqlcfg
