[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#913236: reportbug: Can't detect Runit as init (Sysv detected instead)



Package: reportbug
Version: 7.5.0+runit
Severity: normal
Tags: patch



-- Package-specific info:
** Environment settings:
DEBEMAIL="lorenzo.ru.g@gmail.com"
DEBFULLNAME="Lorenzo Puliti"
INTERFACE="text"

** /home/ombra/.reportbugrc:
reportbug_version "7.1.7"
mode advanced
ui text
realname "Lorenzo Puliti"
email "lorenzo.ru.g@gmail.com"
no-cc
header "X-Debbugs-CC: lorenzo.ru.g@gmail.com"
smtphost reportbug.debian.org

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.17.3-van (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)

Versions of packages reportbug depends on:
ii  apt                1.7.0
ii  python3            3.6.7-1
ii  python3-reportbug  7.5.0+runit
ii  sensible-utils     0.0.12

reportbug recommends no packages.

Versions of packages reportbug suggests:
pn  claws-mail                               <none>
pn  debconf-utils                            <none>
ii  debsums                                  2.2.3
pn  dlocate                                  <none>
pn  emacs24-bin-common | emacs25-bin-common  <none>
ii  file                                     1:5.34-2
ii  gnupg                                    2.2.10-3
ii  postfix [mail-transport-agent]           3.3.1-1
pn  python3-urwid                            <none>
pn  reportbug-gtk                            <none>
ii  xdg-utils                                1.1.3-1

Versions of packages python3-reportbug depends on:
ii  apt                1.7.0
ii  file               1:5.34-2
ii  python3            3.6.7-1
ii  python3-apt        1.7.0
ii  python3-debian     0.1.33
ii  python3-debianbts  2.7.2
ii  python3-requests   2.20.0-2

python3-reportbug suggests no packages.

-- no debconf information

Dear Maintainer,
Both Runit-init (Sid-Testing) and Sysvinit-core are shipping /sbin/init so
reportbug can wrongly report that init is sysv when in fact is runit.
I've searched a bit the source and find some relevant code in 'utils.py', so I'm
attempting a patch. Please be aware i've not searched and read all the code so I
may have missed something, but tested twice locally, (also moving away
/run/runit.stopit to make sure sysv is still detected) and it look it's working to me.
The file /run/runit.stopit is used to detect runit, this file is created at boot
and it should remain there untill shutdown when it's actually used.

Best Regards,
Lorenzo 
>From 6330c8c09e7aab388b2095baea5bf29c96c648c1 Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <lorenzo.ru.g@gmail.com>
Date: Thu, 1 Nov 2018 18:11:14 +0100
Subject: [PATCH] Detect runit as init

Reportbug has no code to detect runit as init; moreover both
sysvinit-core and runit-init ship a '/sbin/init' file, so there is the
chance that reportbug wrongly detect sysv as init when in fact runit is
in charge. This commit let reportbug detect when runit is init by
checking for the existence of '/run/runit.stopit' file. That file is
created during Stage-1 (early one-time boot tasks) and is used by runit
during Stage-3 (shutdown tasks).
---
 reportbug/utils.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index a3d5083..32fdde0 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -1279,6 +1279,8 @@ def get_init_system():
         init = 'systemd (via /run/systemd/system)'
     if not subprocess.call('. /lib/lsb/init-functions ; init_is_upstart', shell=True):
         init = 'upstart (via init_is_upstart())'
+    elif os.path.isfile('/run/runit.stopit'):
+        init = 'runit (via /run/runit.stopit)'
     elif os.path.isfile('/sbin/init') and not os.path.islink('/sbin/init'):
         init = 'sysvinit (via /sbin/init)'
 
-- 
2.19.1


Reply to: