Просмотр исходного кода

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
Родитель
Сommit
fee30cd37c
2 измененных файлов с 6 добавлено и 0 удалено
  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
     SIGPIPE due to tar closing the pipe without exhausting all the data
     available. Closes: #523329
+  * dpkg-gencontrol now handles properly (empty) dependencies which contain
+    only spaces. Closes: #522787
 
   [ Guillem Jover ]
   * 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{union} = 0 if not exists $options{union};
 
+    # Strip trailing/leading spaces
+    $dep_line =~ s/^\s+//;
+    $dep_line =~ s/\s+$//;
+
     my @dep_list;
     foreach my $dep_and (split(/\s*,\s*/m, $dep_line)) {
         my @or_list = ();