[Mageia-dev] alternatives policy

Anssi Hannula anssi at mageia.org
Wed Apr 11 03:18:42 CEST 2012


11.04.2012 04:15, Anssi Hannula kirjoitti:
> 11.04.2012 03:13, Maarten Vanraes kirjoitti:
>> Hi,
>>
>> from a question someone asked, i was reminded why an alternative file ( 
>> /var/lib/rpm/alternative/gl_conf ) was not owned.
>>
>> I found out that alternative files are usually %ghost 'ed, but it seems not in 
>> this case.
>>
>> I looked at the alternatives policy, but it was empty as it needs yet to be 
>> written.
>>
>> so, is it true that alternative files should be %ghost 'ed? or not?
> 
> /var/lib/rpm/alternatives/foo is not an "alternative file" (at least not
> IMHO), but an internal update-alternaties db, so it is not ghosted.
> 
> It is automatically removed by update-alternatives when it becomes empty
> (i.e. all packages providing the alternative have been removed).
> 
> There is one problem regarding this, though. If the files becomes
> corrupted, the alternatives system becomes kind of stuck... IMO it
> should zero/drop the /var/lib/rpm/alternatives/foo on error (possibly
> with a backup). AFAICS this would mean changing the badfmt() error
> handler in /usr/sbin/update-alternatives to remove/move the file and
> changing the open(AF, "$admindir/$name") loop starting in line 135 to
> handle errors gracefully...

Sorry, I changed my mind while writing the above paragraph so it got a
bit confused. I meant that in case of syntax error, a warning is printed
out (and possibly a backup of the file made) instead of aborting like
the script currently does (no zeroing/dropping the file necessary). The
old file will be overwritten later in the script when the configuration
is written back.

-- 
Anssi Hannula


More information about the Mageia-dev mailing list