[ppa][packaging]libreoffice-base post-rm script syntax fail

Bug #1354557 reported by V字龍(Vdragon)
68
This bug affects 13 people
Affects Status Importance Assigned to Milestone
libreoffice (Ubuntu)
Fix Released
High
Björn Michaelsen

Bug Description

I tried to use LibreOffice test builds and backports PPA and follow it's instructions to purge libreoffice-core then encountered this bug.

Bug will be triggered when this package is been removed. Since it seems to be trivial please fix it ASAP.

## Console output
...
/var/lib/dpkg/info/libreoffice-base.postrm: 28: /var/lib/dpkg/info/libreoffice-base.postrm: Syntax error: end of file unexpected (expecting "fi")
dpkg: error processing package libreoffice-base (--purge):
 子程序 已安裝的 post-removal script 傳回了錯誤退出狀態 2
translation: sub-process installed post-removal script returned error return status 2
...

## Debugging info
As far as I can see the problem is at the second 'if ' statement:

if [ "$1" = abort-upgrade ] && dpkg --compare-versions "$2" lt dpkg --compare-versions "$2" lt 1:4.3.0~beta1-1; then
 dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
  --divert /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess \
                        /usr/lib/libreoffice/share/basic/dialog.xlc
 dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
  --divert /usr/lib/libreoffice/share/basic/script.xlc.noaccess \ # ← This trailing backslash shoudn't exist
fi

Tags: packaging ppa
description: updated
description: updated
tags: added: ppa
tags: added: packaging
Revision history for this message
V字龍(Vdragon) (vdragon) wrote :

I'm previously using 4.3.X PPA and wanna switch to LibreOffice test builds and backports PPA, FYI.

Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :

Almost, see:

http://anonscm.debian.org/gitweb/?p=pkg-openoffice/libreoffice.git;a=blobdiff;f=libreoffice-base.postrm.in;h=87b18a97e496dafff2b390b165b7e7beb7083d1b;hp=79edfef61b0c9fa4bad2a32e09a4b8497332e9e1;hb=95247585ddd5976b09be65444bf2e096b19b1355;hpb=f6f07fa08c7c5a1baeccafc32b3d78e4b8607c62

what is actually missing is the last argument for the line continuation. However, the diff above looks wrong to me too as it adds the argument, but also removes the backslash to keep the line continuation in place. Will be fixed properly soonish.

Changed in libreoffice (Ubuntu):
assignee: nobody → Björn Michaelsen (bjoern-michaelsen)
status: New → Triaged
status: Triaged → In Progress
importance: Undecided → High
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :
Revision history for this message
V字龍(Vdragon) (vdragon) wrote :

@Björn Michaelsen
Great, thanks for the effort!

Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :

Works fine with testbuild from:
https://launchpad.net/~bjoern-michaelsen/+archive/ubuntu/libreoffice-staging-proposed/+sourcepub/4353716/+listing-archive-extra
which is suggested for sponsoring to utopic-proposed. Note this doesnt fix the broken maintainer script in the existing package, so to unblock the update you would have to manually fix the maintscript on your system in /var/lib/dpkg/info/libreoffice-base.postrm.

Changed in libreoffice (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Peter Ludwig (peter-ludwig) wrote :

http://ubuntuforums.org/showthread.php?t=2239841

The link above helped me to solve the problem "somehow". At least I could remove LibroOffice and go on with work.

With adding this line:

/usr/lib/libreoffice/share/basic/script.xlc

To this file:

/var/lib/dpkg/info/libreoffice-base.postrm

There: (I marked the position with three leading stars ***)

----- File begins ------------------
#!/bin/sh

set -e

if [ "$1" = remove -o "$1" = abort-install -o "$1" = disappear ]; then
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess \
/usr/lib/libreoffice/share/basic/dialog.xlc
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/script.xlc.noaccess \
/usr/lib/libreoffice/share/basic/script.xlc
fi
if [ "$1" = abort-upgrade ] && dpkg --compare-versions "$2" lt dpkg --compare-versions "$2" lt 1:4.3.0~beta1-1; then
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/dialog.xlc.noaccess \
/usr/lib/libreoffice/share/basic/dialog.xlc
dpkg-divert --package $DPKG_MAINTSCRIPT_PACKAGE --remove --rename \
--divert /usr/lib/libreoffice/share/basic/script.xlc.noaccess \
***/usr/lib/libreoffice/share/basic/script.xlc
fi

# Automatically added by dh_installmenu
if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
# End automatically added section

exit 0

---------- file ends ----------------

That should do the trick. From here:

http://ubuntuforums.org/showthread.php?t=2239841

Thanks to nadrach

Grüße

Revision history for this message
V字龍(Vdragon) (vdragon) wrote :

@Björn Michaelsen
I would like to ask how much damage may occur if I workarounded this issue using the method in the "Bug description"? By far I haven't found problem but I just wanna make sure.

Revision history for this message
Peter Ludwig (peter-ludwig) wrote :

I did what I wrote above and was able to remove the LO packages at least again so that they stopped blocking my future installations. I reinstalled now libre office again and it worked (??) and up to now everything seems to run smooth.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libreoffice - 1:4.3.0-3ubuntu1

---------------
libreoffice (1:4.3.0-3ubuntu1) utopic; urgency=low

  * merge from Debian 4.3.0-3 (LP: #1354557)

libreoffice (1:4.3.0-3) unstable; urgency=low

  * debian/control.in: remove libreoffice-avmedia-backend-opengl here ...
  * debian/control.gltf.in: ... add here ...
  * debian/rules: ... and add it only to control when we ENABLE_GLTF=y
  * debian/libreoffice-base.postrm.in: missing \...

libreoffice (1:4.3.0-2) unstable; urgency=low

  * upload to unstable

  * debian/patches/system-coinmp.diff: add patch to implement
    --with-system-coinmp

  * debian/rules:
    - disable firebird on BE-archs as per upstream advice. Experimental
      feature anyway - and fails the dbacccess_firebird_test test
    - add conditional for system-coinmp, don't enable yet
  * debian/libreoffice-sdbc-firebird.bug-script.in: add, as for -gtk3

libreoffice (1:4.3.0-1) experimental; urgency=low

  * LibreOffice 4.3.0 release

  * debian/libreoffice-base.postrm.in: fix again..

libreoffice (1:4.3.0~rc3-2) experimental; urgency=low

  * Brown paper bag release

  * debian/patches/handle-symlinks-to-icon-themes-correctly.diff: as name says;
    from upstream

  * debian/rules:
    - fix typo so export DISABLE_CVE_TESTS=TRUE is actually set
    - add symlinks for images*.zip again
    - s/iceweasel-dev/npapi-sdk-dev/. Re-enable system-npapi-headers
    - ENABLE_AVAHI=n (closes: #749770, #755309)
  * debian/libreoffice-base.preinst.in: fix version check (closes: #755290)
  * debian/libreoffice-base.postrm.in: add more checks for the
    Access2Base diversions; add forgotten recommended abort-upgrade step
    from policy manual

libreoffice (1:4.3.0~rc3-1) experimental; urgency=low

  * new upstream release candidate
    - packages galaxy icon as the icon scanner expects

  * debian/rules, debian/control.in: revert images.zip Depends: workaround,
    symlink still seems to be broken somehow, keep that
  * debian/rules: remove unused (and buggy?) manual --with-images= when not
    building kde and/or gtk. Obsolete as upstream builds with all images
    per default anyway. Sync IMAGES with upstream configure.ac (split galaxy
    and default)
  * debian/rules: move new images_galaxy.zip into -galaxy
  * debian/rules: export DISABLE_CVE_TESTS=TRUE on arm*,powerpc*/ppc*,s390*
    to work around CppunitTest_filter_psd_test hang. Results are ignored
    anyway, and if it was a real issue it would fail on i386/amd64, too
    most probably
  * debian/control.ure.in: add Breaks: libreoffice-core (<< 1:4.3.0~) to
    uno-libs3 (closes: #754535)
 -- Bjoern Michaelsen <email address hidden> Sat, 09 Aug 2014 20:51:38 +0200

Changed in libreoffice (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Phillip Sz (phillip-sz) wrote :

Hey, I have added that line, but it still dont works for me, what can I do?

Revision history for this message
Phillip Sz (phillip-sz) wrote :

Ohh works now just sudo apt-get purge libreoffice-base libreoffice-report-builder-bin libreoffice after adding the line.

Revision history for this message
Luigi Calderone (lugligino) wrote :
Revision history for this message
Jabru (jgjaca) wrote :

Just to say thanks to #11 Philip Sz.

I have been trying to get rid of this error for a couple of days without result. Your comment has been the key to solve it. I tried just 'sudo apt-get purge libreoffice-base' and 'sudo apt-get remove libreoffice-base' without result. The correct solution has been to include libreoffice-report-builder-bin and libreoffice.

Revision history for this message
ullix (ullix) wrote :

I am adding my thanks to #11 Philip Sz!

Your comment allowed my to get rid of the nuisance, i.e. adding the line from #6 plus your purge command.

Revision history for this message
Josir Cardoso Gomes (josircg) wrote :

I tried this solution but when I try to "sudo apt-get purge libreoffice-base libreoffice-report-builder-bin libreoffice", I got that

You must execute 'apt-get -f install' to correct it:
Os pacotes a seguir têm dependências desencontradas:
 libreoffice-report-builder : Depende: libreoffice-report-builder-bin (>= 1:4.3.0) mas não será instalado
E: Dependências desencontradas. Tente 'apt-get -f install' sem nenhum pacote (ou especifique uma solução)

If I try: sudo apt-get -f install,

I got

dpkg: problemas de dependência impedem a configuração de libreoffice-base:
 libreoffice-base depende de libreoffice-base-core (= 1:4.3.0-0ubuntu1~precise1); porém:
  Versão de libreoffice-base-core no sistema é 1:4.3.1~rc2-0ubuntu1~precise1.

Could you help me to fix this "deadlock" ?

Revision history for this message
Josir Cardoso Gomes (josircg) wrote :

what I worked for me:

Include the line on /var/lib/dpkg/info/libreoffice-base.postrm as cited above

and then:

sudo mv /var/lib/dpkg/info/libreoffice.* /tmp/
sudo dpkg --remove --force-remove-reinstreq libreoffice
sudo dpkg --remove --force-remove-reinstreq libreoffice-base
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get install libreoffice

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.