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

Re: update-alternatives switching from manual to auto



On Mon, Jul 31, 2000 at 09:50:46AM +0000, Jean-Philippe Guérard wrote:
> Le 2000-07-26 21:26:28 -0700, Brian F. Kimball écrivait :
 
> > Hi, on March 6th Wichert wrote about bug #54933...
> > 
> > > Previously Jean-Philippe Guérard wrote:
> > 
> > > > Then, when the alternative that was last selected (when the system
> > > > revert to manual) is removed or renamed, the system stays manual,
> > > > and the program will cease to work.
> > >
> > > This is indeed wrong behaviour. I modified the code to return an
> > > alternative to automatic mode when a manually selected alternative is
> > > removed.
> > 
> > and here's the relevant section of update-alternatives from dpkg 1.6.14,
> > beginning on line 303:
> > 
> > if ($mode eq 'remove') {
> >     if ($manual eq "manual" and $state = "expected") {
> >         &pr("Removing manually selected alternative - switching to auto mode");
> >         $manual= "auto";
> >     }
> > 
> > Shouldn't you be checking if $state = "nonexistant"? And aren't you
> > accidentally changing $state, instead of checking it's value? ( "=" vs.
> > "eq").  I don't know perl though...
> 
> Yes, this is precisely the problem. eq is a test, = is changing
> the value. Replacing "=" by "eq" solve this problem !

Great.
 
> > I tracked this down because a few packages in woody have been annoyingly
> > resetting my manual alternatives to auto mode on each upgrade.  It turns
> > out that they call "update-alternatives --remove ..." in their prerm
> > scripts even if the package is only being upgraded.  I presume replacing
> > "=" with "eq" and "expected" with "nonexistant" in the above section of
> > code would (on the surface) fix that problem.
> 
> It is even worse, removing any alternative, not only the current
> default will switch back to auto mode.
> 
> The test for non-existent link is done around line 237.

Ah.  Someone needs to replace "nonexistant" with "nonexistent" in the
description of the $state variable (line 18).

> This part
> of the code check if the default alternative has been manually
> selected, and, if it is the case, switch back to auto mode.
>
> Which means, if your favorite alternative is the current default,
> it will get changed whenever the default change. You cannot use
> config to make it your default.

Why?  That seems like housekeeping gone overboard.  IMHO an admin's
settings shouldn't be overridden unless they break the alternative.

Cheers,

	Brian



Reply to: