Hi,
I've got a bug with is_link and lstats. Any symlinks not created in the
current session, will not be read. This only occurs in the Apache 2 SAPI
version, not in the CLI version.
Script:
/<?
$symlink = '/tmp/link-test';
if (file_exists($symlink)) unlink($symlink);
symlink('/tmp/pear', $symlink);
echo (file_exists($symlink) ? is_link($symlink) ? "Correct" :
"ERROR" : "Couldn't create the link"), "<br/>\n";
$symlink = '/tmp/link-persist';
if (!file_exists($symlink)) symlink('/tmp/pear', $symlink);
echo (file_exists($symlink) ? is_link($symlink) ? "Correct" :
"ERROR" : "Couldn't create the link"), "<br/>\n";
?>/
First run:
/ Correct
Correct
/
Second run:
/ Correct
ERROR/
Next runs:
/ Correct
ERROR
/I've recently start using the daily snapshots op PHP, but I also tried
it on version 5.2.1, which shows the same result. It used to work just
fine, so I'm sure this isn't the expected result. I've recently upgraded
from Ubuntu Edgy (6.10) to Feisty (7.04), with kernel and apache update,
so I believe that the problem is related to that.
I've straced the process (see attachment), but I can't pinpoint the
problem. This is a big issue for me, can anyone point me in the right
direction to find the source of this problem.
Thanks,
Arnold
<snip>Hi,
I've got a bug with is_link and lstats. Any symlinks not created in the
current session, will not be read. This only occurs in the Apache 2 SAPI
version, not in the CLI version.Script:
<?
$symlink = '/tmp/link-test';
if (file_exists($symlink)) unlink($symlink);
symlink('/tmp/pear', $symlink);
echo (file_exists($symlink) ? is_link($symlink) ? "Correct" : "ERROR" :
"Couldn't create the link"), "<br/>\n";$symlink = '/tmp/link-persist'; if (!file_exists($symlink)) symlink('/tmp/pear', $symlink); echo (file_exists($symlink) ? is_link($symlink) ? "Correct" : "ERROR" :
"Couldn't create the link"), "<br/>\n";
?>First run:
Correct
CorrectSecond run:
Correct
ERRORNext runs:
Correct
ERRORI've recently start using the daily snapshots op PHP, but I also tried it on
version 5.2.1, which shows the same result. It used to work just fine, so
I'm sure this isn't the expected result. I've recently upgraded from Ubuntu
Edgy (6.10) to Feisty (7.04), with kernel and apache update, so I believe
that the problem is related to that.I've straced the process (see attachment), but I can't pinpoint the problem.
This is a big issue for me, can anyone point me in the right direction to
find the source of this problem.Thanks,
Arnold
Well, I've also tested this code, and it does work fine. BUT if
/tmp/pear doesn't exists, what i had at first, then file_exists
returns false, because file_exists follows symlinks, and the symlink
pointed to nothing. So if you're sure that $symlink is a link, then it
might be better to check it with is_link.
Also, the is_link function is cached, so you might want to add one or
more clearstatcache()
in your script.
I checked your strace also, but it doesn't look like there's a bug.
But I've never studied on the PHP core so....
Well, if above doesn't help you, then one of the "real experts" needs
to look at it :)
Tijnema
Hi again,
Thanks for your reply. I think perhaps I've not been totally clear on my
last e-mail. The directory does exist. If this dir or symlink would not
exist, the code would have outputted "Couldn't create the link". The
fact that is goes well right after the symlink is just created, is
indeed the cause of the stat cache.
But the actual problem is that the symlink is not recognized as a
symlink. It seems to be dereferenced by functions like 'lstat',
'is_link' and 'filetype'. And that isn't supposed to happen.
The problem has probably something to do with my system in combination
with apache/php. So I guess reporting it as a bug won't do, because it
will simply be filed under 'works here'. If anybody has any clue what is
going on here, please let me know. For the record I've updated to CVS
snapshot of May 10, 2007 14:30 GMT, but it didn't work with older
version as well.
Let me give another example, with which I hope I can make the problem
clearer.
Script:
<?
$symlink = '/tmp/link-test';
$target = '/tmp/pear';
if (!file_exists($target)) trigger_error("Target '$target' does not
exist", E_USER_ERROR);
if (file_exists($symlink) && !unlink($symlink)) trigger_error("Could
not delete '$symlink'", E_USER_ERROR);
symlink($target, $symlink);
`clearstatcache()`;
/* This should output 'link' */
echo filetype($symlink), "\n";
/* This should output 'link' */
echo is_link($symlink) ? 'link' : 'not a link', "\n";
/* This should output 'differ' */
echo lstat($symlink) === stat($target) ? 'same' : 'differ';
?>
Expected:
link
link
differ
Actual:
dir
not a link
same
Thanks for any help,
Arnold
Tijnema ! wrote:
<snip>Hi,
I've got a bug with is_link and lstats. Any symlinks not created in the
current session, will not be read. This only occurs in the Apache 2 SAPI
version, not in the CLI version.Script:
<?
$symlink = '/tmp/link-test';
if (file_exists($symlink)) unlink($symlink);
symlink('/tmp/pear', $symlink);
echo (file_exists($symlink) ? is_link($symlink) ? "Correct" :
"ERROR" :
"Couldn't create the link"), "<br/>\n";$symlink = '/tmp/link-persist'; if (!file_exists($symlink)) symlink('/tmp/pear', $symlink); echo (file_exists($symlink) ? is_link($symlink) ? "Correct" :
"ERROR" :
"Couldn't create the link"), "<br/>\n";
?>First run:
Correct
CorrectSecond run:
Correct
ERRORNext runs:
Correct
ERRORI've recently start using the daily snapshots op PHP, but I also
tried it on
version 5.2.1, which shows the same result. It used to work just
fine, so
I'm sure this isn't the expected result. I've recently upgraded from
Ubuntu
Edgy (6.10) to Feisty (7.04), with kernel and apache update, so I
believe
that the problem is related to that.I've straced the process (see attachment), but I can't pinpoint the
problem.
This is a big issue for me, can anyone point me in the right
direction to
find the source of this problem.Thanks,
ArnoldWell, I've also tested this code, and it does work fine. BUT if
/tmp/pear doesn't exists, what i had at first, then file_exists
returns false, because file_exists follows symlinks, and the symlink
pointed to nothing. So if you're sure that $symlink is a link, then it
might be better to check it with is_link.Also, the is_link function is cached, so you might want to add one or
moreclearstatcache()
in your script.I checked your strace also, but it doesn't look like there's a bug.
But I've never studied on the PHP core so....Well, if above doesn't help you, then one of the "real experts" needs
to look at it :)Tijnema
Hi,
I've posted this problem some time ago, but never got a real answer and
it is still bothering me a lot.
My problem is that PHP does not recognize a symlink as a symlink. It
seems to be dereferenced by functions like 'lstat', 'is_link' and
'filetype'. And that isn't supposed to happen.
The bug http://bugs.php.net/bug.php?id=17128 describes my problem
exactly, but is marked as bogus. Well this problem sure isn't bogus for
me. I'm having this problem, since I've updated from Ubuntu Edgy to
Feisty. Before that all worked fine.
Please note that I've not installed PHP from a repository, but I build
the latest CVS version of PHP 5 regularly myself. Also this problem only
occurs in the Apache 2 SAPI, not in the CLI version.
Let me give an example, to make the problem clear.
<?
$symlink = '/tmp/link-test';
$target = '/tmp/pear';
if (!file_exists($target)) trigger_error("Target '$target' does not
exist", E_USER_ERROR);
if (file_exists($symlink) && !unlink($symlink)) trigger_error("Could
not delete '$symlink'", E_USER_ERROR);
symlink($target, $symlink);
`clearstatcache()`;
/* This should output 'link' */
echo filetype($symlink), "\n";
/* This should output 'link' */
echo is_link($symlink) ? 'link' : 'not a link', "\n";
/* This should output 'differ' */
echo lstat($symlink) === stat($target) ? 'same' : 'differ';
?>
Expected:
link
link
differ
Actual:
dir
not a link
same
I understand that if I post this as a bug, it is tested, can't be
reproduced and marked as bogus. Therefore, I could appreciate it if
someone could please point me towards a way to pinpoint the problem.
I've run a strace already, but can't notice anything weird.
Thanks for any help,
Arnold
So, would this be Ubuntu 7.04? I happen to have one of those boxes
sitting here:
5:52pm ubuntu:~> mkdir /tmp/pear
5:52pm ubuntu:~> cat /etc/issue
Ubuntu 7.04 \n \l
5:52pm ubuntu:~> uname -a
Linux ubuntu 2.6.20-15-server #2 SMP Sun Apr 15 07:41:34 UTC 2007 i686
GNU/Linux
5:52pm ubuntu:~> php p
link
link
differ
5:52pm ubuntu:~> l /tmp | grep link
lrwxrwxrwx 1 rasmus rasmus 9 2007-05-23 17:52 link-test -> /tmp/pear/
The 'p' script is just a copy of paste of your script from this message.
-Rasmus
Arnold Daniels wrote:
Hi,
I've posted this problem some time ago, but never got a real answer and
it is still bothering me a lot.My problem is that PHP does not recognize a symlink as a symlink. It
seems to be dereferenced by functions like 'lstat', 'is_link' and
'filetype'. And that isn't supposed to happen.The bug http://bugs.php.net/bug.php?id=17128 describes my problem
exactly, but is marked as bogus. Well this problem sure isn't bogus for
me. I'm having this problem, since I've updated from Ubuntu Edgy to
Feisty. Before that all worked fine.
Please note that I've not installed PHP from a repository, but I build
the latest CVS version of PHP 5 regularly myself. Also this problem only
occurs in the Apache 2 SAPI, not in the CLI version.Let me give an example, to make the problem clear.
<?
$symlink = '/tmp/link-test';
$target = '/tmp/pear';if (!file_exists($target)) trigger_error("Target '$target' does not
exist", E_USER_ERROR);
if (file_exists($symlink) && !unlink($symlink)) trigger_error("Could
not delete '$symlink'", E_USER_ERROR);symlink($target, $symlink);
clearstatcache()
;/* This should output 'link' */
echo filetype($symlink), "\n";/* This should output 'link' */
echo is_link($symlink) ? 'link' : 'not a link', "\n";/* This should output 'differ' */
echo lstat($symlink) === stat($target) ? 'same' : 'differ';
?>Expected:
link
link
differActual:
dir
not a link
same
I understand that if I post this as a bug, it is tested, can't be
reproduced and marked as bogus. Therefore, I could appreciate it if
someone could please point me towards a way to pinpoint the problem.
I've run a strace already, but can't notice anything weird.Thanks for any help,
Arnold
Rasmus Lerdorf wrote:
5:52pm ubuntu:~> php p
I think he said "Also this problem only occurs in the Apache 2 SAPI, not
in the CLI version."
=)
--
Brian Moon
Senior Developer
http://dealnews.com/
It's good to be cheap =)
Brian Moon wrote:
Rasmus Lerdorf wrote:
5:52pm ubuntu:~> php p
I think he said "Also this problem only occurs in the Apache 2 SAPI, not
in the CLI version."
Works fine under Apache1. I don't have Apache2 handy on this box. But
I can't see this being affected by the SAPI in any way other than user
permissions and/or some sort of SELinux restriction. As in, things
external to PHP itself.
So, if someone who knows their way around strace can reproduce this
problem and show me the series of syscalls and their exit status, we can
probably figure out what is happening. I'm about 90% sure this is not a
PHP problem, but rather a system configuration problem.
-Rasmus
I'm getting similar results from a RHEL 4 box we have here, its running
5.2.3-dev.
scott@scarlet [/tmp] # cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
scott@scarlet [~] # uname -a
Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006
i686 i686 i386 GNU/Linux
scott@scarlet [/tmp] # php test.php
dir
not a link
same
strace for the during execution is.
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "dir", 3dir) = 3
write(1, "\n", 1) = 1
write(1, "not a link", 10not a link) = 10
write(1, "\n", 1) = 1
time(NULL) = 1179958429
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "same", 4same) = 4
Scott
Arnold Daniels wrote:
Hi,
I've posted this problem some time ago, but never got a real answer and
it is still bothering me a lot.My problem is that PHP does not recognize a symlink as a symlink. It
seems to be dereferenced by functions like 'lstat', 'is_link' and
'filetype'. And that isn't supposed to happen.The bug http://bugs.php.net/bug.php?id=17128 describes my problem
exactly, but is marked as bogus. Well this problem sure isn't bogus for
me. I'm having this problem, since I've updated from Ubuntu Edgy to
Feisty. Before that all worked fine.
Please note that I've not installed PHP from a repository, but I build
the latest CVS version of PHP 5 regularly myself. Also this problem only
occurs in the Apache 2 SAPI, not in the CLI version.Let me give an example, to make the problem clear.
<?
$symlink = '/tmp/link-test';
$target = '/tmp/pear';if (!file_exists($target)) trigger_error("Target '$target' does not
exist", E_USER_ERROR);
if (file_exists($symlink) && !unlink($symlink)) trigger_error("Could
not delete '$symlink'", E_USER_ERROR);symlink($target, $symlink);
clearstatcache()
;/* This should output 'link' */
echo filetype($symlink), "\n";/* This should output 'link' */
echo is_link($symlink) ? 'link' : 'not a link', "\n";/* This should output 'differ' */
echo lstat($symlink) === stat($target) ? 'same' : 'differ';
?>Expected:
link
link
differActual:
dir
not a link
same
I understand that if I post this as a bug, it is tested, can't be
reproduced and marked as bogus. Therefore, I could appreciate it if
someone could please point me towards a way to pinpoint the problem.
I've run a strace already, but can't notice anything weird.Thanks for any help,
Arnold
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6
Scott MacVicar wrote:
I'm getting similar results from a RHEL 4 box we have here, its running
5.2.3-dev.scott@scarlet [/tmp] # cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)scott@scarlet [~] # uname -a
Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006
i686 i686 i386 GNU/Linuxscott@scarlet [/tmp] # php test.php
dir
not a link
samestrace for the during execution is.
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
That means /tmp/link-test exists already, otherwise lstat returns -1.
Here is what I see if the link already exists when I run my script:
access("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6
So did you leave out those access() calls, and did they fail, or did the
unlink()
fail perhaps?
-Rasmus
Miscopied, a full strace is:
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
time(NULL) = 1179959483
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
unlink("/tmp/link-test") = 0
time(NULL) = 1179959483
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff2137c) = -1 ENOENT (No such file or
directory)
time(NULL) = 1179959483
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
time(NULL) = 1179959483
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "dir", 3dir) = 3
write(1, "\n", 1
) = 1
write(1, "not a link", 10not a link) = 10
write(1, "\n", 1
) = 1
time(NULL) = 1179959483
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "same", 4same) = 4
SELinux is disabled on the box.
Scott
Rasmus Lerdorf wrote:
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6Scott MacVicar wrote:
I'm getting similar results from a RHEL 4 box we have here, its running
5.2.3-dev.scott@scarlet [/tmp] # cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)scott@scarlet [~] # uname -a
Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006
i686 i686 i386 GNU/Linuxscott@scarlet [/tmp] # php test.php
dir
not a link
samestrace for the during execution is.
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0That means /tmp/link-test exists already, otherwise lstat returns -1.
Here is what I see if the link already exists when I run my script:access("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6So did you leave out those access() calls, and did they fail, or did the
unlink()
fail perhaps?-Rasmus
Works as expected on my Mac (no strace on my Mac). On my Gentoo 64-bit
server, I get the wrong data from Apache2 and CLI. On my 32-bit
Gentoo server, without Apache 2, I get the correct answer from apache
and cli. On my 32-bit Gentoo server with Apache 2 I get a wrong answer
from Apache and cli.
We build our PHP on these servers with the same options via emerge. The
only difference is Apache 2. What the hell?
uname -a
Linux proxy1 2.6.18-gentoo-r6 #1 SMP Thu Feb 8 07:32:31 EST 2007 x86_64
Dual-Core AMD Opteron(tm) Processor 2210 AuthenticAMD GNU/Linux
php foobar.php
dir
not a link
same
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", 0x7fff3f48fb70) = -1 ENOENT (No such file or
directory)
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x2b906b634000
write(1, "dir", 3dir) = 3
write(1, "\n", 1
) = 1
write(1, "not a link", 10not a link) = 10
write(1, "\n", 1
) = 1
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "same", 4same) = 4
32-bit Gentoo however acts as expected.
$ uname -a
Linux deadpool 2.6.11-gentoo-r6 #1 SMP Thu Apr 14 07:52:09 EDT 2005 i686
Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linux
php test.php
link
link
differ
access("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
time(NULL) = 1179959743
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0
lstat64("/tmp/link-test", 0xbfff5e4c) = -1 ENOENT (No such file or
directory)
time(NULL) = 1179959743
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
- = 0xb78b1000
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
write(1, "differ", 6differ) = 6
Rasmus Lerdorf wrote:
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6Scott MacVicar wrote:
I'm getting similar results from a RHEL 4 box we have here, its running
5.2.3-dev.scott@scarlet [/tmp] # cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)scott@scarlet [~] # uname -a
Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006
i686 i686 i386 GNU/Linuxscott@scarlet [/tmp] # php test.php
dir
not a link
samestrace for the during execution is.
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0That means /tmp/link-test exists already, otherwise lstat returns -1.
Here is what I see if the link already exists when I run my script:access("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6So did you leave out those access() calls, and did they fail, or did the
unlink()
fail perhaps?-Rasmus
--
Brian Moon
Senior Developer
http://dealnews.com/
It's good to be cheap =)
Which filesystems is /tmp on on the various boxes? tmpfs related perhaps?
-Rasmus
Brian Moon wrote:
Works as expected on my Mac (no strace on my Mac). On my Gentoo 64-bit
server, I get the wrong data from Apache2 and CLI. On my 32-bit Gentoo
server, without Apache 2, I get the correct answer from apache and cli.
On my 32-bit Gentoo server with Apache 2 I get a wrong answer from
Apache and cli.We build our PHP on these servers with the same options via emerge. The
only difference is Apache 2. What the hell?uname -a
Linux proxy1 2.6.18-gentoo-r6 #1 SMP Thu Feb 8 07:32:31 EST 2007 x86_64
Dual-Core AMD Opteron(tm) Processor 2210 AuthenticAMD GNU/Linuxphp foobar.php
dir
not a link
samelstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", 0x7fff3f48fb70) = -1 ENOENT (No such file or
directory)
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x2b906b634000
write(1, "dir", 3dir) = 3
write(1, "\n", 1
) = 1
write(1, "not a link", 10not a link) = 10
write(1, "\n", 1
) = 1
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "same", 4same) = 432-bit Gentoo however acts as expected.
$ uname -a
Linux deadpool 2.6.11-gentoo-r6 #1 SMP Thu Apr 14 07:52:09 EDT 2005 i686
Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linuxphp test.php
link
link
differaccess("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
time(NULL) = 1179959743
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0
lstat64("/tmp/link-test", 0xbfff5e4c) = -1 ENOENT (No such file or
directory)
time(NULL) = 1179959743
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
- = 0xb78b1000
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
write(1, "differ", 6differ) = 6Rasmus Lerdorf wrote:
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6Scott MacVicar wrote:
I'm getting similar results from a RHEL 4 box we have here, its running
5.2.3-dev.scott@scarlet [/tmp] # cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)scott@scarlet [~] # uname -a
Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006
i686 i686 i386 GNU/Linuxscott@scarlet [/tmp] # php test.php
dir
not a link
samestrace for the during execution is.
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0That means /tmp/link-test exists already, otherwise lstat returns -1.
Here is what I see if the link already exists when I run my script:access("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6So did you leave out those access() calls, and did they fail, or did the
unlink()
fail perhaps?-Rasmus
Rasmus Lerdorf wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related perhaps?
On all my systems, /tmp is just part of / which is ReiserFS.
--
Brian Moon
Senior Developer
http://dealnews.com/
It's good to be cheap =)
Hi,
Sorry I didn't react sooner. I was out of the office.
I'm running ReiserFS as well.
arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.20-15-generic/volatile type tmpfs (rw)
/dev/sda5 on /home type reiserfs (rw)
/dev/sda6 on /xen-images type reiserfs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
arnold@arnold-laptop:~$ apache2 -v
Server version: Apache/2.2.3
Server built: Jan 15 2007 18:14:50
If I need to send anything else, please let me know.
Best regards,
Arnold
Brian Moon wrote:
Rasmus Lerdorf wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?On all my systems, /tmp is just part of / which is ReiserFS.
Which filesystems is /tmp on on the various boxes? tmpfs related perhaps?
-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked all
for me, except for msdos&vfat file systems, as they don't support
symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phps
Tijnema
Brian Moon wrote:
Works as expected on my Mac (no strace on my Mac). On my Gentoo 64-bit
server, I get the wrong data from Apache2 and CLI. On my 32-bit Gentoo
server, without Apache 2, I get the correct answer from apache and cli.
On my 32-bit Gentoo server with Apache 2 I get a wrong answer from
Apache and cli.We build our PHP on these servers with the same options via emerge. The
only difference is Apache 2. What the hell?uname -a
Linux proxy1 2.6.18-gentoo-r6 #1 SMP Thu Feb 8 07:32:31 EST 2007 x86_64
Dual-Core AMD Opteron(tm) Processor 2210 AuthenticAMD GNU/Linuxphp foobar.php
dir
not a link
samelstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/tmp/pear", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", 0x7fff3f48fb70) = -1 ENOENT (No such file or
directory)
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-test", "/tmp/pear", 4096) = 9
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x2b906b634000
write(1, "dir", 3dir) = 3
write(1, "\n", 1
) = 1
write(1, "not a link", 10not a link) = 10
write(1, "\n", 1
) = 1
lstat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "same", 4same) = 432-bit Gentoo however acts as expected.
$ uname -a
Linux deadpool 2.6.11-gentoo-r6 #1 SMP Thu Apr 14 07:52:09 EDT 2005 i686
Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linuxphp test.php
link
link
differaccess("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
time(NULL) = 1179959743
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0
lstat64("/tmp/link-test", 0xbfff5e4c) = -1 ENOENT (No such file or
directory)
time(NULL) = 1179959743
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
- = 0xb78b1000
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
write(1, "differ", 6differ) = 6Rasmus Lerdorf wrote:
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6Scott MacVicar wrote:
I'm getting similar results from a RHEL 4 box we have here, its running
5.2.3-dev.scott@scarlet [/tmp] # cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)scott@scarlet [~] # uname -a
Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006
i686 i686 i386 GNU/Linuxscott@scarlet [/tmp] # php test.php
dir
not a link
samestrace for the during execution is.
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0That means /tmp/link-test exists already, otherwise lstat returns -1.
Here is what I see if the link already exists when I run my script:access("/tmp/pear", F_OK) = 0
access("/tmp/link-test", F_OK) = 0
unlink("/tmp/link-test") = 0
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/link-test", 0xbff229ec) = -1 ENOENT (No such file or
directory)
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test") = 0
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
write(1, "link", 4link) = 4
write(1, "\n", 1
) = 1
stat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(1, "differ", 6differ) = 6So did you leave out those access() calls, and did they fail, or did the
unlink()
fail perhaps?-Rasmus
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked all
for me, except for msdos&vfat file systems, as they don't support
symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phps
Mount options then perhaps? There is a "nosymlink" mount option which
would certainly cause this.
-Rasmus
Hi again,
No, the symlinks work fine in the shell and with all other applications.
Also I haven't mounted with any options other than 'notail'. Please have
a look at the e-mail I've send a few hours ago.
arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
.....
Best regards,
Arnold
Rasmus Lerdorf wrote:
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked all
for me, except for msdos&vfat file systems, as they don't support
symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phpsMount options then perhaps? There is a "nosymlink" mount option which
would certainly cause this.-Rasmus
Hi,
how about
gdb php
Regards,
Oliver
Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels:
Hi again,
No, the symlinks work fine in the shell and with all other applications.
Also I haven't mounted with any options other than 'notail'. Please have
a look at the e-mail I've send a few hours ago.arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
.....Best regards,
ArnoldRasmus Lerdorf wrote:
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked all
for me, except for msdos&vfat file systems, as they don't support
symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phpsMount options then perhaps? There is a "nosymlink" mount option which
would certainly cause this.-Rasmus
Hi,
how about
gdb php
Regards,
Oliver
He said that the problem only occured with the Apache 2 SAPI, so the
gdb is for the PHP CLI.
Tijnema
Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels:
Hi again,
No, the symlinks work fine in the shell and with all other applications.
Also I haven't mounted with any options other than 'notail'. Please have
a look at the e-mail I've send a few hours ago.arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
.....Best regards,
ArnoldRasmus Lerdorf wrote:
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked all
for me, except for msdos&vfat file systems, as they don't support
symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phpsMount options then perhaps? There is a "nosymlink" mount option which
would certainly cause this.-Rasmus
Am Freitag, 25. Mai 2007 20:30 schrieben Sie:
He said that the problem only occured with the Apache 2 SAPI, so the
gdb is for the PHP CLI.
You can also use it with apache2 sapi. But then you need to do (Debian)
gdb /usr/sbin/apache2
and then
run -k start
If you set a break to zif_... that should work.
Regards,
Oliver
Tijnema
Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels:
Hi again,
No, the symlinks work fine in the shell and with all other
applications. Also I haven't mounted with any options other than
'notail'. Please have a look at the e-mail I've send a few hours ago.arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
.....Best regards,
ArnoldRasmus Lerdorf wrote:
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked
all for me, except for msdos&vfat file systems, as they don't
support symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phpsMount options then perhaps? There is a "nosymlink" mount option
which would certainly cause this.-Rasmus
Hi again,
I've used strace and after simplifying the test and looking at it more
closely, I did see something strange. The apache process does an lstat,
reads the link and then does an lstat on real file.
Perhaps this was already recognized by others, but I didn't see a
confirmation of this in any of the e-mails. If I need to run gdb please
let me know, though it might be a bit to complicated for me a php
internals newbie (I can make my own simple extensions, but the knowledge
ends there).
<?php
echo getmypid()
;
flush()
;
sleep(10);
/* This should output link */
echo filetype('/tmp/test-php-bug-simple-link'), "\n";
?>
When I run the code in the command line (strace php simple.php 2>
/tmp/php-bug.cli.trace):
....
read(3, "<?php\n echo getmypid()
;\n f"..., 8192) = 153
read(3, "", 4096) = 0
read(3, "", 8192) = 0
close(3) = 0
munmap(0xb7590000, 4096) = 0
write(1, "9469", 4) = 4
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({10, 0}, {10, 0}) = 0
lstat64("/tmp/test-php-bug-simple-link", {st_mode=S_IFLNK|0777,
st_size=19, ...}) = 0
write(1, "link", 4) = 4
write(1, "\n", 1) = 1
close(2) = 0
close(1) = 0
close(0) = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
exit_group(0) = ?
Process 9469 detached
But when I run the same code in Apache (strace -p8753 2>
/tmp/php-bug.apache2.trace):
Process 8753 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
time(NULL) = 1180130951
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=1160, ...}) = 0
lstat64("/tmp/test-php-bug-simple-link", {st_mode=S_IFLNK|0777,
st_size=19, ...}) = 0
readlink("/tmp/test-php-bug-simple-link", "test-php-bug-simple", 4096) = 19
lstat64("/tmp/test-php-bug-simple", {st_mode=S_IFREG|0644, st_size=12,
...}) = 0
lstat64("/tmp/test-php-bug-simple", {st_mode=S_IFREG|0644, st_size=12,
...}) = 0
time(NULL) = 1180130951
stat64("/", {st_mode=S_IFDIR|0755, st_size=600, ...}) = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
writev(22, [{"5\r\n", 3}, {"file\n", 5}, {"\r\n", 2}, {"0\r\n\r\n", 5}],
- = 15
read(22, "", 8000) = 0
write(14, "127.0.0.1 - - [26/May/2007:00:09"..., 181) = 181
gettimeofday({1180130951, 718114}, NULL) = 0
shutdown(22, 1 /* send */) = 0
poll([{fd=22, events=POLLIN, revents=POLLIN|POLLHUP}], 1, 2000) = 1
read(22, "", 512) = 0
close(22) = 0
read(4, 0xbff61af7, 1) = -1 EAGAIN (Resource
temporarily unavailable)
accept(3, <unfinished ...>
Process 8753 detached
Best regards,
Arnold
Oliver Block wrote:
Am Freitag, 25. Mai 2007 20:30 schrieben Sie:
He said that the problem only occured with the Apache 2 SAPI, so the
gdb is for the PHP CLI.You can also use it with apache2 sapi. But then you need to do (Debian)
gdb /usr/sbin/apache2
and then
run -k start
If you set a break to zif_... that should work.
Regards,
Oliver
Tijnema
Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels:
Hi again,
No, the symlinks work fine in the shell and with all other
applications. Also I haven't mounted with any options other than
'notail'. Please have a look at the e-mail I've send a few hours ago.arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
.....Best regards,
ArnoldRasmus Lerdorf wrote:
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs related
perhaps?-Rasmus
Nice idea, but I don't think it's a problem there, I think it's a
configuration problem. I've build my own linux, and so I have all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3 module.
I've split up my USB stick in a few file systems, and they worked
all for me, except for msdos&vfat file systems, as they don't
support symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and source for the test is here:
http://86.86.80.41/fs_test.phpsMount options then perhaps? There is a "nosymlink" mount option
which would certainly cause this.-Rasmus
Hi again,
No, the symlinks work fine in the shell and with all other applications.
Also I haven't mounted with any options other than 'notail'. Please have a
look at the e-mail I've send a few hours ago.arnold@arnold-laptop:~$ mount
/dev/sda3 on / type reiserfs (rw,notail)
.....Best regards,
Arnold
Quite weird, I have mounted with notail too now, just to make sure the
problem isn't there, but I can't reproduce your problem. I also have
Apache 2.2.3, and I tested it with PHP-5.2.3RC1, PHP-5.2.2RC2,
PHP-5.2.1 and an old CVS of PHP6. No problems at all.
Tijnema
Rasmus Lerdorf wrote:
Tijnema wrote:
Which filesystems is /tmp on on the various boxes? tmpfs
related
perhaps?
-Rasmus
Nice idea, but I don't think it's a problem there, I think it's
a
configuration problem. I've build my own linux, and so I have
all
configuration like I want.
I'm running php-5.2.3RC1 as Apache 2.2.3
module.
I've split up my USB stick in a few file systems, and they worked
all
for me, except for msdos&vfat file systems, as they don't
support
symlinks.
Test results here:
http://86.86.80.41/fs_test.php
and
source for the test is here:
http://86.86.80.41/fs_test.phps
Mount options then perhaps? There is a "nosymlink" mount option which
would
certainly cause this.
-Rasmus
2007/5/23, Arnold Daniels info@adaniels.nl:
Expected:
link
link
differ
I get the "expected" result. with apache 2.2.3 and fastcgi in both
5.2.2 and current -dev , /tmp is mounted as a separate directory with
"noatime" on a reiserfs filesystem.