Ticket #173 (reopened defect)

Opened 2 years ago

Last modified 1 month ago

eaccelerator.filter not working correctly

Reported by: oliver Assigned to: bart
Priority: minor Milestone: 0.9.6
Component: eAccelerator Version: 0.9.5
Keywords: filter Cc:

Description

Have spent about an hour trying various combinations of filters and really can't work out what is going on.

eg:

eaccelerator.filter="/usr/local/www/example.com*  /usr/local/share/pear*"

will cache most (but not all!!) scripts under /usr/local/www/example.com and nothing under /usr/local/share/pear.

also

eaccelerator.filter="!/usr/local/share/pear*" 

will not exclude the files under /usr/local/share/pear as it should.

Sorry if I am missing something obvious. I have a hunch that it might have something to do with capitals (or other certain characters) in the file name?

Attachments

eaccelerator-0.9.5.2-filtercheck.patch (2.4 kB) - added by norganna on 03/28/08 13:52:42.
I've just had to fix this for my company's website, and thought I'd just provide the patch here for you guys who use linux and want it working on a non-development version. The attached patch may work on other versions of unix, probably not on windows however. YMMV, Use at your own risk, etc.

Change History

09/14/06 15:38:34 changed by oliver@realtsp.com

forgot to give details (duh):

eAccelerator 0.9.5-rc1 [shm:mmap_anon sem:spinlock]

PHP 5.1.6 [ZE 2.1.0] Using apache2handler on FreeBSD servername 6.1-RELEASE-p3 FreeBSD 6.1-RELEASE-p3 #2: Wed Sep 13 14:56:33 BST 2006 root@servername:/usr/src/sys/amd64/compile/SERVER amd64

This server has 2 dual core opterons in it.

09/14/06 15:43:00 changed by oliver@realtsp.com

I saw that some bugs in the filter were resolved in r209, but since I am using 0.95-RC1, which appears to have been tagged at r243, I should already have those yes?

09/15/06 07:47:56 changed by oliver

  • component changed from Control panel to eAccelerator.

09/15/06 12:56:08 changed by bart

Yeah, you should have those. But the filter performs really bad.

10/06/06 18:13:51 changed by tomlove

In eaccelerator.c, eaccelerator_compile_file(),

eaccelerator_ok_to_cache(realname TSRMLS_CC);

changed to

eaccelerator_ok_to_cache(file_handle->filename TSRMLS_CC);

And broke it. Looks simple enough to fix.

10/06/06 18:46:47 changed by tomlove

Never mind I guess it's more like around line 1408 it needs ok_to_cache there.

10/06/06 20:07:55 changed by tomlove

Oh, and for me using file_handle->opened_path works better than file_handle->filename

Sorry about the spam :)

11/08/06 13:15:40 changed by bart

  • milestone changed from 0.9.5 to 0.9.6.

02/15/07 17:51:41 changed by bart

I kicked out the old filter implementation and I'm using fnmatch, for now this breaks windows support. Before 0.9.6 this should be fixed (I should start looking for someone whom windows machine I can hijackt to fix this). The plan is to use a bsd-licensed implementation when the platform doesn't have a fnmatch implementation.

02/15/07 17:52:16 changed by bart

Btw, this is in rev [299]

08/19/07 19:49:33 changed by bart

  • priority changed from major to no-response.
  • status changed from new to closed.
  • resolution set to fixed.

No reaction by the reporter so I'm going to close this one and assume it's fixed.

08/22/07 18:32:11 changed by G Mawr

  • status changed from closed to reopened.
  • resolution deleted.

I'm using eAccelerator 0.9.5.1 on a SUSE Linux 10, with Apache 2.0.54, PHP 5.0.4.

This is does not appear to be fixed. AFAICT, only the first pattern in eaccelerator.filter is taken into account.

As noted by a previous poster, some things don't work as they are described in the documentation. Briefly, this seems to be the case:

"/path/one* /path/two*" only first path seems to be taken into account "!/path*" doesn't seem to work at all "!*.php" works

08/22/07 18:40:42 changed by bart

I didn't say it was fixed in 0.9.5.1, it's fixed in the development version. These fixes will be in 0.9.6 NOT 0.9.5.1!

08/23/07 12:30:58 changed by G Mawr

Sorry - I misunderstood.

I'm not sure if this would be included in the latest snapshot, so I tried 0.9.6-svn327-dev, but I get similar results.

eaccelerator.filter = "!/usr/share/php5/PEAR/symfony*"

I see these cached files:

1. /usr/share/php5/PEAR/symfony/vendor/creole/Creole.php

2. /usr/share/php5/PEAR/symfony/vendor/creole/SQLException.php

3. /usr/share/php5/PEAR/symfony/vendor/creole/Connection.php

4. /usr/share/php5/PEAR/symfony/vendor/creole/ResultsSet.php

eaccelerator.filter = "!/usr/share/php5/PEAR/symfony* !/usr/share/php5/PEAR/symfony/vendor/creole*"

Has the same results.

I also tried checking out the trunk, but make falls over. Please note that I do realise that I can't expect the trunk to be stable.

08/29/07 18:48:29 changed by vollans

I'm seeing the same thing here with FC4. I was using a filter

eaccelerator.filter = "!/var/www/vhosts/thepoultrykeeper.co.uk/subdomains/forums/httpdocs/cache/sql !*.inc *.php"

And .inc's and the SQL cache directory is being cached.

03/28/08 13:52:42 changed by norganna

  • attachment eaccelerator-0.9.5.2-filtercheck.patch added.

I've just had to fix this for my company's website, and thought I'd just provide the patch here for you guys who use linux and want it working on a non-development version. The attached patch may work on other versions of unix, probably not on windows however. YMMV, Use at your own risk, etc.

03/28/08 14:02:53 changed by norganna

The above attached patch makes 0.9.5.2 behave as specified in the documentation under (at least) Centos 5.1.

By this, I mean that it uses the absolute canonical file path to make a match against, '*' will cross direcory boundaries (so /home* would match anything in home or any subdirectory thereof, and *.php matches any php file in any folder), slashes are not escaped.

One extra thing included in this patch is all patterns are case-insensitive, if this is not desirable for you, remove the FNM_CASEFOLD option from the 2 fnmatch() calls.

Enjoy!

06/04/08 23:50:45 changed by ssevennm

Just a note for people attempting to use norganna's patch on Mac OS X who may be getting a segfault in httpd when using eA with mod_php...

I had to change this:

 char *rpath

to:

 char rpath[MAXPATHLEN];

and this:

 rpath = realpath(file_handle->filename, NULL);

to:

 realpath(file_handle->filename, rpath);

06/05/08 00:24:58 changed by ssevennm

I guess technically this:

 rpath = realpath(file_handle->filename, NULL); 
 if (!rpath) {

should be:

 if (!realpath(file_handle->filename, rpath)) {

...but since rpath contains filename when realpath() returns NULL on OS X (as opposed to undefined as on some systems) then the change in the previous comment works though the change in this comment is a better general solution as the pointer returned in either case is NULL when the filename can't be resolved.

06/05/08 00:27:33 changed by ssevennm

  • priority changed from no-response to minor.