Commit Graph

66734 Commits

Author SHA1 Message Date
Michael A Cassaniti
eeee486159 sysupdate: Use sector size for partition size calculations 2023-08-15 09:17:12 +02:00
Daan De Meyer
4b17f5c378 Merge pull request #28829 from DaanDeMeyer/mount-fd
tree-wide: Mount file descriptors via /proc/<pid>/fd
2023-08-15 09:04:45 +02:00
Luca Boccassi
e158e17299 Merge pull request #28835 from mrc0mmand/more-tests
test: add coverage for #27953
2023-08-15 01:54:52 +01:00
Daan De Meyer
4419735822 fd-util: Use /proc/pid/fd instead of /proc/self/fd
Currently, we mount via file descriptors using /proc/self/fd. This
works, but it means that in /proc/mounts and various other files,
the source of the mount will be listed as /proc/self/fd/xxx. For other
software that parses these files, /proc/self/fd/xxx doesn't mean anything,
or worse, it means the completely wrong thing, as it will refer to one of
their own file descriptors instead.

Let's improve the situation by using /proc/pid/fd instead. This allows
processes parsing /proc/mounts to do the right thing more often than not.
One scenario where even this doesn't work if when containers are involved,
as with the pid namespace unshared, even /proc/pid/fd will mean the wrong
thing, but it's no worse than /proc/self/fd which will always means the wrong
thing.

This also doesn't work if we mount via file descriptor and then exit, as the pid will
be gone, but it does work as long as the process that did the mount is alive, which
makes it useful for systemd-dissect --with for example if the program we run in the
image wants to parse /proc/mounts.
2023-08-14 22:43:12 +02:00
Frantisek Sumsal
01febfcdce test: explicitly specify a UTF-8 locale for UTF-8 shenanigans
As things don't work well without it:

$ LANG=C printf "\ufffe\n"
\uFFFE
2023-08-14 20:09:31 +02:00
Frantisek Sumsal
3ba954dd57 test: add coverage for #27953 2023-08-14 19:35:37 +02:00
Frantisek Sumsal
39f17be437 test: drop unnecessary log level setup
As we do that globally via a dropin.
2023-08-14 19:31:20 +02:00
Daan De Meyer
672de611dd Merge pull request #28828 from DaanDeMeyer/sysupdate-fdisk
fdisk-util: Make fdisk_new_context_fd() more generic
2023-08-14 14:23:03 +02:00
Daan De Meyer
e36c6210b7 dissect-image: Fix mount_point_is_available()
We call dir_is_empty() to check if the directory is empty but don't
take the result into account when returning from the function.
2023-08-14 14:22:38 +02:00
Daan De Meyer
2af02e6165 tree-wide: Always include <net/if.h> before related linux headers
Otherwise, we get redefinition errors if <net/if.h> is included later
on by another header.
2023-08-14 13:16:46 +02:00
Daan De Meyer
4492eb1186 tree-wide: Use fdisk_new_context_at() more 2023-08-14 10:42:43 +02:00
Daan De Meyer
fd9fe57a26 fdisk-util: Make fdisk_new_context_fd() more generic
Let's make this an openat() style function so we can also pass a
device path.
2023-08-14 10:27:57 +02:00
Daan De Meyer
59120e89d8 Merge pull request #28827 from gioele/docs-fix-network-online-example-unit
docs/NETWORK_ONLINE: Move `Type=`, `RemainAfterExit=` to `[Service]` + Use `until` instead of `while !`
2023-08-14 10:08:20 +02:00
Gioele Barabucci
4a899c5a23 docs/NETWORK_ONLINE: Use until instead of while !
`until` is the standard POSIX shell builtin to be used when waiting for
a condition to appear.
2023-08-14 09:15:31 +02:00
Gioele Barabucci
3078ece8c4 docs/NETWORK_ONLINE: Move Type=, RemainAfterExit= to [Service]
`Type=` and `RemainAfterExit=` belong in `[Service]`, not `[Unit]`.

Fixes #28826
2023-08-14 09:15:21 +02:00
Susant Sahani
3912d49d0d network: ndisc - Ignore route information if reserved (10) value is
received

RFC4191 – Section 2.3 Route Information Option's Prf field:
If the Reserved (10) value is received, the Route Information Option MUST be ignored.
2023-08-14 12:43:38 +09:00
Mike Yuan
031a399d87 sleep: clear EFI HibernateLocation if writing kernel config fails
Follow-up for f1f331a252
2023-08-13 22:12:32 +01:00
Yu Watanabe
57ffa99daa core: drop redundant assignment of UNIT_MERGED in unit_load_fragment()
If the unit is merged into another unit, then the load state is already
set in merge_by_names() -> unit_merge(). Let's drop the redundant assignment.
2023-08-13 12:56:08 +01:00
Yu Watanabe
e3390a22dc Merge pull request #28744 from YHNdnzj/battery-check-minor-followup
battery-util: minor follow-ups
2023-08-13 19:27:56 +09:00
Yu Watanabe
88321d5d77 Merge pull request #28809 from YHNdnzj/proc-cmdline-true-when-missing
proc-cmdline: introduce PROC_CMDLINE_TRUE_WHEN_MISSING and use it where appropriate
2023-08-13 19:25:22 +09:00
Sam James
0b4e0943a0 basic: add comment for LFS assert in dirent-util.h
Followup to eb29296937 as promised; requested
by lennart at https://github.com/systemd/systemd/pull/27599#discussion_r1192619263.
2023-08-13 10:40:36 +01:00
Luca Boccassi
a0b0b670ab test: skip test-path on Salsa CI
Salsa is the Debian git forge. In the package build environment test-path
always fails as we cannot set up cgroups and so the path unit fails to
start. Skip the test in that environment.

Unfortunately meson doesn't allow to skip individual tests by name.
2023-08-13 10:27:04 +01:00
Mike Yuan
46b0b7e24a battery-util: log_notice when unsure about battery state
Follow-up for 02f7f8aa4f

This deserves some highlight.

Addresses https://github.com/systemd/systemd/pull/28597#discussion_r1288592726
2023-08-13 13:02:58 +08:00
Mike Yuan
60d83c3e86 battery-util: don't log duplicate message
Follow-up for 02f7f8aa4f

Addresses https://github.com/systemd/systemd/pull/28597#discussion_r1288591215

> this is pretty unnecessary, battery_read_capacity_percentage()
debug logs on its own about this already, in more detailed way?
2023-08-13 13:02:57 +08:00
Mike Yuan
022a19c9f6 reboot-util: cache the result of shall_restore_state 2023-08-13 12:54:56 +08:00