Re: [PHP] unlink, symlink and caching

2005-12-22 Thread jgmtfia Mr
> Be sure to include the OS, filesystem type and the configure line
> in the report, cause there seems to be something system dependent
> causing it since the script you posted earlier worked fine on my
> system.

Thanks for your help.  I appreciate it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] unlink, symlink and caching

2005-12-22 Thread jgmtfia Mr
> > I just ran the test with php4 cli and it works correctly.
> > PHP 4.3.10-15 (cli) (built: May  9 2005 08:54:56)
> >
> > But with php5 cli and apache2 module it does not:
> > PHP 5.1.0b3 (cli) (built: Oct 18 2005 16:13:19)
> > PHP 5.1.0 apache module
>
> The versions I ran the tests  were on:
>   PHP 5.1.0RC5-dev (cli) (built: Nov 17 2005 10:02:23)
>   PHP 5.1.2-dev (cli) (built: Dec 19 2005 12:03:32)
>
> > Is this not a bug?
>
> If it still happens on your system with the latest snapshot it
> sounds like it.

I just downloaded + compiled 5.1.1 and it does have the same problem. 
What should be next step be?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] unlink, symlink and caching

2005-12-22 Thread jgmtfia Mr
> Thank you for checking on this.
>
> I am using debain stable with a 2.6.14.3 kernel.  The filesystem in
> question is ext2 on a 48 MB ramdisk.
>
> I also did the following on another machine using ext2 on a harddisk
> with command line php.

I just ran the test with php4 cli and it works correctly.
PHP 4.3.10-15 (cli) (built: May  9 2005 08:54:56)

But with php5 cli and apache2 module it does not:
PHP 5.1.0b3 (cli) (built: Oct 18 2005 16:13:19)
PHP 5.1.0 apache module

Is this not a bug?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] unlink, symlink and caching

2005-12-21 Thread jgmtfia Mr
> > The loop then continues forever with file_exists() returning true, but
> > unlink() returns false with the error message "Warning:
> > unlink(/config1/C) [function.unlink]: No such file or directory in
> > /www/script.php on line 10"
>
> This might be an issue with the OS or Filessystem.  The code
> works just fine for me, i dont even need the clearstatcache().

Thank you for checking on this.

I am using debain stable with a 2.6.14.3 kernel.  The filesystem in
question is ext2 on a 48 MB ramdisk.

I also did the following on another machine using ext2 on a harddisk
with command line php.

 A
-rw-r--r--  1 user user 91 Dec 21 12:41 test.php
*/

$FILE = 'C';

while(file_exists($FILE)){
echo "$FILE exists\n";
echo `ls -l C`;
if(!unlink($FILE)){
echo "Unable to delete $FILE\n";
echo `ls -l C`;
}else{
echo "Deleted $FILE\n";
}
echo "\n";
}

/*
Output:
>php5 ./test.php

C exists
lrwxr-xr-x  1 user user 1 Dec 21 12:59 C -> A
Deleted C


C exists
ls: C: No such file or directory
Warning: unlink(C): No such file or directory in
/home/user/x/test.php on line 14
Unable to delete C
ls: C: No such file or directory


C exists
ls: C: No such file or directory
Warning: unlink(C): No such file or directory in
/home/user/x/test.php on line 14
Unable to delete C
ls: C: No such file or directory

 */

?>

This shows that apache is not responsible for the problem.

Note also that if I delete A and C within the loop the code works as
expected and the loop only executes once.  So file_exists() is seeing
"A" when I tell it to delete "C" and unlink is seeing "C" as it
should.

Any ideas where to start to look for the cause of the problem?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] unlink, symlink and caching

2005-12-21 Thread jgmtfia Mr
I have a directory with the files:
/config/A
/config/B
and
/config/C is a symlink to /config/A.

Via php I unlink /config/C:

$FILE = '/config/C';
while(file_exists($FILE)){
unlink($FILE);
clearstatcache();
}

When run, the first time through the loop $FILE is removed from disk
as it should.

The loop then continues forever with file_exists() returning true, but
unlink() returns false with the error message "Warning:
unlink(/config1/C) [function.unlink]: No such file or directory in
/www/script.php on line 10"

If I do this:
$FILE = '/config/C';
unlink($FILE);
cleanstatcache();
symlink('/config/B', '/config/C');

I get the error message:
Warning: symlink() [function.symlink]: File exists in /www/script.php
on line 11

However the link had been deleted.

The symlink /config/C is read via file_get_contents() before the
unlink and relink is performed.

I have also done the following:
$FILE = '/config/C';
unlink($FILE);
`ln -s /config/B /config/C`

Which works as expected, the old link is replaced with the new link,
however any attempt to open and read from the new link returns the
contents of the old file.

How would I be able to get the expected behavior from PHP.  I expect
that the problem has something to do with the symlinks being used.

Any assistance is appreciated.


PHP Version: 5.1.0
Server API: Apache 2.0 Handler
PHP API: 20041225
PHP Extension: 20050922
Zend Extension: 220051025
Apache Version: Apache/2.0.52 (Unix) PHP/5.1.0
Apache API Version: 20020903

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php