Compare commits

...

15 Commits

Author SHA1 Message Date
Luca Boccassi 9cebd9362b
Merge b96f2d71f8 into d99198819c 2024-11-21 22:55:43 -08:00
Yu Watanabe d99198819c core/service: service_add_fd_store() consumes passed fd
Without this change, the fd is closed twice on failure.

Fixes a bug introduced by dff9808a62.

Fixes #35288.
2024-11-22 04:15:51 +01:00
Tobias Zimmermann f70e5620b6 hwdb: Add quirk for Logitech MX Keys for Mac
The KEY_102ND and KEY_GRAVE keys are switched on the
Logitech MX Keys for Mac, so switch them back
2024-11-21 21:16:07 +01:00
Zbigniew Jędrzejewski-Szmek 3127c71bf4
Keep tmpfiles/legacy.conf even if SysVInit support is dropped (#35278) 2024-11-21 21:13:50 +01:00
Yuri Chornoivan b153eebfb2 po: Translated using Weblate (Ukrainian)
Currently translated at 100.0% (257 of 257 strings)

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/uk/
Translation: systemd/main
2024-11-22 05:02:16 +09:00
Zbigniew Jędrzejewski-Szmek 2c06e40ae9 tmpfiles: add period at end of the sentence
The license that is immediately above is properly punctuated and it looks
sloppy when our line below isn't.
2024-11-21 18:35:18 +01:00
Zbigniew Jędrzejewski-Szmek 5ca9149464 tmpfiles: narrow scope of HAVE_SYSV_COMPAT condition for legacy.conf
That file contains a bunch of entries of which only some are related to SysV.
The rest are just "traditional APIs" that need to stay. In particular,
/var/lock a.k.a. /run/lock is used by many programs (LVM, iscsi, alsactl).
Similarly, the README about /var/log is something that should stay as long as
we have people migrating from older systems or using the copiuos documentation
that mentions /var/log/messages.txt on the Internet.

/var/lock/subsys is only used by sysvinit, and our code to support /forcefsck,
/fastboot, and /forcequotacheck is conditionalized on HAVE_SYSV_COMPAT, so
conditionalize those here on HAVE_SYSV_COMPAT too.
2024-11-21 18:32:46 +01:00
Luca Boccassi b96f2d71f8 CI: add unit test run without proc/sys/dev 2024-11-13 14:23:44 +00:00
Luca Boccassi d47d93eb7c test-loop-block: return -77 on skip in more places 2024-11-13 14:23:44 +00:00
Luca Boccassi 395910cfda test: skip manually when procfs is not mounted in remaining tests
Some tests, like the journald ones, do not use the TEST() macro for
one reason or another, so manually check procfs where needed.
2024-11-13 14:23:20 +00:00
Luca Boccassi 3a7f1f3b14 test: introduce .proc_mounted unit test property
Following the model of the existing .sd_booted property, which checks
that the system was booted with systemd and skips the unit test if it
was not, add a .proc_mounted property that checks whether /proc/ is
available and accessible, and skips otherwise.
2024-11-13 14:21:28 +00:00
Luca Boccassi 48b13aa7b2 test: load testdata from current directory if the binary path cannot be obtained
If /proc/ is not available, try to search in the current dir as
a fallback
2024-11-13 14:21:28 +00:00
Luca Boccassi ef0247684c test: check for procfs in test scripts that need it 2024-11-13 14:21:28 +00:00
Luca Boccassi cd65a11c8d battery-check: parse options before checking for kernel command line
Otherwise --help/--version/etc which exit immediately will do pointless work
2024-11-13 14:21:28 +00:00
Luca Boccassi 3d8b2bccd2 tools/dbus_exporter: set LD_LIBRARY_PATH if procfs is not available
The tools find the libs via proc
2024-11-13 14:21:28 +00:00
85 changed files with 232 additions and 131 deletions

View File

@ -25,6 +25,7 @@ ADDITIONAL_DEPS=(
python3-pytest
rpm
zstd
debootstrap
)
function info() {
@ -128,6 +129,18 @@ for phase in "${PHASES[@]}"; do
(set +x; while :; do echo -ne "\n[WATCHDOG] $(date)\n"; sleep 30; done) &
meson test --timeout-multiplier=3 -C build --print-errorlogs
;;
RUN_NOPROC)
debootstrap testing testing
chroot testing mkdir -p /tmp/repo/
chroot testing sh -c "echo 'deb-src http://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing-src.list"
chroot testing apt-get update
chroot testing apt-get build-dep -y systemd
mount --bind . testing/tmp/repo
chroot testing sh -c 'cd /tmp/repo; meson -Dnobody-group=nogroup -Dslow-tests=true build'
chroot testing sh -c 'cd /tmp/repo/build; ninja -v'
chroot testing sh -c 'cd /tmp/repo/build; meson test --print-errorlogs'
umount --lazy testing/tmp/repo
;;
CLEANUP)
info "Cleanup phase"
if [ ! -f /etc/machine-id ] && [ -w /etc/machine-id.bak ]; then

View File

@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_RELEASE, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS]
run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_RELEASE, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS, NOPROC]
cryptolib: [auto]
include:
- run_phase: GCC

View File

@ -1438,6 +1438,11 @@ evdev:input:b0003v046DpC309*
KEYBOARD_KEY_c01b6=images # My Pictures (F11)
KEYBOARD_KEY_c01b7=audio # My Music (F12)
# Logitech MX Keys for Mac
evdev:input:b0003v046Dp4092*
KEYBOARD_KEY_70035=102nd # '<' key
KEYBOARD_KEY_70064=grave # '^' key
###########################################################
# Maxdata
###########################################################

View File

@ -9,8 +9,8 @@ msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-06 14:42+0000\n"
"PO-Revision-Date: 2024-11-20 19:13+0000\n"
"Last-Translator: Dmytro Markevych <hotr1pak@gmail.com>\n"
"PO-Revision-Date: 2024-11-21 19:38+0000\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <https://translate.fedoraproject.org/projects/"
"systemd/main/uk/>\n"
"Language: uk\n"
@ -120,11 +120,11 @@ msgstr "Для оновлення домашньої теки користува
#: src/home/org.freedesktop.home1.policy:53
msgid "Update your home area"
msgstr "Оновіть свій домашній простір"
msgstr "Оновлення домашньої області"
#: src/home/org.freedesktop.home1.policy:54
msgid "Authentication is required to update your home area."
msgstr "Для оновлення домашньої області потрібна автентифікація."
msgstr "Для оновлення домашньої області слід пройти розпізнавання."
#: src/home/org.freedesktop.home1.policy:63
msgid "Resize a home area"
@ -1215,7 +1215,7 @@ msgstr "Керування додатковими функціями"
#: src/sysupdate/org.freedesktop.sysupdate1.policy:76
msgid "Authentication is required to manage optional features"
msgstr "Для керування додатковими функціями потрібна автентифікація"
msgstr "Для керування додатковими можливостями слід пройти розпізнавання"
#: src/timedate/org.freedesktop.timedate1.policy:22
msgid "Set system time"

View File

@ -123,14 +123,14 @@ static int run(int argc, char *argv[]) {
log_setup();
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
if (r < 0)
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
r = parse_argv(argc, argv);
if (r <= 0)
return r;
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
if (r < 0)
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
if (!arg_doit) {
log_info("Checking battery status and AC power existence is disabled by the kernel command line, skipping execution.");
return 0;

View File

@ -39,7 +39,7 @@ static void test_get_bcd_title_one(
assert_se(!title);
}
TEST(get_bcd_title) {
TEST(get_bcd_title, .proc_mounted = true) {
test_get_bcd_title_one("test-bcd/win10.bcd.zst", u"Windows 10", sizeof(u"Windows 10"));
test_get_bcd_title_one("test-bcd/description-bad-type.bcd.zst", NULL, 0);
@ -52,7 +52,7 @@ TEST(get_bcd_title) {
test_get_bcd_title_one("test-bcd/empty.bcd.zst", NULL, 0);
}
TEST(base_block) {
TEST(base_block, .proc_mounted = true) {
size_t len;
BaseBlock backup;
uint8_t *bcd_base;
@ -89,7 +89,7 @@ TEST(base_block) {
*bcd = backup;
}
TEST(bad_bcd) {
TEST(bad_bcd, .proc_mounted = true) {
size_t len;
uint8_t *hbins;
uint32_t offset;

View File

@ -3426,14 +3426,12 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
return 0;
}
r = service_add_fd_store(s, fd, fdn, do_poll);
r = service_add_fd_store(s, TAKE_FD(fd), fdn, do_poll);
if (r < 0) {
log_unit_debug_errno(u, r,
"Failed to store deserialized fd '%s', ignoring: %m", fdn);
return 0;
}
TAKE_FD(fd);
} else if (streq(key, "extra-fd")) {
_cleanup_free_ char *fdv = NULL, *fdn = NULL;
_cleanup_close_ int fd = -EBADF;

View File

@ -10,6 +10,7 @@
#include "fd-util.h"
#include "fuzz.h"
#include "json-util.h"
#include "stat-util.h"
#include "strv.h"
static int json_dispatch_config(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) {
@ -90,6 +91,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (outside_size_range(size, 0, 65536))
return 0;
if (proc_mounted() <= 0)
return EXIT_TEST_SKIP;
fuzz_setup_logging();
assert_se(datadup = memdup_suffix0(data, size));

View File

@ -4,6 +4,11 @@
set -eux
set -o pipefail
if ! mountpoint /proc; then
echo "procfs is not available, skipping"
exit 77
fi
export SYSTEMD_LOG_LEVEL=debug
kernel_install="${1:?}"

View File

@ -9,6 +9,7 @@
#include "fuzz.h"
#include "path-util.h"
#include "rm-rf.h"
#include "stat-util.h"
#include "tmpfile-util.h"
/* stub out network so that the server doesn't send */
@ -74,6 +75,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < sizeof(DHCPMessage))
return 0;
if (proc_mounted() <= 0)
return EXIT_TEST_SKIP;
fuzz_setup_logging();
assert_se(duped = memdup(data, size));

View File

@ -143,7 +143,7 @@ static void* client(void *p) {
return NULL;
}
TEST(description) {
TEST(description, .proc_mounted = true) {
_cleanup_free_ char *a = NULL;
_cleanup_close_ int fd = -EBADF;
union sockaddr_union sa = {

View File

@ -544,7 +544,7 @@ static void test_inotify_one(unsigned n_create_events) {
sd_event_unref(e);
}
TEST(inotify) {
TEST(inotify, .proc_mounted = true) {
test_inotify_one(100); /* should work without overflow */
test_inotify_one(33000); /* should trigger a q overflow */
}
@ -568,7 +568,7 @@ static int pidfd_handler(sd_event_source *s, const siginfo_t *si, void *userdata
return 0;
}
TEST(pidfd) {
TEST(pidfd, .proc_mounted = true) {
sd_event_source *s = NULL, *t = NULL;
sd_event *e = NULL;
int pidfd;
@ -757,7 +757,7 @@ static int inotify_self_destroy_handler(sd_event_source *s, const struct inotify
return 1;
}
TEST(inotify_self_destroy) {
TEST(inotify_self_destroy, .proc_mounted = true) {
_cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL;
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
char path[] = "/tmp/inotifyXXXXXX";
@ -793,7 +793,7 @@ static int inotify_process_buffered_data_handler(sd_event_source *s, const struc
return 1;
}
TEST(inotify_process_buffered_data) {
TEST(inotify_process_buffered_data, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *p = NULL, *q = NULL;
_cleanup_(sd_event_source_unrefp) sd_event_source *a = NULL, *b = NULL;
_cleanup_(sd_event_unrefp) sd_event *e = NULL;

View File

@ -578,7 +578,7 @@ static void test_sequence_numbers_one(void) {
}
}
TEST(sequence_numbers) {
TEST(sequence_numbers, .proc_mounted = true) {
ASSERT_OK_ERRNO(setenv("SYSTEMD_JOURNAL_COMPACT", "0", 1));
test_sequence_numbers_one();
@ -869,7 +869,7 @@ static void test_generic_array_bisect_one(size_t n, size_t num_corrupted) {
verify(f, seqnum, offset_candidates, offset, n);
}
TEST(generic_array_bisect) {
TEST(generic_array_bisect, .proc_mounted = true) {
for (size_t n = 1; n < 10; n++)
for (size_t m = 1; m <= n; m++)
test_generic_array_bisect_one(n, m);

View File

@ -181,6 +181,9 @@ int main(int argc, char *argv[]) {
if (access("/etc/machine-id", F_OK) != 0)
return log_tests_skipped("/etc/machine-id not found");
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
test_setup_logging(LOG_DEBUG);
/* Run this test multiple times with different configurations of features. */

View File

@ -180,6 +180,9 @@ int main(int argc, char *argv[]) {
const char *verification_key = NULL;
int max_iterations = 512;
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
if (argc > 1) {
/* Don't limit the number of iterations when the verification key
* is provided on the command line, we want to do that only in CIs */

View File

@ -118,7 +118,7 @@ static void test_non_empty_one(void) {
puts("------------------------------------------------------------");
}
TEST(non_empty) {
TEST(non_empty, .proc_mounted = true) {
assert_se(setenv("SYSTEMD_JOURNAL_COMPACT", "0", 1) >= 0);
test_non_empty_one();
@ -258,7 +258,7 @@ static void test_min_compress_size_one(void) {
assert_se(!check_compressed(256, 255));
}
TEST(min_compress_size) {
TEST(min_compress_size, .proc_mounted = true) {
assert_se(setenv("SYSTEMD_JOURNAL_COMPACT", "0", 1) >= 0);
test_min_compress_size_one();

View File

@ -209,7 +209,7 @@ static void test_config_parse_address_one(const char *rvalue, int family, unsign
}
}
TEST(config_parse_address) {
TEST(config_parse_address, .proc_mounted = true) {
test_config_parse_address_one("", AF_INET, 0, NULL, 0);
test_config_parse_address_one("/", AF_INET, 0, NULL, 0);
test_config_parse_address_one("/8", AF_INET, 0, NULL, 0);

View File

@ -51,8 +51,16 @@ static void load_testdata_env(void) {
return;
called = true;
assert_se(readlink_and_make_absolute("/proc/self/exe", &s) >= 0);
assert_se(path_extract_directory(s, &d) >= 0);
r = readlink_and_make_absolute("/proc/self/exe", &s);
if (r >= 0)
assert_se(path_extract_directory(s, &d) >= 0);
else {
_cleanup_free_ char *program = NULL;
log_debug_errno(r, "Failed to determine executable's directory, using current directory: %m");
assert_se(path_make_absolute_cwd(program_invocation_name, &program) >= 0);
assert_se(path_extract_directory(program, &d) >= 0);
}
assert_se(envpath = path_join(d, "systemd-runtest.env"));
r = load_env_file_pairs(NULL, envpath, &pairs);

View File

@ -13,6 +13,7 @@
#include "process-util.h"
#include "rlimit-util.h"
#include "signal-util.h"
#include "stat-util.h"
#include "static-destruct.h"
#include "strv.h"
@ -106,6 +107,7 @@ typedef struct TestFunc {
const char * const name;
bool has_ret:1;
bool sd_booted:1;
bool proc_mounted:1;
} TestFunc;
/* See static-destruct.h for an explanation of how this works. */
@ -162,6 +164,10 @@ static inline int run_test_table(void) {
log_info("/* systemd not booted, skipping %s */", t->name);
if (t->has_ret && r == EXIT_SUCCESS)
r = EXIT_TEST_SKIP;
} else if (t->proc_mounted && proc_mounted() <= 0) {
log_info("/* procfs is not available, skipping %s */", t->name);
if (t->has_ret && r == EXIT_SUCCESS)
r = EXIT_TEST_SKIP;
} else {
log_info("/* %s */", t->name);

View File

@ -31,7 +31,7 @@ static void test_mount_points_list_one(const char *fname) {
yes_no(m->try_remount_ro));
}
TEST(mount_points_list) {
TEST(mount_points_list, .proc_mounted = true) {
test_mount_points_list_one(NULL);
test_mount_points_list_one("/test-umount/empty.mountinfo");
test_mount_points_list_one("/test-umount/garbled.mountinfo");
@ -60,7 +60,7 @@ static void test_swap_list_one(const char *fname) {
log_debug("path=%s", m->path);
}
TEST(swap_list) {
TEST(swap_list, .proc_mounted = true) {
test_swap_list_one(NULL);
test_swap_list_one("/test-umount/example.swaps");
}

View File

@ -8,6 +8,7 @@
#include "fuzz.h"
#include "nulstr-util.h"
#include "selinux-util.h"
#include "stat-util.h"
#include "static-destruct.h"
#include "stdio-util.h"
#include "strv.h"
@ -22,6 +23,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size > 16*1024)
return 0; /* See the comment below about the limit for strv_length(). */
if (proc_mounted() <= 0)
return EXIT_TEST_SKIP;
fuzz_setup_logging();
arg_pager_flags = PAGER_DISABLE; /* We shouldn't execute the pager */

View File

@ -84,7 +84,7 @@ TEST(rename_process_invalid) {
assert_se(rename_process("") == -EINVAL);
}
TEST(rename_process_multi) {
TEST(rename_process_multi, .proc_mounted = true) {
pid_t pid;
pid = fork();
@ -109,7 +109,7 @@ TEST(rename_process_multi) {
_exit(EXIT_SUCCESS);
}
TEST(rename_process) {
TEST(rename_process, .proc_mounted = true) {
test_rename_process_one("foo", 1); /* should always fit */
test_rename_process_one("this is a really really long process name, followed by some more words", 0); /* unlikely to fit */
test_rename_process_one("1234567", 1); /* should always fit */

View File

@ -3,7 +3,7 @@
#include "audit-util.h"
#include "tests.h"
TEST(audit_loginuid_from_pid) {
TEST(audit_loginuid_from_pid, .proc_mounted = true) {
_cleanup_(pidref_done) PidRef self = PIDREF_NULL, pid1 = PIDREF_NULL;
int r;

View File

@ -26,7 +26,7 @@ static void test_path_is_encrypted_one(const char *p, int expect) {
assert_se(expect < 0 || ((r > 0) == (expect > 0)));
}
TEST(path_is_encrypted) {
TEST(path_is_encrypted, .proc_mounted = true) {
int booted = sd_booted(); /* If this is run in build environments such as koji, /dev/ might be a
* regular fs. Don't assume too much if not running under systemd. */

View File

@ -39,6 +39,9 @@ int main(int argc, char *argv[]) {
if (detect_container() > 0)
return log_tests_skipped("test-bpf-firewall fails inside LXC and Docker containers: https://github.com/systemd/systemd/issues/9666");
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
ASSERT_OK(getrlimit(RLIMIT_MEMLOCK, &rl));
rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, CAN_MEMLOCK_SIZE);
(void) setrlimit(RLIMIT_MEMLOCK, &rl);

View File

@ -25,7 +25,7 @@ static void test_is_wanted_print_one(bool header) {
log_info(" ");
}
TEST(is_wanted_print) {
TEST(is_wanted_print, .proc_mounted = true) {
test_is_wanted_print_one(true);
test_is_wanted_print_one(false); /* run twice to test caching */
}

View File

@ -30,7 +30,7 @@ static void test_chase_extract_filename_one(const char *path, const char *root,
ASSERT_STREQ(fname, expected);
}
TEST(chase) {
TEST(chase, .proc_mounted = true) {
_cleanup_free_ char *result = NULL, *pwd = NULL;
_cleanup_close_ int pfd = -EBADF;
char *temp;
@ -727,7 +727,7 @@ TEST(chaseat_prefix_root) {
ASSERT_STREQ(ret, expected);
}
TEST(trailing_dot_dot) {
TEST(trailing_dot_dot, .proc_mounted = true) {
_cleanup_free_ char *path = NULL, *fdpath = NULL;
_cleanup_close_ int fd = -EBADF;

View File

@ -38,7 +38,7 @@ static bool has_xattr(const char *p) {
return true;
}
TEST(chown_recursive) {
TEST(chown_recursive, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
struct stat st;
const char *p;

View File

@ -45,7 +45,7 @@
#include "user-util.h"
#include "virt.h"
TEST(condition_test_path) {
TEST(condition_test_path, .proc_mounted = true) {
Condition *condition;
condition = condition_new(CONDITION_PATH_EXISTS, "/bin/sh", false, false);
@ -508,7 +508,7 @@ TEST(condition_test_firmware_smbios) {
condition_free(condition);
}
TEST(condition_test_kernel_command_line) {
TEST(condition_test_kernel_command_line, .proc_mounted = true) {
Condition *condition;
int r;

View File

@ -382,7 +382,7 @@ static void test_copy_bytes_regular_file_one(const char *src, bool try_reflink,
assert_se((uint64_t) buf3.st_size == max_bytes);
}
TEST(copy_bytes_regular_file) {
TEST(copy_bytes_regular_file, .proc_mounted = true) {
test_copy_bytes_regular_file_one(saved_argv[0], false, UINT64_MAX);
test_copy_bytes_regular_file_one(saved_argv[0], true, UINT64_MAX);
test_copy_bytes_regular_file_one(saved_argv[0], false, 1000); /* smaller than copy buffer size */
@ -391,7 +391,7 @@ TEST(copy_bytes_regular_file) {
test_copy_bytes_regular_file_one(saved_argv[0], true, 32000);
}
TEST(copy_atomic) {
TEST(copy_atomic, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *p = NULL;
const char *q;
int r;
@ -409,7 +409,7 @@ TEST(copy_atomic) {
assert_se(copy_file_atomic("/etc/fstab", q, 0644, COPY_REPLACE) >= 0);
}
TEST(copy_proc) {
TEST(copy_proc, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *p = NULL;
_cleanup_free_ char *f = NULL, *a = NULL, *b = NULL;
@ -569,7 +569,7 @@ TEST(copy_lock) {
fd = safe_close(fd);
}
TEST(copy_verify_linked) {
TEST(copy_verify_linked, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_close_ int tfd = -EBADF, fd_1 = -EBADF, fd_2 = -EBADF;

View File

@ -47,7 +47,7 @@ static void test_acquire_data_fd_one(unsigned flags) {
fd = safe_close(fd);
}
TEST(acquire_data_fd) {
TEST(acquire_data_fd, .proc_mounted = true) {
test_acquire_data_fd_one(0);
test_acquire_data_fd_one(ACQUIRE_NO_DEV_NULL);
test_acquire_data_fd_one(ACQUIRE_NO_MEMFD);
@ -79,7 +79,7 @@ static void assert_equal_fd(int fd1, int fd2) {
}
}
TEST(copy_data_fd) {
TEST(copy_data_fd, .proc_mounted = true) {
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
_cleanup_close_pair_ int sfd[2] = EBADF_PAIR;
_cleanup_(sigkill_waitp) pid_t pid = -1;

View File

@ -158,7 +158,7 @@ TEST(fd_move_above_stdio) {
assert_se(close_nointr(new_fd) != EBADF);
}
TEST(rearrange_stdio) {
TEST(rearrange_stdio, .proc_mounted = true) {
pid_t pid;
int r;
@ -363,7 +363,7 @@ static int seccomp_prohibit_close_range(void) {
#endif
}
TEST(close_all_fds) {
TEST(close_all_fds, .proc_mounted = true) {
int r;
/* Runs the test four times. Once as is. Once with close_range() syscall blocked via seccomp, once
@ -433,7 +433,7 @@ TEST(format_proc_fd_path) {
ASSERT_STREQ(FORMAT_PROC_FD_PATH(2147483647), "/proc/self/fd/2147483647");
}
TEST(fd_reopen) {
TEST(fd_reopen, .proc_mounted = true) {
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
struct stat st1, st2;
int fl;
@ -697,7 +697,7 @@ TEST(fds_are_same_mount) {
assert_se(fds_are_same_mount(fd2, fd3) > 0);
}
TEST(fd_get_path) {
TEST(fd_get_path, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_close_ int tfd = -EBADF, fd = -EBADF;
_cleanup_free_ char *p = NULL, *q = NULL, *saved_cwd = NULL;

View File

@ -10,7 +10,7 @@
#include "tests.h"
#include "tmpfile-util.h"
TEST(fdset_new_fill) {
TEST(fdset_new_fill, .proc_mounted = true) {
_cleanup_fdset_free_ FDSet *fdset = NULL;
int fd = -EBADF, flags;

View File

@ -367,7 +367,7 @@ TEST(status_field) {
}
}
TEST(capeff) {
TEST(capeff, .proc_mounted = true) {
for (int pid = 0; pid < 2; pid++) {
_cleanup_free_ char *capeff = NULL;
int r, p;
@ -485,7 +485,7 @@ TEST(write_string_file_no_create) {
ASSERT_STREQ(buf, "boohoo\n");
}
TEST(write_string_file_verify) {
TEST(write_string_file_verify, .proc_mounted = true) {
_cleanup_free_ char *buf = NULL, *buf2 = NULL;
int r;
@ -525,7 +525,7 @@ static void check_file_pairs_one(char **l) {
}
}
TEST(load_env_file_pairs) {
TEST(load_env_file_pairs, .proc_mounted = true) {
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-load_env_file_pairs-XXXXXX";
int fd, r;
_cleanup_fclose_ FILE *f = NULL;
@ -940,7 +940,7 @@ TEST(read_nul_string) {
assert_se(read_nul_string(f, LONG_LINE_MAX, &s) == 0 && streq_ptr(s, ""));
}
TEST(read_full_file_socket) {
TEST(read_full_file_socket, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *z = NULL;
_cleanup_close_ int listener = -EBADF;
_cleanup_free_ char *data = NULL, *clientname = NULL;
@ -1106,7 +1106,7 @@ TEST(read_virtual_file) {
test_read_virtual_file_one(SIZE_MAX);
}
TEST(fdopen_independent) {
TEST(fdopen_independent, .proc_mounted = true) {
#define TEST_TEXT "this is some random test text we are going to write to a memfd"
_cleanup_close_ int fd = -EBADF;
_cleanup_fclose_ FILE *f = NULL;

View File

@ -683,7 +683,7 @@ TEST(openat_report_new) {
ASSERT_FALSE(b);
}
TEST(xopenat_full) {
TEST(xopenat_full, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_close_ int tfd = -EBADF, fd = -EBADF, fd2 = -EBADF;

View File

@ -8,7 +8,7 @@
#include "tmpfile-util.h"
#include "umask-util.h"
TEST(install_file) {
TEST(install_file, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *p = NULL;
_cleanup_free_ char *a = NULL, *b = NULL, *c = NULL;
struct stat stat1, stat2;

View File

@ -1265,7 +1265,7 @@ TEST(parse_continue) {
assert_se(sd_json_parse_with_source_continue(&p, "piff", /* flags= */ 0, &x, &line, &column) == -EINVAL);
}
TEST(pidref) {
TEST(pidref, .proc_mounted = true) {
_cleanup_(pidref_done) PidRef myself = PIDREF_NULL, pid1 = PIDREF_NULL;
assert_se(pidref_set_pid(&myself, 0) >= 0);
@ -1349,7 +1349,7 @@ TEST(devnum) {
ASSERT_FAIL(json_dispatch_devnum("devnum", v, /* flags= */ 0, &parsed));
}
TEST(fd_info) {
TEST(fd_info, .proc_mounted = true) {
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
_cleanup_close_ int fd = -EBADF;

View File

@ -224,15 +224,14 @@ static int run(int argc, char *argv[]) {
dissected = dissected_image_unref(dissected);
#endif
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0) {
log_tests_skipped("not running privileged");
return 0;
}
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
return log_tests_skipped("not running privileged");
if (detect_container() > 0) {
log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
return 0;
}
if (detect_container() > 0)
return log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, 0, LO_FLAGS_PARTSCAN, LOCK_EX, &loop) >= 0);

View File

@ -63,7 +63,7 @@ static int fake_pressure_callback(sd_event_source *s, void *userdata) {
return 0;
}
TEST(fake_pressure) {
TEST(fake_pressure, .proc_mounted = true) {
_cleanup_(sd_event_source_unrefp) sd_event_source *es = NULL, *ef = NULL;
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
_cleanup_free_ char *j = NULL, *k = NULL;

View File

@ -130,7 +130,7 @@ TEST(mount_flags_to_string) {
"MS_I_VERSION|MS_STRICTATIME|MS_LAZYTIME|fc000200");
}
TEST(bind_remount_recursive) {
TEST(bind_remount_recursive, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *tmp = NULL;
_cleanup_free_ char *subdir = NULL;
@ -184,7 +184,7 @@ TEST(bind_remount_recursive) {
}
}
TEST(bind_remount_one) {
TEST(bind_remount_one, .proc_mounted = true) {
pid_t pid;
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0) {
@ -279,7 +279,7 @@ TEST(make_mount_point_inode) {
assert_se(!(S_IXOTH & st.st_mode));
}
TEST(make_mount_switch_root) {
TEST(make_mount_switch_root, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_free_ char *s = NULL;
int r;
@ -333,7 +333,7 @@ TEST(make_mount_switch_root) {
}
}
TEST(umount_recursive) {
TEST(umount_recursive, .proc_mounted = true) {
static const struct {
const char *prefix;
const char * const keep[3];
@ -418,7 +418,7 @@ TEST(umount_recursive) {
}
}
TEST(fd_make_mount_point) {
TEST(fd_make_mount_point, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_free_ char *s = NULL;
int r;
@ -467,7 +467,7 @@ TEST(fd_make_mount_point) {
}
}
TEST(bind_mount_submounts) {
TEST(bind_mount_submounts, .proc_mounted = true) {
_cleanup_(rmdir_and_freep) char *a = NULL, *b = NULL;
_cleanup_free_ char *x = NULL;
int r;
@ -537,7 +537,7 @@ TEST(bind_mount_submounts) {
assert_se(umount_recursive(b, 0) >= 0);
}
TEST(path_is_network_fs_harder) {
TEST(path_is_network_fs_harder, .proc_mounted = true) {
_cleanup_close_ int dir_fd = -EBADF;
int r;

View File

@ -445,6 +445,9 @@ static int intro(void) {
/* let's move into our own mount namespace with all propagation from the host turned off, so
* that /proc/self/mountinfo is static and constant for the whole time our test runs. */
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
if (unshare(CLONE_NEWNS) < 0) {
if (!ERRNO_IS_PRIVILEGE(errno))
return log_error_errno(errno, "Failed to detach mount namespace: %m");

View File

@ -19,7 +19,7 @@ TEST(path_is_os_tree) {
assert_se(path_is_os_tree("/idontexist") == -ENOENT);
}
TEST(parse_os_release) {
TEST(parse_os_release, .proc_mounted = true) {
_cleanup_free_ char *id = NULL, *id2 = NULL, *name = NULL, *foobar = NULL;
if (access("/etc/os-release", F_OK) >= 0 || access("/usr/lib/os-release", F_OK) >= 0) {
@ -61,7 +61,7 @@ TEST(parse_os_release) {
ASSERT_OK_ERRNO(unsetenv("SYSTEMD_OS_RELEASE"));
}
TEST(parse_extension_release) {
TEST(parse_extension_release, .proc_mounted = true) {
/* Let's assume that we have a valid extension image */
_cleanup_free_ char *id = NULL, *version_id = NULL, *foobar = NULL, *a = NULL, *b = NULL;
_cleanup_(rm_rf_physical_and_freep) char *tempdir = NULL;
@ -104,7 +104,7 @@ TEST(parse_extension_release) {
ASSERT_NULL(foobar);
}
TEST(load_os_release_pairs) {
TEST(load_os_release_pairs, .proc_mounted = true) {
_cleanup_(unlink_tempfilep) char tmpfile[] = "/tmp/test-os-util.XXXXXX";
ASSERT_EQ(write_tmpfile(tmpfile,
"ID=\"ignored\" \n"

View File

@ -421,7 +421,7 @@ TEST(find_executable_full) {
assert_se(find_executable_full(test_file_name, NULL, STRV_MAKE("/doesnotexist", "/tmp", "/bin"), false, &p, NULL) == -ENOENT);
}
TEST(find_executable) {
TEST(find_executable, .proc_mounted = true) {
char *p;
assert_se(find_executable("/bin/sh", &p) == 0);

View File

@ -60,7 +60,7 @@ TEST(pidref_set_pidstr) {
assert_se(!pidref_equal(&pidref, &PIDREF_MAKE_FROM_PID(getpid_cached()+1)));
}
TEST(pidref_set_pidfd) {
TEST(pidref_set_pidfd, .proc_mounted = true) {
_cleanup_(pidref_done) PidRef a = PIDREF_NULL, b = PIDREF_NULL, c = PIDREF_NULL, d = PIDREF_NULL;
assert_se(pidref_set_self(&a) >= 0);
@ -211,7 +211,7 @@ TEST(pidref_done_sigkill_wait) {
freeze();
}
TEST(pidref_verify) {
TEST(pidref_verify, .proc_mounted = true) {
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
assert_se(pidref_verify(NULL) == -ESRCH);

View File

@ -24,7 +24,7 @@ static int parse_item(const char *key, const char *value, void *data) {
return 0;
}
TEST(proc_cmdline_parse) {
TEST(proc_cmdline_parse, .proc_mounted = true) {
assert_se(proc_cmdline_parse(parse_item, &obj, PROC_CMDLINE_STRIP_RD_PREFIX) >= 0);
}

View File

@ -104,7 +104,7 @@ static void test_pid_get_comm_one(pid_t pid) {
log_info("PID"PID_FMT" $PATH: '%s'", pid, strna(i));
}
TEST(pid_get_comm) {
TEST(pid_get_comm, .proc_mounted = true) {
if (saved_argc > 1) {
pid_t pid = 0;
@ -813,7 +813,7 @@ TEST(setpriority_closest) {
}
}
TEST(get_process_ppid) {
TEST(get_process_ppid, .proc_mounted = true) {
uint64_t limit;
int r;
@ -850,7 +850,7 @@ TEST(get_process_ppid) {
}
}
TEST(set_oom_score_adjust) {
TEST(set_oom_score_adjust, .proc_mounted = true) {
int a, b, r;
ASSERT_OK(get_oom_score_adjust(&a));
@ -881,7 +881,7 @@ static void* dummy_thread(void *p) {
return NULL;
}
TEST(get_process_threads) {
TEST(get_process_threads, .proc_mounted = true) {
int r;
/* Run this test in a child, so that we can guarantee there's exactly one thread around in the child */
@ -973,7 +973,7 @@ TEST(is_reaper_process) {
}
}
TEST(pid_get_start_time) {
TEST(pid_get_start_time, .proc_mounted = true) {
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
ASSERT_OK(pidref_set_self(&pidref));

View File

@ -16,6 +16,9 @@ int main(int argc, char *argv[]) {
test_setup_logging(LOG_DEBUG);
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
assert_se(procfs_cpu_get_usage(&nsec) >= 0);
log_info("Current system CPU time: %s", FORMAT_TIMESPAN(nsec/NSEC_PER_USEC, 1));

View File

@ -141,7 +141,7 @@ TEST(setrlimit) {
assert_se(old.rlim_max == new.rlim_max);
}
TEST(pid_getrlimit) {
TEST(pid_getrlimit, .proc_mounted = true) {
int r;
/* We fork off a child and read the parent's resource limit from there (i.e. our own), and compare

View File

@ -363,7 +363,7 @@ TEST(restrict_namespace) {
assert_se(wait_for_terminate_and_check("nsseccomp", pid, WAIT_LOG) == EXIT_SUCCESS);
}
TEST(protect_sysctl) {
TEST(protect_sysctl, .proc_mounted = true) {
pid_t pid;
_cleanup_free_ char *seccomp = NULL;

View File

@ -369,7 +369,7 @@ TEST(in_addr_port_ifindex_name_from_string_auto) {
test_in_addr_port_ifindex_name_from_string_auto_one("[fe80::18]:53%lo#hoge.com", AF_INET6, 53, 1, "hoge.com", "[fe80::18]:53%1#hoge.com");
}
TEST(netns_get_nsid) {
TEST(netns_get_nsid, .proc_mounted = true) {
uint32_t u;
int r;

View File

@ -542,7 +542,7 @@ TEST(ipv6_enabled) {
log_info("IPv6 enabled: %s", yes_no(socket_ipv6_is_enabled()));
}
TEST(sockaddr_un_set_path) {
TEST(sockaddr_un_set_path, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_(unlink_and_freep) char *sh = NULL;
_cleanup_free_ char *j = NULL;

View File

@ -56,7 +56,7 @@ static const Specifier specifier_table[] = {
{}
};
TEST(specifier_printf) {
TEST(specifier_printf, .proc_mounted = true) {
static const Specifier table[] = {
{ 'X', specifier_string, (char*) "AAAA" },
{ 'Y', specifier_string, (char*) "BBBB" },
@ -128,7 +128,7 @@ TEST(specifier_real_path_missing_file) {
assert_se(r == -ENOENT);
}
TEST(specifiers) {
TEST(specifiers, .proc_mounted = true) {
int r;
for (const Specifier *s = specifier_table; s->specifier; s++) {
@ -173,7 +173,7 @@ TEST(specifiers_assorted) {
}
}
TEST(specifiers_missing_data_ok) {
TEST(specifiers_missing_data_ok, .proc_mounted = true) {
_cleanup_free_ char *resolved = NULL;
assert_se(setenv("SYSTEMD_OS_RELEASE", "/dev/null", 1) == 0);

View File

@ -22,7 +22,7 @@
#include "tests.h"
#include "tmpfile-util.h"
TEST(null_or_empty_path) {
TEST(null_or_empty_path, .proc_mounted = true) {
assert_se(null_or_empty_path("/dev/null") == 1);
assert_se(null_or_empty_path("/dev/tty") == 1); /* We assume that any character device is "empty", bleh. */
assert_se(null_or_empty_path("../../../../../../../../../../../../../../../../../../../../dev/null") == 1);
@ -30,7 +30,7 @@ TEST(null_or_empty_path) {
assert_se(null_or_empty_path("/nosuchfileordir") == -ENOENT);
}
TEST(null_or_empty_path_with_root) {
TEST(null_or_empty_path_with_root, .proc_mounted = true) {
assert_se(null_or_empty_path_with_root("/dev/null", NULL) == 1);
assert_se(null_or_empty_path_with_root("/dev/null", "/") == 1);
assert_se(null_or_empty_path_with_root("/dev/null", "/.././../") == 1);
@ -46,7 +46,7 @@ TEST(null_or_empty_path_with_root) {
assert_se(null_or_empty_path_with_root("/foobar/barbar/dev/null", "/foobar/barbar/") == 1);
}
TEST(inode_same) {
TEST(inode_same, .proc_mounted = true) {
_cleanup_close_ int fd = -EBADF;
_cleanup_(unlink_tempfilep) char name[] = "/tmp/test-files_same.XXXXXX";
_cleanup_(unlink_tempfilep) char name_alias[] = "/tmp/test-files_same.alias";
@ -190,7 +190,7 @@ TEST(fd_is_ns) {
assert_se(IN_SET(fd_is_ns(fd, CLONE_NEWNET), 1, -EUCLEAN));
}
TEST(dir_is_empty) {
TEST(dir_is_empty, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *empty_dir = NULL;
_cleanup_free_ char *j = NULL, *jj = NULL, *jjj = NULL;

View File

@ -38,7 +38,7 @@ TEST(sysctl_normalize) {
}
}
TEST(sysctl_read) {
TEST(sysctl_read, .proc_mounted = true) {
_cleanup_free_ char *s = NULL;
struct utsname u;
sd_id128_t a, b;

View File

@ -70,7 +70,7 @@ TEST(read_one_char) {
assert_se(read_one_char(file, &r, 1000000, &need_nl) < 0);
}
TEST(getttyname_malloc) {
TEST(getttyname_malloc, .proc_mounted = true) {
_cleanup_free_ char *ttyname = NULL;
_cleanup_close_ int master = -EBADF;
@ -214,7 +214,7 @@ TEST(terminal_fix_size) {
log_notice("Fixed terminal size.");
}
TEST(terminal_is_pty_fd) {
TEST(terminal_is_pty_fd, .proc_mounted = true) {
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
int r;
@ -294,7 +294,7 @@ TEST(terminal_reset_defensive) {
log_notice_errno(r, "Failed to reset terminal: %m");
}
TEST(pty_open_peer) {
TEST(pty_open_peer, .proc_mounted = true) {
_cleanup_close_ int pty_fd = -EBADF, peer_fd = -EBADF;
_cleanup_free_ char *pty_path = NULL;

View File

@ -461,7 +461,7 @@ static void test_format_timestamp_with_tz_one(const char *tz) {
tzset();
}
TEST(FORMAT_TIMESTAMP_with_tz) {
TEST(FORMAT_TIMESTAMP_with_tz, .proc_mounted = true) {
_cleanup_strv_free_ char **timezones = NULL;
test_format_timestamp_with_tz_one("UTC");

View File

@ -242,7 +242,7 @@ TEST(tempfn_random_child) {
test_tempfn_random_child_one(p, "hoge", q, 0);
}
TEST(link_tmpfile) {
TEST(link_tmpfile, .proc_mounted = true) {
_cleanup_free_ char *cmd = NULL, *cmd2 = NULL, *ans = NULL, *ans2 = NULL, *d = NULL, *tmp = NULL, *line = NULL;
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
const char *p = saved_argv[1] ?: "/tmp";

View File

@ -10,6 +10,9 @@ int main(int argc, char *argv[]) {
test_setup_logging(LOG_DEBUG);
if (proc_mounted() <= 0)
return log_tests_skipped("procfs not available");
u = umask(0111);
n = 0;

View File

@ -16,7 +16,7 @@
#include "tmpfile-util.h"
#include "xattr-util.h"
TEST(getxattr_at_malloc) {
TEST(getxattr_at_malloc, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_free_ char *value = NULL;
_cleanup_close_ int fd = -EBADF;
@ -86,7 +86,7 @@ static void verify_xattr(int dfd, const char *expected) {
ASSERT_STREQ(value, expected);
}
TEST(xsetxattr) {
TEST(xsetxattr, .proc_mounted = true) {
_cleanup_(rm_rf_physical_and_freep) char *t = NULL;
_cleanup_close_ int dfd = -EBADF, fd = -EBADF;
const char *x;

View File

@ -4,6 +4,11 @@ set -eux
shopt -s nullglob
shopt -s globstar
if ! mountpoint /proc; then
echo "procfs is not available, skipping"
exit 77
fi
if [[ -n "${1:-}" ]]; then
generator=$1
elif [[ -x /usr/lib/systemd/system-generators/systemd-fstab-generator ]]; then

View File

@ -2,6 +2,11 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -ex
if ! mountpoint /proc; then
echo "procfs is not available, skipping"
exit 77
fi
# Silence warning from running_in_chroot_or_offline()
export SYSTEMD_IN_CHROOT=0

View File

@ -234,6 +234,11 @@ def test_conditionalized_execute_bit():
assert "user:root:rwx" in c.stdout and "group:root:r-x" in c.stdout
if __name__ == '__main__':
# If proc is not mounted, skip the test
if not os.path.exists('/proc/self'):
print("procfs is not available, skipping")
sys.exit(EXIT_TEST_SKIP)
test_invalids(user=False)
test_invalids(user=True)
test_uninitialized_t()

View File

@ -2,6 +2,11 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
if ! mountpoint /proc; then
echo "procfs is not available, skipping"
exit 77
fi
SYSUSERS="${1:-systemd-sysusers}"
# shellcheck disable=SC1090

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
{% if LINK_SHELL_EXTRA_DROPIN %}
L$ {{SHELLPROFILEDIR}}/70-systemd-shell-extra.sh - - - - {{LIBEXECDIR}}/profile.d/70-systemd-shell-extra.sh

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
{% if LINK_SSH_PROXY_DROPIN %}
L$ {{SSHCONFDIR}}/20-systemd-ssh-proxy.conf - - - - {{LIBEXECDIR}}/ssh_config.d/20-systemd-ssh-proxy.conf

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# Copy systemd-stub provided metadata such as PCR signature and public key file
# from initrd into /run/, so that it will survive the initrd stage

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
{% if LINK_SSHD_USERDB_DROPIN %}
L {{SSHDCONFDIR}}/20-systemd-userdb.conf - - - - {{LIBEXECDIR}}/sshd_config.d/20-systemd-userdb.conf

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
d /etc/credstore 0700 root root
d /etc/credstore.encrypted 0700 root root

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
L /etc/os-release - - - - ../usr/lib/os-release
L+ /etc/mtab - - - - ../proc/self/mounts

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
Q /home 0755 - - -
q /srv 0755 - - -

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# Set the NOCOW attribute for directories of journal files. This flag
# is inherited by their new files and sub-directories. Matters only

View File

@ -5,10 +5,11 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# These files are considered legacy and are unnecessary on legacy-free
# systems.
# The functionality provided by these files and directories has been replaced
# by newer interfaces. Their use is discouraged on legacy-free systems. This
# configuration is provided to maintain backward compatibility.
d /run/lock 0755 root root -
L /var/lock - - - - ../run/lock
@ -16,15 +17,15 @@ L /var/lock - - - - ../run/lock
L$ /var/log/README - - - - ../..{{DOC_DIR}}/README.logs
{% endif %}
{% if HAVE_SYSV_COMPAT %}
# /run/lock/subsys is used for serializing SysV service execution, and
# hence without use on SysV-less systems.
d /run/lock/subsys 0755 root root -
# /forcefsck, /fastboot and /forcequotacheck are deprecated in favor of the
# kernel command line options 'fsck.mode=force', 'fsck.mode=skip' and
# 'quotacheck.mode=force'
r! /forcefsck
r! /fastboot
r! /forcequotacheck
{% endif %}

View File

@ -35,7 +35,7 @@ in_files = [
['20-systemd-stub.conf', 'ENABLE_EFI'],
['20-systemd-userdb.conf', 'ENABLE_SSH_USERDB_CONFIG'],
['etc.conf'],
['legacy.conf', 'HAVE_SYSV_COMPAT'],
['legacy.conf'],
['static-nodes-permissions.conf'],
['systemd.conf'],
['var.conf'],

View File

@ -1,4 +1,4 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
Q /var/lib/portables 0700

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# Provision additional login messages from credentials, if they are set. Note
# that these lines are NOPs if the credentials are not set or if the files

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
d$ /run/systemd/netif 0755 systemd-network systemd-network -
d$ /run/systemd/netif/links 0755 systemd-network systemd-network -

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
Q /var/lib/machines 0700 - - -

View File

@ -5,6 +5,6 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
d /run/user 0755 root root -
{% if ENABLE_UTMP %}

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# Clear tmp directories separately, to make them easier to override
q /tmp 1777 root root 10d

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
q /var 0755 - - -

View File

@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# See tmpfiles.d(5) for details.
# Make sure these are created by default so that nobody else can
# or empty them at startup

View File

@ -10,6 +10,11 @@ set -o pipefail
BINARY="${1:?}"
export SYSTEMD_LOG_LEVEL=info
if [[ ! -d /proc/self/ ]]; then
echo "/proc/self/ is not available, skipping"
exit 77
fi
if [[ ! -x "$BINARY" ]]; then
echo "$BINARY is not an executable"
exit 1

View File

@ -1,14 +1,24 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
import os
from argparse import ArgumentParser
from pathlib import Path
from subprocess import PIPE, run
def extract_interfaces_xml(output_dir, executable):
# If proc is not mounted, set LD_LIBRARY_PATH so that shared/core libs can be found
env = os.environ.copy()
if not os.path.exists('/proc/self'):
if 'LD_LIBRARY_PATH' not in env:
env["LD_LIBRARY_PATH"] = "src/shared:src/core"
else:
env["LD_LIBRARY_PATH"] = f"src/shared:src/core:{env['LD_LIBRARY_PATH']}"
proc = run(
args=[executable.absolute(), '--bus-introspect', 'list'],
stdout=PIPE,
env=env,
check=True,
universal_newlines=True)
@ -18,6 +28,7 @@ def extract_interfaces_xml(output_dir, executable):
proc = run(
args=[executable.absolute(), '--bus-introspect', interface_name],
stdout=PIPE,
env=env,
check=True,
universal_newlines=True)