udevadm allow to override the default log level by environment variable

This commit is contained in:
hanjinpeng 2024-04-28 13:36:33 +08:00
parent d0e118b2d3
commit 1195b77e83
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From cd6ec641deaf94e2eb2fcaf87b9236f65479ef3f Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 6 Jan 2024 03:27:07 +0900
Subject: [PATCH] udevadm: allow to override the default log level by
environment variable
Previously, there was no way to override the log level for test and
test-builtin commands. Let's re-parse environment after setting the log
level to debug. Then, we can control the log level through environment
variable.
(cherry picked from commit 7ba3e44651d43d8bc3644b991a060842649a34a7)
---
src/udev/udevadm-test-builtin.c | 1 +
src/udev/udevadm-test.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c
index f5498a1e5b1..088b4da3c1a 100644
--- a/src/udev/udevadm-test-builtin.c
+++ b/src/udev/udevadm-test-builtin.c
@@ -78,6 +78,7 @@ int builtin_main(int argc, char *argv[], void *userdata) {
int r;
log_set_max_level(LOG_DEBUG);
+ log_parse_environment();
r = parse_argv(argc, argv);
if (r <= 0)
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 809143ede0b..e1afd7d29e6 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -95,6 +95,7 @@ int test_main(int argc, char *argv[], void *userdata) {
int r;
log_set_max_level(LOG_DEBUG);
+ log_parse_environment();
r = parse_argv(argc, argv);
if (r <= 0)

View File

@ -25,7 +25,7 @@
Name: systemd
Url: https://systemd.io/
Version: 255
Release: 11
Release: 12
License: MIT and LGPLv2+ and GPLv2+
Summary: System and Service Manager
@ -58,6 +58,7 @@ Patch6004: backport-core-exec-do-not-crash-with-UtmpMode-user-without-Us.pa
Patch6005: backport-CVE-2023-50387.patch
Patch6006: backport-CVE-2023-50868.patch
Patch6007: backport-fix-analyze-q-option-invalid-issue.patch
Patch6008: backport-allow-override-default-log-level-by-environment-variable.patch
Patch9008: update-rtc-with-system-clock-when-shutdown.patch
Patch9009: udev-add-actions-while-rename-netif-failed.patch
@ -1637,6 +1638,10 @@ fi
%{_libdir}/security/pam_systemd_loadkey.so
%changelog
* Thu Apr 25 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 255-12
- udevadm: allow override default log level for udevadm test-builtin commands
by environment variable
* Wed Apr 24 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 255-11
- Fix systemd-analyze -q option invalid issue