Bug#714427: Regex special characters need escaping in dbg-package-missing-depends test
Control: tags -1 confirmed
On 2013-06-29 07:08, Mattias Ellert wrote:
> Package: lintian
> Version: 2.5.13
> Severity: normal
>
> The dbg-package-missing-depends test is broken for packages that contain
> characters that have special meaning in regular expressions. Of the
> characters that have special meaning in regular expressions, the full
> stop (.) and the plus sign (+) are allowed in package names. These must
> be escaped when the regular expression in the lintian test is created.
>
> Proposed patch attached.
>
Hi,
Thanks for the bug report. That indeed looks like it is a mistake.
>
> lintian-dbg-regex.patch
>
>
> --- /usr/share/lintian/checks/fields.orig 2013-05-19 23:35:42.000000000 +0200
> +++ /usr/share/lintian/checks/fields 2013-06-29 06:53:02.578878761 +0200
> @@ -921,6 +921,7 @@
> }
> }
> my $dstr = join ('|', @arch_dep_pkgs);
> + $dstr =~ s/([.+])/\\$1/g;
Perl has a built-in called "quotemeta" that does this escaping for us,
which can be used with something like:
my $dstr = join ('|', map { quotemeta($_) } @arch_dep_pkgs);
> my $depregex = qr/^(?:$dstr)$/;
> foreach (@dbg_pkgs) {
> my $deps = Lintian::Relation->and ($info->binary_relation ($_, 'pre-depends'),
>
~Niels
Reply to: