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

Bug#164214: fix it _soon_



On Fri, Jan 17, 2003 at 10:25:56AM +0100, Eduard Bloch wrote:
> --- scripts/update-alternatives.pl	28 Apr 2002 19:34:07 -0000	1.28
> +++ scripts/update-alternatives.pl	17 Jan 2003 09:17:08 -0000
> @@ -309,7 +309,7 @@
>  }
>  
>  if ($mode eq 'remove') {
> -    if ($manual eq "manual" and $state ne "expected") {
> +    if ($manual eq "manual" and $state ne "expected" and (grep(/^$apath$/, @versions))) {
>      	&pr("Removing manually selected alternative - switching to auto mode");
>  	$manual= "auto";
>      }

I suggest 'grep(/^\Q$apath\E$/, @versions)' instead, or, more simply,
'grep {$_ eq $apath} @versions'; otherwise this will break subtly if
$apath contains regex metacharacters.

--- scripts/update-alternatives.pl	28 Apr 2002 19:34:07 -0000	1.28
+++ scripts/update-alternatives.pl	17 Jan 2003 09:17:08 -0000
@@ -309,7 +309,7 @@
 }
 
 if ($mode eq 'remove') {
-    if ($manual eq "manual" and $state ne "expected") {
+    if ($manual eq "manual" and $state ne "expected" and (grep {$_ eq $apath} @versions)) {
     	&pr("Removing manually selected alternative - switching to auto mode");
 	$manual= "auto";
     }

(My modification is untested.)

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: