anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

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

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