[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: L::Relation: Fix "too greedy" regex



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 066430af7c3cd9f96a928747a16991cbc165e71a
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Mar 30 12:07:27 2014 +0200

    L::Relation: Fix "too greedy" regex
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog        |  5 +++++
 lib/Lintian/Relation.pm | 10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d519a8a..166a1a0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,11 @@ lintian (2.5.23) UNRELEASED; urgency=medium
       command-line argument "--packages-from-file", when
       the file was "-".
 
+  * lib/Lintian/Relation.pm:
+    + [JW,NT] Fix dependency-testing issues caused by too
+      greedy regular expressions in the dependency parser.
+      (Closes: #742989)
+
  -- Niels Thykier <niels@thykier.net>  Tue, 25 Mar 2014 22:51:16 +0100
 
 lintian (2.5.22) unstable; urgency=medium
diff --git a/lib/Lintian/Relation.pm b/lib/Lintian/Relation.pm
index 22597c3..690e06a 100644
--- a/lib/Lintian/Relation.pm
+++ b/lib/Lintian/Relation.pm
@@ -107,17 +107,17 @@ sub parse_element {
         (?:                             # start of optional version
          \s* \(                         # open parenthesis for version part
          \s* (<<|<=|=|>=|>>|<|>)        # relation part (3)
-         \s* (.*?)                      # version (4)
+         \s* ([^\)]+)                   # version (4)
          \s* \)                         # closing parenthesis
         )?                              # end of optional version
         (?:                             # start of optional architecture
          \s* \[                         # open bracket for architecture
-         \s* (.*?)                      # architectures (5)
+         \s* ([^\]]+)                   # architectures (5)
          \s* \]                         # closing bracket
         )?                              # end of optional architecture
         (?:                             # start of optional restriction
           \s* <                         # open bracket for restriction
-          \s* (.*?)                     # don't parse restrictions now
+          \s* ([^>,]+)                  # don't parse restrictions now
           \s* >                         # closing bracket
         )?                              # end of optional restriction
     /x;
@@ -215,8 +215,8 @@ Lintian::Relation object is empty (always satisfied).
 sub new_norestriction {
     my ($class, $relation) = @_;
     $relation = '' unless defined($relation);
-    $relation =~ s/\[[^\]]*\]//g;
-    $relation =~ s/<[^>]*>//g;
+    $relation =~ s/\[[^,\]]*\]//g;
+    $relation =~ s/<[^>,]*>//g;
     return $class->new($relation);
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: