www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rodrigo campos <camp...@uol.com.br>
Subject mod_rewrite/9686: faulty perl script
Date Fri, 01 Feb 2002 18:49:04 GMT

>Number:         9686
>Category:       mod_rewrite
>Synopsis:       faulty perl script
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Feb 01 10:50:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     camposr@uol.com.br
>Release:        1.3.x
>Organization:
apache
>Environment:
apache site
>Description:
The perl script used to generate an ndbm file listed as an example at mod_rewrite documentation
page does not treat comment and 'all space' correctly lines due to the fact that the s metacharacter
is not escaped

the use of dbmopen is deprecated

dbmopen does not regenerate all records, creating an "always append" condition
>How-To-Repeat:
look at http://httpd.apache.org/docs/mod/mod_rewrite.html
right after the RewriteMap directive
>Fix:

#!/path/to/bin/perl
##
##  txt2dbm -- convert txt map to dbm format
##

use NDBM_File;
use Fcntl;


($txtmap, $dbmmap) = @ARGV;
open(TXT, "<$txtmap");
tie (%DB, 'NDBM_File', $dbmmap,O_RDWR|O_TRUNC|O_CREAT, 0644);
while (<TXT>) {
    next if (m|^\s*#.*| or m|^\s*$|);
    $DB{$1} = $2 if (m|^\s*(\S+)\s+(\S+)$|);
}
untie %DB;
close(TXT)
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
 
 


Mime
View raw message