Bug#1087001: runit: shutdown fails ignorable options, breaking default acpi support
Hi Andrew! Sorry for not replying, I'm very busy.. On Thu, 21 Nov 2024 20:59:05 + Andrew Bower wrote: > On Thu, Nov 07, 2024 at 10:59:12PM +, Andrew Bower wrote: > > > I think this would have significant utility improving the > > out-of-box experience for desktop users and VMs controlled by a QEMU > > monitor. > > Just to correct the record: this fix isn't relevant for desktop > sessions, just headless or virtual console-only installations. I have already added your patch to my local git repo, so consider it accepted and merged. Will push to salsa after addressing you comment on #1071395. Thanks :) > > (I do have an issue with the power button being ignored by desktop > sessions but that would have a different cause and I haven't looked > into it sufficiently to raise a bug.)
Bug#1087001: runit: shutdown fails ignorable options, breaking default acpi support
On Thu, Nov 07, 2024 at 10:59:12PM +, Andrew Bower wrote: > I think this would have significant utility improving the > out-of-box experience for desktop users and VMs controlled by a QEMU > monitor. Just to correct the record: this fix isn't relevant for desktop sessions, just headless or virtual console-only installations. (I do have an issue with the power button being ignored by desktop sessions but that would have a different cause and I haven't looked into it sufficiently to raise a bug.)
Bug#1087001: runit: shutdown fails ignorable options, breaking default acpi support
On Thu, Nov 07, 2024 at 10:59:12PM +, Andrew Bower wrote: [...] > 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. [...] Corrected version (v2) of this patch attached, rebased to 'next' branch on salsa. From 5968e46d591e3df073611775e30fa8e1af0dfdb6 Mon Sep 17 00:00:00 2001 From: Andrew Bower Date: Thu, 7 Nov 2024 23:12:49 + Subject: [PATCH] accept but ignore shutdown -H, -P and message arguments Allows default power button handler from acpi-support-base to work. Closes: #1087001 --- debian/contrib/shutdown.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/contrib/shutdown.c b/debian/contrib/shutdown.c index 6cd3060..01706de 100644 --- a/debian/contrib/shutdown.c +++ b/debian/contrib/shutdown.c @@ -164,6 +164,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; @@ -197,22 +198,30 @@ 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 (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 signature.asc Description: PGP signature
Bug#1087001: runit: shutdown fails ignorable options, breaking default acpi support
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-helper2.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 pn ucspi-unix pn zsh -- no debconf information From 03c4265e7beb651501cbefa23f6124ffb39b5c53 Mon Sep 17 00:00:00 2001 From: Andrew Bower Date: Thu, 7 Nov 2024 22:26:15 + 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 signature.asc Description: PGP signature