LWN.net Logo

Various notes on /usr unification

Various notes on /usr unification

Posted Feb 28, 2012 13:06 UTC (Tue) by khim (subscriber, #9252)
In reply to: Various notes on /usr unification by Sho
Parent article: Various notes on /usr unification

"Being replaced while running" is a scenario very few projects test for.

Every rule has an exception. Google Chrome (and Chromium) are quite explicitly developed for such usage. Of course "silent upgrades" are their core design decision thus they have to support them. Other projects... are less forgiving. Our Linux support team likes to push upgrades every time you connect [loaned] laptop to a corp network. Firefox often becomes unusable as a result :-( Usually restart fixes it, but once or twice (in last five years) it corrupted profile beyond repair.


(Log in to post comments)

Various notes on /usr unification

Posted Feb 28, 2012 13:25 UTC (Tue) by Sho (subscriber, #8956) [Link]

One large contingent of software that potentially has problems with in-place upgrades is any KDE application. This is only very, very rarely a real problem in practice, though, so there's no reason to panic. Still, it's good to be aware of it:

Basically, when code evolves, the format of its configuration file will sometimes change. One way to handle existing user config files using the old format is to retain support for reading the old format, and then write out the new format later, and that's indeed what apps often do. However, the KDE platform also contains an alternate mechanism called "kconf_update". With kconf_update, the application developer supplies scripts that will be run to transform a config file from one format into another (either in a simple DSL or something free-form specifying the interpreter), and a section in the config file is used to keep track of what scripts have already been run.

The problem lies in the "will be run" part. KDE sessions run a process called kded, the KDE daemon, which plays host to lightweight plugins that perform a variety of tasks, from holding binary caches of things like the app db to disk space warnings, etc. One of those plugins also watches directories for newly-installed kconf_update scripts and runs them immediately as it discovers them.

However, KDE apps also tend to flush their config out to disk while quitting.

You can see where this goes:
1. The package manager installs a new version of $app that ships a kconf_update script while the user is logged into KDE and has $app running.
2. The kconf_update plugin in kded notices the new script and runs it, reformatting $app's config file.
3. The user quits the currently-running old version, which flushes its config out to disk as it shuts down, potentially overwriting changes made by the script.
4. The user now runs the new version which may now run into problems reading its config file.

The reason this is very rarely a problem in practice is because config file format changes are rare to begin with, and the changes that do happen often include changing of the config key names, so the number of actual conflicts that occur is very low. But it's a possibility.

And yes, this is definitely a case of bad design.

Various notes on /usr unification

Posted Feb 29, 2012 11:53 UTC (Wed) by Lennie (subscriber, #49641) [Link]

I would change the path of the config file and only look at the new path first in the newer version of the program.

Because otherwise things will just go wrong.

Especially if you have several machines with /home on NFS or whatever which don't get upgraded at the exact same time.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds