Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39004 invoked by uid 1010); 10 May 2007 17:17:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38989 invoked from network); 10 May 2007 17:17:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2007 17:17:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=info@adaniels.nl; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=info@adaniels.nl; sender-id=unknown Received-SPF: error (pb1.pair.com: domain adaniels.nl from 82.94.236.173 cause and error) X-PHP-List-Original-Sender: info@adaniels.nl X-Host-Fingerprint: 82.94.236.173 loco.helderhosting.nl Linux 2.5 (sometimes 2.4) (4) Received: from [82.94.236.173] ([82.94.236.173:42505] helo=loco.helderhosting.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/74-20961-1A353464 for ; Thu, 10 May 2007 13:17:22 -0400 Received: from [192.168.1.170] (a80-126-54-132.adsl.xs4all.nl [80.126.54.132]) by loco (Postfix) with ESMTP id 1FB7B1110E7B for ; Thu, 10 May 2007 19:17:18 +0200 (CEST) Message-ID: <4643539E.2000800@adaniels.nl> Date: Thu, 10 May 2007 19:17:18 +0200 User-Agent: Thunderbird 1.5.0.10 (X11/20070403) MIME-Version: 1.0 To: internals@lists.php.net References: <4638E608.2090202@adaniels.nl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] How to find a bug: is_link troubles From: info@adaniels.nl (Arnold Daniels) 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: Expected: link link differ Actual: dir not a link same ------------ Thanks for any help, Arnold Tijnema ! wrote: > On 5/2/07, Arnold Daniels wrote: >> 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"), "
\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"), "
\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 >> > > > 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