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

Re: update-alternatives switching from manual to auto

Le 2000-07-26 21:26:28 -0700, Brian F. Kimball écrivait :
> [ I sent a similar message to 54933@bugs.debian.org but it got bounced
>   and is now wallowing in the BTS junk.  At least that gave me a second
>   chance to go into more detail in this message... ]

The correct current bug to send this message to would be #65129.
(This is the currently open bug regarding this issue).

> 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 !

> 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. 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.

Jean-Philippe Guérard

Reply to: