Commit Graph
62899 Commits
Author SHA1 Message Date
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
Yu Watanabe 25e12db5e4 Merge pull request #26650 from yuwata/udev-trigger
test: generate debugging logs for udevd after restart
2023-03-06 16:36:34 +09:00
Zbigniew Jędrzejewski-Szmek efcde781de meson: adjust for removal of gnu-efi compat
gnu-efi-3.0.11-13.fc39 in Fedora dropped the old include paths.
2023-03-05 19:11:58 +00:00
Yu Watanabe ae9f36397f Revert "hwdb: fix swapped buttons for Logitech Lift left"
This reverts commit 81cfea95e5.

The modalias seems to match a generic Logitech USB receiver even the
connected mouce is not for left hand.

Fixes #26671 and #26676.
2023-03-05 14:21:22 +01:00
Zbigniew Jędrzejewski-Szmek cfba58fe79 Merge pull request #26651 from yuwata/meson-cleanups
Several meson cleanups
2023-03-05 13:38:55 +01:00
Daan De Meyer 877e68e702 mkosi: Install dnf on centos and fedora
dnf is not installed by default anymore, but it's still useful to
have in our images, so let's install it explicitly.
2023-03-05 18:05:19 +09:00
Yu Watanabe 561f17a1e4 Merge pull request #26668 from yuwata/man-link-rename
man: add/update example in systemd.link
2023-03-04 22:14:22 +09:00
Yu Watanabe 181d719542 man: add an example to (re-)apply new settings to a network interface
Closes #26601.
2023-03-04 20:07:56 +09:00
Yu Watanabe 9b7f499ff1 man: sync the default .link file in example 2023-03-04 14:35:01 +09:00
Yu Watanabe f482e22484 Merge pull request #26653 from poettering/tmpfile-linkable-replace
teach link_tmpfile() to optionally replace files
2023-03-04 02:53:59 +09:00
Frantisek Sumsal ac76d1ec69 README: update CentOS CI URLs to the new instance 2023-03-03 18:38:40 +01:00
Frantisek Sumsal c63bfd0884 systemctl: explicitly cast the constants to uint64_t
Otherwise under certain conditions `va_arg()` might get garbage instead
of the expected value, i.e.:

$ sudo build-o0/systemctl disable asdfasfaf
sd_bus_message_appendv: Got uint64_t: 0
Failed to disable unit: Unit file asdfasfaf.service does not exist.

$ sudo build-o1/systemctl disable asdfasfaf
sd_bus_message_appendv: Got uint64_t: 7954875719681572864
Failed to disable unit: Invalid argument

(reproduced on an armv7hl machine)

Resolves: #26568
Follow-up to: bf1bea43f1
Related issue: https://github.com/systemd/systemd/pull/14470#discussion_r362893735
2023-03-03 15:57:34 +00:00
Luca Boccassi 0c70d5e623 Merge pull request #26646 from poettering/nspawn-private
nspawn: ensure all mount propagation is turned off between host and container, except for the "tunnel" dir
2023-03-03 15:57:13 +00:00
Luca Boccassi 4ed17fb88c Merge pull request #26649 from yuwata/parse-timstamp
test: fix and extend test for parse_timestamp()
2023-03-03 15:56:53 +00:00
Yu Watanabe af766bb844 test: trigger new events after all currently queued events are processed
Otherwise, udevd may be busy and udevadm may not receive the reply
for the control packet within the time limit.
2023-03-03 23:25:01 +09:00
Yu Watanabe ff0a9199d4 man: fix doubled word 2023-03-03 23:13:23 +09:00
наб f8b7ff8493 man: fix typo (#26655) 2023-03-03 23:01:51 +09:00
Lennart Poettering acbab8697e hwdb: port to flink_tmpfile()
And modernize heavily while doing so.

Fixes: #21787

(Strictly speaking, this leaves a race window open: the the system is
powered off in the short interval when we linked in the prepared hwdb
file into the dir under a temporary name and are about to rename it to
the final name, then the file might be left over after all. But this
minimizes the window so much that this shouldn't be an issue in
real-life. Key after all is that with this change we'll build up the
hwdb file under O_TMPFILE, and thus are robust to power loss during the
slow operation)
2023-03-03 13:44:12 +01:00
Lennart Poettering 23e208e742 tmpfile-util: teach link_tmpfile() to optionally replace files 2023-03-03 13:44:12 +01:00
Lennart Poettering 16a9ad557d Merge pull request #26355 from poettering/journal-no-rtc
journald: support ordering journal entries by boot ID if no RTC is available
2023-03-03 13:13:13 +01:00
Yu Watanabe 9f819781ca time-util: refuse non-zero gmtoff with non-UTC timezone
Also this moves the range check for gmtoff to parse_timestamp_impl(), to
address the post-merge comment:
https://github.com/systemd/systemd/pull/26409#discussion_r1118650190
2023-03-03 20:39:19 +09:00
Yu Watanabe 87e0fd575e time-util: extend comment a bit 2023-03-03 20:39:19 +09:00
Yu Watanabe 8beb47c824 time-util: rename len -> tz_offset
And merge parse_timestamp_with_tz() with parse_timestamp_impl().
Addresses the post-merge comment:
https://github.com/systemd/systemd/pull/26409#discussion_r1118647440
2023-03-03 20:39:19 +09:00
Yu Watanabe ca9c9d8d8e time-util: fix typo
Follow-up for 7a9afae604.
2023-03-03 20:39:19 +09:00
Yu Watanabe b66b3c4099 meson: extend timeout for test-time-util
The test forks so many child processes, and may hit the default time
limit on slow environment or running with sanitizers.
2023-03-03 20:39:19 +09:00
Yu Watanabe d8f3ad627c test: test parse_timestamp() in various timezone 2023-03-03 20:39:10 +09:00
Yu Watanabe 695253466b meson: show options about tests in the summary 2023-03-03 20:27:44 +09:00
Lennart Poettering 56339a10db nspawn: disable propagation for selected host API bind mounts
We bind mount two selected inodes from the host into our container.
Let's turn off propagation for that, since we just want those inodes,
nothing else.

With this change "grep master: /proc/self/mountinfo" should list only
the mount propagation "tunnel" dir, and nothing else anymore.
2023-03-03 12:17:49 +01:00
Lennart Poettering 75f8173247 nspawn: disconnect mounts propagation from host on our container dir
@brauner noticed that in invoked containers the root directory is set to
still receive mounts from the host. We should disable that, and
guarantee we live in our own world, because that's what an
(nspawn-style) container *is* after all: a whole new world.

This hence mounts the container subtree to MS_PRIVATE after getting the
root dir in place. Note that this will later be set to MS_SHARED again.
The MS_PRIVATE disconnects mounts from the host, the MS_SHARED then
establishes a new peer group for mount propagation events, so that
payload service managers (such as systemd) can take benefit of
propagation further down the tree.
2023-03-03 12:17:42 +01:00
Yu Watanabe e3b2f7c056 tools: explicitly specify "setup" subcommand
As invoking meson without subcommand is deprecated since 0.64.0.
2023-03-03 20:06:30 +09:00
Yu Watanabe d2ec38e2b2 meson: rename conflicting target names
The update-man-rules and update-dbus-docs targets are both declared in the
main meson.build and man/meson.build, so we cannot build the target with
'meson compile' command:
====
$ meson compile update-man-rules
INFO: autodetecting backend as ninja

ERROR: Can't invoke target `update-man-rules`: ambiguous name.Add target type and/or path:
- ./man/update-man-rules:custom
- ./update-man-rules:run
====
Let's rename the targets declared in man/meson.build.
2023-03-03 19:56:38 +09:00
Yu Watanabe 26ab5ea69d tools: fix the file name that "meson setup" generates 2023-03-03 19:54:38 +09:00
Yu Watanabe b6b5135e66 test: generate debugging logs for udevd after restart 2023-03-03 19:48:40 +09:00
Yu Watanabe 8677fdc78b test: clear tzname[] after timezone is changed
Fixes the issue reported in fe56f21ae3.
2023-03-03 19:45:32 +09:00
Yu Watanabe 0b20d70d1c test: use get_timezones() to iterate all known timezones 2023-03-03 19:45:32 +09:00
Yu Watanabe 11fa81bf77 meson: add missing man rules for new sd-login functions
Follow-up for d71f5b1217,
c4ef14dc2a, and
d622fefc00.
2023-03-03 14:38:13 +09:00
Lennart Poettering 11875a98e4 nspawn: drop unused arg 2023-03-02 20:54:31 +01:00
Luca Boccassi a41ac8ac40 Merge pull request #26628 from msizanoen1/utf8-quote-valid
escape: Ensure that output is always valid UTF-8
2023-03-02 17:33:16 +00:00
Michal Koutný edd84b8e4b meson: Copy files with git only in true git repository
When mkosi is run from git-worktree(1), the .git is not a repository
directory but a textfile pointing to the real git dir
(e.g. /home/user/systemd/.git/worktrees/systemd-worktree). This git dir
is not bind mounted into build environment and it fails with:

> fatal: not a git repository: /home/user/systemd/.git/worktrees/systemd-worktree
> test/meson.build:190:16: ERROR: Command `/usr/bin/env -u GIT_WORK_TREE /usr/bin/git --git-dir=/root/src/.git ls-files ':/test/dmidecode-dumps/*.bin'` failed with status 128.

There is already a fallback to use shell globbing instead of ls-files,
use it with git worktrees as well.
2023-03-02 15:04:40 +00:00
msizanoen1 0b82a6fa5d escape: add missing non-NULL parameter assertions 2023-03-02 19:55:47 +07:00
msizanoen1 582843ee37 test-escape: Add tests for escaping bogus UTF-8 sequences 2023-03-02 19:55:47 +07:00
msizanoen1 00f57157f3 escape: Ensure that output is always valid UTF-8
This ensures that shell string escape operations will not produce output
with invalid UTF-8 from the input by escaping invalid UTF-8 data as if
they were single byte characters.
2023-03-02 19:55:12 +07:00
Lennart Poettering c48f13d8e1 update TODO 2023-03-02 10:18:24 +01:00
Lennart Poettering 4601c7aa8f test: add test for journals without RTC
This adds a test for checking we can safely order boot IDs via the
timestamp of their most recent known entry. It takes a set of journal
files (supplied by a user) and that are partially corrupted, and ensures
we get a clear, defined order of boot IDs out of it.
2023-03-02 10:18:24 +01:00
Lennart Poettering 262299dccb journal: use boot-id/timestamp info for odering entries
With this we should be able to determine on systems without
battery-backed RTC even during early boot whether a boot is supposed to
be earlier than another.

Fixes: #662
2023-03-02 10:03:15 +01:00
Lennart Poettering 34af74946e sd-journal: track newest open journal file per boot ID
This is useful to later order boot IDs by time, addressing #662.

Basically, this determines the most recently written for each boot ID
from all currently open journal files. This is then stored in a hash
table (which maps the boot ID to a prioq of journal files, ordered by
their timestamp).

Why is this useful? If systems lack a battery-buffered RTC they will
initially have a system clock basically starting at zero. Later they
might acquire an NTP fix, or at least roughly monotonic time via a
stored timestamp. Thus, log entries written early during boot tend to be
badly timestamped, and those written most recently are likely to have
most accurate timestamps. Thus, if we track the newest entry for each
boot ID we likely can order the boot ID via their timestamps.

This commit only add the logic to maintain the hash table/prioq. It
doesn't actually make use of this information for ordering yet. A later
patch adds that.
2023-03-02 10:03:15 +01:00
Lennart Poettering 206f0f397e journal-file: journal-file: extend journal header to always carry offset of most recent entry
This way we can quickly find the most recent entry, without searching or
traversing entry array chains.

This is relevant later, as it it allows us to quickly determine the most
recent timestamps of each journal file, in a roughly atomic way.
2023-03-02 10:03:15 +01:00
Luca Boccassi 7a67afe331 Merge pull request #26627 from mrc0mmand/TEST-17-tweaks
test: skip the hwdb update related tests w/ sanitizers and w/o accel
2023-03-01 23:11:05 +00:00
Luca Boccassi f05f2334ee Merge pull request #26632 from poettering/dissect-arch-nspawn
dissect: determine arch from DDI and use it for nspawn
2023-03-01 22:53:16 +00:00