From 159d1e2659d19de5f61dca14a52be7a9cceac078 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 18 Dec 2023 17:06:43 +0100 Subject: [PATCH 1/4] journalctl: also refuse --cursor-file= with --since= We already refuse the other two cursor-related options (--cursor= and --after-cursor=) with --since=, so let's do the same with --cursor-file=. Closes: #20523 --- src/journal/journalctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index de1534befd..fe68ec4310 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1088,9 +1088,9 @@ static int parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--since= must be before --until=."); - if (!!arg_cursor + !!arg_after_cursor + !!arg_since_set > 1) + if (!!arg_cursor + !!arg_after_cursor + !!arg_cursor_file + !!arg_since_set > 1) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Please specify only one of --since=, --cursor=, and --after-cursor=."); + "Please specify only one of --since=, --cursor=, --cursor-file=, and --after-cursor=."); if (arg_follow && arg_reverse) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), From 31dcc1b4ba9f91673ceaf83e236cfb167917c828 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 18 Dec 2023 17:09:06 +0100 Subject: [PATCH 2/4] man: avoid potential shell expansion in systemctl's example Resolves: #30014 --- man/systemctl.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/systemctl.xml b/man/systemctl.xml index 21447e8ed9..4651e89510 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -1855,7 +1855,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err for more details. The patterns are matched against the primary names of units currently in memory, and patterns which do not match anything are silently skipped. For example: - # systemctl stop sshd@*.service + # systemctl stop "sshd@*.service" will stop all sshd@.service instances. Note that alias names of units, and units that aren't in memory are not considered for glob expansion. From 3c4d0ec9406d5dd1e3b741ee9a00d6f4b4bf3114 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 18 Dec 2023 17:25:10 +0100 Subject: [PATCH 3/4] analyze: use strempty() --- src/analyze/analyze-verify-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyze/analyze-verify-util.c b/src/analyze/analyze-verify-util.c index 6fbd6fa54c..0202db7713 100644 --- a/src/analyze/analyze-verify-util.c +++ b/src/analyze/analyze-verify-util.c @@ -152,7 +152,7 @@ int verify_set_unit_path(char **filenames) { * Treat explicit empty path to mean that nothing should be appended. */ old = getenv("SYSTEMD_UNIT_PATH"); if (!streq_ptr(old, "") && - !strextend_with_separator(&joined, ":", old ?: "")) + !strextend_with_separator(&joined, ":", strempty(old))) return -ENOMEM; assert_se(set_unit_path(joined) >= 0); From e80c6ea740959aa3ffe88ffd3867d540ad4b2e6a Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 18 Dec 2023 17:26:19 +0100 Subject: [PATCH 4/4] pcrlock: use empty_or_dash() more --- src/pcrlock/pcrlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pcrlock/pcrlock.c b/src/pcrlock/pcrlock.c index dc48bc57e5..5bac04519b 100644 --- a/src/pcrlock/pcrlock.c +++ b/src/pcrlock/pcrlock.c @@ -4906,7 +4906,7 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_PCRLOCK: - if (isempty(optarg) || streq(optarg, "-")) + if (empty_or_dash(optarg)) arg_pcrlock_path = mfree(arg_pcrlock_path); else { r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_pcrlock_path); @@ -4918,7 +4918,7 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_POLICY: - if (isempty(optarg) || streq(optarg, "-")) + if (empty_or_dash(optarg)) arg_policy_path = mfree(arg_policy_path); else { r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_policy_path);