Bug#680293: update-rc.d manual: `update-rc.d remove name` works when `/etc/init.d/name` exists

Dmitry Bogatov KAction at debian.org
Fri Jan 11 12:37:07 GMT 2019


control: tags -1 +patch

[2012-07-04 22:17] Paul Menzel <pm.debian at googlemail.com>
> Dear Debian folks,
> 
> 
> the manual of `update-rc.d` contains the following paragraph.
> 
>         $ man update-rc.d
>         […]
>         When invoked with the remove option, update-rc.d removes any
>         links in the /etc/rcrunlevel.d directories to the
>         script /etc/init.d/name. The script must have been deleted
>         already.  If the script is still present then update-rc.d aborts
>         with an error message.
>         […]
> 
> It looks like `update-rc.d remove name` still works though when the
> script in `/etc/init.d/name` is not removed beforehand.
> 
>         $ sudo update-rc.d pulseaudio remove
>         update-rc.d: using dependency based boot sequencing
>         $ ls -l /etc/init.d/pulseaudio
>         -rwxr-xr-x 1 root root 2227  1. Okt 2011  /etc/init.d/pulseaudio
>         $ ls -l /etc/rc*.d/*audio
>         ls: Zugriff auf /etc/rc*.d/*audio nicht möglich: Datei oder Verzeichnis nicht gefunden
>         $ sudo service pulseaudio stop
>         PulseAudio configured for per-user sessions ... (warning).
> 
> I guess the bug has been present for a longer time, so please update the
> version information accordingly.

Dear maintainers of init-system-helpers, please consider following
patch, that adjust behaviour of update-rc.d to match manpage.


From 46c7069cf9253399540cb0a75c51e164293e8689 Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <KAction at debian.org>
Date: Thu, 10 Jan 2019 15:57:35 +0000
Subject: [PATCH] update-rc.d: refuse to remove links to present script

Fix behaviour of update-rc.d to match manual page: throw error on
attemps to remove links to script, that is not removed.
(Closes: #680293)
---
 script/update-rc.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/script/update-rc.d b/script/update-rc.d
index 71fb1a6..870af0e 100755
--- a/script/update-rc.d
+++ b/script/update-rc.d
@@ -193,7 +193,7 @@ sub create_sequence {
     $sysv_insserv->{remove} = sub {
         my ($scriptname) = @_;
         if ( -f "/etc/init.d/$scriptname" ) {
-            return system($insserv, @opts, "-r", $scriptname) >> 8;
+            error("/etc/init.d$scriptname exists, refusing `remove' action.");
         } else {
             # insserv removes all dangling symlinks, no need to tell it
             # what to look for.



More information about the Pkg-systemd-maintainers mailing list