#658702 libxml-sax-perl: update-perl-sax-parsers sometimes fails when called from old-prerm during squeeze->wheezy update

#658702#5
Date:
2012-02-05 12:37:54 UTC
From:
To:
Hi,

while I analyzed piuparts logs I noticed that sometimes the following
error occurs:

  Preparing to replace libxml-libxml-perl 1.70.ds-1 (using .../libxml-libxml-perl_1.88+dfsg-1+b1_amd64.deb) ...
  Can't locate File/Basename.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/share/perl5/XML/SAX.pm line 15.
  BEGIN failed--compilation aborted at /usr/share/perl5/XML/SAX.pm line 15.
  Compilation failed in require at /usr/bin/update-perl-sax-parsers line 18.
  BEGIN failed--compilation aborted at /usr/bin/update-perl-sax-parsers line 18.
  dpkg: warning: subprocess old pre-removal script returned error exit status 2
  dpkg - trying script from the new package instead ...
  dpkg: ... it looks like that went OK.
  Unpacking replacement libxml-libxml-perl ...

This is not harmful as the installation succeeds, but eventually some
dependencies can be tightened to avoid this problem and noise.

The full log of upgrading libxml-simple-perl to 2.18-3 is attached, I
extracted the perl+xml packages:

  [...]
  Selecting previously unselected package libswitch-perl.
  (Reading database ... 7716 files and directories currently installed.)
  Unpacking libswitch-perl (from .../libswitch-perl_2.16-2_all.deb) ...
  Selecting previously unselected package libclass-isa-perl.
  Unpacking libclass-isa-perl (from .../libclass-isa-perl_0.36-3_all.deb) ...
  Preparing to replace perl-modules 5.10.1-17squeeze2 (using .../perl-modules_5.14.2-6_all.deb) ...
  Unpacking replacement perl-modules ...
  [...]
  Preparing to replace perl 5.10.1-17squeeze2 (using .../perl_5.14.2-6_amd64.deb) ...
  Unpacking replacement perl ...
  Preparing to replace libxml2 2.7.8.dfsg-2+squeeze1 (using .../libxml2_2.7.8.dfsg-5.1_amd64.deb) ...
  Unpacking replacement libxml2 ...
  Preparing to replace libxml-sax-perl 0.96+dfsg-2 (using .../libxml-sax-perl_0.99+dfsg-1_all.deb) ...
  Unpacking replacement libxml-sax-perl ...
  Selecting previously unselected package libxml-sax-base-perl.
  Unpacking libxml-sax-base-perl (from .../libxml-sax-base-perl_1.07-1_all.deb) ...
  [...]
  Preparing to replace libxml-libxml-perl 1.70.ds-1 (using .../libxml-libxml-perl_1.88+dfsg-1+b1_amd64.deb) ...
  Can't locate File/Basename.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/share/perl5/XML/SAX.pm line 15.
  BEGIN failed--compilation aborted at /usr/share/perl5/XML/SAX.pm line 15.
  Compilation failed in require at /usr/bin/update-perl-sax-parsers line 18.
  BEGIN failed--compilation aborted at /usr/bin/update-perl-sax-parsers line 18.
  dpkg: warning: subprocess old pre-removal script returned error exit status 2
  dpkg - trying script from the new package instead ...
  dpkg: ... it looks like that went OK.
  Unpacking replacement libxml-libxml-perl ...
  [...]
  Preparing to replace perl-base 5.10.1-17squeeze2 (using .../perl-base_5.14.2-6_amd64.deb) ...
  Unpacking replacement perl-base ...
  Setting up perl-base (5.14.2-6) ...
  [...]
  Setting up libxml2 (2.7.8.dfsg-5.1) ...
  [...]
  Setting up libswitch-perl (2.16-2) ...
  Setting up perl-modules (5.14.2-6) ...
  Setting up perl (5.14.2-6) ...
  Setting up libxml-sax-base-perl (1.07-1) ...
  Setting up libxml-sax-perl (0.99+dfsg-1) ...
  update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::PurePerl with priority 10...
  update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
  Setting up libxml-libxml-perl (1.88+dfsg-1+b1) ...
  update-perl-sax-parsers: Registering Perl SAX parser XML::LibXML::SAX::Parser with priority 50...
  update-perl-sax-parsers: Registering Perl SAX parser XML::LibXML::SAX with priority 50...
  update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...

Andreas

#658702#10
Date:
2012-02-05 13:23:56 UTC
From:
To:
I don't think it can be fixed by tightening dependencies.

This happens in the 'old-prerm upgrade' phase if perl/perl-modules and
perl-base are out of sync.

Functionality from non-essential packages is not guaranteed to be working
in such a phase. Even a Pre-Depends entry wouldn't help IIRC.

I think the options are

- fix update-perl-sax-parsers to only use modules from perl-base (unlikely?)
- fix update-perl-sax-parsers to fail more gracefully in such a situation
- stop invoking update-perl-sax-parsers in 'old-prerm upgrade'
  * this doesn't help squeeze->wheezy anymore but it would fix the
    issue for future upgrades
  * at least libxml-sax-expat-perl already only invokes the update script
    on removals, not upgrades

I'm not sure if update-perl-sax-parsers is always idempotent, ie. if
an upgrade where "update-perl-sax-parsers --remove" fails but a later
"update-perl-sax-parsers --add" call succees will leave double entries
in ParserDetails.ini. Quick tests do not show any double entries FWIW,
so the "fail more gracefully" option seems possible.

If somebody does implement this, please file a bug against perl afterwards
so we can add a Conflicts or Breaks entry against the old version.
(See #657940 for a related case.)

#658702#19
Date:
2012-08-10 20:06:02 UTC
From:
To:
Hello,

We've just hit that same bug in Ubuntu when preparing for Ubuntu 10.04
to 12.04 upgrades without internet connectivity.

I'm attaching the patch we've applied to workaround/fix that problem.
It's based on a similar change that was done to doc-base a while ago,
basically implementing a local version of dirname.

I have uploaded updated patches to precise-proposed and quantal a few
minutes ago but don't expect any other issue with that package.

#658702#26
Date:
2014-08-18 21:20:03 UTC
From:
To:
This is known and considered just cosmetic unless somebody reports otherwise.
See #658702 and #625771.

I suppose somebody should bite the bullet and apply the Ubuntu changes
in #658702 that remove the need for modules outside of perl-base, even
if that only helps for jessie+1 (not sure about that.)

#658702#31
Date:
2014-08-19 11:41:15 UTC
From:
To:
Maybe a message could be printed:
"If there was some error .... don't worry it was just ....".