Your message dated Wed, 13 Mar 2019 19:05:57 +0000
with message-id <[email protected]>
and subject line Bug#923924: fixed in runit 2.1.2-27
has caused the Debian Bug report #923924,
regarding Please review and apply attached patch to support shutdown on SIGPWR
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
923924: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923924
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: runit
Version: 2.1.2-22
Severity: wishlist
Tags: upstream

Hi,

currently lxc can't cleanly shutdown a container running runit as its init
system, because all it can do to bring about a shutdown is send signals to
init (sigpwr by default), and runit requires additional steps to initiate a
shutdown.

I wrote a trivial patch that should add sigpwr support to runit. Please
review it and if you think it's OK, apply it and perhaps submit it to Gerrit
for inclusion.

Thanks!

AndrĂ¡s

-- 
                 Enter any 11-digit prime number to continue.
diff --git a/runit-2.1.2/man/runit.8 b/runit-2.1.2/man/runit.8
index 6c07cf8..d597fdd 100644
--- a/runit-2.1.2/man/runit.8
+++ b/runit-2.1.2/man/runit.8
@@ -75,6 +75,12 @@ exists and has the execute by owner permission set,
 .B runit
 is told to shutdown the system.
 .P
+If
+.B runit
+receives a PWR signal,
+.B runit
+is told to shutdown the system.
+.P
 if
 .B runit
 receives an INT signal, a ctrl-alt-del keyboard request is triggered.
diff --git a/runit-2.1.2/src/runit.c b/runit-2.1.2/src/runit.c
index 2bb4794..584207a 100644
--- a/runit-2.1.2/src/runit.c
+++ b/runit-2.1.2/src/runit.c
@@ -30,6 +30,7 @@ const char * const stage[3] ={
 int selfpipe[2];
 int sigc =0;
 int sigi =0;
+int sigp =0;
 
 void sig_cont_handler (void) {
   sigc++;
@@ -39,6 +40,10 @@ void sig_int_handler (void) {
   sigi++;
   write(selfpipe[1], "", 1);
 }
+void sig_pwr_handler (void) {
+  sigp++;
+  write(selfpipe[1], "", 1);
+}
 void sig_child_handler (void) { write(selfpipe[1], "", 1); }
 
 void sync_if_needed() {
@@ -71,6 +76,7 @@ int main (int argc, const char * const *argv, char * const *envp) {
   sig_block(sig_hangup);
   sig_block(sig_int);
   sig_catch(sig_int, sig_int_handler);
+  sig_catch(sig_pwr, sig_pwr_handler);
   sig_block(sig_pipe);
   sig_block(sig_term);
 
@@ -244,7 +250,7 @@ int main (int argc, const char * const *argv, char * const *envp) {
         sigi =0;
         sigc++;
       }
-      if (sigc && (stat(STOPIT, &s) != -1) && (s.st_mode & S_IXUSR)) {
+      if ((sigp) || (sigc && (stat(STOPIT, &s) != -1) && (s.st_mode & S_IXUSR))) {
         int i;
         /* unlink(STOPIT); */
         chmod(STOPIT, 0);
@@ -308,7 +314,7 @@ int main (int argc, const char * const *argv, char * const *envp) {
   switch (pid) {
   case  0:
   case -1:
-  if ((stat(REBOOT, &s) != -1) && (s.st_mode & S_IXUSR)) {
+  if ((!sigp) && ((stat(REBOOT, &s) != -1) && (s.st_mode & S_IXUSR))) {
     strerr_warn2(INFO, "system reboot.", 0);
     sync_if_needed();
     reboot_system(RB_AUTOBOOT);
diff --git a/runit-2.1.2/src/sig.c b/runit-2.1.2/src/sig.c
index 423d18e..9d9d69b 100644
--- a/runit-2.1.2/src/sig.c
+++ b/runit-2.1.2/src/sig.c
@@ -9,6 +9,7 @@ int sig_cont = SIGCONT;
 int sig_hangup = SIGHUP;
 int sig_int = SIGINT;
 int sig_pipe = SIGPIPE;
+int sig_pwr = SIGPWR;
 int sig_term = SIGTERM;
 
 void (*sig_defaulthandler)() = SIG_DFL;
diff --git a/runit-2.1.2/src/sig.h b/runit-2.1.2/src/sig.h
index 2a3c780..0ced62d 100644
--- a/runit-2.1.2/src/sig.h
+++ b/runit-2.1.2/src/sig.h
@@ -9,6 +9,7 @@ extern int sig_cont;
 extern int sig_hangup;
 extern int sig_int;
 extern int sig_pipe;
+extern int sig_pwr;
 extern int sig_term;
 
 extern void (*sig_defaulthandler)();

--- End Message ---
--- Begin Message ---
Source: runit
Source-Version: 2.1.2-27

We believe that the bug you reported is fixed in the latest version of
runit, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Dmitry Bogatov <[email protected]> (supplier of updated runit package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 13 Mar 2019 18:30:49 +0000
Source: runit
Architecture: source
Version: 2.1.2-27
Distribution: experimental
Urgency: medium
Maintainer: Dmitry Bogatov <[email protected]>
Changed-By: Dmitry Bogatov <[email protected]>
Closes: 919699 923924
Changes:
 runit (2.1.2-27) experimental; urgency=medium
 .
   * Support `--wtmp-only' flag in /sbin/halt implementation (Closes: #919699)
   * Initiate system shutdown when runit-init receives SIGPWR (Closes: #923924)
     + Thanks: Andras Korn <[email protected]>
Checksums-Sha1:
 aa48d0d440160c94b28bac9a197354da53b40cba 2152 runit_2.1.2-27.dsc
 8b9796b88b21bdec489a11fd50e18f9875c3e52d 29280 runit_2.1.2-27.debian.tar.xz
 9e803a4165d4aca25ca236c7e5cc8d6a0bd85f3b 5356 runit_2.1.2-27_source.buildinfo
Checksums-Sha256:
 3cd2d389e33dda63bbec959b2968bc7a2f8813c70cc7f2f1c4414a6202de21d1 2152 
runit_2.1.2-27.dsc
 c9003568cae16987ff09ec2394a27363b4a98ef6f17611ed7193727eae5bbafa 29280 
runit_2.1.2-27.debian.tar.xz
 3dc8e3f8fcc31c5aca70920d8d83ea8e1483dc6ebf66f324da214d0dbcf117ac 5356 
runit_2.1.2-27_source.buildinfo
Files:
 f97cfa37c043756897161dca83c9743b 2152 admin optional runit_2.1.2-27.dsc
 8555e21585c567c856ab0416e6f4904d 29280 admin optional 
runit_2.1.2-27.debian.tar.xz
 149c99205b85529dff7a51e78fea426e 5356 admin optional 
runit_2.1.2-27_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCgAxFiEEhnHVzDbtdH7ktKj4SBLY3qgmEeYFAlyJTsMTHGthY3Rpb25A
ZGViaWFuLm9yZwAKCRBIEtjeqCYR5oG6EACGW62rQBzCtWLW34RCkDgLTsx9xQ7a
fO83AwWIkokR7c19uyl8H633sc5EQOOa+wH9uJH+eT1k+vIw9RGgR4797Ep09NyO
pv3jxid7sW1AOUMTi9gtPFwP5I/HpFhRtB1l6k+2nXeBan/vKv6e64e1X61283e+
RlILePoTef4N5sUjkP2dXmwbP7ZsdPsgraAsG3+Dv2fwRM3bKVmrDJxgvS8e/VLE
ymKimCtMbKVF3Lq157tBFFy0x1FjRCvj+pYXHJ9Ut5vHnVQsfVqLRyJq1vkWReJ0
EHjcv1kD679aNokE9IwTU04GEi4tobn7FCzfNqxYnGhZlEe++l2Fo8pDR9szj8iH
8t3P7h+atKvmFmN37MLZdVZCQrukxVgGvpq+Wcl72gh8i6tQOEvjn5uwOzFkJCKS
3xJMjW0lcoOrQJumV5QS8FnqkxJgg6MjypTG/Nw+JTNv0nvYYd87VaWQjh8h0gMC
+6zp4dDnvAzj+QUW/eNQA/vEQ+40nBNMxNOvLXYTmFYLtUO+4R2pYgznNzW6fU/C
pDTRf06L1VYJR/BBMsbLRitHji1Sjp7XnCiMr44h37/sSQ2SPmr6zfkrPXx1Fc/z
785njOAQiTFSuD9Dub0AzFK1ZUzdCIVPmLhov9eYyZAlQLkx9ag9oFLin7RgdY46
5uKvF7ZFI0l6fQ==
=V4de
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to