]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
18 months 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

18 months 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.

18 months 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.

18 months 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.

18 months 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

18 months 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

18 months 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

18 months 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.

18 months 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()

18 months 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

18 months 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

18 months 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

18 months 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.
```

...

18 months 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.

18 months 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

18 months 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

18 months 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

18 months 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.

18 months 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

18 months 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

18 months 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

18 months 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

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

18 months 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.

18 months 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"

18 months 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

18 months 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.

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

18 months 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

18 months 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.

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

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

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

18 months 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()

18 months 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()

18 months 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()

18 months 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()

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

18 months 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

18 months 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

18 months 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

18 months 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.

18 months 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.

18 months 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.

18 months 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

18 months 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.

18 months 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

18 months 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.

18 months 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.

18 months 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.

18 months agobasic: rename util.h to logarithm.h
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 15:54:32 +0000 (16:54 +0100)] 
basic: rename util.h to logarithm.h

util.h is now about logarithms only, so we can rename it. Many files included
util.h for no apparent reason… Those includes are dropped.

18 months agobasic: move a bunch of cmdline-related funcs to new argv-util.c+h
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 15:45:48 +0000 (16:45 +0100)] 
basic: move a bunch of cmdline-related funcs to new argv-util.c+h

I wanted to move saved_arg[cv] to process-util.c+h, but this causes problems:
process-util.h includes format-util.h which includes net/if.h, which conflicts
with linux/if.h. So we can't include process-util.h in some files.

But process-util.c is very long anyway, so it seems nice to create a new file.
rename_process(), invoked_as(), invoked_by_systemd(), and argv_looks_like_help()
which lived in process-util.c refer to saved_argc and saved_argv, so it seems
reasonable to move them to the new file too.

util.c is now empty, so it is removed. util.h remains.

18 months agomeson: add version.h as dependency to more targets
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2022 12:37:27 +0000 (13:37 +0100)] 
meson: add version.h as dependency to more targets

version.h can be generated after compilation starts, creating a race condition
between compilation of various .c files and creation of version.h. Let's add it
as a dependency to more build targets that require version.h or build.h.

So far we played whack'a'mole by adding versiondep whenever compilation failed.
In principle any target which includes compilation (i.e. any that has .c
sources directly), could require this. I don't understand why we didn't see
more failures… But it seems reasonable to just add the dependency more widely.

18 months agoupdate TODO
Lennart Poettering [Tue, 8 Nov 2022 13:37:26 +0000 (14:37 +0100)] 
update TODO

18 months agomkosi: Build and install kernel selftests 25300/head
Daan De Meyer [Wed, 2 Nov 2022 11:19:11 +0000 (12:19 +0100)] 
mkosi: Build and install kernel selftests

18 months agomkosi: Add back libasan/libubsan libraries
Daan De Meyer [Wed, 2 Nov 2022 10:46:14 +0000 (11:46 +0100)] 
mkosi: Add back libasan/libubsan libraries

These were accidentally removed as part of #24025

18 months agobasic: move version() to build.h+c
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 15:30:58 +0000 (16:30 +0100)] 
basic: move version() to build.h+c

18 months agobasic,shared: move disable_coredumps() to coredump-util.[ch]
Zbigniew Jędrzejewski-Szmek [Sat, 5 Nov 2022 16:47:06 +0000 (17:47 +0100)] 
basic,shared: move disable_coredumps() to coredump-util.[ch]

18 months agobasic: move container_get_leader() to process-util.[ch]
Zbigniew Jędrzejewski-Szmek [Sat, 5 Nov 2022 16:40:01 +0000 (17:40 +0100)] 
basic: move container_get_leader() to process-util.[ch]

basic/util.[ch] is a grab-bag of unrelated functions. Let's move a few
of the remaning functions to better locations.

18 months agobasic: create new basic/initrd-util.[ch] for initrd-related functions
Zbigniew Jędrzejewski-Szmek [Sat, 5 Nov 2022 16:29:43 +0000 (17:29 +0100)] 
basic: create new basic/initrd-util.[ch] for initrd-related functions

I changed imports of util.h to initrd-util.h, or added an import of
initrd-util.h, to keep compilation working. It turns out that many files didn't
import util.h directly.

When viewing the patch, don't be confused by git rename detection logic:
a new .c file is added and two functions moved into it.

18 months agotests: move tests for eqzero() to a new file
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 16:19:32 +0000 (17:19 +0100)] 
tests: move tests for eqzero() to a new file

It's a bit silly to have a separate file that one short test, but this is the
last part of the test code that is misplaced, and here consistency beats
brevity.

18 months agotests: move tests for PROTECT_ERRNO to the right file
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 16:15:56 +0000 (17:15 +0100)] 
tests: move tests for PROTECT_ERRNO to the right file

Also, rename them to uppercase so that the test name matches what we're
actually testing.

18 months agotests: create test-raw-clone.c for raw-clone.h
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 16:13:57 +0000 (17:13 +0100)] 
tests: create test-raw-clone.c for raw-clone.h

The include for process-util.h is added for reset_cached_pid(). This
essentially fixes a pre-existing missing include.

18 months agotests: create test-limits-util.c for limits-util funcs
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2022 15:59:04 +0000 (16:59 +0100)] 
tests: create test-limits-util.c for limits-util funcs

18 months agosd-journal: make prot_from_flags() static and rename
Zbigniew Jędrzejewski-Szmek [Sat, 5 Nov 2022 15:12:15 +0000 (16:12 +0100)] 
sd-journal: make prot_from_flags() static and rename

The function had just one caller and a name that didn't explain much.
Let's make it static and rename for clarity.

While at it, the only caller was not doing error handling correctly
— the function would potentially return a negative error value which
wasn't handled. In practice this couldn't happen, but let's remove
this ambiguity.

18 months agotest: adjust systemd-mount's tests based on recent coverage reports 25297/head
Frantisek Sumsal [Tue, 8 Nov 2022 11:44:37 +0000 (12:44 +0100)] 
test: adjust systemd-mount's tests based on recent coverage reports

18 months agotest: install realpath into the test images
Frantisek Sumsal [Tue, 8 Nov 2022 11:43:57 +0000 (12:43 +0100)] 
test: install realpath into the test images

18 months agoman: add note that network-generator is not a generator
Zbigniew Jędrzejewski-Szmek [Tue, 8 Nov 2022 10:07:02 +0000 (11:07 +0100)] 
man: add note that network-generator is not a generator

Also fix indentation.

18 months agotest: fix a race in the systemd-mount test
Frantisek Sumsal [Tue, 8 Nov 2022 11:01:13 +0000 (12:01 +0100)] 
test: fix a race in the systemd-mount test

Where we might check the automount unit before systemd has a chance to
react.

18 months agohwdb: Add accel orientation quirk for the Acer Switch V 10 SW5-017 2-in-1
Hans de Goede [Mon, 7 Nov 2022 20:46:56 +0000 (21:46 +0100)] 
hwdb: Add accel orientation quirk for the Acer Switch V 10 SW5-017 2-in-1

Add a quirk for the accelerometer orientation for
the Acer Switch V 10 SW5-017 2-in-1.

18 months agoFix key toggle and programmable button for Positivo N14ZP
drosdeck [Mon, 7 Nov 2022 15:14:07 +0000 (12:14 -0300)] 
Fix key toggle and programmable button for Positivo N14ZP

18 months agokernel-install: skip 50-depmod if depmod is not available
Luca Boccassi [Mon, 7 Nov 2022 16:28:33 +0000 (16:28 +0000)] 
kernel-install: skip 50-depmod if depmod is not available

Images might be built without any kernel module, and without
installing depmod as it is not needed. Skip it.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023607

18 months agoMerge pull request #25286 from mrc0mmand/systemd-mount-test-fix
Luca Boccassi [Mon, 7 Nov 2022 19:24:52 +0000 (20:24 +0100)] 
Merge pull request #25286 from mrc0mmand/systemd-mount-test-fix

test: replace tmpfs with vfat when testing --owner=

18 months agokernel-install/90-loaderentry: do not override an existing systemd.machine_id
Antonio Alvarez Feijoo [Mon, 7 Nov 2022 14:25:25 +0000 (15:25 +0100)] 
kernel-install/90-loaderentry: do not override an existing systemd.machine_id

If the systemd.machine_id command line option is already set, do not override
it.

18 months agoMerge pull request #25279 from mrc0mmand/firstboot-test-fixes
Frantisek Sumsal [Mon, 7 Nov 2022 18:41:44 +0000 (18:41 +0000)] 
Merge pull request #25279 from mrc0mmand/firstboot-test-fixes

test: cover some interactive/error paths in firstboot

18 months agomkosi: use the new mkosi.conf suffix
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2022 15:39:50 +0000 (17:39 +0200)] 
mkosi: use the new mkosi.conf suffix

Mkosi 14 is out, compat with old mkosi is not terribly important. Let's
use the new nice suffix.

18 months agosemaphore: remove the Semaphore repositories recursively
Frantisek Sumsal [Mon, 7 Nov 2022 15:39:12 +0000 (16:39 +0100)] 
semaphore: remove the Semaphore repositories recursively

The list of disabled repositories was recently converted from a single
file into a directory with separate repository files, so let's adjust
the setup script accordingly.

```
$ ls -lR /etc/apt/sources.list.d/
/etc/apt/sources.list.d/:
total 36
-rw-r--r-- 1 root root   76 Nov  3 10:28 azure-cli.list
-rw-r--r-- 1 root root   72 Nov  3 10:22 bazel.list
drwxr-xr-x 2 root root 4096 Nov  3 10:31 disabled
-rw-r--r-- 1 root root  113 Nov  3 10:13 docker-source.list
-rw-r--r-- 1 root root  367 Nov  3 10:28 github_git-lfs.list
-rw-r--r-- 1 root root  111 Nov  3 10:25 google-chrome-source.list
-rw-r--r-- 1 root root   64 Nov  3 10:14 google-cloud-sdk.list
-rw-r--r-- 1 root root   54 Nov  3 10:23 helm-stable-debian.list
-rw-r--r-- 1 root root   89 Nov  3 10:29 yarn-source.list

/etc/apt/sources.list.d/disabled:
total 20
-rw-r--r-- 1 root root 100 Nov  3 10:23 devel_kubic_libcontainers_stable.list
-rw-r--r-- 1 root root 103 Nov  3 10:27 git.list
-rw-r--r-- 1 root root 105 Nov  3 10:22 gradle.list
-rw-r--r-- 1 root root 118 Nov  3 10:13 pypy.list
-rw-r--r-- 1 root root 104 Nov  3 10:13 python.list
```

18 months agoMerge pull request #25282 from keszybz/trivial-cleanups
Yu Watanabe [Mon, 7 Nov 2022 15:21:40 +0000 (00:21 +0900)] 
Merge pull request #25282 from keszybz/trivial-cleanups

Trivial cleanups

18 months agotest: replace tmpfs with vfat when testing --owner= 25286/head
Frantisek Sumsal [Mon, 7 Nov 2022 14:55:08 +0000 (15:55 +0100)] 
test: replace tmpfs with vfat when testing --owner=

18 months agoRevert "mountpoint-util: tmpfs supports uid=/gid= mount options"
Frantisek Sumsal [Mon, 7 Nov 2022 14:43:54 +0000 (15:43 +0100)] 
Revert "mountpoint-util: tmpfs supports uid=/gid= mount options"

This reverts commit 7d4f00c88c65532bf66d20b3ec498b5bfaa621d2.

fstype_can_uid_gid() is about fixating all files to the specified
uid/gid. tmpfs does not qualify. The uid/gid parameter there is simply
about the default uid/gid for the root inode of the tmpfs, it allows
setting uids/gid arbirarily for all inodes after that.

This distinction matters: for file systems this function returns true
for we can use this in place of uidmapped mounts. But for tmpfs this is
not going to work, given inodes on that fs can end up having arbitrary
uid/gid.

See: https://github.com/systemd/systemd/pull/25284#issue-1438427144

18 months agotest: cover some interactive/error paths in firstboot 25279/head
Frantisek Sumsal [Sun, 6 Nov 2022 21:40:33 +0000 (22:40 +0100)] 
test: cover some interactive/error paths in firstboot

18 months agotest: fix keymaps installation on Arch
Frantisek Sumsal [Mon, 7 Nov 2022 11:07:27 +0000 (12:07 +0100)] 
test: fix keymaps installation on Arch

Where the keymaps live under /usr/share/kbd/keymaps/.

18 months agotest: fix locale installation when locale-gen is used
Frantisek Sumsal [Mon, 7 Nov 2022 10:57:59 +0000 (11:57 +0100)] 
test: fix locale installation when locale-gen is used

locale-gen might merge all compiled locales into a simple archive, so we
need to install it as well if necessary.

18 months agotest: compile test-utmp.c only if UTMP is enabled
Torsten Hilbrich [Mon, 7 Nov 2022 07:38:58 +0000 (08:38 +0100)] 
test: compile test-utmp.c only if UTMP is enabled

When compiling with -D utmp=false the compilation fails with:

../../git/systemd/src/test/test-utmp.c: In function ‘test_dump_run_utmp’:
../../git/systemd/src/test/test-utmp.c:21:9: error: cleanup argument not a function
   21 |         _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
      |         ^~~~~~~~
../../git/systemd/src/test/test-utmp.c:23:17: error: implicit declaration of function ‘utxent_start’ [-Werror=implicit-function-declaration]
   23 |         utmpx = utxent_start();
      |                 ^~~~~~~~~~~~

any many other errors

Add a conditional to compile test-utmp.c only if ENABLE_UTMP is true.

18 months agoMerge pull request #25277 from mrc0mmand/also-coverage
Yu Watanabe [Mon, 7 Nov 2022 12:59:44 +0000 (21:59 +0900)] 
Merge pull request #25277 from mrc0mmand/also-coverage

test: add coverage for systemd-mount

18 months agoudevadm: merge two log stmts 25282/head
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2022 14:00:13 +0000 (16:00 +0200)] 
udevadm: merge two log stmts

18 months agoman: grammarro
Zbigniew Jędrzejewski-Szmek [Tue, 18 Jan 2022 11:08:05 +0000 (12:08 +0100)] 
man: grammarro

18 months agosd-event: adjust indentation
Zbigniew Jędrzejewski-Szmek [Fri, 28 Oct 2022 14:38:46 +0000 (16:38 +0200)] 
sd-event: adjust indentation

18 months agoMerge pull request #25266 from poettering/dissect-fsck-fix
Lennart Poettering [Mon, 7 Nov 2022 11:24:53 +0000 (12:24 +0100)] 
Merge pull request #25266 from poettering/dissect-fsck-fix

dissect: fix fsck invocation

18 months agotest: don't ignore non-existent paths in inst_recursive()
Frantisek Sumsal [Mon, 7 Nov 2022 10:55:29 +0000 (11:55 +0100)] 
test: don't ignore non-existent paths in inst_recursive()

The process substitution in the while loop hides errors raised by the
find utility, which might (and did), in turn, hide errors in test setup.

18 months agotest: add coverage for systemd-mount 25277/head
Frantisek Sumsal [Sun, 6 Nov 2022 21:40:40 +0000 (22:40 +0100)] 
test: add coverage for systemd-mount

18 months agomountpoint-util: tmpfs supports uid=/gid= mount options
Frantisek Sumsal [Sun, 6 Nov 2022 21:49:47 +0000 (22:49 +0100)] 
mountpoint-util: tmpfs supports uid=/gid= mount options

As tmpfs(5) says, both uid= and gid= are supported since kernel 2.5.7 and
the mount utility seems to agree:

```
# stat -c "%U:%G" mnt
root:root
# mount -o uid=testuser,gid=testuser -t tmpfs tmpfs mnt
# stat -c "%U:%G" mnt
testuser:testuser
```

However, systemd-mount currently complains:

```
# systemd-mount --owner testuser -t tmpfs tmpfs mnt
File system type tmpfs is not known to support uid=/gid=, refusing.
```

18 months agoMerge pull request #25107 from lucab/ups/sysusers-gid-check-username
Luca Boccassi [Sun, 6 Nov 2022 22:58:53 +0000 (23:58 +0100)] 
Merge pull request #25107 from lucab/ups/sysusers-gid-check-username

sysusers: cross-check user and group names too

18 months agoloop-util: open lock fd read-only
Christian Göttsche [Fri, 4 Nov 2022 18:36:31 +0000 (19:36 +0100)] 
loop-util: open lock fd read-only

flock(2) works with file descriptors opened with O_RDONLY.

This affects SELinux systems where access to block devices is quite
restricted to avoid bypasses on filesystem objects.

18 months agocore: update audit messages
Christian Göttsche [Fri, 4 Nov 2022 15:30:57 +0000 (16:30 +0100)] 
core: update audit messages

Pass getuid() instead of literal `0` as auid, since user session
managers also issue audit messages on SELinux denials.

18 months agodissect: get rid of basename() use
Lennart Poettering [Thu, 20 Oct 2022 21:20:49 +0000 (23:20 +0200)] 
dissect: get rid of basename() use

18 months agoci(dev-freeze): Use GitHub Action for PR comments
Jan Macku [Wed, 12 Oct 2022 13:37:00 +0000 (15:37 +0200)] 
ci(dev-freeze): Use GitHub Action for PR comments

GitHub Action `devel-freezer` helps with development freeze notifications
during the RC phase. It will create comments using predefined messages on
newly created and updated PRs when the RC tag has been released.
Also, it will update comments once a new major version has been released.

Documentation available at: https://github.com/redhat-plumbers-in-action/devel-freezer

18 months agotest: fstab-generator: adjust PATH for fsck
Christian Göttsche [Fri, 4 Nov 2022 14:48:50 +0000 (15:48 +0100)] 
test: fstab-generator: adjust PATH for fsck

fsck(8) is located in /usr/sib/ on Debian sid:

    stdout:
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-01-dev-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-02-dhcp.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-03-dhcp6.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-04-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-05-nfs4.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-06-ipv4.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-07-ipv6.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-08-implicit-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-09-cifs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-10-iscsi.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-11-live.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-12-dev-sdx.input
    --- /dev/fd/63  2022-11-04 15:39:13.131532174 +0100
    +++ /dev/fd/62  2022-11-04 15:39:13.131532174 +0100
    @@ -6,3 +6,4 @@
     initrd-usr-fs.target.requires
     initrd-usr-fs.target.requires/sysroot.mount
     sysroot.mount
    +systemd-fsck-root.service
    **** Unexpected output for /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-12-dev-sdx.input
    stderr:
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on CIFS was requested.
    Skipping root directory handling, as root on iSCSI was requested.
    Skipping root directory handling, as root on live image was requested.
    Found entry what=/dev/sdx1 where=/sysroot type=n/a opts=ro
    Checking was requested for /dev/sdx1, but the fsck command does not exist.

18 months agodissect: fix fsck 25266/head
Lennart Poettering [Fri, 4 Nov 2022 17:26:42 +0000 (18:26 +0100)] 
dissect: fix fsck

Since f7725647bb41c3398a867f139efe526efe8aa1b3 when dissecting a disk
image we operate with fds to the device nodes in question wherever we
can. This includes when we fork off fsck, where we pass a /proc/self/fd/
path as argument. This only works if we keep that fd open however and
disable O_CLOEXEC on the fd. Hence do so, and fix fsck this way.

(Without this, all fsck will fail, since the fd path is invalid)

18 months agoprocess-util: add new FORK_CLOEXEC_OFF flag for disabling O_CLOEXEC on remaining fds
Lennart Poettering [Fri, 4 Nov 2022 17:20:47 +0000 (18:20 +0100)] 
process-util: add new FORK_CLOEXEC_OFF flag for disabling O_CLOEXEC on remaining fds

Often the fds that shall stay around in the child shall be passed
to a process over execve(), hence add an option to explicitly disable
O_CLOEXEC on them in the child.