[Pkg-sysvinit-devel] Bug#826214: SysV init scripts using init-d-script are not properly redirected to systemctl

Michael Biebl biebl at debian.org
Sun Oct 7 15:12:04 BST 2018


Control: tags -1 + pending

On Thu, 11 Jan 2018 01:38:00 +0300 Mert Dirik <mertdirik at gmail.com> wrote:
> On Wed, 10 Jan 2018 22:49:17 +0300 Mert Dirik <mertdirik at gmail.com> wrote:
>  > On 01/10/18 21:20, Petter Reinholdtsen wrote:
>  > > [Mert Dirik]
>  > >> Please forgive my naivety, but simply moving the argument shift 
> part before
>  > >> sourcing /lib/lsb/init-functions seems to successfully redirect to
>  > >> systemctl.
>  > > Interesting. This seem like a very good idea. :)
>  > I'm happy to hear that.
>  > >
>  > >> The only variable leaking to /lib/lsb/init-functions is "script", 
> which can be
>  > >> easily renamed and namespaced in case of a possible problem.
>  > > Perhaps good to give it some init-d-script related prefix, to 
> reduce the
>  > > chance of a future collision?
>  > Maybe "__init_d_script_path"?
>  > >
>  > >> Is there anything wrong with this approach?
>  > > Nothing I could think of from the top of my head. :)
>  > >
>  > Great :) I'll test it again in stretch or sid and I'll post the result
>  > here. (previous test was done in jessie)
>  >
> 
> I've tested the attached patch in a sid lxc container and the issue 
> seems to be fixed there.


Thanks Mert for the patch and Petter for the review.

I've prepared an NMU with Mert's latest version of the patch and
uploaded it to DELAYED/7.
Full debdiff is attached.

Regards,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
-------------- next part --------------
diff -Nru sysvinit-2.88dsf/debian/changelog sysvinit-2.88dsf/debian/changelog
--- sysvinit-2.88dsf/debian/changelog	2017-09-08 21:18:37.000000000 +0200
+++ sysvinit-2.88dsf/debian/changelog	2018-10-07 16:04:09.000000000 +0200
@@ -1,3 +1,15 @@
+sysvinit (2.88dsf-59.11) unstable; urgency=medium
+
+  * Non-maintainer upload.
+
+  [ Mert Dirik ]
+  * Make sure that services using init-d-script can be properly redirected to
+    systemctl. (Closes: #826214)
+  * Avoid naming collisions when storing the script name in init-d-script by
+    using a custom prefix.
+
+ -- Michael Biebl <biebl at debian.org>  Sun, 07 Oct 2018 16:04:09 +0200
+
 sysvinit (2.88dsf-59.10) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru sysvinit-2.88dsf/debian/init-d-script sysvinit-2.88dsf/debian/init-d-script
--- sysvinit-2.88dsf/debian/init-d-script	2017-02-12 22:55:39.000000000 +0100
+++ sysvinit-2.88dsf/debian/init-d-script	2018-10-07 16:04:01.000000000 +0200
@@ -1,6 +1,11 @@
 #!/bin/sh
 # See init-d-script(5) for instructions on how to use this library.
 #=============================================================================
+
+# Shift arguments early to fix #826214
+__init_d_script_name="$1"
+shift
+
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
 # and status_of_proc is working.
@@ -153,12 +158,10 @@
     set -x
 fi
 
-SCRIPTNAME=$1
-scriptbasename="$(basename $1)"
+SCRIPTNAME="$__init_d_script_name"
+scriptbasename="$(basename "$__init_d_script_name")"
 if [ "$scriptbasename" != "init-d-script" ] ; then
-    script="$1"
-    shift
-    . $script
+    . "$__init_d_script_name"
 else
     exit 0
 fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-sysvinit-devel/attachments/20181007/ad4cea25/attachment.sig>


More information about the Pkg-sysvinit-devel mailing list