Package: file-rc
Version: 0.8.11
Tags: patch
Severity: minor

I discovered this while testing sysv-rc - file-rc migration.  There is
a bug in the file-rc postrm script, which only seem to trigger when
migrating from file-rc to sysv-rc directly using dpkg.  Here is a test
run demonstrating the problem, which is that the update-rc.d and
invoke-rc.d scripts are broken after installing sysv-rc.  The reason
is that the file-rc postrm script is executed after sysv-rc is
unpacked, and thus overwrites the binaries provided in sysv-rc.  I do
not believe the problem occur when the migration is done using apt-get
or aptitude, because there the conflicting package is removed before
the new package is installed.

  minerva:/# dpkg -i /var/cache/apt/archives/sysv-rc_2.86.ds1-65_all.deb
  Selecting previously deselected package sysv-rc.
  dpkg: considering removing file-rc in favour of sysv-rc ...
  dpkg: yes, will remove file-rc in favour of sysv-rc.
  (Reading database ... 8157 files and directories currently installed.)
  Unpacking sysv-rc (from .../sysv-rc_2.86.ds1-65_all.deb) ...
  Setting up sysv-rc (2.86.ds1-65) ...
  Processing triggers for man-db ...
  minerva:/# ls -l /usr/sbin/update-rc.d
  lrwxrwxrwx 1 root root 31 Aug 26 21:29 /usr/sbin/update-rc.d ->
    /usr/share/sysvinit/update-rc.d
  minerva:/# 

This patch solve the issue, by making sure the symlinks are only
inserted when the programs are missing.

diff -ur file-rc-0.8.11/debian/postrm file-rc-0.8.11-pere/debian/postrm
--- file-rc-0.8.11/debian/postrm        2003-04-25 18:39:48.000000000 +0200
+++ file-rc-0.8.11-pere/debian/postrm   2009-08-26 23:35:35.000000000 +0200
@@ -23,8 +23,12 @@
     ;;

     remove)
-       ln -sf /usr/share/sysvinit/update-rc.d /usr/sbin/update-rc.d
-       ln -sf /usr/share/sysvinit/update-rc.d /usr/sbin/invoke-rc.d
+       if [ ! -e /usr/sbin/update-rc.d ] ; then
+           ln -sf /usr/share/sysvinit/update-rc.d /usr/sbin/update-rc.d
+       fi
+       if [ ! -e /usr/sbin/invoke-rc.d ] ; then
+           ln -sf /usr/share/sysvinit/update-rc.d /usr/sbin/invoke-rc.d
+       fi
     ;;

     purge)

Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to