Rewriting update-alternatives in C

Among the goals listed in dpkg’s roadmap, there’s the C rewrite of the remaining perl scripts provided by the dpkg binary package (dpkg-dev is not concerned, it will remain a collection of perl scripts). Of the remaining scripts, update-alternatives was the largest piece of code (~1100 lines of perl) and I started converting it to C a few weeks ago (based on preliminary work of Guillem). It’s now 2200 lines of C…

Thanks to the relatively extensive test-suite that I wrote last year, I’m relatively confident that this new update-alternatives won’t break your system. That said, it still needs some real-life usage to ensure everything is really ok (and users actively trying to break it are even better). Thus I would be glad if you could try it out ( binary package for i386 or .dsc) and report back to

The rewrite of the 2 other remaining scripts is almost completed in a branch of Guillem. Hopefully this can be our last project completed in time for Squeeze as far as dpkg goes. It would be a great achievement for people that would like to use dpkg in embedded environments and avoid perl due to its size.

Note: nobody sponsored that work. But it’s not too late 🙂


  1. funktree says

    hey, why don’t switch to haskell? it can describe complex operations and dataflows very succinctly, and it compiles to native code. a suggestion.

  2. says

    @funktree: first the rewrite is already done so I won’t redo it a second time. Then I never used haskell and dpkg is only C+perl+sh and I don’t see a good reason to introduce another language in the mix.

  3. Ewoud Kohl van Wijngaarden says

    Your dpkg roadmap link is broken. The M in roadmap should be uppercase as well.