Commit graph

62957 commits

Author SHA1 Message Date
Dmitry V. Levin f94e9529fe rules: do not use blkid builtin if built without blkid support
When built without blkid, then udev-builtin-blkid is not built,
and the verifier warns about the unknown builtin:

60-persistent-storage.rules:114 Unknown builtin command: blkid --hint=session_offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}
60-persistent-storage.rules:117 Unknown builtin command: blkid --noraid
60-persistent-storage.rules:120 Unknown builtin command: blkid
60-persistent-storage.rules: udev rules check failed
2023-03-08 18:55:40 +00:00
Dmitry V. Levin acdba85e0e udevadm: introduce new 'verify' command
We seem to have no tool to verify udev rule files.  There is a simple
udev rules syntax checker in the tree, test/rule-syntax-check.py, but
it is too simple to detect less trivial issues not detected by udev,
e.g. redundant comparisons (#26593) or labels without references.

Such a tool would be beneficial not only for maintaining udev rules
distributed along with udev, but also and even more so for maintaining
third party udev rules that are more likely to have issues with syntax
and semantic correctness.

Implement a udev rules syntax and semantics checker in the form of
'udevadm verify [OPTIONS] FILE...' command that is based on
udev_rules_parse_file() interface and would apply further checks
on top of it in subsequent commits.

Resolves: #26606
2023-03-08 18:55:40 +00:00
Dmitry V. Levin 4f5de15731 udev_rules_parse_file: mark logged issues
Traditionally, all issues found in udev rules by udev_rules_parse_file()
are logged and ignored, so there was no mechanism to propagate the
information about these issues back to the caller.

Introduce such a mechanism by adding a new member to UdevRuleFile.
This new member is a bitmask describing which log levels were used
in messages logged with regards to the rule file.

This mechanism is going to be used by udevadm verify in subsequent
commits.
2023-03-08 18:55:40 +00:00
Luca Boccassi 82c63b0731
Merge pull request #26716 from mrc0mmand/more-tests
test: add a couple of tests for systemd-escape and systemd-id128
2023-03-08 18:55:40 +00:00
Zbigniew Jędrzejewski-Szmek ad078f59fa
Merge pull request #26678 from yuwata/foreach_array
macro: introduce FOREACH_ARRAY() macro
2023-03-08 19:06:20 +01:00
Luca Boccassi af2fb2f250 core: log message when reloading finishes
Reloading might be slow, especially when under memory pressure, and watchdogs
might be triggered. It is useful to have timestamped telemetry in the journal
to see how long a reload takes.
2023-03-08 18:41:07 +01:00
Frantisek Sumsal bb076d77f4 test: add a couple of tests for systemd-id128 2023-03-08 16:28:37 +01:00
Frantisek Sumsal c38cad7aea test: add a couple of tests for systemd-escape 2023-03-08 16:28:37 +01:00
Frantisek Sumsal 8fc58b35ea random-seed: drop extraneous "we" 2023-03-08 16:28:37 +01:00
Yu Watanabe 0744ed0f26
Merge pull request #26713 from keszybz/man-getenv
Add note to docs that setenv() cannot be called in parallel with getenv()
2023-03-09 00:16:30 +09:00
Zbigniew Jędrzejewski-Szmek d329bae3e6 man: use more references 2023-03-08 15:32:59 +01:00
Zbigniew Jędrzejewski-Szmek 8c51e1520b man: add mention that libsystemd uses getenv()
See #26688: getenv() is not thread-safe, and could a possible source of
problems when a multi-threaded program calls setenv()/putenv()/unsetenv() in
parallel. It is not possible to avoid getenv() calls in general, since $PATH,
$LANG, $SHELL, $USER, $HOME, $TZ may need to be accessed at any time.
Add a warning to our docs so that people are aware of the issue.

Closes #26688. (Real fixes will need to be in glibc and gnome-shell or other
programs.)

The text is added to threads-aware.xml to be included in various places. By
including it in libsystemd-pkgconfig.xml, it is automatically added to all sd-*
pages. The text is also included explicitly in pages for a few other functions
which are call getenv().
2023-03-08 15:32:59 +01:00
Chitoku 0f9c8d0291
timesync: stop re-sync on network configuration change when no link servers are configured (#26708)
This commit fixes an issue where systemd-timesyncd re-synchronizes the
system clock every time the network configuration is updated, no matter
whether link servers are actually changed.

Fixes a bug introduced by e05dd7718d.
2023-03-08 19:52:55 +09:00
Zbigniew Jędrzejewski-Szmek 82c2095a5e localed: skip verification when libxkbcommon is not installed
When compliled without libxkbcommon, we do no verification and accept the
arguments as given. When compliled against with, if dlopen() works, we do the
verification. But if dlopen() fails, we would refuse the call and return
SD_BUS_ERROR_INVALID_ARGS. 5de344704d added things
this way when converting to dlopen(), but it seems not very useful: it can be
expected that when the library is supported but missing at runtime, we degrade
softly, and that the behaviour is something inbetween the cases of hard disable
at compilation time and full support. But right now we behave more strictly then
if disabled at compilation. Change the code to just warn if dlopen fails, but
accept the arguments.

(There are various minimization scenarios where forcing the installation of
libxkbcommon is not useful. E.g. a small installation where we want to set the
keymap via logind, but the configuration is managed by a configuration
management system and is known to be valid. Verification via libxkbcommon is
just overhead in this case.)

800f65f827 moved the check earlier, so now even
a noop case of setting the values that were already in place can fail.
C.f. https://bugzilla.redhat.com/show_bug.cgi?id=2175244.
2023-03-08 19:44:12 +09:00
Zbigniew Jędrzejewski-Szmek 81707069fc
Merge pull request #26685 from yuwata/man-missing-services
man: mention two missing services
2023-03-08 09:35:03 +01:00
Frantisek Sumsal 16600a8661 test: add a couple of tests for busctl 2023-03-08 12:53:44 +09:00
Luca Boccassi e079120505
Merge pull request #26706 from jengelh/master
doc: various orthographic fixes
2023-03-07 21:34:03 +00:00
Luca Boccassi ce0cac4c8e
Merge pull request #26695 from poettering/dissect-mount-helper
make "systemd-dissect --mount" available as /sbin/mount.ddi
2023-03-07 20:07:17 +00:00
Daan De Meyer 1a87882635
Merge pull request #26709 from DaanDeMeyer/mkosi-drop-debug
mkosi: Various cleanups
2023-03-07 15:49:06 +01:00
Daan De Meyer 2f88bb9aee mkosi: Fix locations of mkosi-check-and-shutdown files 2023-03-07 15:25:19 +01:00
Daan De Meyer 925bb83ea5 mkosi: Drop debug logging
The spurious "connection timed out" errors from nspawn should be
fixed now that we're running the latest version.
2023-03-07 15:25:19 +01:00
Daan De Meyer 8d29e401ce mkosi: Drop kernel command line masking in CI
These services should be disabled by default and not need explicit
masking anymore.
2023-03-07 15:25:19 +01:00
Daan De Meyer 523d71076d mkosi: Update to latest
So that we don't enable services by default anymore on Debian.
2023-03-07 15:25:02 +01:00
Jan Engelhardt 18fe76eba5 doc: correct wrong use "'s" contractions 2023-03-07 13:39:31 +01:00
Jan Engelhardt e6faa51a84 doc: replace wrong idiom in homed comment 2023-03-07 13:06:43 +01:00
Jan Engelhardt 3ff1721c21 doc: replace wrong á preposition by à 2023-03-07 13:06:43 +01:00
Luca Boccassi 0531ac585a
Merge pull request #26648 from bluca/kernel_install_guid
kernel-install: also try to find $BOOT by partition GUID
2023-03-07 11:26:12 +00:00
Yu Watanabe 9d0d39ee53 conf-files: fix potential memleak in conf_files_list_strv_internal() on failure
This also changes the used hash_ops from path_hash_ops to
string_hash_ops, as the key is not a path, but a filename.
2023-03-07 18:43:34 +09:00
Yu Watanabe 9ecacf1eae systemctl: port FOREACH_ARRAY() to systemctl-list-units.c 2023-03-07 13:27:18 +09:00
Yu Watanabe 5716c27e1f macro: introduce FOREACH_ARRAY() macro
The pattern that runs all array element is quite common.
But, sometimes, the number of element may be in a signed integer, or the
array may be NULL.
2023-03-07 13:27:16 +09:00
Yu Watanabe 9200e520ad
Merge pull request #26669 from YHNdnzj/journalctl-lines-since-until
journalctl: fix output when --lines is used with --since or --until
2023-03-07 12:02:47 +09:00
Joshua Goins ebc03f5d7a udev: Don't mark as tablet if device has relative coordinates
Tablets don't typically have relative coordinates (they are separated on
the kernel device layer). However, some Logitech mice report similar
supported events, so use the existence of EV_REL to determiner whether or
not the device is really a tablet.

Fixes bug introduced by 0855ce6772.

Fixes: #26600
2023-03-07 09:42:11 +09:00
Lennart Poettering 92828ba603 man: document /sbin/mount.ddi 2023-03-06 23:00:52 +01:00
Lennart Poettering 4601243375 test: add test for new /sbin/mount.ddi helper 2023-03-06 22:54:52 +01:00
Lennart Poettering a164d9d5aa dissect: implement external helper plugin interface for /bin/mount
With this change we'll install a symlink /sbin/mount.ddi →
systemd-dissect. If invoked that way we'll do the equivalent of
systemd-dissect --mount.

This makes DDIs mountable directly via the "mount" command, by
specifying the "-t ddi" pseudo file system type. Moreover you can now
mount DDIs directly via /etc/fstab, by specifying "ddi" in the file
system column (3rd column).
2023-03-06 22:52:20 +01:00
Luca Boccassi df40b7ef5a
Merge pull request #26686 from yuwata/iovec
tree-wide: replace IOVEC_INIT with IOVEC_MAKE
2023-03-06 21:00:04 +00:00
Josef Miegl 417283c5c3 network: geneve: add InheritInnerProtocol flag 2023-03-06 20:58:30 +00:00
Adrian Vovk 27e695840c base-filesystem: Support Arch-style multilib
On distros like Arch and on carbonOS, libraries end up in /usr/lib.
Thus, /lib64 should point to /usr/lib. This commit adds this
functionality as a final fallback (if neither Debian-style nor
Fedora-style multilib can be detected)
2023-03-06 20:53:43 +00:00
Luca Boccassi db73b9d2ab
Merge pull request #26502 from DaanDeMeyer/chase-symlinks-additions
Several chase_symlinks() additions
2023-03-06 20:51:06 +00:00
Luca Boccassi 52bdfbf7d7
Merge pull request #26687 from yuwata/c2x
C2X support
2023-03-06 20:50:17 +00:00
Yu Watanabe 84d0dc53ac time-util: drop redundant call of tzset()
It is also called at the beginning of `parse_timestamp_maybe_with_tz()`.
2023-03-06 20:39:37 +00:00
Adrian Vovk d249c23211 gpt-auto: Check for /boot before putting ESP there
We prefer /efi as a mount point for the ESP, and use /boot as a fallback
if /efi doesn't exist. However, when root=tmpfs, neither /efi nor /boot
exist. gpt-auto should mount to /efi in this case, but it mounted to
/boot instead. This is because gpt-auto didn't check for the existence
of /boot. Here, we correct this
2023-03-06 20:37:57 +00:00
Daan De Meyer 9cc018fa93 mkosi: Update to latest
Latest version builds nspawn from source which hopefully gets rid of
the spurious "Connection timed out" errors we've been seeing in CI.
2023-03-06 19:30:40 +01:00
Lennart Poettering c8170f9c39 TODO 2023-03-06 18:49:09 +01:00
Daan De Meyer 9a98c0f2b1 chase-symlinks: Add chase_symlinks_at_and_open() 2023-03-06 13:53:01 +01:00
Daan De Meyer e864dfa671 chase-symlinks: Add CHASE_MKDIR_0755 2023-03-06 13:42:43 +01:00
Daan De Meyer 28aa650eb7 chase-symlinks: Add CHASE_PARENT
Let's simplify chasing the parent directory of some path by adding
CHASE_PARENT.
2023-03-06 13:42:43 +01:00
Daan De Meyer 7bf4057d79 chase-symlinks: Return "." as path from chase_symlinks_at() instead of NULL 2023-03-06 13:42:40 +01:00
Daan De Meyer 577efd82f2 chase-symlinks: Skip shortcuts if CHASE_PROHIBIT_SYMLINKS is set 2023-03-06 13:41:02 +01:00
Dmitry V. Levin 42a467b552 udev_rules_parse_file: do not skip ENOENT
Starting with commit ed88bcfb7c,
udev_rules_parse_file() silently skips files it fails to open with
ENOENT error, e.g. when they are broken symlinks.  As this behavior is
undocumented and it seems to be unintended, let's treat ENOENT like any
other error.  This change would also simplify the implementation of the
udev rules syntax checker mentioned in #26606.

udev_rules_load(), the only user of udev_rules_parse_file(), is not
affected by this change because it essentially ignores the value
returned by the latter, the only visible difference would be a log
message issued for every udev rules file that couldn't be open because
of ENOENT.

Fixes: ed88bcfb7c ("Be more careful when checking for empty files")
2023-03-06 17:42:12 +09:00