ID:               32501
 User updated by:  Bjorn dot Wiberg at its dot uu dot se
 Reported By:      Bjorn dot Wiberg at its dot uu dot se
-Status:           Feedback
+Status:           Open
 Bug Type:         Directory function related
 Operating System: IBM AIX 5.2.0.0 ML5
-PHP Version:      5CVS-2005-07-04
+PHP Version:      5CVS-2005-07-05
 New Comment:

Hi again!

(Thanks for fixing the mpm_common crash, that problem is gone now.)

All the following with #define HAVE_BROKEN_GETCWD 1 in
main/php_config.h, and the following code (tests 1-4):

<?php

  print getcwd() . "<BR>";

  $handle = fopen("a.txt", "w", false);
  if ( $handle != FALSE ) {
    fputs($handle, "testtext");
    fclose($handle);
  }

?>

..and, respectively (tests 5-8):

<?php

  print getcwd() . "<BR>";

  $handle = fopen("./a.txt", "w", false);
  if ( $handle != FALSE ) {
    fputs($handle, "testtext");
    fclose($handle);
  }

?>


1. No existing "a.txt" file in the destination directory. With the
"read" flag missing to the "test" directory along the path, and write
permissions to the destination directory:

Warning: fopen(): open_basedir restriction in effect. File(a.txt) is
not within the allowed path(s):
(.:/apache/php/lib/php/:/apache/htdocs/bwiberg/) in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning:
fopen(a.txt): failed to open stream: Not owner in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5

No file gets created. getcwd() fails.


2. No existing "a.txt" file in the destination directory. Having both
read and execute flags along the path, and write permissions to the
destination directory:

/apache/htdocs/bwiberg/test/safemode
Warning: fopen(): Unable to access a.txt in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning:
fopen(a.txt): failed to open stream: No such file or directory in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 

No file gets created. But getcwd() correctly returns "
/apache/htdocs/bwiberg/test/safemode".


3. No existing "a.txt" file in the destination directory. Trying with
"./a.txt" instead, a missing "read" flag to the "test" directory along
the path, and write permissions to the destination directory:

No error message. The a.txt file gets correctly created, but getcwd()
fails.


4. No existing "a.txt" file in the destination directory. Trying with
"./a.txt", both "read" and "execute" flags along the path, and write
permissions to the destination directory:

No error message. The file gets correctly created, and getcwd() returns
"/apache/htdocs/bwiberg/test/safemode".


5. Existing "a.txt" file in the destination directory. With the "read"
flag missing to the "test" directory along the path, and write
permissions to the destination directory:

Warning: fopen(): open_basedir restriction in effect. File(a.txt) is
not within the allowed path(s):
(.:/apache/php/lib/php/:/apache/htdocs/bwiberg/) in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning:
fopen(a.txt): failed to open stream: Not owner in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5

File does not get overwritten. getcwd() fails.


6. Existing "a.txt" file in the destination directory. Having both read
and execute flags along the path, and write permissions to the
destination directory:

No error message. File gets overwritten correctly. getcwd() returns
"/apache/htdocs/bwiberg/test/safemode".


7. Existing "a.txt" file in the destination directory. Trying with
"./a.txt" instead, a missing "read" flag to the "test" directory along
the path, and write permissions to the destination directory:

No error message. File gets overwritten correctly, but getcwd() fails.

8. Existing "a.txt" file in the destination directory. Trying with
"./a.txt", both "read" and "execute" flags along the path, and write
permissions to the destination directory:

No error message. File gets overwritten correctly. getcwd() returns
"/apache/htdocs/bwiberg/test/safemode".


>From a getcwd() perspective (the scope of this particular bug report),
tests number 1, 2, 3, 5 and 7 fail although they perhaps shouldn't.

So, it appears that HAVE_BROKEN_GETCWD does not solve the "problems" on
AIX (with the current code for HAVE_BROKEN_GETCWD). Hence, the proposed
change to acinclude.m4 is currently not needed.

Any ideas on how to go from here? Or should we accept that getcwd()
should fail under these circumstances?

Thanks in advance!

Best regards,
Björn


Previous Comments:
------------------------------------------------------------------------

[2005-07-04 16:22:43] [EMAIL PROTECTED]

Try the latest CVS, the crash should be fixed now.


------------------------------------------------------------------------

[2005-07-04 14:18:35] Bjorn dot Wiberg at its dot uu dot se

Hi again!

Thanks for the quick reply!

I'm using the following command line to call configure:

CC=/usr/local/bin/gcc CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/lib
-L/opt/freeware/lib -L/usr/local/lib" ./configure --enable-bcmath
--enable-calendar --enable-dba --enable-dbase --enable-dbx
--enable-debug --enable-dio --enable-exif --enable-embedded-mysqli
--enable-filepro --enable-ftp --enable-gd-jis-conv
--enable-gd-native-ttf --enable-mbstring --enable-memory-limit
--enable-shmop --enable-soap --enable-sockets --enable-sysvmsg
--enable-sysvsem --enable-sysvshm --enable-yp --enable-zend-multibyte
--prefix=/apache/php --with-apxs2=/apache/bin/apxs --with-bz2
--with-freetype-dir --with-gd --with-gdbm --with-gettext --with-inifile
--with-jpeg-dir --with-ldap --with-libxml-dir --with-mime-magic
--with-mysql=/usr/local/mysql --with-openssl=/opt/freeware
--with-png-dir --with-tiff-dir --with-ttf --with-xpm-dir --with-xsl
--with-zlib --with-zlib-dir

Best regards,
Björn

------------------------------------------------------------------------

[2005-07-04 14:10:48] [EMAIL PROTECTED]

What configure line you used?


------------------------------------------------------------------------

[2005-07-04 13:54:27] Bjorn dot Wiberg at its dot uu dot se

With this release, Apache segfaults in mpm_common if I try to access
the directory where I have enabled safe mode:

[EMAIL PROTECTED]:/# gdb /nynom/apache/bin/httpd /home/bwiberg/core 
GNU gdb 5.0-aix51-020209
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "powerpc-ibm-aix5.2.0.0"...
Core was generated by `httpd'.
Program terminated with signal 11, Segmentation fault.
#0  0x10032354 in sig_coredump (sig=11) at mpm_common.c:1050
1050    mpm_common.c: No such file or directory.
(gdb) bt
#0  0x10032354 in sig_coredump (sig=11) at mpm_common.c:1050
#1  0xffffffff in ?? () from (unknown load module)

The Apache error log indicates:

[Mon Jul 04 13:51:52 2005] [notice] child pid 1654882 exit signal
Segmentation fault (11)
[Mon Jul 04 13:51:53 2005] [notice] child pid 1667296 exit signal
Segmentation fault (11)
[Mon Jul 04 13:51:53 2005] [notice] child pid 1155238 exit signal
Segmentation fault (11)
[Mon Jul 04 13:51:53 2005] [notice] child pid 290932 exit signal
Segmentation fault (11)
[Mon Jul 04 13:51:53 2005] [notice] child pid 892998 exit signal
Segmentation fault (11)
[Mon Jul 04 13:51:54 2005] [notice] child pid 1781880 exit signal
Segmentation fault (11)

This also happened with an earlier snapshot release (2005-06-21 10:30),
although I thought it would be a temporary error because of CVS
development.

Best regards,
Björn

------------------------------------------------------------------------

[2005-07-04 01:06:22] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



------------------------------------------------------------------------

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/32501

-- 
Edit this bug report at http://bugs.php.net/?id=32501&edit=1

Reply via email to