Browse Source

Dpkg::Deps::parse(): parse properly an empty dep with spaces only

Leading and trailing spaces were not stripped and when no further parsing
was done (because there's no valid dependency to parse) it was improperly
erroring out.
Raphael Hertzog 17 years ago
parent
commit
fee30cd37c
2 changed files with 6 additions and 0 deletions
  1. 2 0
      debian/changelog
  2. 4 0
      scripts/Dpkg/Deps.pm

+ 2 - 0
debian/changelog

@@ -53,6 +53,8 @@ dpkg (1.15.1) UNRELEASED; urgency=low
   * Fix dpkg-source to not die when uncompressor processes are killed by
   * Fix dpkg-source to not die when uncompressor processes are killed by
     SIGPIPE due to tar closing the pipe without exhausting all the data
     SIGPIPE due to tar closing the pipe without exhausting all the data
     available. Closes: #523329
     available. Closes: #523329
+  * dpkg-gencontrol now handles properly (empty) dependencies which contain
+    only spaces. Closes: #522787
 
 
   [ Guillem Jover ]
   [ Guillem Jover ]
   * Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082
   * Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082

+ 4 - 0
scripts/Dpkg/Deps.pm

@@ -304,6 +304,10 @@ sub parse {
     $options{host_arch} = get_host_arch() if not exists $options{host_arch};
     $options{host_arch} = get_host_arch() if not exists $options{host_arch};
     $options{union} = 0 if not exists $options{union};
     $options{union} = 0 if not exists $options{union};
 
 
+    # Strip trailing/leading spaces
+    $dep_line =~ s/^\s+//;
+    $dep_line =~ s/\s+$//;
+
     my @dep_list;
     my @dep_list;
     foreach my $dep_and (split(/\s*,\s*/m, $dep_line)) {
     foreach my $dep_and (split(/\s*,\s*/m, $dep_line)) {
         my @or_list = ();
         my @or_list = ();