Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57564 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60727 invoked from network); 30 Jan 2012 07:42:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2012 07:42:10 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.199.177.89 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.199.177.89 il-mr1.zend.com Received: from [212.199.177.89] ([212.199.177.89:54409] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 30/90-53934-0D9462F4 for ; Mon, 30 Jan 2012 02:42:09 -0500 Received: from il-gw1.zend.com (unknown [10.1.1.22]) by il-mr1.zend.com (Postfix) with ESMTP id 8774F6076C; Mon, 30 Jan 2012 09:40:33 +0200 (IST) Received: from tpl2.home (10.1.10.8) by il-ex2.zend.net (10.1.1.22) with Microsoft SMTP Server id 14.1.255.0; Mon, 30 Jan 2012 09:41:26 +0200 Message-ID: <4F2649CB.1080308@zend.com> Date: Mon, 30 Jan 2012 11:42:03 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Rasmus Lerdorf CC: PHP internals , Stas Malyshev References: <4F247F60.9000707@lerdorf.com> In-Reply-To: <4F247F60.9000707@lerdorf.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.1.10.8] Subject: Re: Symlinks in / don't work From: dmitry@zend.com (Dmitry Stogov) Hi Rasmus, I've reproduced it and will take a deeper look a bit later today. Thanks. Dmitry. On 01/29/2012 03:06 AM, Rasmus Lerdorf wrote: > Hey Dmitry, could you take a look at this one. I think this is mostly > your code and I am a bit lost in the path manipulation that is going on > here. This is bug https://bugs.php.net/51860 and it can be reproduced > from cli like this: > > % cd / > % ln -s / phptest > % echo "OK"> /phpfile > % echo ' /phpinc > > % php /phptest/phpinc > > And you will see that it can't find /phptest/phpfile > > But magically if you run it like this: > > % php phptest/phpinc > > it works fine. > > The problem is that /phptest gets cached without the directory bit set. > And when we read it back from the cache and see it isn't a directory we > obviously don't think it can contain a file. It works in the second case > because of what is probably a secondary bug and that is that it ends up > caching //phptest instead of /phptest. So in that case there is a cache > miss on the include and it doesn't fail. However, if you add a second > include that includes another file from /phptest then the first include > would have caused /phptest to get cached and the second include will > then fail. > > If you do this exact same test from /foo instead of from / then > /foo/phptest which in this case is a symlink to /foo correctly gets > cached with directory=1. > > So somewhere in the while(1) loop logic in tsrm_realpath_r() we fail to > get to the point where we stat / and set the directory bit. > > Obviously if someone else wants to fire up gdb to find the likely > off-by-one error that is causing this, please do. > > -Rasmus