Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29706 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82456 invoked by uid 1010); 23 May 2007 22:15:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82441 invoked from network); 23 May 2007 22:15:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2007 22:15:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=scott@macvicar.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=scott@macvicar.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain macvicar.net from 72.36.186.210 cause and error) X-PHP-List-Original-Sender: scott@macvicar.net X-Host-Fingerprint: 72.36.186.210 midden.org.uk Received: from [72.36.186.210] ([72.36.186.210:52277] helo=lovelace.midden.org.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/44-52937-C1DB4564 for ; Wed, 23 May 2007 18:15:58 -0400 Received: from macvicar.demon.co.uk ([80.177.111.173] helo=[192.168.1.101]) by lovelace.midden.org.uk with esmtp (Exim 4.63) (envelope-from ) id 1Hqz7Z-000716-9C; Wed, 23 May 2007 23:15:53 +0100 Message-ID: <4654BD0A.60903@macvicar.net> Date: Wed, 23 May 2007 23:15:38 +0100 User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: Arnold Daniels CC: internals@lists.php.net References: <4638E608.2090202@adaniels.nl> <4654A616.7050302@adaniels.nl> In-Reply-To: <4654A616.7050302@adaniels.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Still having lstat trouble From: scott@macvicar.net (Scott MacVicar) 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 > 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