teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0039-debug-generator-introduce-rd.-version-of-all-options.patch

ff6046
From 55798355455b9255458d6a705f8766c4dbe3ef73 Mon Sep 17 00:00:00 2001
ff6046
From: Lukas Nykryn <lnykryn@redhat.com>
ff6046
Date: Thu, 25 Oct 2018 16:34:00 +0200
ff6046
Subject: [PATCH] debug-generator: introduce rd.* version of all options
ff6046
ff6046
(cherry picked from commit a7dd6d04b07f58df5c0294743d76df0be0b4b928)
ff6046
ff6046
Resolves: #1643429
ff6046
---
ff6046
 man/systemd-debug-generator.xml       | 27 +++++++++++++++++++--------
ff6046
 src/debug-generator/debug-generator.c |  2 +-
ff6046
 2 files changed, 20 insertions(+), 9 deletions(-)
ff6046
ff6046
diff --git a/man/systemd-debug-generator.xml b/man/systemd-debug-generator.xml
ff6046
index d5cf4109b0..fa88e8ac01 100644
ff6046
--- a/man/systemd-debug-generator.xml
ff6046
+++ b/man/systemd-debug-generator.xml
ff6046
@@ -33,27 +33,38 @@
ff6046
     that reads the kernel command line and understands three
ff6046
     options:</para>
ff6046
 
ff6046
-    <para>If the <option>systemd.mask=</option> option is specified
ff6046
-    and followed by a unit name, this unit is masked for the runtime,
ff6046
-    similar to the effect of
ff6046
+    <para>If the <option>systemd.mask=</option> or <option>rd.systemd.mask=</option>
ff6046
+    option is specified and followed by a unit name, this unit is
ff6046
+    masked for the runtime, similar to the effect of
ff6046
     <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
ff6046
     <command>mask</command> command. This is useful to boot with
ff6046
     certain units removed from the initial boot transaction for
ff6046
-    debugging system startup. May be specified more than once.</para>
ff6046
+    debugging system startup. May be specified more than once.
ff6046
+    <option>rd.systemd.mask=</option> is honored only by initial
ff6046
+    RAM disk (initrd) while <option>systemd.mask=</option> is
ff6046
+    honored only in the main system.</para>
ff6046
 
ff6046
-    <para>If the <option>systemd.wants=</option> option is specified
ff6046
+    <para>If the <option>systemd.wants=</option> or
ff6046
+    <option>rd.systemd.wants=</option> option is specified
ff6046
     and followed by a unit name, a start job for this unit is added to
ff6046
     the initial transaction. This is useful to start one or more
ff6046
-    additional units at boot. May be specified more than once.</para>
ff6046
+    additional units at boot. May be specified more than once.
ff6046
+    <option>rd.systemd.wants=</option> is honored only by initial
ff6046
+    RAM disk (initrd) while <option>systemd.wants=</option> is
ff6046
+    honored only in the main system.</para>
ff6046
 
ff6046
-    <para>If the <option>systemd.debug_shell</option> option is
ff6046
+    <para>If the <option>systemd.debug_shell</option> or
ff6046
+    <option>rd.systemd.debug_shell</option> option is
ff6046
     specified, the debug shell service
ff6046
     <literal>debug-shell.service</literal> is pulled into the boot
ff6046
     transaction. It will spawn a debug shell on tty9 during early
ff6046
     system startup. Note that the shell may also be turned on
ff6046
     persistently by enabling it with
ff6046
     <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
ff6046
-    <command>enable</command> command.</para>
ff6046
+    <command>enable</command> command.
ff6046
+    <option>rd.systemd.debug_shell=</option> is honored only by initial
ff6046
+    RAM disk (initrd) while <option>systemd.debug_shell</option> is
ff6046
+    honored only in the main system.</para>
ff6046
 
ff6046
     <para><filename>systemd-debug-generator</filename> implements
ff6046
     <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
ff6046
diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c
ff6046
index dd6ab94fa2..800d31cebe 100644
ff6046
--- a/src/debug-generator/debug-generator.c
ff6046
+++ b/src/debug-generator/debug-generator.c
ff6046
@@ -154,7 +154,7 @@ int main(int argc, char *argv[]) {
ff6046
 
ff6046
         umask(0022);
ff6046
 
ff6046
-        r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
ff6046
+        r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_RD_STRICT | PROC_CMDLINE_STRIP_RD_PREFIX);
ff6046
         if (r < 0)
ff6046
                 log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
ff6046