cvs: pear /Log package.php package.xml /Log/Log file.php /Log/docs guide.txt

From: Date: Mon, 19 Sep 2005 04:24:15 +0000
Subject: cvs: pear /Log package.php package.xml /Log/Log file.php /Log/docs guide.txt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-34861@lists.php.net to get a copy of this message
jon Mon Sep 19 00:24:15 2005 EDT Modified files: /pear/Log package.php package.xml /pear/Log/Log file.php /pear/Log/docs guide.txt Log: The file handler will now only attempt to set the log file's permissions mode if it is responsible for creating the file. This feels like friendlier behavior in general, and it also allows us to remove the code which was attempting to infer whether or not we had sufficient ownership over the file to call chmod(). Bug: 5418 http://cvs.php.net/diff.php/pear/Log/package.php?r1=1.36&r2=1.37&ty=u Index: pear/Log/package.php diff -u pear/Log/package.php:1.36 pear/Log/package.php:1.37 --- pear/Log/package.php:1.36 Tue Sep 6 01:54:36 2005 +++ pear/Log/package.php Mon Sep 19 00:24:12 2005 @@ -16,7 +16,7 @@ The file handler can now handle file modes given as strings. The display handler now offers a 'linebreak' configuration option. The composite handler's getIdent() method now returns the correct value. -The file handler now only attempts to set the log file's mode if it has permission. +The file handler now only attempts to set the log file's mode if it created it. The factory() method will no longer attempt to include the handler file if the handler class has already been defined. EOT; @@ -33,7 +33,7 @@ The file handler can now handle file modes given as strings. (Bug 4948) The display handler now offers a 'linebreak' configuration option. (Bug 5014) The composite handler's getIdent() method now returns the correct value. (Bug 5192) -The file handler now only attempts to set the log file's mode if it has permission. (Bug 5273) +The file handler now only attempts to set the log file's mode if it created it. (Bug 5273, 5418) The factory() method will no longer attempt to include the handler file if the handler class has already been defined. (Bug 5182) EOT; http://cvs.php.net/diff.php/pear/Log/package.xml?r1=1.92&r2=1.93&ty=u Index: pear/Log/package.xml diff -u pear/Log/package.xml:1.92 pear/Log/package.xml:1.93 --- pear/Log/package.xml:1.92 Tue Sep 6 01:54:36 2005 +++ pear/Log/package.xml Mon Sep 19 00:24:12 2005 @@ -14,7 +14,7 @@ </maintainers> <release> <version>1.9.0</version> - <date>2005-09-05</date> + <date>2005-09-18</date> <license>PHP License</license> <state>stable</state> <notes>Added stringToPriority() for converting priority names to PEAR_LOG_* constants. @@ -29,7 +29,7 @@ The file handler can now handle file modes given as strings. The display handler now offers a 'linebreak' configuration option. The composite handler's getIdent() method now returns the correct value. -The file handler now only attempts to set the log file's mode if it has permission. +The file handler now only attempts to set the log file's mode if it created it. The factory() method will no longer attempt to include the handler file if the handler class has already been defined.</notes> <deps> <dep type="pkg" rel="ge" version="1.3" optional="yes">DB</dep> @@ -99,7 +99,7 @@ <changelog> <release> <version>1.9.0</version> - <date>2005-09-05</date> + <date>2005-09-18</date> <license>PHP License</license> <state>stable</state> <notes>Added stringToPriority() for converting priority names to PEAR_LOG_* constants. (Bug 2853) @@ -114,7 +114,7 @@ The file handler can now handle file modes given as strings. (Bug 4948) The display handler now offers a 'linebreak' configuration option. (Bug 5014) The composite handler's getIdent() method now returns the correct value. (Bug 5192) -The file handler now only attempts to set the log file's mode if it has permission. (Bug 5273) +The file handler now only attempts to set the log file's mode if it created it. (Bug 5273, 5418) The factory() method will no longer attempt to include the handler file if the handler class has already been defined. (Bug 5182)</notes> </release> <release> http://cvs.php.net/diff.php/pear/Log/Log/file.php?r1=1.43&r2=1.44&ty=u Index: pear/Log/Log/file.php diff -u pear/Log/Log/file.php:1.43 pear/Log/Log/file.php:1.44 --- pear/Log/Log/file.php:1.43 Tue Sep 6 01:25:50 2005 +++ pear/Log/Log/file.php Mon Sep 19 00:24:14 2005 @@ -1,8 +1,8 @@ <?php /** - * $Header: /repository/pear/Log/Log/file.php,v 1.43 2005/09/06 05:25:50 jon Exp $ + * $Header: /repository/pear/Log/Log/file.php,v 1.44 2005/09/19 04:24:14 jon Exp $ * - * @version $Revision: 1.43 $ + * @version $Revision: 1.44 $ * @package Log */ @@ -221,15 +221,17 @@ $this->_mkpath($this->_filename, $this->_dirmode); } + /* Determine whether the log file needs to be created. */ + $creating = !file_exists($this->_filename); + /* Obtain a handle to the log file. */ $this->_fp = fopen($this->_filename, ($this->_append) ? 'a' : 'w'); /* We consider the file "opened" if we have a valid file pointer. */ $this->_opened = ($this->_fp !== false); - /* Set the file's mode if we own it or are the superuser. */ - $euid = posix_geteuid(); - if ($euid === 0 || $euid === fileowner($this->_filename)) { + /* Attempt to set the file's permissions if we just created it. */ + if ($creating && $this->_opened) { chmod($this->_filename, $this->_mode); } } http://cvs.php.net/diff.php/pear/Log/docs/guide.txt?r1=1.20&r2=1.21&ty=u Index: pear/Log/docs/guide.txt diff -u pear/Log/docs/guide.txt:1.20 pear/Log/docs/guide.txt:1.21 --- pear/Log/docs/guide.txt:1.20 Tue Sep 6 01:32:56 2005 +++ pear/Log/docs/guide.txt Mon Sep 19 00:24:15 2005 @@ -8,8 +8,8 @@ :Author: Jon Parise :Contact: jon@php.net -:Date: $Date: 2005/09/06 05:32:56 $ -:Revision: $Revision: 1.20 $ +:Date: $Date: 2005/09/19 04:24:15 $ +:Revision: $Revision: 1.21 $ .. contents:: Contents .. section-numbering:: @@ -450,11 +450,8 @@ .. _flock: http://www.php.net/flock .. _strftime: http://www.php.net/strftime -The file handler will only attempt to set the `mode` value if it thinks that -is has permission to do so. Per chmod(2)_, this is defined as effectively -running as the user who owns the file or as the superuser. - -.. _chmod(2): http://www.opengroup.org/onlinepubs/007908799/xsh/chmod.html +The file handler will only attempt to set the `mode` value if it was +responsible for creating the file. Example ~~~~~~~

« previous php.pear.cvs (#34861) next »