how to fix the annoying Ubuntu/Debian XML::SAX install problems

Debian and its derived distributions have a policy about packages not being able to modify the configuration of other packages. While this might generally seem like a good idea, for the TIMTOWTDI world of Perl, this causes problems.

The problem arises if you have installed Perl XML modules from both CPAN and the Debian (or Ubuntu, or whatever) repositories. Debian’s modifications subtly break the XML::SAX module, on which most Perl XML modules (including the brilliant XML::Simple) depend. If you’ve been naughty and used a module from CPAN, Debian gets its knickers in a knot, and won’t configure or run anything remotely related to libxml-sax-perl.

If you get the error Can’t locate object method “save_parsers_debian” via package “XML::SAX” at /usr/bin/update-perl-sax-parsers line 90, your system is affected. You might get the clue that any of your Perl XML handlers freak out and fail in weird ways.

Here’s a method (there’s always more than one, of course)  to fix it. This was combined from a couple of sources, each of which was on the right track but didn’t entirely work. Actually, the first might’ve been right on the money, but my hiragana’s a bit ropey …

  1. make sure you’ve got your system up to date with apt-get or aptitude.
  2. sudo cpan CPANPLUS (this will ask you lots of questions, to which you should almost always answer with the default)
  3. sudo cpanp -u XML::SAX (this takes quite a while, and produces no output for most of it)
  4. LC_ALL=C sudo apt-get install --reinstall libxml-sax-perl (the LC_ALL=C might not be strictly necessary, but it worked for me)

You must remember never to pretend to be smarter than the Debian maintainers, and suitably chastened, may now return to your normal OpenSSH patching activities …

5 thoughts on “how to fix the annoying Ubuntu/Debian XML::SAX install problems”

  1. Thank you for this… I was starting to go a little bananas with this one! I did have to manually delete the XML::SAX modules before I could get it sorted, but it’s working now 🙂

  2. This fixed the issue, but the fact that it needed to be fixed is really annoying.

    But the thing is, in my awareness that it would be perfectly sensible and feasible to create a module XML::SAX::apt that would inherit everything from XML:SAX and then add in the required method and use THAT instead…

    AND that that is the preferred way to go about things, because modifying your own copy of a CPAN module and using it in preference over the CPAN module in a way that can cause conflicts is shoddy and hackish…

    AND with the way that most of the Debian maintainers have responded to bug reports and so on regarding this issue in a snotty, holier-than-thou way when THEY are the jerkasses not following standards, pretending their way is better than the accepted way of going about things, coining the concept of TOOWTDI (There’s Only Our Way To Do It) and making absurd assertions like “CPAN compatibility would be nice but is not a requirement of this distribution”…

    Then regarding “pretending to be smarter than the Debian maintainers…” — WHO’S PRETENDING?

  3. It was heavy irony there, Dodger – don’t forget it was the Debian maintainers’ ignorance that created the OpenSSL vulnerability debacle

  4. Thank you for the post, i was searching for entire day for this problem and could not able to find any solution but your blog really helped me.

Leave a Reply

Your email address will not be published. Required fields are marked *