php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41660 New file tests fail
Submitted: 2007-06-11 22:11 UTC Modified: 2007-06-18 13:33 UTC
From: uwe dot pries at digartis dot de Assigned: johannes (profile)
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 5CVS-2007-06-11 (CVS) OS: Linux 2.6 (ubuntu feisty-fawn)
Private report: No CVE-ID: None
 [2007-06-11 22:11 UTC] uwe dot pries at digartis dot de
Description:
------------
check:

http://digger.homelinux.net:8080/php_tests/

http://digger.homelinux.net:8080/php_tests/is_readable_basic.out




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-11 22:14 UTC] johannes@php.net
Zoe,

do you have an idea why that many tests (see the ones with .out/.diff files on the first link) might fail on that box - they work for me...
 [2007-06-12 08:36 UTC] zoe at uk dot ibm dot com
Interesting - I'm looking at it and will update later. I also tested on Linux (Ubuntu 6.10 and Fedora core release 5) so it's likely to to be something set-up/environment specific and possibly something we should check for in a SKIPIF.
 [2007-06-12 09:52 UTC] zoe@php.net
Hi Uwe - are you by any chance using running the tests as "root"?
 [2007-06-12 10:06 UTC] uwe dot pries at digartis dot de
hi zoe,

*doh* yes, "sudo make test" :-X

i'm re-running them now as normal user...

sorry and thanks for your help.

regards
uwe
 [2007-06-12 10:15 UTC] uwe dot pries at digartis dot de
hello zoe,

after make test as normal user, I get only readlink test failed.

Test readlink() and realpath() functions: usage variation [ext/standard/tests/file/readlink_realpath_variation.phpt]

http://digger.homelinux.net:8080/php_tests/readlink_realpath_variation.phpt
http://digger.homelinux.net:8080/php_tests/readlink_realpath_variation.out
http://digger.homelinux.net:8080/php_tests/readlink_realpath_variation.diff

Regards
uwe
 [2007-06-12 21:02 UTC] zoe@php.net
Hi Uwe 

Actually - it's my "d'oh" I think - this is certain to happen so we ought to have a check in the tests. I have a fix, I just wanted to be sure that that's what the problem was.

I'll have a look at the other failure tomorrow.
 [2007-06-12 21:37 UTC] johannes@php.net
Reopening this so we won't forget :-)
 [2007-06-13 07:05 UTC] zoe@php.net
Hi Uwe - I can't access the links, would it be possible to e-mail the files? (zoe@uk.ibm.com)
 [2007-06-13 21:09 UTC] uwe dot pries at digartis dot de
hello zoe,

sorry, my laptop was off last night.
it's now up and running again.

http://digger.homelinux.net:8080/php_tests/

thanks and regards
uwe
 [2007-06-14 08:42 UTC] zoe@php.net
Hi Uwe
I can't reproduce the readlink/realpath failure on my system. On your system the test is failing to resolve a path using realpath(). I'm wondering if there were some temporary files left around after the previous test failures when run as root which are causing a problem. Would it be possible to do a clean checkuot and re-run the tests from a normal ID? I'd like to be able to rule out the possibility - although I admit that I can't see exactly how it causes the problem.


 [2007-06-14 10:06 UTC] uwe dot pries at digartis dot de
hello zoe,

johannes assisted me in cleanig and building php.

readlink() and realpath() are still in FAILED TEST SUMMARY
http://digger.homelinux.net:8080/php_tests/

my config file is there:
http://digger.homelinux.net:8080/config.nice

thanks and regards
uwe
 [2007-06-14 11:07 UTC] zoe@php.net
Hi again - thanks for that. I got a little further with this and will probably send you a simplified testcase later on. I'm also trying to get access to a system that uses exactly the same level of Ubuntu as you.


 [2007-06-14 14:56 UTC] zoe@php.net
Hi Uwe

Could I get you to try a couple of simple tests for me?
Could you run the following PHP:
<?php 
$name_prefix = dirname(__FILE__);
$filename = "$name_prefix/fred.tmp";
mkdir("$name_prefix/mary/", 0777, true); 

// create a temp file
$file_handle = fopen($filename, "w");
fclose($file_handle);


$link_arr= array(
        "$name_prefix/../$name_prefix/no_file.tmp"
);
var_dump( symlink($filename, $link_arr[0]) );
var_dump( readlink($link_arr[0]) );
var_dump( realpath($link_arr[0]) );

unlink("$name_prefix/fred.tmp");
rmdir("$name_prefix/mary/");
?>


When you run it please would you do it by giving the full path name of the PHP executable? Probably something like this:
/home/uwe/php52/sapi/cli/php simpletest.php

Would you run a second test where you just type:
php simpletest.php

The reason for this is that I can reproduce your failure with an older version of PHP (in fact the one that comes on Ubuntu as default), so I suspect that you might be picking this up accidentally.

Please would you attach the output from both tests to this bugzilla?

 [2007-06-14 15:03 UTC] zoe@php.net
PS - If what I think in the last update is correct you found a regression in PHP5 AND an error in our testcase which didn't detect the regression :-)
 [2007-06-14 15:08 UTC] uwe dot pries at digartis dot de
hi zoe,

your script:
http://digger.homelinux.net:8080/php/simpletest.phps

produces with:

up@digger:~/work/php5$ sapi/cli/php simpletest.php

Warning: symlink(): No such file or directory in /home/up/work/php5/simpletest.php on line 14
bool(false)

Warning: readlink(): No such file or directory in /home/up/work/php5/simpletest.php on line 15
bool(false)
bool(false)

and 

up@digger:~/work/php5$ php simpletest.php

Warning: symlink(): No such file or directory in /home/up/work/php5/simpletest.php on line 14
bool(false)

Warning: readlink(): No such file or directory in /home/up/work/php5/simpletest.php on line 15
bool(false)
bool(false)
 [2007-06-14 16:25 UTC] zoe@php.net
Oh - bother - that's really annoying I was hoping to see different results - your output is not the same as my PHP52 download from today but it is the same as I get with the standard php installation on Ubuntu.

I'll get access to a feisty installation tomorrow, in the meantime please would you attach the output from  <?php phpinfo() ?> ? Just in case I can get anything additional from that?

Thanks
 [2007-06-15 09:23 UTC] zoe@php.net
Hi Uwe
I have run the test on an Ubuntu Feisty system and still can't reproduce your failure.

Looking at the phpinfo() output there are two main differences between your and my set up. The first one (you are using php-ini.dist and I was not using any ini file) I have checked and ruled out. The second one is your ./configure command.

I have just re-built php with ./configure --with-pcre-regex --disable-all and I still get the same results. Please would you re-build with this configure command and rerun the sample code then post the results? I'll try and get as close as I can to your configure command but may not be able to reproduce it exactly.

Thanks - Zoe
 [2007-06-15 09:43 UTC] zoe@php.net
Hi - don't worry about rebuilding, it's one of 4 options on the configure command that is making the difference. I can reproduce your failure.
Zoe
 [2007-06-15 11:58 UTC] zoe@php.net
Hi Uwe

I now understand this as far as it's possible for me, the next step is to get someone more expert to look at it - so I'm summarising and assigning back to Johannes.

Summary
=======

There are two parts to this defect - first the problem with tests being run as root. I have fixed those test cases.

The second part is with the failing readlink_realpath_variation.phpt test. This test is failing on Uwe's sytem because he has used the configure option --enable-maintainer-zts.

There are two problems with readlink_realpath_variation.phpt. First the test case has been coded incorrectly, it should *pass* with --enable-maintainer-zts and should *fail* without it. Secondly, there is a bug in PHP which needs someone fairly expert to look at it.

I will change the test case so that it fails properly instead of testing for, and passing, incorrect behaviour.

Here is a simple reproduce test case for the failure:

--TEST--
Dump failure result of trying to create non-existant link followed by realpath() on non-existant link
--FILE--
<?php 
$name_prefix = dirname(__FILE__);
$filename = "$name_prefix/fred.tmp";
mkdir("$name_prefix/mary/", 0777, true); 

// create a temp file
$file_handle = fopen($filename, "w");
fclose($file_handle);

$no_such_link = "$name_prefix/../$name_prefix/no_file.tmp";

//******************************************//
var_dump( symlink($filename, $no_such_link) );
var_dump( realpath($no_such_link ));
//******************************************//

unlink("$name_prefix/fred.tmp");
rmdir("$name_prefix/mary/");
?>
--EXPECTF--
Warning: symlink(): No such file or directory in %s on line %d
bool(false)
bool(false)

The two important lines are marked by ***. Both of these work correctly on their own - but not together.

 [2007-06-15 13:01 UTC] uwe dot pries at digartis dot de
Hello Zoe,

glad to hear you found the problem :-)
I hope I did not keep you from working on other important issues tho ;)=

Please tell me when you commit the new test. I will run it then and tell you about the state.

Who will close this issue/bug? 
[ ] The developer (zoe)
[ ] The assigner (chinstrap)
[ ] The reporter (uwe)

Thanks & regards
Uwe
 [2007-06-15 13:45 UTC] zoe@php.net
Thanks Uwe.

I don't think that anyone can close the bug till someone fixes or agrees to fix the defect in the engine :-)

When I fix the test case it will pass for you but will fail for everyone else until the engine bug is fixed.
 [2007-06-18 12:44 UTC] uwe dot pries at digartis dot de
hey zoe,

after dmitry updated ext/standard/tests/file/readlink_realpath_basic.* the test runs through now.

thanks again to all

regards
uwe
 [2007-06-18 13:33 UTC] nlopess@php.net
closing then.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 17:01:31 2024 UTC