Package: libparse-debianchangelog-perl
Version: 1.1.1-2
Severity: important
Hi Frank,
Could you please modify the library so that it doesn't use any of the magic
vars mentioned in the subject?
Attached diff replaces all the uses of $&; I also tried to replace the use of
$POSTMATCH but somehow broke the whole thing.
The following links contain more information on the subject:
* http://search.cpan.org/dist/Devel-SawAmpersand/lib/Devel/SawAmpersand.pm
* perlre
* http://perl.apache.org/docs/1.0/guide/performance.html#Avoid_the_Evil_Troika
Since Parse::DebianChangelog is used by many scripts, including lintian, it
would be great if you could fix this ASAP (and probably provide a backport so
that lenny users take advantage of a faster lintian).
Cheers,
--
Raphael Geissert - Debian Maintainer
www.debian.org - get.debian.net
diff --git a/lib/Parse/DebianChangelog/ChangesFilters.pm b/lib/Parse/DebianChangelog/ChangesFilters.pm
index 8434770..af5268f 100644
--- a/lib/Parse/DebianChangelog/ChangesFilters.pm
+++ b/lib/Parse/DebianChangelog/ChangesFilters.pm
@@ -70,11 +70,11 @@ sub http_ftp_urls {
$text=~ s|<URL:([-\w\.\/:~...@]+):([a-zA-Z0-9\'() ]+)>
|$cgi->a({ -href=>$1 }, $2)
|xego;
- $text=~ s|https?:[\w/\.:\...@+\-~\%\#?=&;,]+[\w/]
- |$cgi->a({ -href=>$& }, $&)
+ $text=~ s|(https?:[\w/\.:\...@+\-~\%\#?=&;,]+[\w/])
+ |$cgi->a({ -href=>$1 }, $1)
|xego;
- $text=~ s|ftp:[\w/\.:\...@+\-~\%\#?=&;,]+[\w/]
- |$cgi->a({ -href=>$& }, $&)
+ $text=~ s|(ftp:[\w/\.:\...@+\-~\%\#?=&;,]+[\w/])
+ |$cgi->a({ -href=>$1 }, $1)
|xego;
return $text;
@@ -83,15 +83,15 @@ sub http_ftp_urls {
sub email_to_ddpo {
my ($text, $cgi) = @_;
- $text =~ s|[a-zA-Z0-9_\+\-\.]+\@([a-zA-Z0-9][\w\.+\-]+\.[a-zA-Z]{2,})
- |$cgi->a({ -href=>"http://qa.debian.org/developer.php?login=$&" }, $&)
+ $text =~ s|([a-zA-Z0-9_\+\-\.]+\@([a-zA-Z0-9][\w\.+\-]+\.[a-zA-Z]{2,}))
+ |$cgi->a({ -href=>"http://qa.debian.org/developer.php?login=$1" }, $1)
|xego;
return $text;
}
sub bugs_to_bts {
- (my $text = $_[0]) =~ s|Closes:\s*(?:Bug)?\#\d+(?:\s*,\s*(?:Bug)?\#\d+)*
- |my $tmp = $&; { no warnings;
+ (my $text = $_[0]) =~ s|(Closes:\s*(?:Bug)?\#\d+(?:\s*,\s*(?:Bug)?\#\d+)*)
+ |my $tmp = $1; { no warnings;
$tmp =~ s@(Bug)?\#(\d+)@<a class="buglink" href="http://bugs.debian.org/$2">$1\#$2</a>@ig; }
"$tmp"
|xiego;
@@ -101,8 +101,8 @@ sub bugs_to_bts {
sub cve_to_mitre {
my ($text, $cgi) = @_;
- $text =~ s!\b(?:CVE|CAN)-\d{4}-\d{4}\b
- !$cgi->a({ -href=>"http://cve.mitre.org/cgi-bin/cvename.cgi?name=$&" }, $&)
+ $text =~ s!(\b(?:CVE|CAN)-\d{4}-\d{4}\b)
+ !$cgi->a({ -href=>"http://cve.mitre.org/cgi-bin/cvename.cgi?name=$1" }, $1)
!xego;
return $text;
}
@@ -129,17 +129,17 @@ sub pseudo_markup {
sub common_licenses {
my ($text, $cgi) = @_;
- $text=~ s|/usr/share/common-licenses/GPL(?:-2)?
- |$cgi->a({ -href=>"http://www.gnu.org/copyleft/gpl.html" }, $&)
+ $text=~ s|(/usr/share/common-licenses/GPL(?:-2)?)
+ |$cgi->a({ -href=>"http://www.gnu.org/copyleft/gpl.html" }, $1)
|xego;
- $text=~ s|/usr/share/common-licenses/LGPL(?:-2(?:\.1)?)?
- |$cgi->a({ -href=>"http://www.gnu.org/copyleft/lgpl.html" }, $&)
+ $text=~ s|(/usr/share/common-licenses/LGPL(?:-2(?:\.1)?)?)
+ |$cgi->a({ -href=>"http://www.gnu.org/copyleft/lgpl.html" }, $1)
|xego;
- $text=~ s|/usr/share/common-licenses/Artistic
- |$cgi->a({ -href=>"http://www.opensource.org/licenses/artistic-license.php" }, $&)
+ $text=~ s|(/usr/share/common-licenses/Artistic)
+ |$cgi->a({ -href=>"http://www.opensource.org/licenses/artistic-license.php" }, $1)
|xego;
- $text=~ s|/usr/share/common-licenses/BSD
- |$cgi->a({ -href=>"http://www.debian.org/misc/bsd.license" }, $&)
+ $text=~ s|(/usr/share/common-licenses/BSD)
+ |$cgi->a({ -href=>"http://www.debian.org/misc/bsd.license" }, $1)
|xego;
return $text;
diff --git a/lib/Parse/DebianChangelog/Util.pm b/lib/Parse/DebianChangelog/Util.pm
index 9086249..2c74d4a 100644
--- a/lib/Parse/DebianChangelog/Util.pm
+++ b/lib/Parse/DebianChangelog/Util.pm
@@ -67,8 +67,8 @@ sub find_closes {
my $changes = shift;
my @closes = ();
- while ($changes && ($changes =~ /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/ig)) {
- push(@closes, $& =~ /\#?\s?(\d+)/g);
+ while ($changes && ($changes =~ /(closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*)/ig)) {
+ push(@closes, $1 =~ /\#?\s?(\d+)/g);
}
@closes = sort { $a <=> $b } @closes;