diff --git a/TODO b/TODO index fab110f8b1..17fe6e8b2a 100644 --- a/TODO +++ b/TODO @@ -541,7 +541,7 @@ Features: directory trees from the host to the services RootImage= and RootDirectory= environment. Which we can use for /etc/machine-id and in particular /etc/resolv.conf. Should be smart and do something useful on read-only - images, for example fallback to read-only bind mounting the file instead. + images, for example fall back to read-only bind mounting the file instead. * show invocation ID in systemd-run output @@ -1018,7 +1018,7 @@ Features: - journald: also get thread ID from client, plus thread name - journal: when waiting for journal additions in the client always sleep at least 1s or so, in order to minimize wakeups - add API to close/reopen/get fd for journal client fd in libsystemd-journal. - - fallback to /dev/log based logging in libsystemd-journal, if we cannot log natively? + - fall back to /dev/log based logging in libsystemd-journal, if we cannot log natively? - declare the local journal protocol stable in the wiki interface chart - sd-journal: speed up sd_journal_get_data() with transparent hash table in bg - journald: when dropping msgs due to ratelimit make sure to write diff --git a/man/html.in b/man/html.in index b7e79841d0..23b77ebbb0 100755 --- a/man/html.in +++ b/man/html.in @@ -11,5 +11,14 @@ ninja -C "@BUILD_ROOT@" version.h target="man/$1.html" ninja -C "@BUILD_ROOT@" "$target" + +fullname="@BUILD_ROOT@/$target" +redirect="$(readlink "$fullname" 2>/dev/null)" +if [ -n "$redirect" ]; then + ninja -C "@BUILD_ROOT@" "man/$redirect" + + fullname="@BUILD_ROOT@/man/$redirect" +fi + set -x -exec xdg-open "@BUILD_ROOT@/$target" +exec xdg-open "$fullname" diff --git a/man/man.in b/man/man.in index fa6164b8de..12eb332ee0 100755 --- a/man/man.in +++ b/man/man.in @@ -16,4 +16,13 @@ if [ -z "$target" ]; then exit 1 fi ninja -C "@BUILD_ROOT@" "$target" -exec man "@BUILD_ROOT@/$target" + +fullname="@BUILD_ROOT@/$target" +redirect="$(sed -n -r '1 s|^\.so man[0-9]/(.*)|\1|p' "$fullname")" +if [ -n "$redirect" ]; then + ninja -C "@BUILD_ROOT@" "man/$redirect" + + fullname="@BUILD_ROOT@/man/$redirect" +fi + +exec man "$fullname" diff --git a/man/rules/meson.build b/man/rules/meson.build index d545f032a2..80412269c7 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -63,7 +63,7 @@ manpages = [ ['repart.d', '5', [], 'ENABLE_REPART'], ['resolvectl', '1', ['resolvconf'], 'ENABLE_RESOLVE'], ['resolved.conf', '5', ['resolved.conf.d'], 'ENABLE_RESOLVE'], - ['runlevel', '8', [], ''], + ['runlevel', '8', [], 'HAVE_SYSV_COMPAT'], ['sd-bus-errors', '3', ['SD_BUS_ERROR_ACCESS_DENIED', @@ -785,7 +785,7 @@ manpages = [ ['shutdown', '8', [], ''], ['sysctl.d', '5', [], ''], ['systemctl', '1', [], ''], - ['systemd-analyze', '1', [], ''], + ['systemd-analyze', '1', [], 'ENABLE_ANALYZE'], ['systemd-ask-password-console.service', '8', ['systemd-ask-password-console.path', @@ -818,7 +818,7 @@ manpages = [ ['systemd-debug-generator', '8', [], ''], ['systemd-delta', '1', [], ''], ['systemd-detect-virt', '1', [], ''], - ['systemd-dissect', '1', [], ''], + ['systemd-dissect', '1', [], 'HAVE_BLKID'], ['systemd-environment-d-generator', '8', ['30-systemd-environment-d-generator'], @@ -831,7 +831,7 @@ manpages = [ ''], ['systemd-fstab-generator', '8', [], ''], ['systemd-getty-generator', '8', [], ''], - ['systemd-gpt-auto-generator', '8', [], ''], + ['systemd-gpt-auto-generator', '8', [], 'HAVE_BLKID'], ['systemd-halt.service', '8', ['systemd-kexec.service', @@ -912,7 +912,7 @@ manpages = [ '8', ['systemd-random-seed'], 'ENABLE_RANDOMSEED'], - ['systemd-rc-local-generator', '8', [], ''], + ['systemd-rc-local-generator', '8', [], 'HAVE_SYSV_COMPAT'], ['systemd-remount-fs.service', '8', ['systemd-remount-fs'], ''], ['systemd-repart', '8', ['systemd-repart.service'], 'ENABLE_REPART'], ['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVE'], @@ -1010,7 +1010,7 @@ manpages = [ ['systemd.timer', '5', [], ''], ['systemd.unit', '5', [], ''], ['sysusers.d', '5', [], 'ENABLE_SYSUSERS'], - ['telinit', '8', [], ''], + ['telinit', '8', [], 'HAVE_SYSV_COMPAT'], ['timedatectl', '1', [], 'ENABLE_TIMEDATECTL'], ['timesyncd.conf', '5', ['timesyncd.conf.d'], 'ENABLE_TIMESYNCD'], ['tmpfiles.d', '5', [], ''], diff --git a/man/runlevel.xml b/man/runlevel.xml index 87e2ed234a..75a572cb00 100644 --- a/man/runlevel.xml +++ b/man/runlevel.xml @@ -3,7 +3,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - @@ -159,5 +159,4 @@ systemctl1 - diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml index 3d6de1710d..4da5b4c3f8 100644 --- a/man/systemd-analyze.xml +++ b/man/systemd-analyze.xml @@ -3,7 +3,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - diff --git a/man/systemd-dissect.xml b/man/systemd-dissect.xml index fd70e1bfc1..55e7076b43 100644 --- a/man/systemd-dissect.xml +++ b/man/systemd-dissect.xml @@ -3,7 +3,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - diff --git a/man/systemd-gpt-auto-generator.xml b/man/systemd-gpt-auto-generator.xml index 78fdacccab..7476edcffc 100644 --- a/man/systemd-gpt-auto-generator.xml +++ b/man/systemd-gpt-auto-generator.xml @@ -1,9 +1,9 @@ - - + - + + systemd-gpt-auto-generator diff --git a/man/systemd-rc-local-generator.xml b/man/systemd-rc-local-generator.xml index 81744c2025..0e607d0bce 100644 --- a/man/systemd-rc-local-generator.xml +++ b/man/systemd-rc-local-generator.xml @@ -3,8 +3,7 @@ - - + systemd-rc-local-generator systemd @@ -51,5 +50,4 @@ systemctl1 - diff --git a/man/telinit.xml b/man/telinit.xml index 43871eb351..0fffd51093 100644 --- a/man/telinit.xml +++ b/man/telinit.xml @@ -3,7 +3,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - @@ -148,5 +148,4 @@ wall1 - diff --git a/meson.build b/meson.build index dc2d06f1f4..5fedbaa117 100644 --- a/meson.build +++ b/meson.build @@ -791,7 +791,7 @@ tty_gid = get_option('tty-gid') conf.set('TTY_GID', tty_gid) substs.set('TTY_GID', tty_gid) -# Ensure provided GID argument is numeric, otherwise fallback to default assignment +# Ensure provided GID argument is numeric, otherwise fall back to default assignment users_gid = get_option('users-gid') substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid) @@ -1415,42 +1415,43 @@ else endif conf.set10('ENABLE_REMOTE', have) -foreach term : ['utmp', - 'hibernate', - 'environment-d', +foreach term : ['analyze', + 'backlight', 'binfmt', 'coredump', - 'pstore', - 'resolve', - 'logind', + 'efi', + 'environment-d', + 'firstboot', + 'gshadow', + 'hibernate', 'hostnamed', + 'hwdb', + 'idn', + 'ima', + 'initrd', + 'ldconfig', 'localed', + 'logind', 'machined', - 'portabled', - 'userdb', 'networkd', + 'nss-myhostname', + 'nss-systemd', + 'portabled', + 'pstore', + 'quotacheck', + 'randomseed', + 'resolve', + 'rfkill', + 'smack', + 'sysusers', 'timedated', 'timesyncd', - 'firstboot', - 'randomseed', - 'backlight', - 'vconsole', - 'quotacheck', - 'sysusers', 'tmpfiles', - 'hwdb', - 'rfkill', - 'xdg-autostart', - 'ldconfig', - 'efi', 'tpm', - 'ima', - 'smack', - 'gshadow', - 'idn', - 'initrd', - 'nss-myhostname', - 'nss-systemd'] + 'userdb', + 'utmp', + 'vconsole', + 'xdg-autostart'] have = get_option(term) name = 'ENABLE_' + term.underscorify().to_upper() conf.set10(name, have) @@ -1767,7 +1768,7 @@ public_programs += executable( libmount, libblkid], install_rpath : rootlibexecdir, - install : get_option('analyze')) + install : conf.get('ENABLE_ANALYZE')) executable( 'systemd-journald', @@ -3681,7 +3682,7 @@ foreach tuple : [ ['link-networkd-shared', get_option('link-networkd-shared')], ['link-timesyncd-shared', get_option('link-timesyncd-shared')], ['kernel-install', get_option('kernel-install')], - ['systemd-analyze', get_option('analyze')], + ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1], ] if tuple.length() >= 2 diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 75a6282ed0..14b12b2706 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -976,6 +976,6 @@ int read_nr_open(void) { return v; } - /* If we fail, fallback to the hard-coded kernel limit of 1024 * 1024. */ + /* If we fail, fall back to the hard-coded kernel limit of 1024 * 1024. */ return 1024 * 1024; } diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 34a2260783..030789d716 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -120,7 +120,7 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char if (!IN_SET(errno, EINVAL, ENOSYS, ENOTTY, EPERM)) /* FAT returns EPERM on link()… */ return -errno; - /* OK, neither RENAME_NOREPLACE nor linkat()+unlinkat() worked. Let's then fallback to the racy TOCTOU + /* OK, neither RENAME_NOREPLACE nor linkat()+unlinkat() worked. Let's then fall back to the racy TOCTOU * vulnerable accessat(F_OK) check followed by classic, replacing renameat(), we have nothing better. */ if (faccessat(newdirfd, newpath, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c index 87cb5558f4..2ad27ce830 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -173,7 +173,7 @@ int fd_is_mount_point(int fd, const char *filename, int flags) { if (!ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno)) return -errno; - /* If statx() is not available or forbidden, fallback to name_to_handle_at() below */ + /* If statx() is not available or forbidden, fall back to name_to_handle_at() below */ } else if (FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) /* yay! */ return FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT); @@ -186,7 +186,7 @@ int fd_is_mount_point(int fd, const char *filename, int flags) { goto fallback_fdinfo; else if (r == -EOPNOTSUPP) /* This kernel or file system does not support name_to_handle_at(), hence let's see if the upper fs - * supports it (in which case it is a mount point), otherwise fallback to the traditional stat() + * supports it (in which case it is a mount point), otherwise fall back to the traditional stat() * logic */ nosupp = true; else if (r < 0) diff --git a/src/core/manager.c b/src/core/manager.c index 3a8df8245c..b7ca184081 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -4371,11 +4371,11 @@ const char *manager_get_confirm_spawn(Manager *m) { * * If the console suddenly disappear at the time our children will really it * then they will simply fail to acquire it and a positive answer will be - * assumed. New children will fallback to /dev/console though. + * assumed. New children will fall back to /dev/console though. * * Note: TTYs are devices that can come and go any time, and frequently aren't * available yet during early boot (consider a USB rs232 dongle...). If for any - * reason the configured console is not ready, we fallback to the default + * reason the configured console is not ready, we fall back to the default * console. */ if (!m->confirm_spawn || path_equal(m->confirm_spawn, "/dev/console")) diff --git a/src/core/namespace.c b/src/core/namespace.c index 79b3ac4f9d..671d0dc925 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -650,7 +650,7 @@ static int clone_device_node( *make_devnode = false; } - /* We're about to fallback to bind-mounting the device + /* We're about to fall back to bind-mounting the device * node. So create a dummy bind-mount target. * Do not prepare device-node SELinux label (see issue 13762) */ r = mknod(dn, S_IFREG, 0); diff --git a/src/core/service.c b/src/core/service.c index 00e61945ba..641391752a 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1034,7 +1034,7 @@ static void service_search_main_pid(Service *s) { assert(s); - /* If we know it anyway, don't ever fallback to unreliable + /* If we know it anyway, don't ever fall back to unreliable * heuristics */ if (s->main_pid_known) return; diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install index 97fc3bcc35..567d2b9f4b 100644 --- a/src/kernel-install/90-loaderentry.install +++ b/src/kernel-install/90-loaderentry.install @@ -95,7 +95,7 @@ for initrd in "${INITRD_OPTIONS[@]}"; do fi done -# If no initrd option is supplied, fallback to "initrd" which is +# If no initrd option is supplied, fall back to "initrd" which is # the name used by dracut when generating it in its kernel-install hook [[ ${#INITRD_OPTIONS[@]} == 0 ]] && INITRD_OPTIONS=( initrd ) diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c index 03c60f90b3..ab25ebf41b 100644 --- a/src/login/user-runtime-dir.c +++ b/src/login/user-runtime-dir.c @@ -166,7 +166,7 @@ static int do_umount(const char *user) { int r; /* The user may be already removed. So, first try to parse the string by parse_uid(), - * and if it fails, fallback to get_user_creds().*/ + * and if it fails, fall back to get_user_creds().*/ if (parse_uid(user, &uid) < 0) { r = get_user_creds(&user, &uid, NULL, NULL, NULL, 0); if (r < 0) diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c index 528440b82f..d970640993 100644 --- a/src/shared/dev-setup.c +++ b/src/shared/dev-setup.c @@ -72,10 +72,11 @@ int make_inaccessible_nodes( { "inaccessible/sock", S_IFSOCK | 0000 }, /* The following two are likely to fail if we lack the privs for it (for example in an userns - * environment, if CAP_SYS_MKNOD is missing, or if a device node policy prohibit major/minor of 0 - * device nodes to be created). But that's entirely fine. Consumers of these files should carry - * fallback to use a different node then, for example /inaccessible/sock, which is close - * enough in behaviour and semantics for most uses. */ + * environment, if CAP_SYS_MKNOD is missing, or if a device node policy prohibits creation of + * device nodes with a major/minor of 0). But that's entirely fine. Consumers of these files + * should implement falling back to use a different node then, for example + * /inaccessible/sock, which is close enough in behaviour and semantics for most uses. + */ { "inaccessible/chr", S_IFCHR | 0000 }, { "inaccessible/blk", S_IFBLK | 0000 }, }; diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 98cf15cd33..d573b2feec 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -813,8 +813,8 @@ int dissect_image( _cleanup_free_ char *o = NULL; const char *options = NULL; - /* If the root has was set, then we won't fallback to a generic node, because the root hash - * decides */ + /* If the root hash was set, then we won't fall back to a generic node, because the + * root hash decides. */ if (root_hash) return -EADDRNOTAVAIL; @@ -1426,7 +1426,7 @@ static int verity_partition( r = crypt_activate_by_volume_key(cd, name, root_hash, root_hash_size, CRYPT_ACTIVATE_READONLY); /* libdevmapper can return EINVAL when the device is already in the activation stage. * There's no way to distinguish this situation from a genuine error due to invalid - * parameters, so immediately fallback to activating the device with a unique name. + * parameters, so immediately fall back to activating the device with a unique name. * Improvements in libcrypsetup can ensure this never happens: https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/96 */ if (r == -EINVAL && FLAGS_SET(flags, DISSECT_IMAGE_VERITY_SHARE)) return verity_partition(m, v, root_hash, root_hash_size, verity_data, NULL, root_hash_sig ?: hash_sig_from_file, root_hash_sig_size, flags & ~DISSECT_IMAGE_VERITY_SHARE, d); diff --git a/src/shared/reboot-util.h b/src/shared/reboot-util.h index 5aeb34821f..1e98ee1dba 100644 --- a/src/shared/reboot-util.h +++ b/src/shared/reboot-util.h @@ -6,7 +6,7 @@ int update_reboot_parameter_and_warn(const char *parameter, bool keep); typedef enum RebootFlags { REBOOT_LOG = 1 << 0, /* log about what we are going to do and all errors */ REBOOT_DRY_RUN = 1 << 1, /* return 0 right before actually doing the reboot */ - REBOOT_FALLBACK = 1 << 2, /* fallback to plain reboot() if argument-based reboot doesn't work, isn't configured or doesn't apply otherwise */ + REBOOT_FALLBACK = 1 << 2, /* fall back to plain reboot() if argument-based reboot doesn't work, isn't configured or doesn't apply otherwise */ } RebootFlags; int read_reboot_parameter(char **parameter); diff --git a/src/shared/resolve-util.h b/src/shared/resolve-util.h index 0524f1a74f..a7a9c77bdf 100644 --- a/src/shared/resolve-util.h +++ b/src/shared/resolve-util.h @@ -53,7 +53,7 @@ enum DnsOverTlsMode { DNS_OVER_TLS_NO, /* Try to connect using DNS-over-TLS, but if connection fails, - * fallback to using an unencrypted connection */ + * fall back to using an unencrypted connection */ DNS_OVER_TLS_OPPORTUNISTIC, /* Enforce DNS-over-TLS and require valid server certificates */ diff --git a/src/test/test-acl-util.c b/src/test/test-acl-util.c index df879747f5..9f0e594e67 100644 --- a/src/test/test-acl-util.c +++ b/src/test/test-acl-util.c @@ -7,6 +7,7 @@ #include "acl-util.h" #include "fd-util.h" +#include "format-util.h" #include "string-util.h" #include "tmpfile-util.h" #include "user-util.h" @@ -18,6 +19,8 @@ static void test_add_acls_for_user(void) { uid_t uid; int r; + log_info("/* %s */", __func__); + fd = mkostemp_safe(fn); assert_se(fd >= 0); @@ -39,6 +42,7 @@ static void test_add_acls_for_user(void) { uid = getuid(); r = add_acls_for_user(fd, uid); + log_info_errno(r, "add_acls_for_user(%d, "UID_FMT"): %m", fd, uid); assert_se(r >= 0); cmd = strjoina("ls -l ", fn); diff --git a/src/test/test-string-util.c b/src/test/test-string-util.c index 13936f6d25..1127d398a5 100644 --- a/src/test/test-string-util.c +++ b/src/test/test-string-util.c @@ -326,6 +326,38 @@ static void test_strjoina(void) { assert_se(streq(actual, "foo")); } +static void test_strjoin(void) { + char *actual; + + actual = strjoin("", "foo", "bar"); + assert_se(streq(actual, "foobar")); + mfree(actual); + + actual = strjoin("foo", "bar", "baz"); + assert_se(streq(actual, "foobarbaz")); + mfree(actual); + + actual = strjoin("foo", "", "bar", "baz"); + assert_se(streq(actual, "foobarbaz")); + mfree(actual); + + actual = strjoin("foo", NULL); + assert_se(streq(actual, "foo")); + mfree(actual); + + actual = strjoin(NULL, NULL); + assert_se(streq(actual, "")); + mfree(actual); + + actual = strjoin(NULL, "foo"); + assert_se(streq(actual, "")); + mfree(actual); + + actual = strjoin("foo", NULL, "bar"); + assert_se(streq(actual, "foo")); + mfree(actual); +} + static void test_strcmp_ptr(void) { assert_se(strcmp_ptr(NULL, NULL) == 0); assert_se(strcmp_ptr("", NULL) > 0); @@ -727,6 +759,7 @@ int main(int argc, char *argv[]) { test_ascii_strlower(); test_strshorten(); test_strjoina(); + test_strjoin(); test_strcmp_ptr(); test_foreach_word(); test_foreach_word_quoted(); diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index c12af28d10..758b5ed7e2 100644 --- a/src/udev/udev-builtin-usb_id.c +++ b/src/udev/udev-builtin-usb_id.c @@ -372,7 +372,7 @@ fallback: if (r < 0) return log_device_debug_errno(dev_usb, r, "Failed to get idProduct attribute: %m"); - /* fallback to USB vendor & device */ + /* fall back to USB vendor & device */ if (vendor_str[0] == '\0') { const char *usb_vendor;