systemd-252-66
Resolves: RHEL-138414, RHEL-92752, RHEL-111135, RHEL-137252
This commit is contained in:
parent
08272a4b03
commit
fdda15f23a
28
1301-core-service-fix-error-cause-in-the-log.patch
Normal file
28
1301-core-service-fix-error-cause-in-the-log.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From de696eb8fc5caf5d5ad0a314fa21f8ca78bf8071 Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Tue, 9 May 2023 00:21:20 +0900
|
||||
Subject: [PATCH] core/service: fix error cause in the log
|
||||
|
||||
Fixes a bug caused by a5648b809457d120500b2acb18b31e2168a4817a.
|
||||
Fixes #27575.
|
||||
|
||||
(cherry picked from commit f86a388de339bc9fd3bc90df7de0d9693b52369f)
|
||||
|
||||
Resolves: RHEL-138414
|
||||
---
|
||||
src/core/service.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 305f3b7170..9c938aee91 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -989,7 +989,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
||||
r = chase_symlinks(s->pid_file, NULL, 0, NULL, &fd);
|
||||
}
|
||||
if (r < 0)
|
||||
- return log_unit_full_errno(UNIT(s), prio, fd,
|
||||
+ return log_unit_full_errno(UNIT(s), prio, r,
|
||||
"Can't open PID file %s (yet?) after %s: %m", s->pid_file, service_state_to_string(s->state));
|
||||
|
||||
/* Let's read the PID file now that we chased it down. But we need to convert the O_PATH fd
|
||||
45
1302-fstab-generator-drop-assertions-for-mount-opts.patch
Normal file
45
1302-fstab-generator-drop-assertions-for-mount-opts.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 7640cebb70cc13ada4f0b6e3e26b7973be6d1b23 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Yuan <me@yhndnzj.com>
|
||||
Date: Fri, 26 Jan 2024 00:47:23 +0800
|
||||
Subject: [PATCH] fstab-generator: drop assertions for mount opts
|
||||
|
||||
fstab_filter_options accepts NULL and (with later changes)
|
||||
might even return NULL.
|
||||
|
||||
(cherry picked from commit c521ce42b43ad542a8e3c6e5e83ceb653ca6a71e)
|
||||
|
||||
Related: RHEL-92752
|
||||
---
|
||||
src/fstab-generator/fstab-generator.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
|
||||
index b9606a5341..fe0283b4e7 100644
|
||||
--- a/src/fstab-generator/fstab-generator.c
|
||||
+++ b/src/fstab-generator/fstab-generator.c
|
||||
@@ -486,7 +486,6 @@ static int add_mount(
|
||||
|
||||
assert(what);
|
||||
assert(where);
|
||||
- assert(opts);
|
||||
assert(target_unit);
|
||||
assert(source);
|
||||
|
||||
@@ -797,6 +796,9 @@ static int add_sysusr_sysroot_usr_bind_mount(const char *source) {
|
||||
static MountPointFlags fstab_options_to_flags(const char *options, bool is_swap) {
|
||||
MountPointFlags flags = 0;
|
||||
|
||||
+ if (isempty(options))
|
||||
+ return 0;
|
||||
+
|
||||
if (fstab_test_option(options, "x-systemd.makefs\0"))
|
||||
flags |= MOUNT_MAKEFS;
|
||||
if (fstab_test_option(options, "x-systemd.growfs\0"))
|
||||
@@ -872,7 +874,6 @@ static int parse_fstab_one(
|
||||
|
||||
assert(what_original);
|
||||
assert(fstype);
|
||||
- assert(options);
|
||||
|
||||
if (prefix_sysroot && !mount_in_initrd(where_original, options, accept_root))
|
||||
return 0;
|
||||
114
1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch
Normal file
114
1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch
Normal file
@ -0,0 +1,114 @@
|
||||
From 0a4f0be757c73e3320d1c611de9845f7713b10d0 Mon Sep 17 00:00:00 2001
|
||||
From: Jules Lamur <contact@juleslamur.fr>
|
||||
Date: Mon, 7 Apr 2025 18:49:26 +0200
|
||||
Subject: [PATCH] fstab-generator: fix options in systemd.mount-extra= arg
|
||||
|
||||
Fixes a bug introduced by 55365b0a233ae3024411fd0815ad930e20f6a3d6 (v254).
|
||||
|
||||
The arguments `(rd.)systemd.mount-extra` take a value that looks like
|
||||
`WHAT:WHERE[:FSTYPE[:OPTIONS]]`. The `OPTIONS` were parsed into a nulstr
|
||||
where a comma-separated c-string was expected. This leads to a bug where
|
||||
only the first option was taken into account by the generator.
|
||||
|
||||
For example, if you passed `systemd.mount-extra=/x:/y:baz:ro,defaults`
|
||||
to the kernel, `systemd-fstab-generator` would translate that into a
|
||||
nulstr: `ro\0defaults\0`.
|
||||
Since methods processing options in the generator expected a
|
||||
comma-separated c-string, they would only see the first option, `ro` in
|
||||
this case.
|
||||
|
||||
(cherry picked from commit 06fadc4286fee6a7505a88659e5ae2e6f3ee60ba)
|
||||
|
||||
Resolves: RHEL-92752
|
||||
---
|
||||
src/fstab-generator/fstab-generator.c | 21 ++++---------------
|
||||
.../hoge-withx20space.mount | 2 +-
|
||||
.../dev-sdy3.swap | 2 +-
|
||||
.../dev-sdy3.swap | 0
|
||||
4 files changed, 6 insertions(+), 19 deletions(-)
|
||||
rename test/test-fstab-generator/test-20-swap-from-cmdline.expected/{swap.target.requires => swap.target.wants}/dev-sdy3.swap (100%)
|
||||
|
||||
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
|
||||
index fe0283b4e7..28677a2f39 100644
|
||||
--- a/src/fstab-generator/fstab-generator.c
|
||||
+++ b/src/fstab-generator/fstab-generator.c
|
||||
@@ -105,15 +105,15 @@ static int mount_array_add_internal(
|
||||
char *in_what,
|
||||
char *in_where,
|
||||
const char *in_fstype,
|
||||
- const char *in_options) {
|
||||
+ char *in_options) {
|
||||
|
||||
_cleanup_free_ char *what = NULL, *where = NULL, *fstype = NULL, *options = NULL;
|
||||
- int r;
|
||||
|
||||
/* This takes what and where. */
|
||||
|
||||
what = ASSERT_PTR(in_what);
|
||||
where = in_where;
|
||||
+ options = in_options;
|
||||
|
||||
fstype = strdup(isempty(in_fstype) ? "auto" : in_fstype);
|
||||
if (!fstype)
|
||||
@@ -122,19 +122,6 @@ static int mount_array_add_internal(
|
||||
if (streq(fstype, "swap"))
|
||||
where = mfree(where);
|
||||
|
||||
- if (!isempty(in_options)) {
|
||||
- _cleanup_strv_free_ char **options_strv = NULL;
|
||||
-
|
||||
- r = strv_split_full(&options_strv, in_options, ",", 0);
|
||||
- if (r < 0)
|
||||
- return r;
|
||||
-
|
||||
- r = strv_make_nulstr(options_strv, &options, NULL);
|
||||
- } else
|
||||
- r = strv_make_nulstr(STRV_MAKE("defaults"), &options, NULL);
|
||||
- if (r < 0)
|
||||
- return r;
|
||||
-
|
||||
if (!GREEDY_REALLOC(arg_mounts, arg_n_mounts + 1))
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -164,7 +151,7 @@ static int mount_array_add(bool for_initrd, const char *str) {
|
||||
if (!isempty(str))
|
||||
return -EINVAL;
|
||||
|
||||
- return mount_array_add_internal(for_initrd, TAKE_PTR(what), TAKE_PTR(where), fstype, options);
|
||||
+ return mount_array_add_internal(for_initrd, TAKE_PTR(what), TAKE_PTR(where), fstype, TAKE_PTR(options));
|
||||
}
|
||||
|
||||
static int mount_array_add_swap(bool for_initrd, const char *str) {
|
||||
@@ -182,7 +169,7 @@ static int mount_array_add_swap(bool for_initrd, const char *str) {
|
||||
if (!isempty(str))
|
||||
return -EINVAL;
|
||||
|
||||
- return mount_array_add_internal(for_initrd, TAKE_PTR(what), NULL, "swap", options);
|
||||
+ return mount_array_add_internal(for_initrd, TAKE_PTR(what), NULL, "swap", TAKE_PTR(options));
|
||||
}
|
||||
|
||||
static int write_options(FILE *f, const char *options) {
|
||||
diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount
|
||||
index e9ffb4bbd9..d3797c9706 100644
|
||||
--- a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount
|
||||
+++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount
|
||||
@@ -9,4 +9,4 @@ Before=remote-fs.target
|
||||
What=//foobar
|
||||
Where=/hoge/with space
|
||||
Type=cifs
|
||||
-Options=rw
|
||||
+Options=rw,seclabel
|
||||
diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap
|
||||
index 3b6563d216..1b4b53c9b8 100644
|
||||
--- a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap
|
||||
+++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap
|
||||
@@ -7,4 +7,4 @@ After=blockdev@dev-sdy3.target
|
||||
|
||||
[Swap]
|
||||
What=/dev/sdy3
|
||||
-Options=x-systemd.makefs
|
||||
+Options=x-systemd.makefs,nofail
|
||||
diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy3.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.wants/dev-sdy3.swap
|
||||
similarity index 100%
|
||||
rename from test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy3.swap
|
||||
rename to test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.wants/dev-sdy3.swap
|
||||
57
1304-core-reorder-systemd-arguments-on-reexec.patch
Normal file
57
1304-core-reorder-systemd-arguments-on-reexec.patch
Normal file
@ -0,0 +1,57 @@
|
||||
From 88dfaa167328461ac18e8e764c97e19632b34161 Mon Sep 17 00:00:00 2001
|
||||
From: Frantisek Sumsal <frantisek@sumsal.cz>
|
||||
Date: Thu, 29 Jun 2023 13:31:19 +0200
|
||||
Subject: [PATCH] core: reorder systemd arguments on reexec
|
||||
|
||||
When reexecuting system let's put our arguments carrying deserialization
|
||||
info first followed by any existing arguments to make sure they get
|
||||
parsed in case we get weird stuff from the kernel cmdline (like --).
|
||||
|
||||
See: https://github.com/systemd/systemd/issues/28184
|
||||
(cherry picked from commit 06afda6b38d5d730fca3c65449096425933272bc)
|
||||
|
||||
Resolves: RHEL-111135
|
||||
---
|
||||
src/core/main.c | 6 +++++-
|
||||
test/TEST-01-BASIC/test.sh | 5 +++++
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index f230270340..2eba3a3c50 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -1814,13 +1814,17 @@ static int do_reexecute(
|
||||
xsprintf(sfd, "%i", fileno(arg_serialization));
|
||||
|
||||
i = 1; /* Leave args[0] empty for now. */
|
||||
- filter_args(args, &i, argv, argc);
|
||||
|
||||
+ /* Put our stuff first to make sure it always gets parsed in case
|
||||
+ * we get weird stuff from the kernel cmdline (like --) */
|
||||
if (switch_root_dir)
|
||||
args[i++] = "--switched-root";
|
||||
args[i++] = arg_system ? "--system" : "--user";
|
||||
args[i++] = "--deserialize";
|
||||
args[i++] = sfd;
|
||||
+
|
||||
+ filter_args(args, &i, argv, argc);
|
||||
+
|
||||
args[i++] = NULL;
|
||||
|
||||
assert(i <= args_size);
|
||||
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
|
||||
index cc6d0651c1..d0e714ac30 100755
|
||||
--- a/test/TEST-01-BASIC/test.sh
|
||||
+++ b/test/TEST-01-BASIC/test.sh
|
||||
@@ -8,6 +8,11 @@ RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
|
||||
TEST_REQUIRE_INSTALL_TESTS=0
|
||||
TEST_SUPPORTING_SERVICES_SHOULD_BE_MASKED=0
|
||||
|
||||
+# Check if we can correctly deserialize if the kernel cmdline contains "weird" stuff
|
||||
+# like an invalid argument, "end of arguments" separator, or a sysvinit argument (-z)
|
||||
+# See: https://github.com/systemd/systemd/issues/28184
|
||||
+KERNEL_APPEND="foo -- -z bar --- baz $KERNEL_APPEND"
|
||||
+
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
5322
1305-basic-add-RuntimeScope-enum.patch
Normal file
5322
1305-basic-add-RuntimeScope-enum.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,68 @@
|
||||
From 2728e6821ab6f5c0c5316a367bb1aa626b036779 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 9 Mar 2023 17:41:25 +0100
|
||||
Subject: [PATCH] runtime-scope: add helper that turns RuntimeScope enum into
|
||||
--system/--user string
|
||||
|
||||
(cherry picked from commit 40d73340faabb6073602ba3ff41896f3478a2cbf)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/basic/runtime-scope.c | 8 ++++++++
|
||||
src/basic/runtime-scope.h | 2 ++
|
||||
src/core/main.c | 2 +-
|
||||
src/systemctl/systemctl-start-special.c | 2 +-
|
||||
4 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/basic/runtime-scope.c b/src/basic/runtime-scope.c
|
||||
index 88afb53d0b..3d653d6cef 100644
|
||||
--- a/src/basic/runtime-scope.c
|
||||
+++ b/src/basic/runtime-scope.c
|
||||
@@ -10,3 +10,11 @@ static const char* const runtime_scope_table[_RUNTIME_SCOPE_MAX] = {
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(runtime_scope, RuntimeScope);
|
||||
+
|
||||
+static const char* const runtime_scope_cmdline_option_table[_RUNTIME_SCOPE_MAX] = {
|
||||
+ [RUNTIME_SCOPE_SYSTEM] = "--system",
|
||||
+ [RUNTIME_SCOPE_USER] = "--user",
|
||||
+ [RUNTIME_SCOPE_GLOBAL] = "--global",
|
||||
+};
|
||||
+
|
||||
+DEFINE_STRING_TABLE_LOOKUP_TO_STRING(runtime_scope_cmdline_option, RuntimeScope);
|
||||
diff --git a/src/basic/runtime-scope.h b/src/basic/runtime-scope.h
|
||||
index 6a7f9e65d4..6553e4c199 100644
|
||||
--- a/src/basic/runtime-scope.h
|
||||
+++ b/src/basic/runtime-scope.h
|
||||
@@ -15,3 +15,5 @@ typedef enum RuntimeScope {
|
||||
|
||||
const char *runtime_scope_to_string(RuntimeScope scope) _const_;
|
||||
RuntimeScope runtime_scope_from_string(const char *s) _const_;
|
||||
+
|
||||
+const char *runtime_scope_cmdline_option_to_string(RuntimeScope scope) _const_;
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index 3ef613a8b1..18f5781126 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -1821,7 +1821,7 @@ static int do_reexecute(
|
||||
* we get weird stuff from the kernel cmdline (like --) */
|
||||
if (switch_root_dir)
|
||||
args[i++] = "--switched-root";
|
||||
- args[i++] = arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "--system" : "--user";
|
||||
+ args[i++] = runtime_scope_cmdline_option_to_string(arg_runtime_scope);
|
||||
args[i++] = "--deserialize";
|
||||
args[i++] = sfd;
|
||||
|
||||
diff --git a/src/systemctl/systemctl-start-special.c b/src/systemctl/systemctl-start-special.c
|
||||
index 503d69f2a0..8373dabe15 100644
|
||||
--- a/src/systemctl/systemctl-start-special.c
|
||||
+++ b/src/systemctl/systemctl-start-special.c
|
||||
@@ -260,7 +260,7 @@ int verb_start_system_special(int argc, char *argv[], void *userdata) {
|
||||
if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Bad action for %s mode.",
|
||||
- arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? "--global" : "--user");
|
||||
+ runtime_scope_cmdline_option_to_string(arg_runtime_scope));
|
||||
|
||||
return verb_start_special(argc, argv, userdata);
|
||||
}
|
||||
79
1307-sd-path-add-support-for-XDG_STATE_HOME.patch
Normal file
79
1307-sd-path-add-support-for-XDG_STATE_HOME.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From 3be3354126953a51625015b43ab5abc11315cd40 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 18:55:14 +0200
|
||||
Subject: [PATCH] sd-path: add support for XDG_STATE_HOME
|
||||
|
||||
(cherry picked from commit 9a653235d12a795a8bd6adf6289ea735ccae71af)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
man/sd_path_lookup.xml | 1 +
|
||||
src/libsystemd/sd-path/sd-path.c | 3 +++
|
||||
src/path/path.c | 2 ++
|
||||
src/systemd/sd-path.h | 5 ++++-
|
||||
4 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml
|
||||
index 01fb1ed8f1..c2ea6469a1 100644
|
||||
--- a/man/sd_path_lookup.xml
|
||||
+++ b/man/sd_path_lookup.xml
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
<constant>SD_PATH_USER_CONFIGURATION</constant>,
|
||||
<constant>SD_PATH_USER_RUNTIME</constant>,
|
||||
+ <constant>SD_PATH_USER_STATE_PRIVATE</constant>,
|
||||
<constant>SD_PATH_USER_STATE_CACHE</constant>,
|
||||
|
||||
<constant>SD_PATH_USER</constant>,
|
||||
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
|
||||
index 2c8181fbfb..73a51aebc2 100644
|
||||
--- a/src/libsystemd/sd-path/sd-path.c
|
||||
+++ b/src/libsystemd/sd-path/sd-path.c
|
||||
@@ -281,6 +281,9 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
|
||||
case SD_PATH_USER_STATE_CACHE:
|
||||
return from_home_dir("XDG_CACHE_HOME", ".cache", buffer, ret);
|
||||
|
||||
+ case SD_PATH_USER_STATE_PRIVATE:
|
||||
+ return from_home_dir("XDG_STATE_HOME", ".local/state", buffer, ret);
|
||||
+
|
||||
case SD_PATH_USER:
|
||||
r = get_home_dir(buffer);
|
||||
if (r < 0)
|
||||
diff --git a/src/path/path.c b/src/path/path.c
|
||||
index 0024a60611..9d9b24d5e2 100644
|
||||
--- a/src/path/path.c
|
||||
+++ b/src/path/path.c
|
||||
@@ -41,6 +41,8 @@ static const char* const path_table[_SD_PATH_MAX] = {
|
||||
[SD_PATH_USER_CONFIGURATION] = "user-configuration",
|
||||
[SD_PATH_USER_RUNTIME] = "user-runtime",
|
||||
[SD_PATH_USER_STATE_CACHE] = "user-state-cache",
|
||||
+ [SD_PATH_USER_STATE_PRIVATE] = "user-state-private",
|
||||
+
|
||||
[SD_PATH_USER] = "user",
|
||||
[SD_PATH_USER_DOCUMENTS] = "user-documents",
|
||||
[SD_PATH_USER_MUSIC] = "user-music",
|
||||
diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h
|
||||
index 161a8e0c8d..0c04e7c22e 100644
|
||||
--- a/src/systemd/sd-path.h
|
||||
+++ b/src/systemd/sd-path.h
|
||||
@@ -53,9 +53,10 @@ enum {
|
||||
SD_PATH_USER_SHARED,
|
||||
|
||||
/* User configuration, state, runtime ... */
|
||||
- SD_PATH_USER_CONFIGURATION, /* takes both actual configuration (like /etc) and state (like /var/lib) */
|
||||
+ SD_PATH_USER_CONFIGURATION,
|
||||
SD_PATH_USER_RUNTIME,
|
||||
SD_PATH_USER_STATE_CACHE,
|
||||
+ /* → SD_PATH_USER_STATE_PRIVATE is added at the bottom */
|
||||
|
||||
/* User resources */
|
||||
SD_PATH_USER, /* $HOME itself */
|
||||
@@ -110,6 +111,8 @@ enum {
|
||||
/* systemd-networkd search paths */
|
||||
SD_PATH_SYSTEMD_SEARCH_NETWORK,
|
||||
|
||||
+ SD_PATH_USER_STATE_PRIVATE,
|
||||
+
|
||||
_SD_PATH_MAX
|
||||
};
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
From c5a486e8816778e6b3c6c9b02e1fb57d24f60252 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 18:55:39 +0200
|
||||
Subject: [PATCH] sd-path: bring spacing in sd-path.h and systemd-path tool in
|
||||
sync
|
||||
|
||||
(cherry picked from commit 4bbfc9eac53a9bd1d239312e2572ad352e418d20)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/path/path.c | 12 ++++++++----
|
||||
src/systemd/sd-path.h | 1 +
|
||||
2 files changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/path/path.c b/src/path/path.c
|
||||
index 9d9b24d5e2..6762e2c553 100644
|
||||
--- a/src/path/path.c
|
||||
+++ b/src/path/path.c
|
||||
@@ -62,18 +62,22 @@ static const char* const path_table[_SD_PATH_MAX] = {
|
||||
[SD_PATH_SEARCH_CONFIGURATION] = "search-configuration",
|
||||
|
||||
[SD_PATH_SYSTEMD_UTIL] = "systemd-util",
|
||||
+
|
||||
[SD_PATH_SYSTEMD_SYSTEM_UNIT] = "systemd-system-unit",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_PRESET] = "systemd-system-preset",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_CONF] = "systemd-system-conf",
|
||||
- [SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT] = "systemd-search-system-unit",
|
||||
- [SD_PATH_SYSTEMD_SYSTEM_GENERATOR] = "systemd-system-generator",
|
||||
- [SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR] = "systemd-search-system-generator",
|
||||
[SD_PATH_SYSTEMD_USER_UNIT] = "systemd-user-unit",
|
||||
[SD_PATH_SYSTEMD_USER_PRESET] = "systemd-user-preset",
|
||||
[SD_PATH_SYSTEMD_USER_CONF] = "systemd-user-conf",
|
||||
+
|
||||
+ [SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT] = "systemd-search-system-unit",
|
||||
[SD_PATH_SYSTEMD_SEARCH_USER_UNIT] = "systemd-search-user-unit",
|
||||
- [SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR] = "systemd-search-user-generator",
|
||||
+
|
||||
+ [SD_PATH_SYSTEMD_SYSTEM_GENERATOR] = "systemd-system-generator",
|
||||
[SD_PATH_SYSTEMD_USER_GENERATOR] = "systemd-user-generator",
|
||||
+ [SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR] = "systemd-search-system-generator",
|
||||
+ [SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR] = "systemd-search-user-generator",
|
||||
+
|
||||
[SD_PATH_SYSTEMD_SLEEP] = "systemd-sleep",
|
||||
[SD_PATH_SYSTEMD_SHUTDOWN] = "systemd-shutdown",
|
||||
|
||||
diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h
|
||||
index 0c04e7c22e..a187cd6aee 100644
|
||||
--- a/src/systemd/sd-path.h
|
||||
+++ b/src/systemd/sd-path.h
|
||||
@@ -83,6 +83,7 @@ enum {
|
||||
* replaces "path" by "search"), since this API is about dirs/paths anyway, and contains "path"
|
||||
* already in the prefix */
|
||||
SD_PATH_SYSTEMD_UTIL,
|
||||
+
|
||||
SD_PATH_SYSTEMD_SYSTEM_UNIT,
|
||||
SD_PATH_SYSTEMD_SYSTEM_PRESET,
|
||||
SD_PATH_SYSTEMD_SYSTEM_CONF,
|
||||
25
1309-path-tool-add-some-basic-ansi-highlighing.patch
Normal file
25
1309-path-tool-add-some-basic-ansi-highlighing.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 60180ce9e6f78cfaf20bb3b3f08c3395f11908a3 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 18:55:52 +0200
|
||||
Subject: [PATCH] path tool: add some basic ansi highlighing
|
||||
|
||||
(cherry picked from commit 17f06e97e4d07448b579086b2e0217f84236d634)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/path/path.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/path/path.c b/src/path/path.c
|
||||
index 6762e2c553..77361b43af 100644
|
||||
--- a/src/path/path.c
|
||||
+++ b/src/path/path.c
|
||||
@@ -108,7 +108,7 @@ static int list_homes(void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
- printf("%s: %s\n", path_table[i], p);
|
||||
+ printf("%s%s:%s %s\n", ansi_highlight(), path_table[i], ansi_normal(), p);
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -0,0 +1,91 @@
|
||||
From 186ec2bf76640d5250809827625cb6f2a1f8f09f Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 22:34:25 +0200
|
||||
Subject: [PATCH] execude: include RuntimeScope field in ExecParameters
|
||||
|
||||
Let's decouple execute.c a bit from the Manager object, let's pass the
|
||||
runtime scope (i.e. the enum that discern invocation for user or system
|
||||
context) as part of ExecParameters. This makes the scope available in
|
||||
various functions without having to pass the Manager object in.
|
||||
|
||||
(cherry picked from commit 170d978b2f85aa0ea5c994d7821dfbf6870cffb9)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.c | 9 ++++++---
|
||||
src/core/execute.h | 3 +++
|
||||
src/core/unit.c | 2 ++
|
||||
3 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 35f8ccf770..404ca9fe94 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -3621,7 +3621,7 @@ static int apply_mount_namespace(
|
||||
}
|
||||
}
|
||||
|
||||
- if (MANAGER_IS_SYSTEM(u->manager)) {
|
||||
+ if (params->runtime_scope == RUNTIME_SCOPE_SYSTEM) {
|
||||
propagate_dir = path_join("/run/systemd/propagate/", u->id);
|
||||
if (!propagate_dir) {
|
||||
r = -ENOMEM;
|
||||
@@ -3639,11 +3639,14 @@ static int apply_mount_namespace(
|
||||
r = -ENOMEM;
|
||||
goto finalize;
|
||||
}
|
||||
- } else
|
||||
+ } else {
|
||||
+ assert(params->runtime_scope == RUNTIME_SCOPE_USER);
|
||||
+
|
||||
if (asprintf(&extension_dir, "/run/user/" UID_FMT "/systemd/unit-extensions", geteuid()) < 0) {
|
||||
r = -ENOMEM;
|
||||
goto finalize;
|
||||
}
|
||||
+ }
|
||||
|
||||
r = setup_namespace(root_dir, root_image, context->root_image_options,
|
||||
&ns_info, context->read_write_paths,
|
||||
@@ -4261,7 +4264,7 @@ static int exec_child(
|
||||
* invocations themselves. Also note that while we'll only invoke NSS modules involved in user management they
|
||||
* might internally call into other NSS modules that are involved in hostname resolution, we never know. */
|
||||
if (setenv("SYSTEMD_ACTIVATION_UNIT", unit->id, true) != 0 ||
|
||||
- setenv("SYSTEMD_ACTIVATION_SCOPE", runtime_scope_to_string(unit->manager->runtime_scope), true) != 0) {
|
||||
+ setenv("SYSTEMD_ACTIVATION_SCOPE", runtime_scope_to_string(params->runtime_scope), true) != 0) {
|
||||
*exit_status = EXIT_MEMORY;
|
||||
return log_unit_error_errno(unit, errno, "Failed to update environment: %m");
|
||||
}
|
||||
diff --git a/src/core/execute.h b/src/core/execute.h
|
||||
index 4c54422073..fc0e138029 100644
|
||||
--- a/src/core/execute.h
|
||||
+++ b/src/core/execute.h
|
||||
@@ -24,6 +24,7 @@ typedef struct Manager Manager;
|
||||
#include "nsflags.h"
|
||||
#include "numa-util.h"
|
||||
#include "path-util.h"
|
||||
+#include "runtime-scope.h"
|
||||
#include "time-util.h"
|
||||
|
||||
#define EXEC_STDIN_DATA_MAX (64U*1024U*1024U)
|
||||
@@ -393,6 +394,8 @@ typedef enum ExecFlags {
|
||||
/* Parameters for a specific invocation of a command. This structure is put together right before a command is
|
||||
* executed. */
|
||||
struct ExecParameters {
|
||||
+ RuntimeScope runtime_scope;
|
||||
+
|
||||
char **environment;
|
||||
|
||||
int *fds;
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||
index e90b51d8c4..7f321c911d 100644
|
||||
--- a/src/core/unit.c
|
||||
+++ b/src/core/unit.c
|
||||
@@ -5203,6 +5203,8 @@ int unit_set_exec_params(Unit *u, ExecParameters *p) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ p->runtime_scope = u->manager->runtime_scope;
|
||||
+
|
||||
p->confirm_spawn = manager_get_confirm_spawn(u->manager);
|
||||
p->cgroup_supported = u->manager->cgroup_supported;
|
||||
p->prefix = u->manager->prefix;
|
||||
25
1311-execute-remove-redundant-assignment.patch
Normal file
25
1311-execute-remove-redundant-assignment.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From c59f57077d76e7d21abfaa28fdeefb4bcfffba5d Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 22:36:31 +0200
|
||||
Subject: [PATCH] execute: remove redundant assignment
|
||||
|
||||
(cherry picked from commit d9e5137185e53ad7b8ec2ebbf23f0f990e23b4cb)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/execute.h b/src/core/execute.h
|
||||
index fc0e138029..97666b0832 100644
|
||||
--- a/src/core/execute.h
|
||||
+++ b/src/core/execute.h
|
||||
@@ -124,7 +124,7 @@ struct ExecRuntime {
|
||||
};
|
||||
|
||||
typedef enum ExecDirectoryType {
|
||||
- EXEC_DIRECTORY_RUNTIME = 0,
|
||||
+ EXEC_DIRECTORY_RUNTIME,
|
||||
EXEC_DIRECTORY_STATE,
|
||||
EXEC_DIRECTORY_CACHE,
|
||||
EXEC_DIRECTORY_LOGS,
|
||||
@ -0,0 +1,79 @@
|
||||
From cf623677c7a565d1dc9ae1790a0bbfa63407e790 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 11:09:03 +0200
|
||||
Subject: [PATCH] execute: when recursively chowning StateDirectory= when
|
||||
spawning services, follow initial symlink
|
||||
|
||||
It should be OK to allow one level of symlink for the various types of
|
||||
directories like StateDirectory=, LogsDirectory= and such.
|
||||
|
||||
(cherry picked from commit d5602c16324ec545c82bb59a3d60a349da7c370c)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.c | 2 +-
|
||||
src/shared/chown-recursive.c | 7 +++++--
|
||||
src/shared/chown-recursive.h | 2 +-
|
||||
src/test/test-chown-rec.c | 2 +-
|
||||
4 files changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 404ca9fe94..913802dfc0 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2521,7 +2521,7 @@ static int setup_exec_directory(
|
||||
/* Then, change the ownership of the whole tree, if necessary. When dynamic users are used we
|
||||
* drop the suid/sgid bits, since we really don't want SUID/SGID files for dynamic UID/GID
|
||||
* assignments to exist. */
|
||||
- r = path_chown_recursive(pp ?: p, uid, gid, context->dynamic_user ? 01777 : 07777);
|
||||
+ r = path_chown_recursive(pp ?: p, uid, gid, context->dynamic_user ? 01777 : 07777, AT_SYMLINK_FOLLOW);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
}
|
||||
diff --git a/src/shared/chown-recursive.c b/src/shared/chown-recursive.c
|
||||
index bbc270d34b..eda0ebf554 100644
|
||||
--- a/src/shared/chown-recursive.c
|
||||
+++ b/src/shared/chown-recursive.c
|
||||
@@ -111,12 +111,15 @@ int path_chown_recursive(
|
||||
const char *path,
|
||||
uid_t uid,
|
||||
gid_t gid,
|
||||
- mode_t mask) {
|
||||
+ mode_t mask,
|
||||
+ int flags) {
|
||||
|
||||
_cleanup_close_ int fd = -1;
|
||||
struct stat st;
|
||||
|
||||
- fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
|
||||
+ assert((flags & ~AT_SYMLINK_FOLLOW) == 0);
|
||||
+
|
||||
+ fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOATIME|(FLAGS_SET(flags, AT_SYMLINK_FOLLOW) ? 0 : O_NOFOLLOW));
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
diff --git a/src/shared/chown-recursive.h b/src/shared/chown-recursive.h
|
||||
index 00038c3b32..2aab8e7414 100644
|
||||
--- a/src/shared/chown-recursive.h
|
||||
+++ b/src/shared/chown-recursive.h
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
-int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask);
|
||||
+int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask, int flags);
|
||||
|
||||
int fd_chown_recursive(int fd, uid_t uid, gid_t gid, mode_t mask);
|
||||
diff --git a/src/test/test-chown-rec.c b/src/test/test-chown-rec.c
|
||||
index 801b49f7b7..dcff17efec 100644
|
||||
--- a/src/test/test-chown-rec.c
|
||||
+++ b/src/test/test-chown-rec.c
|
||||
@@ -104,7 +104,7 @@ TEST(chown_recursive) {
|
||||
assert_se(st.st_gid == gid);
|
||||
assert_se(has_xattr(p));
|
||||
|
||||
- assert_se(path_chown_recursive(t, 1, 2, 07777) >= 0);
|
||||
+ assert_se(path_chown_recursive(t, 1, 2, 07777, 0) >= 0);
|
||||
|
||||
p = strjoina(t, "/dir");
|
||||
assert_se(lstat(p, &st) >= 0);
|
||||
195
1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch
Normal file
195
1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch
Normal file
@ -0,0 +1,195 @@
|
||||
From 27653e83d21754c2147f0d1e1e62c0fb21d0c1f2 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 22:42:33 +0200
|
||||
Subject: [PATCH] execute: add support for XDG_STATE_HOME for placing service
|
||||
state data in --user mode
|
||||
|
||||
This adds support for the new XDG_STATE_HOME env var that was added to
|
||||
the xdg basedir spec. Previously, because the basedir spec didn't know
|
||||
the concept we'd alias the backing dir for StateDirectory= to the one
|
||||
for ConfigurationDirectory= when runnin in --user mode. With this change
|
||||
we'll make separate. This brings us various benefits, such as proper
|
||||
"systemctl clean" support, where we can clear service state separately
|
||||
from service configuration, now in user mode too.
|
||||
|
||||
This does not come without complications: retaining compatibility with
|
||||
older setups is difficult, because we cannot possibly identitfy which
|
||||
files in existing populated config dirs are actually "state" and which
|
||||
one are true" configuration.
|
||||
|
||||
Hence let's deal with this pragmatically: if we detect that a service
|
||||
that has both dirs configured only has the configuration dir existing,
|
||||
then symlink the state dir to the configuration dir to retain
|
||||
compatibility.
|
||||
|
||||
This is not great, but it's the only somewhat reasonable way out I can
|
||||
see.
|
||||
|
||||
Fixes: #25739
|
||||
(cherry picked from commit f9c91932b4d83faf0f95624dc82db353d0726425)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
man/systemd.exec.xml | 4 +-
|
||||
man/systemd.unit.xml | 4 +-
|
||||
src/core/execute.c | 55 +++++++++++++++++++
|
||||
src/core/manager.c | 4 +-
|
||||
src/core/unit-printf.c | 4 +-
|
||||
test/test-execute/exec-specifier-user.service | 4 +-
|
||||
6 files changed, 65 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
|
||||
index 4927764b9b..cce0426ed4 100644
|
||||
--- a/man/systemd.exec.xml
|
||||
+++ b/man/systemd.exec.xml
|
||||
@@ -1324,7 +1324,7 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
|
||||
<row>
|
||||
<entry><varname>StateDirectory=</varname></entry>
|
||||
<entry><filename>/var/lib/</filename></entry>
|
||||
- <entry><varname>$XDG_CONFIG_HOME</varname></entry>
|
||||
+ <entry><varname>$XDG_STATE_HOME</varname></entry>
|
||||
<entry><varname>$STATE_DIRECTORY</varname></entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -1336,7 +1336,7 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
|
||||
<row>
|
||||
<entry><varname>LogsDirectory=</varname></entry>
|
||||
<entry><filename>/var/log/</filename></entry>
|
||||
- <entry><varname>$XDG_CONFIG_HOME</varname><filename>/log/</filename></entry>
|
||||
+ <entry><varname>$XDG_STATE_HOME</varname><filename>/log/</filename></entry>
|
||||
<entry><varname>$LOGS_DIRECTORY</varname></entry>
|
||||
</row>
|
||||
<row>
|
||||
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
|
||||
index afa4aea5c9..a70237f06b 100644
|
||||
--- a/man/systemd.unit.xml
|
||||
+++ b/man/systemd.unit.xml
|
||||
@@ -2105,7 +2105,7 @@ Note that this setting is <emphasis>not</emphasis> influenced by the <varname>Us
|
||||
<row>
|
||||
<entry><literal>%L</literal></entry>
|
||||
<entry>Log directory root</entry>
|
||||
- <entry>This is either <filename>/var/log</filename> (for the system manager) or the path <literal>$XDG_CONFIG_HOME</literal> resolves to with <filename index="false">/log</filename> appended (for user managers).</entry>
|
||||
+ <entry>This is either <filename>/var/log</filename> (for the system manager) or the path <varname>$XDG_STATE_HOME</varname> resolves to with <filename index="false">/log</filename> appended (for user managers).</entry>
|
||||
</row>
|
||||
<xi:include href="standard-specifiers.xml" xpointer="m"/>
|
||||
<xi:include href="standard-specifiers.xml" xpointer="M"/>
|
||||
@@ -2145,7 +2145,7 @@ Note that this setting is <emphasis>not</emphasis> influenced by the <varname>Us
|
||||
<row>
|
||||
<entry><literal>%S</literal></entry>
|
||||
<entry>State directory root</entry>
|
||||
- <entry>This is either <filename>/var/lib</filename> (for the system manager) or the path <literal>$XDG_CONFIG_HOME</literal> resolves to (for user managers).</entry>
|
||||
+ <entry>This is either <filename>/var/lib</filename> (for the system manager) or the path <varname>$XDG_STATE_HOME</varname> resolves to (for user managers).</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%t</literal></entry>
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 913802dfc0..2adb4392f9 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2343,6 +2343,61 @@ static int setup_exec_directory(
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
+ if (IN_SET(type, EXEC_DIRECTORY_STATE, EXEC_DIRECTORY_LOGS) && params->runtime_scope == RUNTIME_SCOPE_USER) {
|
||||
+
|
||||
+ /* If we are in user mode, and a configuration directory exists but a state directory
|
||||
+ * doesn't exist, then we likely are upgrading from an older systemd version that
|
||||
+ * didn't know the more recent addition to the xdg-basedir spec: the $XDG_STATE_HOME
|
||||
+ * directory. In older systemd versions EXEC_DIRECTORY_STATE was aliased to
|
||||
+ * EXEC_DIRECTORY_CONFIGURATION, with the advent of $XDG_STATE_HOME is is now
|
||||
+ * seperated. If a service has both dirs configured but only the configuration dir
|
||||
+ * exists and the state dir does not, we assume we are looking at an update
|
||||
+ * situation. Hence, create a compatibility symlink, so that all expectations are
|
||||
+ * met.
|
||||
+ *
|
||||
+ * (We also do something similar with the log directory, which still doesn't exist in
|
||||
+ * the xdg basedir spec. We'll make it a subdir of the state dir.) */
|
||||
+
|
||||
+ /* this assumes the state dir is always created before the configuration dir */
|
||||
+ assert_cc(EXEC_DIRECTORY_STATE < EXEC_DIRECTORY_LOGS);
|
||||
+ assert_cc(EXEC_DIRECTORY_LOGS < EXEC_DIRECTORY_CONFIGURATION);
|
||||
+
|
||||
+ r = laccess(p, F_OK);
|
||||
+ if (r == -ENOENT) {
|
||||
+ _cleanup_free_ char *q = NULL;
|
||||
+
|
||||
+ /* OK, we know that the state dir does not exist. Let's see if the dir exists
|
||||
+ * under the configuration hierarchy. */
|
||||
+
|
||||
+ if (type == EXEC_DIRECTORY_STATE)
|
||||
+ q = path_join(params->prefix[EXEC_DIRECTORY_CONFIGURATION], context->directories[type].items[i].path);
|
||||
+ else if (type == EXEC_DIRECTORY_LOGS)
|
||||
+ q = path_join(params->prefix[EXEC_DIRECTORY_CONFIGURATION], "log", context->directories[type].items[i].path);
|
||||
+ else
|
||||
+ assert_not_reached();
|
||||
+ if (!q) {
|
||||
+ r = -ENOMEM;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ r = laccess(q, F_OK);
|
||||
+ if (r >= 0) {
|
||||
+ /* It does exist! This hence looks like an update. Symlink the
|
||||
+ * configuration directory into the state directory. */
|
||||
+
|
||||
+ r = symlink_idempotent(q, p, /* make_relative= */ true);
|
||||
+ if (r < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
+ log_notice("Unit state directory %s missing but matching configuration directory %s exists, assuming update from systemd 253 or older, creating compatibility symlink.", p, q);
|
||||
+ continue;
|
||||
+ } else if (r != -ENOENT)
|
||||
+ log_warning_errno(r, "Unable to detect whether unit configuration directory '%s' exists, assuming not: %m", q);
|
||||
+
|
||||
+ } else if (r < 0)
|
||||
+ log_warning_errno(r, "Unable to detect whether unit state directory '%s' is missing, assuming it is: %m", p);
|
||||
+ }
|
||||
+
|
||||
if (exec_directory_is_private(context, type)) {
|
||||
/* So, here's one extra complication when dealing with DynamicUser=1 units. In that
|
||||
* case we want to avoid leaving a directory around fully accessible that is owned by
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index a5337594f7..9070dc0b1f 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -703,9 +703,9 @@ static int manager_setup_prefix(Manager *m) {
|
||||
|
||||
static const struct table_entry paths_user[_EXEC_DIRECTORY_TYPE_MAX] = {
|
||||
[EXEC_DIRECTORY_RUNTIME] = { SD_PATH_USER_RUNTIME, NULL },
|
||||
- [EXEC_DIRECTORY_STATE] = { SD_PATH_USER_CONFIGURATION, NULL },
|
||||
+ [EXEC_DIRECTORY_STATE] = { SD_PATH_USER_STATE_PRIVATE, NULL },
|
||||
[EXEC_DIRECTORY_CACHE] = { SD_PATH_USER_STATE_CACHE, NULL },
|
||||
- [EXEC_DIRECTORY_LOGS] = { SD_PATH_USER_CONFIGURATION, "log" },
|
||||
+ [EXEC_DIRECTORY_LOGS] = { SD_PATH_USER_STATE_PRIVATE, "log" },
|
||||
[EXEC_DIRECTORY_CONFIGURATION] = { SD_PATH_USER_CONFIGURATION, NULL },
|
||||
};
|
||||
|
||||
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
|
||||
index 1b267d4fdd..2e54f3b462 100644
|
||||
--- a/src/core/unit-printf.c
|
||||
+++ b/src/core/unit-printf.c
|
||||
@@ -207,8 +207,8 @@ int unit_full_printf_full(const Unit *u, const char *format, size_t max_length,
|
||||
* %C: the cache directory root (e.g. /var/cache or $XDG_CACHE_HOME)
|
||||
* %d: the credentials directory ($CREDENTIALS_DIRECTORY)
|
||||
* %E: the configuration directory root (e.g. /etc or $XDG_CONFIG_HOME)
|
||||
- * %L: the log directory root (e.g. /var/log or $XDG_CONFIG_HOME/log)
|
||||
- * %S: the state directory root (e.g. /var/lib or $XDG_CONFIG_HOME)
|
||||
+ * %L: the log directory root (e.g. /var/log or $XDG_STATE_HOME/log)
|
||||
+ * %S: the state directory root (e.g. /var/lib or $XDG_STATE_HOME)
|
||||
* %t: the runtime directory root (e.g. /run or $XDG_RUNTIME_DIR)
|
||||
*
|
||||
* %h: the homedir of the running user
|
||||
diff --git a/test/test-execute/exec-specifier-user.service b/test/test-execute/exec-specifier-user.service
|
||||
index ee0301a426..ab565fb4fb 100644
|
||||
--- a/test/test-execute/exec-specifier-user.service
|
||||
+++ b/test/test-execute/exec-specifier-user.service
|
||||
@@ -5,7 +5,7 @@ Description=Test for specifiers
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=sh -c 'test %t = $$XDG_RUNTIME_DIR'
|
||||
-ExecStart=sh -c 'test %S = %h/.config'
|
||||
+ExecStart=sh -c 'test %S = %h/.local/state'
|
||||
ExecStart=sh -c 'test %C = %h/.cache'
|
||||
-ExecStart=sh -c 'test %L = %h/.config/log'
|
||||
+ExecStart=sh -c 'test %L = %h/.local/state/log'
|
||||
ExecStart=sh -c 'test %E = %h/.config'
|
||||
@ -0,0 +1,92 @@
|
||||
From 381294403c49f78d10e48ed49f84256df36598c9 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 11:16:01 +0200
|
||||
Subject: [PATCH] execute: associate logs from setup_exec_directory() with the
|
||||
unit name
|
||||
|
||||
(cherry picked from commit 59dd2bbbb6fa4e5497b1cae17b76ee132f3107c1)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.c | 29 +++++++++++++++--------------
|
||||
1 file changed, 15 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 2adb4392f9..1e1247e702 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2298,6 +2298,7 @@ static int create_many_symlinks(const char *root, const char *source, char **sym
|
||||
}
|
||||
|
||||
static int setup_exec_directory(
|
||||
+ Unit *u,
|
||||
const ExecContext *context,
|
||||
const ExecParameters *params,
|
||||
uid_t uid,
|
||||
@@ -2389,13 +2390,13 @@ static int setup_exec_directory(
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
- log_notice("Unit state directory %s missing but matching configuration directory %s exists, assuming update from systemd 253 or older, creating compatibility symlink.", p, q);
|
||||
+ log_unit_notice(u, "Unit state directory %s missing but matching configuration directory %s exists, assuming update from systemd 253 or older, creating compatibility symlink.", p, q);
|
||||
continue;
|
||||
} else if (r != -ENOENT)
|
||||
- log_warning_errno(r, "Unable to detect whether unit configuration directory '%s' exists, assuming not: %m", q);
|
||||
+ log_unit_warning_errno(u, r, "Unable to detect whether unit configuration directory '%s' exists, assuming not: %m", q);
|
||||
|
||||
} else if (r < 0)
|
||||
- log_warning_errno(r, "Unable to detect whether unit state directory '%s' is missing, assuming it is: %m", p);
|
||||
+ log_unit_warning_errno(u, r, "Unable to detect whether unit state directory '%s' is missing, assuming it is: %m", p);
|
||||
}
|
||||
|
||||
if (exec_directory_is_private(context, type)) {
|
||||
@@ -2452,9 +2453,9 @@ static int setup_exec_directory(
|
||||
* it over. Most likely the service has been upgraded from one that didn't use
|
||||
* DynamicUser=1, to one that does. */
|
||||
|
||||
- log_info("Found pre-existing public %s= directory %s, migrating to %s.\n"
|
||||
- "Apparently, service previously had DynamicUser= turned off, and has now turned it on.",
|
||||
- exec_directory_type_to_string(type), p, pp);
|
||||
+ log_unit_info(u, "Found pre-existing public %s= directory %s, migrating to %s.\n"
|
||||
+ "Apparently, service previously had DynamicUser= turned off, and has now turned it on.",
|
||||
+ exec_directory_type_to_string(type), p, pp);
|
||||
|
||||
if (rename(p, pp) < 0) {
|
||||
r = -errno;
|
||||
@@ -2521,9 +2522,9 @@ static int setup_exec_directory(
|
||||
/* Hmm, apparently DynamicUser= was once turned on for this service,
|
||||
* but is no longer. Let's move the directory back up. */
|
||||
|
||||
- log_info("Found pre-existing private %s= directory %s, migrating to %s.\n"
|
||||
- "Apparently, service previously had DynamicUser= turned on, and has now turned it off.",
|
||||
- exec_directory_type_to_string(type), q, p);
|
||||
+ log_unit_info(u, "Found pre-existing private %s= directory %s, migrating to %s.\n"
|
||||
+ "Apparently, service previously had DynamicUser= turned on, and has now turned it off.",
|
||||
+ exec_directory_type_to_string(type), q, p);
|
||||
|
||||
if (unlink(p) < 0) {
|
||||
r = -errno;
|
||||
@@ -2556,10 +2557,10 @@ static int setup_exec_directory(
|
||||
|
||||
/* Still complain if the access mode doesn't match */
|
||||
if (((st.st_mode ^ context->directories[type].mode) & 07777) != 0)
|
||||
- log_warning("%s \'%s\' already exists but the mode is different. "
|
||||
- "(File system: %o %sMode: %o)",
|
||||
- exec_directory_type_to_string(type), context->directories[type].items[i].path,
|
||||
- st.st_mode & 07777, exec_directory_type_to_string(type), context->directories[type].mode & 07777);
|
||||
+ log_unit_warning(u, "%s \'%s\' already exists but the mode is different. "
|
||||
+ "(File system: %o %sMode: %o)",
|
||||
+ exec_directory_type_to_string(type), context->directories[type].items[i].path,
|
||||
+ st.st_mode & 07777, exec_directory_type_to_string(type), context->directories[type].mode & 07777);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -4589,7 +4590,7 @@ static int exec_child(
|
||||
needs_mount_namespace = exec_needs_mount_namespace(context, params, runtime);
|
||||
|
||||
for (ExecDirectoryType dt = 0; dt < _EXEC_DIRECTORY_TYPE_MAX; dt++) {
|
||||
- r = setup_exec_directory(context, params, uid, gid, dt, needs_mount_namespace, exit_status);
|
||||
+ r = setup_exec_directory(unit, context, params, uid, gid, dt, needs_mount_namespace, exit_status);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(unit, r, "Failed to set up special execution directory in %s: %m", params->prefix[dt]);
|
||||
}
|
||||
62
1315-execute-shorten-some-code-by-using-RET_NERRNO.patch
Normal file
62
1315-execute-shorten-some-code-by-using-RET_NERRNO.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 17119db763328e6b329cbd580f79472e26104040 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 11:19:12 +0200
|
||||
Subject: [PATCH] execute: shorten some code by using RET_NERRNO()
|
||||
|
||||
(cherry picked from commit db58f5de3d9f0eb4897c2781fc226307b7ac0a5e)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.c | 20 ++++++++------------
|
||||
1 file changed, 8 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 1e1247e702..b1f7eeca8a 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2457,10 +2457,9 @@ static int setup_exec_directory(
|
||||
"Apparently, service previously had DynamicUser= turned off, and has now turned it on.",
|
||||
exec_directory_type_to_string(type), p, pp);
|
||||
|
||||
- if (rename(p, pp) < 0) {
|
||||
- r = -errno;
|
||||
+ r = RET_NERRNO(rename(p, pp));
|
||||
+ if (r < 0)
|
||||
goto fail;
|
||||
- }
|
||||
} else {
|
||||
/* Otherwise, create the actual directory for the service */
|
||||
|
||||
@@ -2526,15 +2525,13 @@ static int setup_exec_directory(
|
||||
"Apparently, service previously had DynamicUser= turned on, and has now turned it off.",
|
||||
exec_directory_type_to_string(type), q, p);
|
||||
|
||||
- if (unlink(p) < 0) {
|
||||
- r = -errno;
|
||||
+ r = RET_NERRNO(unlink(p));
|
||||
+ if (r < 0)
|
||||
goto fail;
|
||||
- }
|
||||
|
||||
- if (rename(q, p) < 0) {
|
||||
- r = -errno;
|
||||
+ r = RET_NERRNO(rename(q, p));
|
||||
+ if (r < 0)
|
||||
goto fail;
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2550,10 +2547,9 @@ static int setup_exec_directory(
|
||||
* as in the common case it is not written to by a service, and shall
|
||||
* not be writable. */
|
||||
|
||||
- if (stat(p, &st) < 0) {
|
||||
- r = -errno;
|
||||
+ r = RET_NERRNO(stat(p, &st));
|
||||
+ if (r < 0)
|
||||
goto fail;
|
||||
- }
|
||||
|
||||
/* Still complain if the access mode doesn't match */
|
||||
if (((st.st_mode ^ context->directories[type].mode) & 07777) != 0)
|
||||
@ -0,0 +1,26 @@
|
||||
From f252ea93dbc029704c7c8fe408a60ee7effdc242 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 11:19:31 +0200
|
||||
Subject: [PATCH] execute: shorten code by making use of laccess() return code
|
||||
properly
|
||||
|
||||
(cherry picked from commit b93d24e07d903d5860f20ec97849760091348d98)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index b1f7eeca8a..0ae4640382 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2447,7 +2447,7 @@ static int setup_exec_directory(
|
||||
goto fail;
|
||||
|
||||
if (is_dir(p, false) > 0 &&
|
||||
- (laccess(pp, F_OK) < 0 && errno == ENOENT)) {
|
||||
+ (laccess(pp, F_OK) == -ENOENT)) {
|
||||
|
||||
/* Hmm, the private directory doesn't exist yet, but the normal one exists? If so, move
|
||||
* it over. Most likely the service has been upgraded from one that didn't use
|
||||
@ -0,0 +1,29 @@
|
||||
From 03efe234974d2511b04dc3733b21261a50fa6941 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 11:19:47 +0200
|
||||
Subject: [PATCH] execute: don't bother with chowning StateDirectory= and
|
||||
friends in user mode
|
||||
|
||||
(cherry picked from commit f5bb36dcfe71dab3f79e8e6133a2f4260d91f213)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
src/core/execute.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 0ae4640382..9e3da5315f 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2570,6 +2570,11 @@ static int setup_exec_directory(
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
+ /* Skip the rest (which deals with ownership) in user mode, since ownership changes are not
|
||||
+ * available to user code anyway */
|
||||
+ if (params->runtime_scope != RUNTIME_SCOPE_SYSTEM)
|
||||
+ continue;
|
||||
+
|
||||
/* Then, change the ownership of the whole tree, if necessary. When dynamic users are used we
|
||||
* drop the suid/sgid bits, since we really don't want SUID/SGID files for dynamic UID/GID
|
||||
* assignments to exist. */
|
||||
79
1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch
Normal file
79
1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From 9eefbd2ec116cad4dbf0df51acc095e44583e110 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Mon, 26 Jun 2023 23:23:21 +0200
|
||||
Subject: [PATCH] test: add test for new XDG_STATE_HOME handling
|
||||
|
||||
(cherry picked from commit 580a007bb6a192b5f821ace04f13694278b6618c)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
test/units/testsuite-23.statedir.sh | 60 +++++++++++++++++++++++++++++
|
||||
1 file changed, 60 insertions(+)
|
||||
create mode 100755 test/units/testsuite-23.statedir.sh
|
||||
|
||||
diff --git a/test/units/testsuite-23.statedir.sh b/test/units/testsuite-23.statedir.sh
|
||||
new file mode 100755
|
||||
index 0000000000..b592314a09
|
||||
--- /dev/null
|
||||
+++ b/test/units/testsuite-23.statedir.sh
|
||||
@@ -0,0 +1,60 @@
|
||||
+#!/usr/bin/env bash
|
||||
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
+# shellcheck disable=SC2235
|
||||
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
+set -eux
|
||||
+set -o pipefail
|
||||
+
|
||||
+# Test unit configuration/state/cache/log/runtime data cleanup
|
||||
+
|
||||
+export HOME=/root
|
||||
+export XDG_RUNTIME_DIR=/run/user/0
|
||||
+
|
||||
+systemctl start user@0.service
|
||||
+
|
||||
+( ! test -d "$HOME"/.local/state/foo)
|
||||
+( ! test -d "$HOME"/.config/foo)
|
||||
+
|
||||
+systemd-run --user -p StateDirectory=foo --wait /bin/true
|
||||
+
|
||||
+test -d "$HOME"/.local/state/foo
|
||||
+( ! test -L "$HOME"/.local/state/foo)
|
||||
+( ! test -d "$HOME"/.config/foo)
|
||||
+
|
||||
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
|
||||
+
|
||||
+test -d "$HOME"/.local/state/foo
|
||||
+( ! test -L "$HOME"/.local/state/foo)
|
||||
+test -d "$HOME"/.config/foo
|
||||
+
|
||||
+rmdir "$HOME"/.local/state/foo "$HOME"/.config/foo
|
||||
+
|
||||
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
|
||||
+
|
||||
+test -d "$HOME"/.local/state/foo
|
||||
+( ! test -L "$HOME"/.local/state/foo)
|
||||
+test -d "$HOME"/.config/foo
|
||||
+
|
||||
+rmdir "$HOME"/.local/state/foo "$HOME"/.config/foo
|
||||
+
|
||||
+# Now trigger an update scenario by creating a config dir first
|
||||
+systemd-run --user -p ConfigurationDirectory=foo --wait /bin/true
|
||||
+
|
||||
+( ! test -d "$HOME"/.local/state/foo)
|
||||
+test -d "$HOME"/.config/foo
|
||||
+
|
||||
+# This will look like an update and result in a symlink
|
||||
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
|
||||
+
|
||||
+test -d "$HOME"/.local/state/foo
|
||||
+test -L "$HOME"/.local/state/foo
|
||||
+test -d "$HOME"/.config/foo
|
||||
+
|
||||
+test "$(readlink "$HOME"/.local/state/foo)" = ../../.config/foo
|
||||
+
|
||||
+# Check that this will work safely a second time
|
||||
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
|
||||
+
|
||||
+rm "$HOME"/.local/state/foo
|
||||
+rmdir "$HOME"/.config/foo
|
||||
54
1319-man-mention-the-newly-added-XDG_STATE_HOME.patch
Normal file
54
1319-man-mention-the-newly-added-XDG_STATE_HOME.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From 8ff3fbaf94ef1d179171d528a2d595ba9a2015e4 Mon Sep 17 00:00:00 2001
|
||||
From: Franklin Yu <franklinyu@google.com>
|
||||
Date: Thu, 25 May 2023 22:06:54 -0700
|
||||
Subject: [PATCH] man: mention the newly-added XDG_STATE_HOME
|
||||
|
||||
The description is copied from config-home.
|
||||
|
||||
Taken from: #27795
|
||||
|
||||
(cherry picked from commit b4d6bc63e602048188896110a585aa7de1c70c9b)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
man/file-hierarchy.xml | 20 +++++++++++++-------
|
||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml
|
||||
index 4961f019f0..6943f386bc 100644
|
||||
--- a/man/file-hierarchy.xml
|
||||
+++ b/man/file-hierarchy.xml
|
||||
@@ -518,13 +518,10 @@
|
||||
<varlistentry>
|
||||
<term><filename>~/.config/</filename></term>
|
||||
|
||||
- <listitem><para>Application configuration and state. When a
|
||||
- new user is created, this directory will be empty or not exist
|
||||
- at all. Applications should fall back to defaults should their
|
||||
- configuration or state in this directory be missing. If an
|
||||
- application finds <varname>$XDG_CONFIG_HOME</varname> set, it
|
||||
- should use the directory specified in it instead of this
|
||||
- directory.</para></listitem>
|
||||
+ <listitem><para>Application configuration. When a new user is created, this directory will be empty
|
||||
+ or not exist at all. Applications should fall back to defaults should their configuration in this
|
||||
+ directory be missing. If an application finds <varname>$XDG_CONFIG_HOME</varname> set, it should use
|
||||
+ the directory specified in it instead of this directory.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -570,6 +567,15 @@
|
||||
directory.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
+ <varlistentry>
|
||||
+ <term><filename>~/.local/state/</filename></term>
|
||||
+
|
||||
+ <listitem><para>Application state. When a new user is created, this directory will be empty or not
|
||||
+ exist at all. Applications should fall back to defaults should their state in this directory be
|
||||
+ missing. If an application finds <varname>$XDG_STATE_HOME</varname> set, it should use the directory
|
||||
+ specified in it instead of this directory.</para></listitem>
|
||||
+ </varlistentry>
|
||||
+
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
96
1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch
Normal file
96
1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch
Normal file
@ -0,0 +1,96 @@
|
||||
From 33f04ca8a23c0fcc2d4260958c3185f4fc3d3d66 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 10:28:44 +0200
|
||||
Subject: [PATCH] man: rebreak lines in file-hierarchy(7) a bit
|
||||
|
||||
(Does not change a single word, just rebreaks a bunch of paragraphs
|
||||
matching our current line breaking rules)
|
||||
|
||||
(cherry picked from commit fa1d34825a9b410275e716b9b70f4fca02c71ba9)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
man/file-hierarchy.xml | 47 ++++++++++++++++--------------------------
|
||||
1 file changed, 18 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml
|
||||
index 6943f386bc..6104324519 100644
|
||||
--- a/man/file-hierarchy.xml
|
||||
+++ b/man/file-hierarchy.xml
|
||||
@@ -505,13 +505,10 @@
|
||||
<varlistentry>
|
||||
<term><filename>~/.cache/</filename></term>
|
||||
|
||||
- <listitem><para>Persistent user cache data. User programs may
|
||||
- place non-essential data in this directory. Flushing this
|
||||
- directory should have no effect on operation of programs,
|
||||
- except for increased runtimes necessary to rebuild these
|
||||
- caches. If an application finds
|
||||
- <varname>$XDG_CACHE_HOME</varname> set, it should use the
|
||||
- directory specified in it instead of this
|
||||
+ <listitem><para>Persistent user cache data. User programs may place non-essential data in this
|
||||
+ directory. Flushing this directory should have no effect on operation of programs, except for
|
||||
+ increased runtimes necessary to rebuild these caches. If an application finds
|
||||
+ <varname>$XDG_CACHE_HOME</varname> set, it should use the directory specified in it instead of this
|
||||
directory.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -527,44 +524,36 @@
|
||||
<varlistentry>
|
||||
<term><filename>~/.local/bin/</filename></term>
|
||||
|
||||
- <listitem><para>Executables that shall appear in the user's
|
||||
- <varname>$PATH</varname> search path. It is recommended not to
|
||||
- place executables in this directory that are not useful for
|
||||
- invocation from a shell; these should be placed in a
|
||||
- subdirectory of <filename>~/.local/lib/</filename> instead.
|
||||
- Care should be taken when placing architecture-dependent
|
||||
- binaries in this place, which might be problematic if the home
|
||||
- directory is shared between multiple hosts with different
|
||||
+ <listitem><para>Executables that shall appear in the user's <varname>$PATH</varname> search path. It
|
||||
+ is recommended not to place executables in this directory that are not useful for invocation from a
|
||||
+ shell; these should be placed in a subdirectory of <filename>~/.local/lib/</filename> instead. Care
|
||||
+ should be taken when placing architecture-dependent binaries in this place, which might be
|
||||
+ problematic if the home directory is shared between multiple hosts with different
|
||||
architectures.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><filename>~/.local/lib/</filename></term>
|
||||
|
||||
- <listitem><para>Static, private vendor data that is compatible
|
||||
- with all architectures.</para></listitem>
|
||||
+ <listitem><para>Static, private vendor data that is compatible with all
|
||||
+ architectures.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><filename>~/.local/lib/<replaceable>arch-id</replaceable>/</filename></term>
|
||||
|
||||
- <listitem><para>Location for placing public dynamic libraries.
|
||||
- The architecture identifier to use is defined on <ulink
|
||||
- url="https://wiki.debian.org/Multiarch/Tuples">Multiarch
|
||||
- Architecture Specifiers (Tuples)</ulink>
|
||||
- list.</para></listitem>
|
||||
+ <listitem><para>Location for placing public dynamic libraries. The architecture identifier to use is
|
||||
+ defined on <ulink url="https://wiki.debian.org/Multiarch/Tuples">Multiarch Architecture Specifiers
|
||||
+ (Tuples)</ulink> list.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><filename>~/.local/share/</filename></term>
|
||||
|
||||
- <listitem><para>Resources shared between multiple packages,
|
||||
- such as fonts or artwork. Usually, the precise location and
|
||||
- format of files stored below this directory is subject to
|
||||
- specifications that ensure interoperability. If an application
|
||||
- finds <varname>$XDG_DATA_HOME</varname> set, it should use the
|
||||
- directory specified in it instead of this
|
||||
- directory.</para></listitem>
|
||||
+ <listitem><para>Resources shared between multiple packages, such as fonts or artwork. Usually, the
|
||||
+ precise location and format of files stored below this directory is subject to specifications that
|
||||
+ ensure interoperability. If an application finds <varname>$XDG_DATA_HOME</varname> set, it should use
|
||||
+ the directory specified in it instead of this directory.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
34
1321-man-properly-close-XML-tags.patch
Normal file
34
1321-man-properly-close-XML-tags.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 7fddcfa3d2c7b4c77c6b325a3a6779dea7afa2ba Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 10:32:11 +0200
|
||||
Subject: [PATCH] man: properly close XML tags
|
||||
|
||||
(cherry picked from commit cc8fdd5d307a620700d4729d74143ca434f0707c)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
man/systemd.exec.xml | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
|
||||
index cce0426ed4..6f172994f7 100644
|
||||
--- a/man/systemd.exec.xml
|
||||
+++ b/man/systemd.exec.xml
|
||||
@@ -1393,7 +1393,7 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
|
||||
The second parameter will be interpreted as a destination path that will be created as a symlink to the directory.
|
||||
The symlinks will be created after any <varname>BindPaths=</varname> or <varname>TemporaryFileSystem=</varname>
|
||||
options have been set up, to make ephemeral symlinking possible. The same source can have multiple symlinks, by
|
||||
- using the same first parameter, but a different second parameter.</para></listitem>
|
||||
+ using the same first parameter, but a different second parameter.</para>
|
||||
|
||||
<para>The directories defined by these options are always created under the standard paths used by systemd
|
||||
(<filename>/var/</filename>, <filename>/run/</filename>, <filename>/etc/</filename>, …). If the service needs
|
||||
@@ -1429,7 +1429,7 @@ StateDirectory=aaa/bbb ccc</programlisting>
|
||||
<programlisting>RuntimeDirectory=foo:bar foo:baz</programlisting>
|
||||
the service manager creates <filename index='false'>/run/foo</filename> (if it does not exist), and
|
||||
<filename index='false'>/run/bar</filename> plus <filename index='false'>/run/baz</filename> as symlinks to
|
||||
- <filename index='false'>/run/foo</filename>.</para>
|
||||
+ <filename index='false'>/run/foo</filename>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@ -0,0 +1,51 @@
|
||||
From cf207cd9f09bbab5482c88d6032119ac7ca19b10 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 27 Jun 2023 13:14:17 +0200
|
||||
Subject: [PATCH] tmpfiles: teach tmpfiles the new XDG_STATE_HOME variable too
|
||||
|
||||
(cherry picked from commit b50aadaff22f9b3ad3bbcbfd2edd661456a5b4bf)
|
||||
|
||||
Resolves: RHEL-137252
|
||||
---
|
||||
man/tmpfiles.d.xml | 4 ++--
|
||||
src/tmpfiles/tmpfiles.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml
|
||||
index 595b9f6934..d3aa4c4d86 100644
|
||||
--- a/man/tmpfiles.d.xml
|
||||
+++ b/man/tmpfiles.d.xml
|
||||
@@ -722,7 +722,7 @@ d /tmp/foo/bar - - - bmA:1h -</programlisting></para>
|
||||
<row>
|
||||
<entry><literal>%L</literal></entry>
|
||||
<entry>System or user log directory</entry>
|
||||
- <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CONFIG_HOME</varname> with <filename index="false">/log</filename> appended, and <filename>/var/log</filename> otherwise.</entry>
|
||||
+ <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_STATE_HOME</varname> with <filename index="false">/log</filename> appended, and <filename>/var/log</filename> otherwise.</entry>
|
||||
</row>
|
||||
<xi:include href="standard-specifiers.xml" xpointer="m"/>
|
||||
<xi:include href="standard-specifiers.xml" xpointer="M"/>
|
||||
@@ -730,7 +730,7 @@ d /tmp/foo/bar - - - bmA:1h -</programlisting></para>
|
||||
<row>
|
||||
<entry><literal>%S</literal></entry>
|
||||
<entry>System or user state directory</entry>
|
||||
- <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CONFIG_HOME</varname>, and <filename>/var/lib</filename> otherwise.</entry>
|
||||
+ <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_STATE_HOME</varname>, and <filename>/var/lib</filename> otherwise.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%t</literal></entry>
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index 101e1a41a7..510440efb6 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -249,9 +249,9 @@ static int specifier_directory(char specifier, const void *data, const char *roo
|
||||
|
||||
static const struct table_entry paths_user[] = {
|
||||
[DIRECTORY_RUNTIME] = { SD_PATH_USER_RUNTIME },
|
||||
- [DIRECTORY_STATE] = { SD_PATH_USER_CONFIGURATION },
|
||||
+ [DIRECTORY_STATE] = { SD_PATH_USER_STATE_PRIVATE },
|
||||
[DIRECTORY_CACHE] = { SD_PATH_USER_STATE_CACHE },
|
||||
- [DIRECTORY_LOGS] = { SD_PATH_USER_CONFIGURATION, "log" },
|
||||
+ [DIRECTORY_LOGS] = { SD_PATH_USER_STATE_PRIVATE, "log" },
|
||||
};
|
||||
|
||||
const struct table_entry *paths;
|
||||
74
1323-test-use-XDG_STATE_HOME-for-S-and-L.patch
Normal file
74
1323-test-use-XDG_STATE_HOME-for-S-and-L.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From 2ad5e04b95c6e6948669cc45854f27a5f7ff6afb Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Thu, 20 Jul 2023 16:07:58 +0900
|
||||
Subject: [PATCH] test: use XDG_STATE_HOME for %S and %L
|
||||
|
||||
This fixes the test failure when invoked by a user.
|
||||
===
|
||||
Running ./systemd-tmpfiles --user on 'f /tmp/test-systemd-tmpfiles.1foag_ur/test-content.n_9r_xhm/arg - - - - %S'
|
||||
expect: '/home/watanabe/.config'
|
||||
actual: '/home/watanabe/.local/state'
|
||||
Traceback (most recent call last):
|
||||
File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 233, in <module>
|
||||
test_valid_specifiers(user=True)
|
||||
File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 135, in test_valid_specifiers
|
||||
test_content('f {} - - - - %S',
|
||||
File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 88, in test_content
|
||||
assert content == expected
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
AssertionError
|
||||
===
|
||||
|
||||
This also makes the test uses fallback paths.
|
||||
|
||||
Follow-up for b50aadaff22f9b3ad3bbcbfd2edd661456a5b4bf.
|
||||
|
||||
(cherry picked from commit b0efbe9b81cdae8544fbc58422f81513adc68d9a)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
test/test-systemd-tmpfiles.py | 29 +++++++++++++++--------------
|
||||
1 file changed, 15 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py
|
||||
index af9ff9bf93..0d7e288681 100755
|
||||
--- a/test/test-systemd-tmpfiles.py
|
||||
+++ b/test/test-systemd-tmpfiles.py
|
||||
@@ -118,22 +118,23 @@ def test_valid_specifiers(*, user):
|
||||
xdg_runtime_dir if user else '/run',
|
||||
user=user)
|
||||
|
||||
- xdg_config_home = os.getenv('XDG_CONFIG_HOME')
|
||||
- if xdg_config_home is not None or not user:
|
||||
- test_content('f {} - - - - %S',
|
||||
- xdg_config_home if user else '/var/lib',
|
||||
- user=user)
|
||||
+ xdg_state_home = os.getenv('XDG_STATE_HOME')
|
||||
+ if xdg_state_home is None and user:
|
||||
+ xdg_state_home = os.path.join(home, ".local/state")
|
||||
+ test_content('f {} - - - - %S',
|
||||
+ xdg_state_home if user else '/var/lib',
|
||||
+ user=user)
|
||||
|
||||
xdg_cache_home = os.getenv('XDG_CACHE_HOME')
|
||||
- if xdg_cache_home is not None or not user:
|
||||
- test_content('f {} - - - - %C',
|
||||
- xdg_cache_home if user else '/var/cache',
|
||||
- user=user)
|
||||
-
|
||||
- if xdg_config_home is not None or not user:
|
||||
- test_content('f {} - - - - %L',
|
||||
- xdg_config_home + '/log' if user else '/var/log',
|
||||
- user=user)
|
||||
+ if xdg_cache_home is None and user:
|
||||
+ xdg_cache_home = os.path.join(home, ".cache")
|
||||
+ test_content('f {} - - - - %C',
|
||||
+ xdg_cache_home if user else '/var/cache',
|
||||
+ user=user)
|
||||
+
|
||||
+ test_content('f {} - - - - %L',
|
||||
+ os.path.join(xdg_state_home, 'log') if user else '/var/log',
|
||||
+ user=user)
|
||||
|
||||
test_content('f {} - - - - %%', '%', user=user)
|
||||
|
||||
41
1324-man-fully-adopt-.local-state.patch
Normal file
41
1324-man-fully-adopt-.local-state.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 7923e6b42174e74f01e6a41734783cf4fb4e85d2 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 3 Jul 2024 10:18:37 +0200
|
||||
Subject: [PATCH] man: fully adopt ~/.local/state/
|
||||
|
||||
The XDG base dir spec adopted ~/.local/state/ as a thing a while back,
|
||||
and we updated our docs in b4d6bc63e602048188896110a585aa7de1c70c9b, but
|
||||
forgot to to update the table at the bottom to fully reflect the update.
|
||||
Fix that.
|
||||
|
||||
(cherry picked from commit 72a6296b16a75d4e26eec972f2999e69c9967b9d)
|
||||
|
||||
Related: RHEL-137252
|
||||
---
|
||||
man/file-hierarchy.xml | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml
|
||||
index 6104324519..7e059f1273 100644
|
||||
--- a/man/file-hierarchy.xml
|
||||
+++ b/man/file-hierarchy.xml
|
||||
@@ -804,7 +804,7 @@
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><filename>~/.config/<replaceable>package</replaceable>/</filename></entry>
|
||||
- <entry>User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing.</entry>
|
||||
+ <entry>User-specific configuration for the package. It is required to default to safe fallbacks if this configuration is missing.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><filename><varname>$XDG_RUNTIME_DIR</varname>/<replaceable>package</replaceable>/</filename></entry>
|
||||
@@ -814,6 +814,10 @@
|
||||
<entry><filename>~/.cache/<replaceable>package</replaceable>/</filename></entry>
|
||||
<entry>Persistent cache data of the package. If this directory is flushed, the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.</entry>
|
||||
</row>
|
||||
+ <row>
|
||||
+ <entry><filename>~/.local/state/<replaceable>package</replaceable>/</filename></entry>
|
||||
+ <entry>Persistent state data of the package.</entry>
|
||||
+ </row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
52
systemd.spec
52
systemd.spec
@ -21,7 +21,7 @@
|
||||
Name: systemd
|
||||
Url: https://systemd.io
|
||||
Version: 252
|
||||
Release: 65%{?dist}
|
||||
Release: 66%{?dist}
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
@ -1383,6 +1383,30 @@ Patch1297: 1297-pam_systemd-honor-session-class-provided-via-PAM-env.patch
|
||||
Patch1298: 1298-core-fix-array-size-in-unit_log_resources.patch
|
||||
Patch1299: 1299-pid1-add-env-var-to-override-default-mount-rate-limi.patch
|
||||
Patch1300: 1300-pid1-add-env-var-to-override-default-mount-rate-limi.patch
|
||||
Patch1301: 1301-core-service-fix-error-cause-in-the-log.patch
|
||||
Patch1302: 1302-fstab-generator-drop-assertions-for-mount-opts.patch
|
||||
Patch1303: 1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch
|
||||
Patch1304: 1304-core-reorder-systemd-arguments-on-reexec.patch
|
||||
Patch1305: 1305-basic-add-RuntimeScope-enum.patch
|
||||
Patch1306: 1306-runtime-scope-add-helper-that-turns-RuntimeScope-enu.patch
|
||||
Patch1307: 1307-sd-path-add-support-for-XDG_STATE_HOME.patch
|
||||
Patch1308: 1308-sd-path-bring-spacing-in-sd-path.h-and-systemd-path-.patch
|
||||
Patch1309: 1309-path-tool-add-some-basic-ansi-highlighing.patch
|
||||
Patch1310: 1310-execude-include-RuntimeScope-field-in-ExecParameters.patch
|
||||
Patch1311: 1311-execute-remove-redundant-assignment.patch
|
||||
Patch1312: 1312-execute-when-recursively-chowning-StateDirectory-whe.patch
|
||||
Patch1313: 1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch
|
||||
Patch1314: 1314-execute-associate-logs-from-setup_exec_directory-wit.patch
|
||||
Patch1315: 1315-execute-shorten-some-code-by-using-RET_NERRNO.patch
|
||||
Patch1316: 1316-execute-shorten-code-by-making-use-of-laccess-return.patch
|
||||
Patch1317: 1317-execute-don-t-bother-with-chowning-StateDirectory-an.patch
|
||||
Patch1318: 1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch
|
||||
Patch1319: 1319-man-mention-the-newly-added-XDG_STATE_HOME.patch
|
||||
Patch1320: 1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch
|
||||
Patch1321: 1321-man-properly-close-XML-tags.patch
|
||||
Patch1322: 1322-tmpfiles-teach-tmpfiles-the-new-XDG_STATE_HOME-varia.patch
|
||||
Patch1323: 1323-test-use-XDG_STATE_HOME-for-S-and-L.patch
|
||||
Patch1324: 1324-man-fully-adopt-.local-state.patch
|
||||
|
||||
# Downstream-only patches (9000–9999)
|
||||
|
||||
@ -2260,6 +2284,32 @@ systemd-hwdb update &>/dev/null || :
|
||||
%{_prefix}/lib/dracut/modules.d/70rhel-net-naming-sysattrs/*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 23 2026 systemd maintenance team <systemd-maint@redhat.com> - 252-66
|
||||
- core/service: fix error cause in the log (RHEL-138414)
|
||||
- fstab-generator: drop assertions for mount opts (RHEL-92752)
|
||||
- fstab-generator: fix options in systemd.mount-extra= arg (RHEL-92752)
|
||||
- core: reorder systemd arguments on reexec (RHEL-111135)
|
||||
- basic: add RuntimeScope enum (RHEL-137252)
|
||||
- runtime-scope: add helper that turns RuntimeScope enum into --system/--user string (RHEL-137252)
|
||||
- sd-path: add support for XDG_STATE_HOME (RHEL-137252)
|
||||
- sd-path: bring spacing in sd-path.h and systemd-path tool in sync (RHEL-137252)
|
||||
- path tool: add some basic ansi highlighing (RHEL-137252)
|
||||
- execude: include RuntimeScope field in ExecParameters (RHEL-137252)
|
||||
- execute: remove redundant assignment (RHEL-137252)
|
||||
- execute: when recursively chowning StateDirectory= when spawning services, follow initial symlink (RHEL-137252)
|
||||
- execute: add support for XDG_STATE_HOME for placing service state data in --user mode (RHEL-137252)
|
||||
- execute: associate logs from setup_exec_directory() with the unit name (RHEL-137252)
|
||||
- execute: shorten some code by using RET_NERRNO() (RHEL-137252)
|
||||
- execute: shorten code by making use of laccess() return code properly (RHEL-137252)
|
||||
- execute: don't bother with chowning StateDirectory= and friends in user mode (RHEL-137252)
|
||||
- test: add test for new XDG_STATE_HOME handling (RHEL-137252)
|
||||
- man: mention the newly-added XDG_STATE_HOME (RHEL-137252)
|
||||
- man: rebreak lines in file-hierarchy(7) a bit (RHEL-137252)
|
||||
- man: properly close XML tags (RHEL-137252)
|
||||
- tmpfiles: teach tmpfiles the new XDG_STATE_HOME variable too (RHEL-137252)
|
||||
- test: use XDG_STATE_HOME for %%S and %%L (RHEL-137252)
|
||||
- man: fully adopt ~/.local/state/ (RHEL-137252)
|
||||
|
||||
* Wed Feb 18 2026 systemd maintenance team <systemd-maint@redhat.com> - 252-65
|
||||
- update specfile and sources after renaming rhel-net-naming-sysattrs to net-naming-sysattrs (RHEL-150622)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user