Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1397 invoked by uid 1010); 10 May 2004 09:44:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1373 invoked from network); 10 May 2004 09:44:45 -0000 Received: from unknown (HELO nx.eth.jp) (221.116.84.201) by pb1.pair.com with SMTP; 10 May 2004 09:44:45 -0000 Received: by nx.eth.jp (Postfix, from userid 1003) id B69E0BE4059; Mon, 10 May 2004 18:44:44 +0900 (JST) Received: from P398 (nx [127.0.0.1]) by nx.eth.jp (Postfix) with SMTP id A01D6BE404A; Mon, 10 May 2004 18:44:43 +0900 (JST) Date: Mon, 10 May 2004 18:44:43 +0900 To: Rasmus Lerdorf Cc: "BUSTARRET, Jean-Francois" , Sterling Hughes , internals@lists.php.net In-Reply-To: References: <30884B45CCC6714B800F6F294BEC0A9901D98718@MSGEXS11.tf1.groupetf1.fr> X-Mailer: Datula version 1.51.09 for Windows Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------=_1084182283.58C.610" Message-ID: <20040510094443.A01D6BE404A@nx.eth.jp> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.6 Subject: Re: [PHP-DEV] [PATCH] suppressing realpath() with APC + tiny patches From: fujimoto@php.net (Masaki fujimoto) --------=_1084182283.58C.610 Content-Type: text/plain; charset=US-ASCII Hello, All of your point is acceptable for me, too. Of cource I do not think APC has something to do with realpath calls, and as I wrote in another mail, APC is just a way to make skipping realpath() calls more easy (to be exact, it's the way to suppress realpath() only once for each script through all the process. So this patch can identify the same script in different path). I tried some other ways to skip realpath (like realpath caching), and then concluded that my previous patch was the simplest, smallest, and most effective one. Anyway, I think Andi's realpath cache which mentioned in another mail will be the great help of most of people, and I'm happy if it'll be committed in php-src (of course I'm happier if I can commit my patch, too:), but if you want to enhance your PHP more (especially in PHP 4, which will not have realpath cache), and if you could arbitrarily build your PHP, I believe my patch should be the great help, too. Finally, an attacehd patch will prevent your crash, but if you already turned all the realpath calls off, my patch will not affect any performance... Masaki Fujimoto The Message From Rasmus Lerdorf: > On Fri, 7 May 2004, BUSTARRET, Jean-Francois wrote: > > Let's get rid of this useless (when using a cache) realpath call, without having to migrate to PHP5 ! > > Well, the realpath call's usefulness doesn't have anything to do with the > cache. It is there to provide a canonicalized absolute pathname to be > stored in the included_files list and on every include another realpath is > done to check against this list. This means that if the same file is > included via different paths, the include_once/require_once will still > catch that fact. > > Now, I do agree with you that the cost for this convenience is way too > high which is why I turn this off for my use and tell people they get what > they deserve if they include the same file via different paths. Of > course, turning this off also messes up any open_basedir checks as it > becomes trivial to work around an open_basedir restriction with a symlink > or some creative path walking. > > I did try your patch and it crashed my build. Granted, my tree is quite > hacked up and doesn't ever call realpath, but still. Haven't had time to > track down exactly why it caused problems. > > -Rasmus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php --------=_1084182283.58C.610 Content-Type: text/plain; charset=US-ASCII; name="apc-2.0.3-delayed-fopen.patch.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="apc-2.0.3-delayed-fopen.patch.txt" diff -ru APC-2.0.3.bak/apc_main.c APC-2.0.3/apc_main.c --- APC-2.0.3.bak/apc_main.c=09Fri Mar 26 03:53:43 2004 +++ APC-2.0.3/apc_main.c=09Thu May 6 20:10:12 2004 @@ -166,6 +166,11 @@ /* search for the file in the cache */ cache_entry =3D apc_cache_find(APCG(cache), key); if (cache_entry !=3D NULL) { +#if DELAYED_FOPEN + if (h->opened_path =3D=3D NULL && cache_entry->filename) { + h->opened_path =3D estrdup(cache_entry->filename); + } +#endif /* DELAYED_FOPEN */ zend_llist_add_element(&CG(open_files), h); /* XXX kludge */ apc_stack_push(APCG(cache_stack), cache_entry); return cached_compile(TSRMLS_C); --------=_1084182283.58C.610--