]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agotests: add tests for various corner cases of nulstr 25360/head
Lennart Poettering [Fri, 11 Nov 2022 22:26:08 +0000 (23:26 +0100)] 
tests: add tests for various corner cases of nulstr

3 years agonulstr-util: fix corner cases of strv_make_nulstr()
Lennart Poettering [Fri, 11 Nov 2022 22:17:12 +0000 (23:17 +0100)] 
nulstr-util: fix corner cases of strv_make_nulstr()

Let's change the return semantics of strv_make_nulstr() so that we can
properly distuingish the case where we have a no entries in the nulstr
from the case where we have a single empty string in a nulstr.

Previously we couldn't distuingish those, we'd in both cases return a
size of zero, and a buffer with two NUL bytes.

With this change, we'll still return a buffer with two NULL bytes, but
for the case where no entries are defined we'll return a size of zero,
and where we have two a size of one.

This is a good idea, as it makes sure we can properly handle all corner
cases.

Nowadays the function is used by one place only: ask-password-api.c. The
corner case never mattered there, since it was used to serialize
passwords, and it was known that there was exactly one password, not
less. But let's clean this up. This means the subtraction of the final
NUL byte now happens in ask-password-api.c instead.

3 years agonulstr-util: don't use 'r' for anything but integer return values
Lennart Poettering [Fri, 11 Nov 2022 21:07:43 +0000 (22:07 +0100)] 
nulstr-util: don't use 'r' for anything but integer return values

3 years agonulstr-util: use memdup_suffix0() where appropriate
Lennart Poettering [Fri, 11 Nov 2022 21:04:37 +0000 (22:04 +0100)] 
nulstr-util: use memdup_suffix0() where appropriate

if the nulstr is not nul-terminated, we shouldn't use strndup() but
memdup_suffix0(), to not trip up static analyzers which imply we are
duping a string here.

3 years agonulstr-util: use _cleanup_strv_free_() where appropriate
Lennart Poettering [Fri, 11 Nov 2022 21:01:03 +0000 (22:01 +0100)] 
nulstr-util: use _cleanup_strv_free_() where appropriate

3 years agonulstr-util: rebreak comments
Lennart Poettering [Fri, 11 Nov 2022 20:59:41 +0000 (21:59 +0100)] 
nulstr-util: rebreak comments

3 years agonulstr-util: modernize strv_from_nulstr() a bit
Lennart Poettering [Fri, 11 Nov 2022 20:57:28 +0000 (21:57 +0100)] 
nulstr-util: modernize strv_from_nulstr() a bit

3 years agostrv: move nulstr utilities to nulstr-util.[ch]
Lennart Poettering [Fri, 11 Nov 2022 20:55:00 +0000 (21:55 +0100)] 
strv: move nulstr utilities to nulstr-util.[ch]

Let's move them out of the generic, already very long strv.[ch] module
into the more specific nulst-util.[ch]

No code changes.

3 years agoac-power: check battery existence and status
Yu Watanabe [Fri, 11 Nov 2022 04:54:03 +0000 (13:54 +0900)] 
ac-power: check battery existence and status

If a battery is not present or its status is not discharging, then
the battery should not be used as a power source.
Let's count batteries currently discharging.

Fixes #25316.

3 years agoMerge pull request #25268 from PeterCxy/fido2-preflight
Luca Boccassi [Sat, 12 Nov 2022 14:51:47 +0000 (15:51 +0100)] 
Merge pull request #25268 from PeterCxy/fido2-preflight

libfido2-util: Perform pre-flight check for credentials in token

3 years agoman/systemd-dissect.xml: fix trivial error
Carlo Teubner [Fri, 11 Nov 2022 19:42:49 +0000 (19:42 +0000)] 
man/systemd-dissect.xml: fix trivial error

3 years agoMerge pull request #25351 from crrodriguez/Wenum-int-mismatch
Luca Boccassi [Sat, 12 Nov 2022 00:40:57 +0000 (01:40 +0100)] 
Merge pull request #25351 from crrodriguez/Wenum-int-mismatch

Fix gcc 13 -Wenum-int-mismatch warnings

3 years agoshared|install: Use InstallChangeType consistently 25351/head
Cristian Rodríguez [Fri, 11 Nov 2022 15:34:32 +0000 (15:34 +0000)] 
shared|install: Use InstallChangeType consistently

gcc 13 -Wenum-int-mismatch, enabled by default, reminds us enum ! = int

3 years agoresolve: dns_server_feature_level_*_string type is DnsServerFeatureLevel
Cristian Rodríguez [Fri, 11 Nov 2022 15:31:18 +0000 (15:31 +0000)] 
resolve: dns_server_feature_level_*_string type is DnsServerFeatureLevel

gcc 13 -Wenum-int-mismatch reminds us that enum != int

3 years agojournal-remote: code is of type enum MHD_RequestTerminationCode
Cristian Rodríguez [Fri, 11 Nov 2022 15:28:51 +0000 (15:28 +0000)] 
journal-remote: code is of type enum MHD_RequestTerminationCode

Fixes gcc 13 -Wenum-int-mismatch which are enabled by default.

3 years agolibfido2-util: Perform pre-flight check for credentials in token 25268/head
MkfsSion [Sat, 29 Oct 2022 18:29:02 +0000 (14:29 -0400)] 
libfido2-util: Perform pre-flight check for credentials in token

Do not attempt to decrypt using a key slot unless its corresponding
credential is found on an available FIDO2 token. Avoids multiple touches
/ confirmations when unlocking a LUKS2 device with multiple FIDO2 tokens
enrolled.

Partially fixes #19208 (when the libcryptsetup plugin is in use).

3 years agolibfido2-util: Extract error handling logic from fido2_use_hmac_hash_specific_token
MkfsSion [Sat, 29 Oct 2022 18:21:06 +0000 (14:21 -0400)] 
libfido2-util: Extract error handling logic from fido2_use_hmac_hash_specific_token

3 years agolibfido2-util: Commonize FIDO2 basic property settings
MkfsSion [Sat, 29 Oct 2022 18:14:22 +0000 (14:14 -0400)] 
libfido2-util: Commonize FIDO2 basic property settings

These properties are repeatedly set across multiple functions.

3 years agorepart: fix build
Lennart Poettering [Fri, 11 Nov 2022 16:47:21 +0000 (17:47 +0100)] 
repart: fix build

Follow-up for: 12e2b70f9b849e54018f147b8a11154cd5e2dcf6

3 years agonulstr-util: Declare NULSTR_FOREACH() iterator inline
Daan De Meyer [Fri, 11 Nov 2022 11:08:26 +0000 (12:08 +0100)] 
nulstr-util: Declare NULSTR_FOREACH() iterator inline

3 years agostrv: Make sure strv_make_nulstr() always returns a valid nulstr
Daan De Meyer [Fri, 11 Nov 2022 10:26:54 +0000 (11:26 +0100)] 
strv: Make sure strv_make_nulstr() always returns a valid nulstr

strv_make_nulstr() is documented to always return a valid nulstr,
but if the input is `NULL` we return a string terminated with only
a single NUL terminator, so let's fix that and always terminate the
resulting string with two NUL bytes.

3 years agosd-bus: Use goto finish instead of return in bus_add_match_full
Daan De Meyer [Fri, 11 Nov 2022 10:09:28 +0000 (11:09 +0100)] 
sd-bus: Use goto finish instead of return in bus_add_match_full

Fixes #25340

3 years agoresolve: Use only C99 flex arrays (#25335)
Cristian Rodríguez [Fri, 11 Nov 2022 14:22:49 +0000 (11:22 -0300)] 
resolve: Use only C99 flex arrays (#25335)

3 years agoMerge pull request #24803 from DaanDeMeyer/repart-copy-deny-list
Daan De Meyer [Fri, 11 Nov 2022 12:19:58 +0000 (13:19 +0100)] 
Merge pull request #24803 from DaanDeMeyer/repart-copy-deny-list

repart: Don't descend into directories assigned to other partitions

3 years agoMerge pull request #25328 from poettering/vertical-tables
Yu Watanabe [Fri, 11 Nov 2022 06:18:12 +0000 (15:18 +0900)] 
Merge pull request #25328 from poettering/vertical-tables

format-table: add concept of "vertical" table

3 years agoMerge pull request #25325 from yuwata/resolve-cap-per-link-setting-by-global
Luca Boccassi [Thu, 10 Nov 2022 22:20:40 +0000 (23:20 +0100)] 
Merge pull request #25325 from yuwata/resolve-cap-per-link-setting-by-global

resolve: provide effective mDNS or LLMNR settings

3 years agotimedatectl: port to new 'vertical' table type 25328/head
Lennart Poettering [Thu, 10 Nov 2022 12:32:08 +0000 (13:32 +0100)] 
timedatectl: port to new 'vertical' table type

3 years agoresolvectl: port to new 'vertical' table type
Lennart Poettering [Thu, 10 Nov 2022 12:31:43 +0000 (13:31 +0100)] 
resolvectl: port to new 'vertical' table type

3 years agoMerge pull request #25261 from poettering/dissec-uuid
Lennart Poettering [Thu, 10 Nov 2022 22:10:17 +0000 (23:10 +0100)] 
Merge pull request #25261 from poettering/dissec-uuid

systemd-dissect: show image UUID in output

3 years agoresolvectl: fail properly if we can't append to table
Lennart Poettering [Thu, 10 Nov 2022 12:30:02 +0000 (13:30 +0100)] 
resolvectl: fail properly if we can't append to table

3 years agoformat-table: add an explicit "vertical" mode
Lennart Poettering [Thu, 10 Nov 2022 11:52:08 +0000 (12:52 +0100)] 
format-table: add an explicit "vertical" mode

Originally, the table formatting code was written to display a number of
records, one per line, and within each line multiple fields of the same
record. The first line contains the column names.

It was then started to be used in a "vertical" mode however,
i.e. with field names on the left instead of the top. Let's support such
a mode explicitly, so that we can provide systematic styling, and can
properly convert this mode to JSON.

A new constructor "table_new_vertical()" is added creating such
"vertical" tables. Internally, this is a table with two columns: "key"
and "value". When outputting this as JSON we'll output a single JSON
object, with key/value as fields. (Which is different from the
traditional output where we'd use the first line as JSON field names,
and output an array of objects).

A new cell type TABLE_FIELD is added for specifically marking the
"field" cells, i.e. the cells in the first column. We'll automatically
suffic ":" to these fields on output.

3 years agomeson: install systemd-ac-power under /usr/bin
Yu Watanabe [Thu, 10 Nov 2022 16:17:57 +0000 (01:17 +0900)] 
meson: install systemd-ac-power under /usr/bin

And test the its help message.

The program is useful for e.g. scripts that conditionalize their tasks
to be invoked only when running on AC power.

3 years agoupdate TODO
Lennart Poettering [Thu, 10 Nov 2022 21:19:22 +0000 (22:19 +0100)] 
update TODO

3 years agopo: Translated using Weblate (Finnish)
Ricky Tigg [Thu, 10 Nov 2022 19:19:46 +0000 (20:19 +0100)] 
po: Translated using Weblate (Finnish)

Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main

3 years agotest: add quick test for ensuring image UUID is deterministic based on the seed passe... 25261/head
Lennart Poettering [Thu, 10 Nov 2022 16:33:31 +0000 (17:33 +0100)] 
test: add quick test for ensuring image UUID is deterministic based on the seed passed to repart

3 years agolocale: honour new env var $SYSTEMD_UTF8=
Lennart Poettering [Thu, 10 Nov 2022 16:18:50 +0000 (17:18 +0100)] 
locale: honour new env var $SYSTEMD_UTF8=

This is useful to force off fancy unicode glyph use (i.e. use "->"
instead of "→"), which is useful in tests where locales might be
missing, and thus control via $LC_CTYPE is not reliable.

Use this in TEST-58, to ensure the output checks we do aren't confused
by missing these glyphs being unicode or not.

3 years agorepart: Add integration test for #24678 24803/head
Daan De Meyer [Wed, 9 Nov 2022 12:41:38 +0000 (13:41 +0100)] 
repart: Add integration test for #24678

3 years agorepart: Don't descend into directories assigned to other partitions
Daan De Meyer [Fri, 23 Sep 2022 19:15:01 +0000 (21:15 +0200)] 
repart: Don't descend into directories assigned to other partitions

Let's say we have the following repart definitions files root.conf
and home.conf:

```
[Partition]
Type=root
CopyFiles=/
```

```
[Partition]
Type=home
CopyFiles=/home
```

Currently, we'd end up copying /home to both the root partition and
the home partition. To prevent this from happening, let's adopt a
new policy when copying files for a partition: We won't copy any
files/directories that appear in the CopyFiles= list of another
partition, unless that directory explicitly appears in our own
CopyFiles= list.

This way, we prevent copying /home twice into the root and home
partition, but should a user really want that behavior, they can
have it by adding /home to the CopyFIles= list of the root partition
as well.

3 years agogpt: Add gpt_partition_type_mountpoint_nulstr()
Daan De Meyer [Tue, 27 Sep 2022 10:30:55 +0000 (12:30 +0200)] 
gpt: Add gpt_partition_type_mountpoint_nulstr()

3 years agogpt: Replace bitfields with designator field in GptPartitionType
Daan De Meyer [Tue, 27 Sep 2022 10:20:20 +0000 (12:20 +0200)] 
gpt: Replace bitfields with designator field in GptPartitionType

To achieve this we move the PartitionDesignator enum from
dissect-image.h to gpt.h

3 years agocopy: Support passing a deny list of files/directories to not copy
Daan De Meyer [Fri, 23 Sep 2022 19:07:41 +0000 (21:07 +0200)] 
copy: Support passing a deny list of files/directories to not copy

3 years agodissect: make image name bold
Lennart Poettering [Wed, 9 Nov 2022 21:51:42 +0000 (22:51 +0100)] 
dissect: make image name bold

3 years agodissect: also parse out the top-level GPT table uuid and expose this as image UUID
Lennart Poettering [Thu, 20 Oct 2022 21:14:28 +0000 (23:14 +0200)] 
dissect: also parse out the top-level GPT table uuid and expose this as image UUID

systemd-repart generates this in a suitably stable fashion, hence let's
actually use it as an identifier for the image. As a first step parse
it, and show it.

3 years agojson: add build helpers to insert id128 in uuid formatting into json object
Lennart Poettering [Thu, 20 Oct 2022 21:08:45 +0000 (23:08 +0200)] 
json: add build helpers to insert id128 in uuid formatting into json object

3 years agoupdate TODO
Lennart Poettering [Thu, 10 Nov 2022 14:59:58 +0000 (15:59 +0100)] 
update TODO

3 years agostat-util: Move inode_hash_ops to stat-util
Daan De Meyer [Fri, 23 Sep 2022 17:00:23 +0000 (19:00 +0200)] 
stat-util: Move inode_hash_ops to stat-util

TO make it usable in other code.

3 years agotest: add tests for mDNS and LLMNR settings 25325/head
Yu Watanabe [Thu, 10 Nov 2022 06:52:57 +0000 (15:52 +0900)] 
test: add tests for mDNS and LLMNR settings

3 years agotest: create config under /run
Yu Watanabe [Thu, 10 Nov 2022 06:51:30 +0000 (15:51 +0900)] 
test: create config under /run

3 years agoresolvectl: warn if the global mDNS or LLMNR support level is lower than the requeste...
Yu Watanabe [Fri, 4 Nov 2022 04:11:55 +0000 (13:11 +0900)] 
resolvectl: warn if the global mDNS or LLMNR support level is lower than the requested one

3 years agoresolve: provide effective supporting levels of mDNS and LLMNR
Yu Watanabe [Fri, 4 Nov 2022 03:53:07 +0000 (12:53 +0900)] 
resolve: provide effective supporting levels of mDNS and LLMNR

The per-link settings are ignored if the feature is disabled by the global setting.
Let's announce the effective level, to make not users confused.

Closes #24863.

3 years agoresolve: introduce link_get_llmnr_support() and link_get_mdns_support()
Yu Watanabe [Fri, 4 Nov 2022 03:53:07 +0000 (12:53 +0900)] 
resolve: introduce link_get_llmnr_support() and link_get_mdns_support()

3 years agoresolve: drop redundant call of socket_ipv6_is_supported()
Yu Watanabe [Fri, 4 Nov 2022 03:53:07 +0000 (12:53 +0900)] 
resolve: drop redundant call of socket_ipv6_is_supported()

As link_relevant() is called with AF_INET6, which returns true only when
the link has at least one relevant IPv6 address.

3 years agobuild: Use -fstrict-flex-arrays=1 if supported
Cristian Rodríguez [Wed, 9 Nov 2022 23:56:46 +0000 (23:56 +0000)] 
build: Use -fstrict-flex-arrays=1 if supported

Due to "historical reasons" both gcc and clang treat *all* trailing
arrays members as flexible arrays, this has an evil side effect
of inhibiting bounds checks on such members as __builtin_object_size
cannot say for sure that:

struct {
...
type foo[3];
}

has a trailing foo member of fixed size rather than unspecified.

Ideally we should use -fstrict-flex-arrays as is, but we have to
tolerate kernel uapi headers that use [0] and third party libraries
written in c89 that may use [1] like curl.

3 years agotest-network: skip test_match if alternative name is not supported by kernel
Yu Watanabe [Thu, 10 Nov 2022 07:21:28 +0000 (16:21 +0900)] 
test-network: skip test_match if alternative name is not supported by kernel

Fixes #25259.

3 years agoMerge pull request #24813 from DaanDeMeyer/at-all-the-things
Luca Boccassi [Thu, 10 Nov 2022 09:57:14 +0000 (10:57 +0100)] 
Merge pull request #24813 from DaanDeMeyer/at-all-the-things

Add more openat() style variants for existing stuff

3 years agoMerge pull request #25315 from poettering/dissect-mtree
Luca Boccassi [Thu, 10 Nov 2022 09:44:27 +0000 (10:44 +0100)] 
Merge pull request #25315 from poettering/dissect-mtree

dissect: add new --mtree switch to generate BSD comaptible mtree manifests of DDIs

3 years agoMerge pull request #25280 from keszybz/initrd-with-overlayfs
Frantisek Sumsal [Thu, 10 Nov 2022 08:22:15 +0000 (08:22 +0000)] 
Merge pull request #25280 from keszybz/initrd-with-overlayfs

Initrd with overlayfs

3 years agopid1: skip cleanup if root is not tmpfs/ramfs 25280/head
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2022 11:40:20 +0000 (12:40 +0100)] 
pid1: skip cleanup if root is not tmpfs/ramfs

in_initrd() was really doing two things: checking if we're in the initrd, and
also verifying that the initrd is set up correctly. But this second check is
complicated, in particular it would return false for overlayfs, even with an
upper tmpfs layer. It also doesn't support the use case of having an initial
initrd with tmpfs, and then transitioning into an intermediate initrd that is
e.g. a DDI, i.e. a filesystem possibly with verity arranged as a disk image.

We don't need to check if we're in initrd in every program. Instead, concerns
are separated:
- in_initrd() just does a simple check for /etc/initrd-release.
- When doing cleanup, pid1 checks if it's on a tmpfs before starting to wipe
  the old root. The only case where we want to remove the old root is when
  we're on a plain tempory filesystem. With an overlay, we'd be creating
  whiteout files, which is not very useful. (*)

This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=2137631
which is caused by systemd refusing to treat the system as an initrd because
overlayfs is used.

(*) I think the idea of keeping the initrd fs around for shutdown is outdated.
We should just have a completely separate exitrd that is unpacked when we want
to shut down. This way, we don't waste memory at runtime, and we also don't
transition to a potentially older version of systemd. But we don't have support
for this yet.

This replaces 0fef5b0f0bd9ded1ae7bcb3e4e4b2893e36c51a6.

3 years agotest-fd-util: fix typos and use log_tests_skipped()
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2022 13:18:46 +0000 (14:18 +0100)] 
test-fd-util: fix typos and use log_tests_skipped()

3 years agotest: add trivial test for systemd-dissect --mtree 25315/head
Lennart Poettering [Wed, 9 Nov 2022 11:31:36 +0000 (12:31 +0100)] 
test: add trivial test for systemd-dissect --mtree

3 years agoman: document new systemd-dissect --mtree switch
Lennart Poettering [Wed, 9 Nov 2022 11:12:02 +0000 (12:12 +0100)] 
man: document new systemd-dissect --mtree switch

3 years agodissect: add a new "--mtree" switch for generating a BSD mtree(5) compatible file...
Lennart Poettering [Wed, 9 Nov 2022 10:34:52 +0000 (11:34 +0100)] 
dissect: add a new "--mtree" switch for generating a BSD mtree(5) compatible file manifest

3 years agomeson: add version.h dependency to more components
Frantisek Sumsal [Wed, 9 Nov 2022 12:33:39 +0000 (13:33 +0100)] 
meson: add version.h dependency to more components

Follow-up to c47511da7e2bab1a429fc1958a73d3f426ebb3da.

```
archlinux_systemd_ci: In file included from ../build/src/dissect/dissect.c:15:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: version.h: No such file or directory
archlinux_systemd_ci:     4 | #include "version.h"
archlinux_systemd_ci:       |          ^~~~~~~~~~~
archlinux_systemd_ci: compilation terminated.
```

```
archlinux_systemd_ci: In file included from ../build/src/journal/cat.c:13:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: 'version.h' file not found
archlinux_systemd_ci: #include "version.h"
archlinux_systemd_ci:          ^~~~~~~~~~~
archlinux_systemd_ci: 1 error generated.
```

```
archlinux_systemd_ci: In file included from ../build/src/sysext/sysext.c:10:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: version.h: No such file or directory
archlinux_systemd_ci:     4 | #include "version.h"
archlinux_systemd_ci:       |          ^~~~~~~~~~~
archlinux_systemd_ci: compilation terminated.
archlinux_systemd_ci: FAILED: systemd-inhibit.p/src_login_inhibit.c.o
```

```
archlinux_systemd_ci: In file included from ../build/src/login/inhibit.c:12:
archlinux_systemd_ci: ../build/src/basic/build.h:4:10: fatal error: version.h: No such file or directory
archlinux_systemd_ci:     4 | #include "version.h"
archlinux_systemd_ci:       |          ^~~~~~~~~~~
archlinux_systemd_ci: compilation terminated.
```

...

3 years agorecurse-dir: optionally, call callback when entering/leaving toplevel dir, too
Lennart Poettering [Wed, 9 Nov 2022 10:31:15 +0000 (11:31 +0100)] 
recurse-dir: optionally, call callback when entering/leaving toplevel dir, too

So far recurse_dir() will call the callback whenever we enter a
directory, and then pass the struct dirent for that directory, and an fd
for the directory the dirent is part of (i.e. the parent of the
directory we call things for). For the top-level dir the function is
invoked for we will not call the callback however, because we have no
dirent for that, and not fd for the directory the top-level dir is part
of. Let's add a flag to call it anyway, and in that case pass a NULL
dirent and -1 as directory fd.

This is useful when we want to treat the top-level dir the same as any
dir further down.

This is done opt-in since the callback must be ablet to handle a NULL
dirent and a -1 directory fd.

3 years agorandom-seed: make sure to load machine id even if the seed file is missing
Franck Bui [Mon, 24 Oct 2022 09:30:29 +0000 (11:30 +0200)] 
random-seed: make sure to load machine id even if the seed file is missing

3 years agoMerge pull request #25321 from poettering/acpi-timing-fix
Lennart Poettering [Wed, 9 Nov 2022 17:32:34 +0000 (18:32 +0100)] 
Merge pull request #25321 from poettering/acpi-timing-fix

acp-fpdt: minor tweaks/fixes

3 years agoMerge pull request #25302 from poettering/dissect-with
Lennart Poettering [Wed, 9 Nov 2022 17:31:54 +0000 (18:31 +0100)] 
Merge pull request #25302 from poettering/dissect-with

dissect: add new --with command for excuting commands with a DDI mounted

3 years agoacpi-fpdt: make sure length/type fields are available in acpi_fpdt_header 25321/head
Lennart Poettering [Wed, 9 Nov 2022 14:16:09 +0000 (15:16 +0100)] 
acpi-fpdt: make sure length/type fields are available in acpi_fpdt_header

some extra safety: make sure the two fields we care about are actually
properly present before the buffer is over.

3 years agoacpi-fpdt: don't accidentally drop signedness of pread() return
Lennart Poettering [Wed, 9 Nov 2022 14:09:08 +0000 (15:09 +0100)] 
acpi-fpdt: don't accidentally drop signedness of pread() return

3 years agoacpi-fpdt: use our usual ret_xyz naming scheme
Lennart Poettering [Wed, 9 Nov 2022 14:08:40 +0000 (15:08 +0100)] 
acpi-fpdt: use our usual ret_xyz naming scheme

3 years agotest: extend TEST-50-DISSECT for systemd-dissect --list and --with 25302/head
Lennart Poettering [Tue, 8 Nov 2022 17:17:55 +0000 (18:17 +0100)] 
test: extend TEST-50-DISSECT for systemd-dissect --list and --with

3 years agoman: document the new --with switch of systemd-dissect
Lennart Poettering [Tue, 8 Nov 2022 16:36:46 +0000 (17:36 +0100)] 
man: document the new --with switch of systemd-dissect

3 years agodissect: add new --with command
Lennart Poettering [Tue, 25 Oct 2022 13:18:28 +0000 (15:18 +0200)] 
dissect: add new --with command

3 years agodissect: officially support initrd DDIs (to implement 2nd stage initrds)
Lennart Poettering [Tue, 8 Nov 2022 13:37:47 +0000 (14:37 +0100)] 
dissect: officially support initrd DDIs (to implement 2nd stage initrds)

Let's complete support for DDI discovery, and also support 2nd stage
initrds.

3 years agoMerge pull request #25314 from poettering/dissect-list-tweaks
Lennart Poettering [Wed, 9 Nov 2022 13:42:30 +0000 (14:42 +0100)] 
Merge pull request #25314 from poettering/dissect-list-tweaks

dissect: minor tweaks to "systemd-dissect --list"

3 years agodissect: open pager in --list mode, output might be long 25314/head
Lennart Poettering [Wed, 9 Nov 2022 10:52:50 +0000 (11:52 +0100)] 
dissect: open pager in --list mode, output might be long

3 years agodissect: simplify flags for recurse_dir()
Lennart Poettering [Wed, 9 Nov 2022 10:37:42 +0000 (11:37 +0100)] 
dissect: simplify flags for recurse_dir()

We are not interested in the struct dirent data, hence there's no point
in passing RECURSE_DIR_ENSURE_TYPE. Let's drop it, and thus avoid some
extrac work on file systems where readdir() does not report .d_type.

Also drop RECURSE_DIR_SAME_MOUNT, because DDIs after all may contain
multiple partitions, and we mount them all together. The --list command
really should report the full set of files in an image.

3 years agodissect: remove unused variable
Lennart Poettering [Wed, 9 Nov 2022 10:37:19 +0000 (11:37 +0100)] 
dissect: remove unused variable

3 years agotest-copy: Rework test_copy_tree_replace_dirs() to use new openat() helpers 24813/head
Daan De Meyer [Mon, 26 Sep 2022 20:33:23 +0000 (22:33 +0200)] 
test-copy: Rework test_copy_tree_replace_dirs() to use new openat() helpers

3 years agorm-rf: Add rm_rf_physical_and_close()
Daan De Meyer [Mon, 26 Sep 2022 20:31:52 +0000 (22:31 +0200)] 
rm-rf: Add rm_rf_physical_and_close()

In tests it's useful to be able to delete temporary directories
via a file descriptor to them, so let's add rm_rf_physical_and_close()
which gets the file descriptor path via /proc and tries to remove it
that way.

3 years agofileio: Add openat() like helpers
Daan De Meyer [Mon, 26 Sep 2022 09:34:47 +0000 (11:34 +0200)] 
fileio: Add openat() like helpers

3 years agomkdir: Add mkdirat_parents()
Daan De Meyer [Mon, 26 Sep 2022 09:19:03 +0000 (11:19 +0200)] 
mkdir: Add mkdirat_parents()

3 years agomkdir: Add mkdirat_safe()
Daan De Meyer [Mon, 26 Sep 2022 08:52:33 +0000 (10:52 +0200)] 
mkdir: Add mkdirat_safe()

3 years agofs-util: Add chown_and_chmod_at()
Daan De Meyer [Mon, 26 Sep 2022 08:15:03 +0000 (10:15 +0200)] 
fs-util: Add chown_and_chmod_at()

3 years agochase-symlinks: Add chase_symlinks_at()
Daan De Meyer [Sun, 25 Sep 2022 07:18:41 +0000 (09:18 +0200)] 
chase-symlinks: Add chase_symlinks_at()

3 years agopath-util: Add path_make_relative_cwd()
Daan De Meyer [Mon, 26 Sep 2022 11:06:47 +0000 (13:06 +0200)] 
path-util: Add path_make_relative_cwd()

3 years agotmpfile-util: Add fopen_temporary_at()
Daan De Meyer [Mon, 26 Sep 2022 09:59:21 +0000 (11:59 +0200)] 
tmpfile-util: Add fopen_temporary_at()

3 years agotmpfile-util: Introduce mkdtemp_open()
Daan De Meyer [Sat, 24 Sep 2022 15:10:40 +0000 (17:10 +0200)] 
tmpfile-util: Introduce mkdtemp_open()

3 years agoMerge pull request #25300 from DaanDeMeyer/kernel-selftests
Luca Boccassi [Wed, 9 Nov 2022 10:07:00 +0000 (11:07 +0100)] 
Merge pull request #25300 from DaanDeMeyer/kernel-selftests

mkosi: Build and install kernel selftests

3 years agopo: Translated using Weblate (French)
blutch112 [Mon, 7 Nov 2022 08:19:51 +0000 (09:19 +0100)] 
po: Translated using Weblate (French)

Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: blutch112 <vincent.lefebvre59@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fr/
Translation: systemd/main

3 years agobasic/virt: treat missing /proc as sign of being in a chroot
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2022 13:59:49 +0000 (15:59 +0200)] 
basic/virt: treat missing /proc as sign of being in a chroot

The logic of running_in_chroot() has been the same since the introduction of
this function in b4f10a5e8956d26f0bc6b9aef12846b57caee08b: if /proc is not
mounted, the function returns -ENOENT and all callers treat this as false. But
that might be the most common case of chrooted calls, esp. in all the naïve
chroots that were done with the chroot binary without additional setup.

(In particular rpm executes all scriptlets in a chroot without bothering to set
up /proc or /sys, and we have codepaths in sysusers and tmpfiles to support
running in such an environment.)

This change effectively shortcircuits various calls to udevadm, downgrades
logging in tmpfiles, and disables all verbs marked with VERB_ONLINE_ONLY in
systemctl. detect-virt -r is also affected:

$ sudo chroot /var/lib/machines/rawhide
before> systemd-detect-virt -r && echo OK
Failed to check for chroot() environment: No such file or directory
after> systemd-detect-virt -r && echo OK
OK

3 years agoshared: make libmount_parse() non-inline
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2022 10:49:36 +0000 (11:49 +0100)] 
shared: make libmount_parse() non-inline

Back in e2857b3d87306d93f0fba526f3e79f4f6806fb02 I added this function
as static inline in order to avoid linking libmount into libshared.
Nevertheless, a dependency on libmount was added to libbasic in
9e7f941acb0d8fe7a31eec7826ff2c9c6af7044f, and later moved to libshared
in 77c772f227d866331560a8d0487fba12dd128dd4. So the shenanigan with an
inline function is not useful, let's make it a normal function.

3 years agoshared/mount-util: fix comment
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2022 10:21:29 +0000 (11:21 +0100)] 
shared/mount-util: fix comment

Just typos and grammar. In the end didn't add a use of a function, but
I read the comment carefully, and this commit is the result of that.

3 years agoRevert "initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs"
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 19:34:21 +0000 (20:34 +0100)] 
Revert "initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs"

This reverts commit 1f22621ba33f8089d2ae5fbcaf8b3970dd68aaf0.

As described in the reverted commit, we don't want to get rid of the check
completely. But the check requires opting-in by setting SYSTEMD_IN_INITRD=lenient,
which is cumbersome and doesn't seem to actually happen.
https://bugzilla.redhat.com/show_bug.cgi?id=2137631 is caused by systemd refusing
to treat the system as an initrd because overlayfs is used. Let's revert this
approach and do something that doesn't require opt-in instead.

I don't think it makes sense to keep support for "SYSTEMD_IN_INITRD=lenient" or
"SYSTEMD_IN_INITRD=auto". To get "auto" behaviour, just unset the option. And
"lenient" will be reimplemented as a better check. Thus the changes to the
option interface are completely reverted.

3 years agoMerge pull request #25291 from keszybz/util-cleanup
Yu Watanabe [Wed, 9 Nov 2022 00:23:17 +0000 (09:23 +0900)] 
Merge pull request #25291 from keszybz/util-cleanup

Split/rename util.c+h and def.h

3 years agonetworkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition
Khem Raj [Tue, 8 Nov 2022 20:21:35 +0000 (12:21 -0800)] 
networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition

This helps in avoiding compiling errors on musl. Definition of
IFF_LOOPBACK is the reason for including linux/if_arp.h, this however
could be obtained from net/if.h glibc header equally and makes it
portable as well.

3 years agoMerge pull request #25297 from mrc0mmand/aux-test-fixes
Yu Watanabe [Tue, 8 Nov 2022 21:34:23 +0000 (06:34 +0900)] 
Merge pull request #25297 from mrc0mmand/aux-test-fixes

test: fix a race in the systemd-mount test

3 years agodissect: grey out trailing slash in --list output
Lennart Poettering [Fri, 4 Nov 2022 17:29:58 +0000 (18:29 +0100)] 
dissect: grey out trailing slash in --list output

Given this is just auxiliary info, let's make it a tiny bit less visible
then the main part of the path.

3 years agoRename def.h to constants.h 25291/head
Zbigniew Jędrzejewski-Szmek [Mon, 7 Nov 2022 13:59:58 +0000 (14:59 +0100)] 
Rename def.h to constants.h

The name "def.h" originates from before the rule of "no needless abbreviations"
was established. Let's rename the file to clarify that it contains a collection
of various semi-related constants.

3 years agobasic/filesystems: fs_in_group() returns a boolean
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 17:41:48 +0000 (18:41 +0100)] 
basic/filesystems: fs_in_group() returns a boolean

is_{temporary,network}_fs() looked like they are incorrectly casting an error
to true, but actually the return type is misdeclared.