Package: libconfigfile-perl
Version: 1.1.1
Severity: normal
Tags: patch

Hi Gunnar,

Reading the ConfigFile code i noticed a possible bug. If you use a #
directly after some value, s/[^\\]#.*$//; will also delete the last
character (matched by [^\\]) of the value.  This shouldn't happen 
often, as most people leave some space before a comment, but it could
happen.

The patch is simple, as this is a perfect case for a negative
look-behind:

--- /usr/share/perl5/ConfigFile.pm      2003-10-27 03:55:40.000000000 +0100
+++ ConfigFile.pm       2005-04-10 18:30:02.000000000 +0200
@@ -21,7 +21,7 @@
         chomp;
         next if m/^\s*#/;
         $line = $_;
-        $line =~ s/[^\\]#.*$//;
+        $line =~ s/(?<!\\)#.*$//;
        $line =~ s/\\#/#/g;
         next if $line =~ m/^\s*$/;
         $line =~ s{\$(\w+)}{

[BTW, you should fix the intendation]

TIA,
        Marc


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to