From: Guillem Jover Date: Sat, 18 Aug 2007 00:52:08 +0000 (+0300) Subject: Fix perl warning when removing a non diverted file with dpkg-divert X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bff40a52e3efa6f47e9217ab435055edd2cff503;p=dpkg Fix perl warning when removing a non diverted file with dpkg-divert --- diff --git a/ChangeLog b/ChangeLog index 85c6880f..929cf303 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-08-18 Guillem Jover + + * 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 * lib/parsehelp.c (parseerr): Switch from ternary operator to compose diff --git a/debian/changelog b/debian/changelog index 386c16cf..2a6c25c2 100644 --- a/debian/changelog +++ b/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). diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl index 253209ef..88c3f7d5 100755 --- a/scripts/dpkg-divert.pl +++ b/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 {