Sfoglia il codice sorgente

Fix perl warning when removing a non diverted file with dpkg-divert

Guillem Jover 19 anni fa
parent
commit
bff40a52e3
3 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 6 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 3 3
      scripts/dpkg-divert.pl

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2007-08-18  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-divert.pl (infol): Check if parameters are defined
+	before using them. Use defined instead of length to check for undef
+	variables.
+
 2007-08-14  Guillem Jover  <guillem@debian.org>
 
 	* lib/parsehelp.c (parseerr): Switch from ternary operator to compose

+ 2 - 0
debian/changelog

@@ -35,6 +35,8 @@ dpkg (1.14.6) UNRELEASED; urgency=low
     to a directory where the existing symlink on-disk points to the
     same place. Closes: #377682
     Thanks to Ian Jackson.
+  * Fix perl warnings:
+    - When removing a non diverted file with dpkg-divert. Closes: #438416
 
   [ Updated scripts translations ]
   * French (Frédéric Bothamy, Christian Perrier).

+ 3 - 3
scripts/dpkg-divert.pl

@@ -217,10 +217,10 @@ if ($mode eq 'add') {
 }
 
 sub infol {
-    return (($_[2] eq ':' ? "local " : length($_[2]) ? "" : "any ").
+    return ((defined($_[2]) ? ($_[2] eq ':' ? "local " : "") : "any ").
             "diversion of $_[0]".
-            (length($_[1]) ? " to $_[1]" : "").
-            (length($_[2]) && $_[2] ne ':' ? " by $_[2]" : ""));
+            (defined($_[1]) ? " to $_[1]" : "").
+            (defined($_[2]) && $_[2] ne ':' ? " by $_[2]" : ""));
 }
 
 sub checkrename {