From: Matthias Lisin <6209465+ml-@users.noreply.github.com>
Date: Wed, 26 Jun 2024 02:12:42 +0000 (+0200)
Subject: tmpfiles: use common macro for a set of specifiers
X-Git-Tag: v257-rc1~1043^2~1
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=282bda46f1fc040fa5b1689bf7dbb987f607a47f;p=thirdparty%2Fsystemd.git
tmpfiles: use common macro for a set of specifiers
This adds %q, %A and %M specifiers to tmpfiles:
- %A and %M were previously added to tmpfiles.d man page, but not to specifier_table
- %q is added via COMMON_SYSTEM_SPECIFIERS
---
diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml
index c89706862f9..2b260da68be 100644
--- a/man/tmpfiles.d.xml
+++ b/man/tmpfiles.d.xml
@@ -764,6 +764,7 @@ d /tmp/foo/bar - - - bmA:1h -
+
%S
System or user state directory
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 5841db293e7..59b48492ab7 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -3610,17 +3610,6 @@ static int parse_line(
assert(buffer);
const Specifier specifier_table[] = {
- { 'a', specifier_architecture, NULL },
- { 'b', specifier_boot_id, NULL },
- { 'B', specifier_os_build_id, NULL },
- { 'H', specifier_hostname, NULL },
- { 'l', specifier_short_hostname, NULL },
- { 'm', specifier_machine_id, NULL },
- { 'o', specifier_os_id, NULL },
- { 'v', specifier_kernel_release, NULL },
- { 'w', specifier_os_version_id, NULL },
- { 'W', specifier_os_variant_id, NULL },
-
{ 'h', specifier_user_home, NULL },
{ 'C', specifier_directory, UINT_TO_PTR(DIRECTORY_CACHE) },
@@ -3628,6 +3617,7 @@ static int parse_line(
{ 'S', specifier_directory, UINT_TO_PTR(DIRECTORY_STATE) },
{ 't', specifier_directory, UINT_TO_PTR(DIRECTORY_RUNTIME) },
+ COMMON_SYSTEM_SPECIFIERS,
COMMON_CREDS_SPECIFIERS(arg_runtime_scope),
COMMON_TMP_SPECIFIERS,
{}
diff --git a/test/units/TEST-22-TMPFILES.20.sh b/test/units/TEST-22-TMPFILES.20.sh
new file mode 100755
index 00000000000..65d2b331617
--- /dev/null
+++ b/test/units/TEST-22-TMPFILES.20.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# Test specifiers
+set -eux
+
+rm -rf /tmp/specifiers
+
+root='/tmp/specifiers/root'
+mkdir -p $root/etc
+cat >$root/etc/os-release <