Package: runit
Version: 2.1.2-60
Severity: normal
Tags: patch

Dear Maintainer,

ACPI shutdown events appear to be ignored when runit-init is installed
because the implementation of the shutdown command provided by the runit
package fails with an error on the use of the -P option or a shutdown
message.

While these arguments are useless for this implementation of the
shutdown command, they are also reasonably ignorable.

I attach a patch which ignores the -P and -H options and any provided
shutdown message so that the default ACPI power button handler provided
by acpi-support-base works.

I appreciate that the runit ecosystem strives to be as simple as
possible but I think this would have significant utility improving the
out-of-box experience for desktop users and VMs controlled by a QEMU
monitor.

Thanks!


-- System Information:
Distributor ID: Devuan
Description:    Devuan GNU/Linux 6 (excalibur/ceres)
Release:        6
Codename:       excalibur ceres
Architecture: x86_64

Kernel: Linux 6.11.4-amd64 (SMP w/3 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: runit (via /run/runit.stopit)

Versions of packages runit depends on:
ii  libc6           2.40-3
ii  runit-helper    2.16.3
ii  sysuser-helper  1.5.0

Versions of packages runit recommends:
ii  runit-init  2.1.2-60

Versions of packages runit suggests:
ii  runit-services  0.7.3~0ajb.5
pn  socklog         <none>
pn  ucspi-unix      <none>
pn  zsh             <none>

-- no debconf information
From 03c4265e7beb651501cbefa23f6124ffb39b5c53 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Thu, 7 Nov 2024 22:26:15 +0000
Subject: [PATCH] accept but ignore shutdown -H, -P and message arguments

Allows default power button handler from acpi-support-base to work.
---
 debian/contrib/shutdown.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/debian/contrib/shutdown.c b/debian/contrib/shutdown.c
index f314381..5f8c4a4 100644
--- a/debian/contrib/shutdown.c
+++ b/debian/contrib/shutdown.c
@@ -154,6 +154,7 @@ int open_trunc(const char *fn)
 static void
 parse_command_line(struct config *cfg, int argc, char **argv)
 {
+	int options_ended = 0;
 	int i;
 
 	cfg->action    = ACTION_HALT;
@@ -186,22 +187,34 @@ parse_command_line(struct config *cfg, int argc, char **argv)
 				cfg->dofsck = true;
 				continue;
 			}
+			if (strcmp(argv[i], "-P") == 0 ||
+				strcmp(argv[i], "-H") == 0) {
+				/* Halt actions not distinguished */
+				continue;
+			}
+			if (strcmp(argv[i], "-F") == 0) {
+				cfg->dofsck = true;
+				continue;
+			}
 			if (argv[i][0]  == '-') {
 				write2(SUSAGE);
 				cfg->error = true;
 				break;
 			}
 			if (strcmp(argv[i], "now") == 0) {
+				options_ended = 1;
 				/*write1("time argument ignored\n"); */
 				continue;
 			}
-			else {
-				/* time spec and shutdown message not supported */
+			else if (!options_ended) {
+				/* time spec not supported */
 				write1("time argument: not supported\n");
-				write1("shutdown message: not supported\n");
 				write2(SUSAGE);
 				cfg->error = true;
 				break;
+			} else {
+				write1("shutdown message: ignored\n");
+				break;
 			}
 		}
 		else {
-- 
2.45.2

Attachment: signature.asc
Description: PGP signature

Reply via email to