Donate Share June 2004: Project of the Month

AWStats

Tracker: Bugs

5 bad case for ENV expansion in awstats.conf - ID: 812681
Last Update: Comment added ( eldy )

The line:
while ($value =~ /__(\w+)__/) {
makes it impossible to use:
LogFile="/var/log/httpd/__SERVER_NAME___access.log"
which is a requirement of my environment, where other
scripts are based on www.domain.com_access.log and
_error.log files. The pattern match returns
"/var/log/httpd/access.log" as "SERVER_NAME_" is not
defined.

I have replaced the line with:
while ($value =~ /__(\w+[^_])__/) {
which looks for only __SERVER_NAME__, freeing any
remaining underscores to be taken literally.
(Actually, If I did something more like [^_]*, you
would be able to use __VAR1____VAR2__, which I doubt
would work with the current expression.)

Support for litterals "__SERVER_NAME__\_access.log"
would be nice, but that could be a pain for C:\\WINDOWS
users..

This patch will hinder ones ability to use a variable
named VARIABLE_, but I doubt that anyone has this need.


Marques Johansson ( displague ) - 2003-09-25 20:01

5

Closed

Fixed

Laurent Destailleur (Eldy)

Other

None

Public


Comments ( 3 )

Date: 2004-01-13 15:36
Sender: eldySourceForge.net DonorProject AdminAccepting Donations

Logged In: YES
user_id=96898

Bug added or fixed in last release.


Date: 2003-09-27 11:35
Sender: eldySourceForge.net DonorProject AdminAccepting Donations

Logged In: YES
user_id=96898

Added/Fixed in CVS tree. Will be available in next version.



Date: 2003-09-27 11:35
Sender: eldySourceForge.net DonorProject AdminAccepting Donations

Logged In: YES
user_id=96898

Correct fix is:
while ($value =~ /__([^\s_]+(?:_[^\s_]+)*)__/) {
That is able to process line like
__VAR_1____VAR_2__
and also
/var/log/httpd/__SERVER_NAME___access.log


Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2004-01-13 15:36 eldy
close_date - 2004-01-13 15:36 eldy
resolution_id None 2003-09-27 11:35 eldy
assigned_to nobody 2003-09-27 11:35 eldy