]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
13 months agorepart: Make sure we look up dropin files in the root directory 27633/head
Daan De Meyer [Fri, 12 May 2023 15:16:21 +0000 (17:16 +0200)] 
repart: Make sure we look up dropin files in the root directory

13 months agoconf-parser: Add root argument to config_parse_many()
Daan De Meyer [Fri, 12 May 2023 15:14:46 +0000 (17:14 +0200)] 
conf-parser: Add root argument to config_parse_many()

13 months agorepart: Make sure r is declared last
Daan De Meyer [Fri, 12 May 2023 15:16:45 +0000 (17:16 +0200)] 
repart: Make sure r is declared last

13 months agorepart: Read arguments directly instead of passing them in
Daan De Meyer [Fri, 12 May 2023 15:08:28 +0000 (17:08 +0200)] 
repart: Read arguments directly instead of passing them in

13 months agomkosi: Use zstd compression on non-centos distros
Daan De Meyer [Tue, 9 May 2023 13:04:56 +0000 (15:04 +0200)] 
mkosi: Use zstd compression on non-centos distros

Just because centos doesn't support it doesn't mean we can't use it
on the other distros.

13 months agomkosi: Update .gitignore to account for changed output locations
Daan De Meyer [Mon, 8 May 2023 14:04:43 +0000 (16:04 +0200)] 
mkosi: Update .gitignore to account for changed output locations

13 months agomkosi: Only build initrd if Bootable= is enabled or set to "auto"
Daan De Meyer [Sat, 6 May 2023 09:36:58 +0000 (11:36 +0200)] 
mkosi: Only build initrd if Bootable= is enabled or set to "auto"

With this change, Bootable= can be set to "no" for a faster build
intended for booting in systemd-nspawn but not qemu.

13 months agomkosi: Use initrd symlink without format/compression
Daan De Meyer [Sat, 6 May 2023 09:50:22 +0000 (11:50 +0200)] 
mkosi: Use initrd symlink without format/compression

This way, we can change the compression (and even the output format)
in the future without having to modify the final preset.

13 months agomkosi: Update to latest
Daan De Meyer [Mon, 8 May 2023 14:13:37 +0000 (16:13 +0200)] 
mkosi: Update to latest

13 months agocore: Try to initialize TERM from systemd.tty.term.console as well
Daan De Meyer [Mon, 8 May 2023 09:27:31 +0000 (11:27 +0200)] 
core: Try to initialize TERM from systemd.tty.term.console as well

We already have the systemd.tty.xxx kernel cmdline arguments for
configuring tty's for services, let's make sure the term cmdline
argument applies to pid1 as well.

13 months agoMerge pull request #27565 from yuwata/static-destruct
Daan De Meyer [Fri, 12 May 2023 06:36:43 +0000 (08:36 +0200)] 
Merge pull request #27565 from yuwata/static-destruct

static-destruct: support clearing array on exit

13 months agomkfs-util: Add quiet argument to make_filesystem()
Daan De Meyer [Sun, 7 May 2023 19:39:10 +0000 (21:39 +0200)] 
mkfs-util: Add quiet argument to make_filesystem()

We default to quiet operation everywhere except for repart, where
we disable quiet and have the mkfs tools write to stdout.

We also make sure --quiet or equivalent is implemented for all mkfs
tools.

13 months agocore: Check if any init exists before switching root
Daan De Meyer [Mon, 8 May 2023 11:48:25 +0000 (13:48 +0200)] 
core: Check if any init exists before switching root

If we switch root and can't execute an init program afterwards, we're
completely stuck as we can't go back to the initramfs to start
emergency.service as it will have been completely removed by the switch
root operation.

To prevent leaving users with a completely undebuggable system, let's
at least check before we switch root whether at least one of the init
programs we might want to execute actually exist, and fail early if
none of them exists.

13 months agocore: Make sure systemctl exit <X> works outside of a container
Daan De Meyer [Thu, 11 May 2023 06:47:38 +0000 (08:47 +0200)] 
core: Make sure systemctl exit <X> works outside of a container

When running in a VM, we now support propagating the exit status
via a vsock notify socket, so drop the restrictions on propagating
an exit status when not in a container to make sure this works
properly.

13 months agoMerge pull request #27618 from DaanDeMeyer/fstab-generator
Yu Watanabe [Thu, 11 May 2023 19:23:54 +0000 (04:23 +0900)] 
Merge pull request #27618 from DaanDeMeyer/fstab-generator

Fstab generator fixes

13 months agotest-network: add tests for static lease matching with chaddr
Yu Watanabe [Thu, 11 May 2023 08:08:27 +0000 (17:08 +0900)] 
test-network: add tests for static lease matching with chaddr

Follow-up for 4646cdaa378fa2aab7334a80228d8a94b316763b (#27313).

13 months agoMerge pull request #27611 from yuwata/core-mount-escape-utf8
Yu Watanabe [Thu, 11 May 2023 16:40:32 +0000 (01:40 +0900)] 
Merge pull request #27611 from yuwata/core-mount-escape-utf8

core/mount: escape invalid utf8 chars

13 months agofstab-generator: Fix log message 27618/head
Daan De Meyer [Wed, 10 May 2023 13:25:34 +0000 (15:25 +0200)] 
fstab-generator: Fix log message

13 months agofstab-generator: Unset kernel cmdline options if empty value is given
Daan De Meyer [Wed, 10 May 2023 08:35:16 +0000 (10:35 +0200)] 
fstab-generator: Unset kernel cmdline options if empty value is given

13 months agofstab-generator: Take systemd.verity= into account
Daan De Meyer [Wed, 10 May 2023 08:34:43 +0000 (10:34 +0200)] 
fstab-generator: Take systemd.verity= into account

Disable verity logic if systemd.verity= switch is disabled.

13 months agocryptenroll: actually allow using multiple "special" strings when wiping
Frantisek Sumsal [Wed, 10 May 2023 09:47:57 +0000 (11:47 +0200)] 
cryptenroll: actually allow using multiple "special" strings when wiping

The systemd-cryptenroll man page states:

    Takes a comma separated list of numeric slot indexes, or the special
    strings ..., or any combination of these strings or numeric
    indexes, in which case all slots matching either are wiped.

but we'd allow only one special string at any given time as the value
was not ORed when assigning. So, for example, --wipe=recovery,password
would actually become --wipe=password, etc.

13 months agoMerge pull request #27610 from DaanDeMeyer/mkosi-trivial
Daan De Meyer [Thu, 11 May 2023 12:04:34 +0000 (14:04 +0200)] 
Merge pull request #27610 from DaanDeMeyer/mkosi-trivial

mkosi: Trivial fixes

13 months agocore/mount: escape invalid UTF8 char in dbus reply 27611/head
Yu Watanabe [Thu, 11 May 2023 10:21:57 +0000 (19:21 +0900)] 
core/mount: escape invalid UTF8 char in dbus reply

When What= or Options= may contain invalid UTF8 chars.

Replaces aaf7b0e41105d7b7cf30912cdac32820f011a219 (#27541).

13 months agoRevert "core/mount: replace invalid UTF-8 code points in "what" and "options""
Yu Watanabe [Thu, 11 May 2023 10:13:51 +0000 (19:13 +0900)] 
Revert "core/mount: replace invalid UTF-8 code points in "what" and "options""

This reverts commit aaf7b0e41105d7b7cf30912cdac32820f011a219.

Not only /proc/mountinfo, .mount units not started yet may contain
invalid UTF-8 chars.

13 months agomkosi: Install apt in Debian/Ubuntu images 27610/head
Daan De Meyer [Wed, 10 May 2023 16:55:24 +0000 (18:55 +0200)] 
mkosi: Install apt in Debian/Ubuntu images

13 months agomkosi: Run in debug mode
Daan De Meyer [Tue, 9 May 2023 18:53:02 +0000 (20:53 +0200)] 
mkosi: Run in debug mode

Let's make sure we log more of what mkosi's doing so we can debug
issues better. Note this also makes mkosi set SYSTEMD_LOG_LEVEL=debug
when running programs so we'll get all the systemd debug logging as
well.

13 months agomkosi: Disable pamconfdir
Daan De Meyer [Tue, 9 May 2023 13:02:45 +0000 (15:02 +0200)] 
mkosi: Disable pamconfdir

Let's use the distro's pam config instead of installing the systemd one.

13 months agomkosi: Add back accidentally removed .gdbinit file
Daan De Meyer [Mon, 8 May 2023 14:04:24 +0000 (16:04 +0200)] 
mkosi: Add back accidentally removed .gdbinit file

13 months agomkosi: Enable systemd-timesyncd by default
Daan De Meyer [Sun, 7 May 2023 09:40:09 +0000 (11:40 +0200)] 
mkosi: Enable systemd-timesyncd by default

13 months agomkosi: Disable auditd in the preset instead of masking it
Daan De Meyer [Sun, 7 May 2023 09:29:28 +0000 (11:29 +0200)] 
mkosi: Disable auditd in the preset instead of masking it

13 months agomkosi: Disable dnf-makecache.service by default
Daan De Meyer [Sun, 7 May 2023 09:24:47 +0000 (11:24 +0200)] 
mkosi: Disable dnf-makecache.service by default

13 months agomkosi: Make sure we use systemd-networkd-wait-online
Daan De Meyer [Sun, 7 May 2023 09:02:13 +0000 (11:02 +0200)] 
mkosi: Make sure we use systemd-networkd-wait-online

Disable the NetworkManager one and pull in the networkd one explicitly.

13 months agomkosi: Replace root password setting with a credential
Daan De Meyer [Sun, 7 May 2023 09:03:29 +0000 (11:03 +0200)] 
mkosi: Replace root password setting with a credential

13 months agomkosi: Disable create-log-dirs option
Daan De Meyer [Sat, 6 May 2023 09:42:07 +0000 (11:42 +0200)] 
mkosi: Disable create-log-dirs option

We run the build as a regular user and create-log-dirs requires to
run as root so let's disable the option to avoid error noise during
the install phase.

13 months agomkosi: Stop creating test users in prepare scripts
Daan De Meyer [Sat, 6 May 2023 09:36:14 +0000 (11:36 +0200)] 
mkosi: Stop creating test users in prepare scripts

This was added for opensuse to make the tests pass but doesn't seem
to be needed anymore after recent changes so let's drop it.

13 months agomkosi: Don't run slow tests by default
Daan De Meyer [Sat, 6 May 2023 09:35:38 +0000 (11:35 +0200)] 
mkosi: Don't run slow tests by default

Instead, allow enabling it via an environment variable and do so
in CI.

13 months agoMerge pull request #27539 from esposem/ukify_pesign
Luca Boccassi [Thu, 11 May 2023 09:45:59 +0000 (10:45 +0100)] 
Merge pull request #27539 from esposem/ukify_pesign

ukify: support pesign as alternative to sbsign

13 months agoMerge pull request #27596 from yuwata/drop-pure
Yu Watanabe [Thu, 11 May 2023 07:49:40 +0000 (16:49 +0900)] 
Merge pull request #27596 from yuwata/drop-pure

drop two more inappropriate _pure_ attributes and several cleanups

13 months agoMerge pull request #27603 from mrc0mmand/more-test-shenanigans
Yu Watanabe [Thu, 11 May 2023 07:48:13 +0000 (16:48 +0900)] 
Merge pull request #27603 from mrc0mmand/more-test-shenanigans

test: merge PID1-related tests into TEST-07-PID1

13 months agobuild(deps): bump actions/checkout from 3.3.0 to 3.5.2
dependabot[bot] [Mon, 1 May 2023 19:11:57 +0000 (19:11 +0000)] 
build(deps): bump actions/checkout from 3.3.0 to 3.5.2

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/ac593985615ec2ede58e132d2e21d2b1cbd6127c...8e5e7e5ab8b370d6c329ec480221332ada57f0ab)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agobuild(deps): bump meson from 1.0.1 to 1.1.0 in /.github/workflows
dependabot[bot] [Mon, 1 May 2023 09:57:42 +0000 (09:57 +0000)] 
build(deps): bump meson from 1.0.1 to 1.1.0 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.0.1 to 1.1.0.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.0.1...1.1.0)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agobuild(deps): bump actions/upload-artifact from 3.1.1 to 3.1.2
dependabot[bot] [Mon, 1 May 2023 09:57:22 +0000 (09:57 +0000)] 
build(deps): bump actions/upload-artifact from 3.1.1 to 3.1.2

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3.1.1...0b7f8abb1508181956e8e162db84b466c27e18ce)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agobuild(deps): bump github/super-linter from 4.10.1 to 5.0.0
dependabot[bot] [Mon, 1 May 2023 09:57:26 +0000 (09:57 +0000)] 
build(deps): bump github/super-linter from 4.10.1 to 5.0.0

Bumps [github/super-linter](https://github.com/github/super-linter) from 4.10.1 to 5.0.0.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](https://github.com/github/super-linter/compare/454ba4482ce2cd0c505bc592e83c06e1e37ade61...45fc0d88288beee4701c62761281edfee85655d7)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agobuild(deps): bump actions/github-script from 6.4.0 to 6.4.1
dependabot[bot] [Mon, 1 May 2023 09:57:30 +0000 (09:57 +0000)] 
build(deps): bump actions/github-script from 6.4.0 to 6.4.1

Bumps [actions/github-script](https://github.com/actions/github-script) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/98814c53be79b1d30f795b907e553d8679345975...d7906e4ad0b1822421a7e6a35d5ca353c962f410)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agotest: abstract the common test parts into a utility script 27603/head
Frantisek Sumsal [Wed, 10 May 2023 19:12:01 +0000 (21:12 +0200)] 
test: abstract the common test parts into a utility script

Also, instead of bailing out on the first failed subtest, always run all
subtests and print a summary at the end (with an appropriate exit code).

13 months agotest: merge TEST-20-MAINPIDGAMES into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 18:17:19 +0000 (20:17 +0200)] 
test: merge TEST-20-MAINPIDGAMES into TEST-07-PID1

13 months agotest: merge TEST-51-ISSUE-16115 into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 12:26:08 +0000 (14:26 +0200)] 
test: merge TEST-51-ISSUE-16115 into TEST-07-PID1

13 months agotest: merge TEST-47-ISSUE-14566 into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 12:19:40 +0000 (14:19 +0200)] 
test: merge TEST-47-ISSUE-14566 into TEST-07-PID1

13 months agotest: move TEST-23's units into a dedicated subfolder
Frantisek Sumsal [Wed, 10 May 2023 12:02:54 +0000 (14:02 +0200)] 
test: move TEST-23's units into a dedicated subfolder

To remain consistent with other tests.

13 months agotest: merge TEST-12-ISSUE-3171 into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 11:58:13 +0000 (13:58 +0200)] 
test: merge TEST-12-ISSUE-3171 into TEST-07-PID1

13 months agotmpfiles: Add merge support for copy files action
Daan De Meyer [Tue, 9 May 2023 11:45:16 +0000 (13:45 +0200)] 
tmpfiles: Add merge support for copy files action

If '+' is specified with 'C', let's merge the tree with any existing
tree.

13 months agorepart: Fix deny list logic
Daan De Meyer [Mon, 8 May 2023 16:44:01 +0000 (18:44 +0200)] 
repart: Fix deny list logic

Until now, we always excluded the top level directories that were
covered by child partition mount points, regardless of the source
directory and the target directory of the copy files operation.
This means that even if we were populating a XBOOTLDR partition, if
there was an EFI partition in the image, we'd exclude /boot
unconditionally, leading to the XBOOTLDR partition to be empty.

Also, because of the same cause, if we were copying a nested source
directory (e.g. /abc/def) to the root directory in the root
partition, if /abc/def/usr existed and was populated with files and
directories, the root partition would have those files under /usr,
even if a /usr partition was defined.

To fix these issues, instead of unconditionally excluding the top
level partition mount points under <source>, let's make sure that
when we're copying files from any source directory to the root
directory of a root partition, that we exclude the partition mount
point directories under the source directory instead of the top
level ones.

13 months agosrc/ukify/test/test_ukify: fix skipped tests 27539/head
Emanuele Giuseppe Esposito [Mon, 8 May 2023 12:41:04 +0000 (08:41 -0400)] 
src/ukify/test/test_ukify: fix skipped tests

Some tests are skipped because initrd extracted from bootctl
is "/boot/initramfs-5.14.0-284.el9.x86_64.img $tuned_initrd"
and not just "/boot/initramfs-5.14.0-284.el9.x86_64.img".
Therefore split and remove the additional garbage.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
13 months agosrc/ukify/test/test_ukify: add pesign unit test
Emanuele Giuseppe Esposito [Mon, 8 May 2023 12:23:11 +0000 (08:23 -0400)] 
src/ukify/test/test_ukify: add pesign unit test

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
13 months agoukify: support pesign as alternative to sbsign
Emanuele Giuseppe Esposito [Thu, 4 May 2023 15:48:47 +0000 (11:48 -0400)] 
ukify: support pesign as alternative to sbsign

sbsign is not available everywhere, for example RHEL does not have it.
Add pesign as alternative to it.

pesign will use options "--secureboot-certificate-name" (mandatory) and
"--secureboot-certificate-dir" (optional), while sbsign will use
"--secureboot-private-key" and "--secureboot-certificate".

By default, use sbsign. If no key/cert is provided or sbsign is not found,
try pesign.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
13 months agoukify: typo in doc and print when package is missing
Emanuele Giuseppe Esposito [Fri, 5 May 2023 10:22:57 +0000 (06:22 -0400)] 
ukify: typo in doc and print when package is missing

If a package is missing, a subprocess is started with None as
command argument. Error raised by subprocess is therefore not helpful
at all to understand what needs to be done to fix that error.

Also fix doc since systemd-stub will look for .cmdline files, and not
.cmdline.efi files.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
13 months agotest: merge TEST-11-ISSUE-3166 into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 11:49:34 +0000 (13:49 +0200)] 
test: merge TEST-11-ISSUE-3166 into TEST-07-PID1

13 months agotest: merge TEST-10-ISSUE-2467 with TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 11:41:03 +0000 (13:41 +0200)] 
test: merge TEST-10-ISSUE-2467 with TEST-07-PID1

13 months agotest: merge TEST-09-ISSUE-2691 into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 11:13:12 +0000 (13:13 +0200)] 
test: merge TEST-09-ISSUE-2691 into TEST-07-PID1

13 months agotest: merge TEST-08-ISSUE-2730 into TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 11:07:26 +0000 (13:07 +0200)] 
test: merge TEST-08-ISSUE-2730 into TEST-07-PID1

13 months agoudev: do not set ID_PATH and by-path symlink for nvmf disks
Yu Watanabe [Wed, 10 May 2023 06:47:44 +0000 (15:47 +0900)] 
udev: do not set ID_PATH and by-path symlink for nvmf disks

Prompted by #27391.

13 months agotest: rename TEST-07-ISSUE-1981 to TEST-07-PID1
Frantisek Sumsal [Wed, 10 May 2023 10:38:57 +0000 (12:38 +0200)] 
test: rename TEST-07-ISSUE-1981 to TEST-07-PID1

13 months agocore: replace hashmap_get() with hashmap_contains() where appropriate 27596/head
Yu Watanabe [Tue, 9 May 2023 18:33:46 +0000 (03:33 +0900)] 
core: replace hashmap_get() with hashmap_contains() where appropriate

13 months agocore: drop unused argument
Yu Watanabe [Tue, 9 May 2023 18:31:11 +0000 (03:31 +0900)] 
core: drop unused argument

13 months agocore: several cleanups for job_get_timeout()
Yu Watanabe [Tue, 9 May 2023 18:25:37 +0000 (03:25 +0900)] 
core: several cleanups for job_get_timeout()

- add missing assertion,
- rename the argument for storing result,
- always initialize result on success.

13 months agotree-wide: drop _pure_ attribute from non-pure functions
Yu Watanabe [Tue, 9 May 2023 18:22:16 +0000 (03:22 +0900)] 
tree-wide: drop _pure_ attribute from non-pure functions

Prompted by #27595.
Follow-ups for 6723c28f36ea566faf61d3610012cd89f95ee4a0.

13 months agodirent: conditionalize dirent assert based on dirent64 existence
Sam James [Wed, 10 May 2023 00:47:13 +0000 (01:47 +0100)] 
dirent: conditionalize dirent assert based on dirent64 existence

>=musl-1.2.4 doesn't define dirent64 and its LFS friends as its "native"
functions are already LFS-aware.

Check for dirent64 in meson.build and only assert if it exists.

Bug: https://bugs.gentoo.org/905900
Closes: https://github.com/systemd/systemd/pull/25809
13 months agonetwork/tc: rename settings in log messages too
Mike Yuan [Tue, 9 May 2023 16:15:14 +0000 (00:15 +0800)] 
network/tc: rename settings in log messages too

Follow-up for c03ef420fa7157b8d4881636fe72596a06e08bb6

13 months agosd-bus: bus_message_type_from_string is not pure
Xi Ruoyao [Tue, 9 May 2023 17:41:28 +0000 (01:41 +0800)] 
sd-bus: bus_message_type_from_string is not pure

GCC document [1] says:

    The pure attribute prohibits a function from modifying the state
    of the program that is observable by means other than inspecting
    the function’s return value.

And there is an example:

    `int hash (char *) __attribute__ ((pure));`
    ... Even though hash takes a non-const pointer argument it must
    not modify the array it points to, ...

But we are modifying the object pointed to by the pointer u, which is
clearly a violation of the semantic of pure.

With -ftrivial-auto-var-init (enabled by -Dmode=release), on some
targets (GCC 12.2 on AArch64 and GCC 13.1 on x86_64) performs an
optimization: as the variable "u" in bus_match_parse has been
zero-initialized (by the -ftrivial-auto-var-init option) and never
modified (because a "pure" bus_message_type_from_string is not allowed
to modify it), "u" will be always 0.

Then 0 is used to initialize .value_u8 field of struct
bus_match_component.  This then causes a infinite event loop, so
"systemctl restart" never stops, and pam_systemd timeouts communicating
with logind, etc.

So we should remove the "pure" attribute here.

Fixes #26395.

[1]:https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute

13 months agoMerge pull request #27597 from mrc0mmand/more-test-shenanigans
Yu Watanabe [Tue, 9 May 2023 23:16:29 +0000 (08:16 +0900)] 
Merge pull request #27597 from mrc0mmand/more-test-shenanigans

test: slightly extend systemd-cryptenroll coverage

13 months agocore/mount: replace invalid UTF-8 code points in "what" and "options"
Michal Sekletar [Fri, 5 May 2023 10:50:15 +0000 (12:50 +0200)] 
core/mount: replace invalid UTF-8 code points in "what" and "options"

Previously, these strings were copied w/o any modification. However, if
mount table contained e.g. remote fs mount like NFS or CIFS that was
mounted from server running with non UTF-8 locale then those strings
might have contained some non UTF-8 characters.

If then client asked about status of such mount unit we tried to forward
these non UTF-8 strings over D-Bus. That is the violation of the
protocol and we ended up kicked from the bus.

13 months agotest: slightly extend systemd-cryptenroll coverage 27597/head
Frantisek Sumsal [Tue, 9 May 2023 20:47:42 +0000 (22:47 +0200)] 
test: slightly extend systemd-cryptenroll coverage

13 months agocryptenroll: fix an assertion with weak passwords
Frantisek Sumsal [Tue, 9 May 2023 20:17:15 +0000 (22:17 +0200)] 
cryptenroll: fix an assertion with weak passwords

Passing 0 to log_xxx_errno() leads to an assertion, so let's not do that:

$ NEWPASSWORD="" build-san/systemd-cryptenroll --unlock-key-file=/tmp/password --password "$img"
/tmp/password has 0644 mode that is too permissive, please adjust the ownership and access mode.
Assertion '(_error) != 0' failed at src/cryptenroll/cryptenroll-password.c:164, function enroll_password(). Aborting.
Aborted (core dumped)

13 months agotest: TEST-70-TPM2 cleanup
Frantisek Sumsal [Tue, 9 May 2023 19:14:24 +0000 (21:14 +0200)] 
test: TEST-70-TPM2 cleanup

No functional changes.

13 months agotest: add coverage for #27533
Frantisek Sumsal [Tue, 9 May 2023 17:59:13 +0000 (19:59 +0200)] 
test: add coverage for #27533

Issue: https://github.com/systemd/systemd/issues/27533
Fix: https://github.com/systemd/systemd/pull/27553

13 months agotest: discard kill's output
Frantisek Sumsal [Tue, 9 May 2023 17:55:04 +0000 (19:55 +0200)] 
test: discard kill's output

13 months agotest: merge unit file related tests into TEST-23-UNIT-FILE
Frantisek Sumsal [Mon, 8 May 2023 20:38:34 +0000 (22:38 +0200)] 
test: merge unit file related tests into TEST-23-UNIT-FILE

Rename TEST-23-TYPE-EXEC to TEST-23-UNIT-FILE and merge it with
following tests:
  - TEST-37-RUNTIMEDIRECTORYPRESERV
  - TEST-40-EXEC-COMMAND-EX
  - TEST-41-ONESHOT-RESTART
  - TEST-42-EXECSTOPPOST
  - TEST-57-ONSUCCESS-UPHOLD

13 months agounits: Add CAP_NET_ADMIN condition to systemd-networkd-wait-online@.service as well
Daan De Meyer [Sun, 7 May 2023 08:49:57 +0000 (10:49 +0200)] 
units: Add CAP_NET_ADMIN condition to systemd-networkd-wait-online@.service as well

It was added to CAP_NET_ADMIN but we forgot to add it to the template
service as well.

13 months agosd-dhcp-client: client ID always has non-zero data
Yu Watanabe [Tue, 9 May 2023 08:57:33 +0000 (17:57 +0900)] 
sd-dhcp-client: client ID always has non-zero data

Follow-up for f04c991a2fbb3531c3b464ed8e6dd7543e521f7a.
Fixes CID#1510978.

13 months agoMerge pull request #27534 from keszybz/deperlify
Yu Watanabe [Tue, 9 May 2023 09:06:51 +0000 (18:06 +0900)] 
Merge pull request #27534 from keszybz/deperlify

Rewrite udev-test.pl in Python

13 months agostatic-destruct: introduce STATIC_ARRAY_DESTRUCTOR_REGISTER() 27565/head
Yu Watanabe [Mon, 8 May 2023 21:44:27 +0000 (06:44 +0900)] 
static-destruct: introduce STATIC_ARRAY_DESTRUCTOR_REGISTER()

13 months agostatic-destruct: several cleanups
Yu Watanabe [Sun, 7 May 2023 09:37:13 +0000 (18:37 +0900)] 
static-destruct: several cleanups

No functional changes, preparation for later commits.

13 months agomemory-util: make ArrayCleanup passed to array_cleanup() const
Yu Watanabe [Sun, 7 May 2023 09:34:35 +0000 (18:34 +0900)] 
memory-util: make ArrayCleanup passed to array_cleanup() const

Should not change any behavior, preparation for later commits.

13 months agomkosi,ci: do not install perl 27534/head
Zbigniew Jędrzejewski-Szmek [Mon, 8 May 2023 11:50:50 +0000 (13:50 +0200)] 
mkosi,ci: do not install perl

13 months agotest: use sed and grep instead of perl
Zbigniew Jędrzejewski-Szmek [Mon, 8 May 2023 11:43:03 +0000 (13:43 +0200)] 
test: use sed and grep instead of perl

This gets rid of the all-but-one remaining uses of perl. I tested the new code
on my machine, so I'm fairly confident that it works as expected.

install_iscsi() has one majestic perl invocation, but we can't get rid of it
easily: it extends the code of tgt-admin to print some list of files. Obviously
this only works because tgt-admin is written in perl, and perl will be installed
if tgt-admin is installed. install_iscsi() is used in TEST-64-UDEV-STORAGE
conditionally if tgtadm is installed, so this can stay as is.

13 months agotools/oss-fuzz: s/perl/awk/
Zbigniew Jędrzejewski-Szmek [Mon, 8 May 2023 10:48:37 +0000 (12:48 +0200)] 
tools/oss-fuzz: s/perl/awk/

The pattern is not exactly the same, but I don't think we need to
be super-precise here.

13 months agotest-execute: use bash instead of perl
Zbigniew Jędrzejewski-Szmek [Mon, 8 May 2023 10:24:37 +0000 (12:24 +0200)] 
test-execute: use bash instead of perl

I think this is easier to grok too.

13 months agotest-udev: skip test on python3.6
Zbigniew Jędrzejewski-Szmek [Mon, 8 May 2023 09:38:25 +0000 (11:38 +0200)] 
test-udev: skip test on python3.6

13 months agoREADME: require python >= 3.7, clean up module descriptions
Zbigniew Jędrzejewski-Szmek [Sun, 7 May 2023 09:16:21 +0000 (11:16 +0200)] 
README: require python >= 3.7, clean up module descriptions

libpython was added in 2cc86f094a8c316f7feb0336df3827a3264b116d, it seems
because of python-systemd module that we built. But libpython by itself
is not enough for actual python programs, and now we also list python itself,
so let's drop libpython from the list.

meson requires >= 3.7. We have CI that runs on CentOS8 with Python 3.6, but
let's not provide official support for an EOL Python version. Individual
distributions can provide backports, but we don't need to mention that in
the user-facing docs. According to [1], 3.7 is on life support and 3.6 is EOL.

[1] https://devguide.python.org/versions/

13 months agotools/check-includes: compat with Python 3.7
Zbigniew Jędrzejewski-Szmek [Sun, 7 May 2023 09:01:33 +0000 (11:01 +0200)] 
tools/check-includes: compat with Python 3.7

I thought that 3.8 is enough. But Centos8 CI chokes on the walrus.

13 months agotest/run-unit-tests, TEST-02: skip tests where the interpeter is not installed
Zbigniew Jędrzejewski-Szmek [Sat, 6 May 2023 09:49:31 +0000 (11:49 +0200)] 
test/run-unit-tests, TEST-02: skip tests where the interpeter is not installed

When the interpeter is missing, we get an exit code of 127. Let's treat those
tests as skipped too. If we could run the test far enough so that it could do
the check itself, it would return 77 anyway.

$ test/asdf; echo $?
exec: Failed to execute process 'test/asdf': The file specified the interpreter '/bin/asdf', which is not an executable command.
127
$ test/asdf; echo $?
/usr/bin/env: ‘/bin/asdf’: No such file or directory
127

This should resolve the problem that TEST-02 fails or Debian's 'unit-tests' fail
when python3 is not installed. Installing python3 via the mechanism that is
used to construct TEST images, i.e. the dracut dependency chasing scheme, would
be a lot of work for python with its modules in multiple locations and hundreds
of little files. So I think it OK to just skip the test there, and also in
other cases where python is not available.

13 months agotest: rework how udev-test is invoked
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 12:46:34 +0000 (14:46 +0200)] 
test: rework how udev-test is invoked

As part of the build, we would populate build/test/sys/ using
sys-script.py, and then udev-test.p[ly] would create a tmpfs instance
on build/test/tmpfs and copy the sys tree to build/test/tmpfs/sys.

Also, we had udev-test.p[ly] which called test-udev. test-udev was
marked as a manual test and installed, but neither udev-test.p[ly] or
sys-script.py were.

test-udev is renamed to udev-rule-runner, which reduces confusion and
frees up the test-udev name. udev-test.py is renamed to test-udev.py.
All three files are now installed.

test-udev.py is modified to internally call sys-script.py to set up the
sys tree. Copying and creating it from scratch should take the same
amount of time. We avoid having a magic directory, everything is now
done underneath a temporary directory.

test-udev.py is now a normal installed test, and run-unit-tests.py will
pick it up. When test-udev.py is invoked from meson, the path to
udev-rule-runner is passed via envvar; when it is invoked via
run-unit-tests.py or directly, it looks for udev-rule-runner in a relative
path.

The goal of this whole change is to let Debian drop the 'udev' test.
It called sys-script.py and udev-test.pl from the source directory and
had to recreate a bunch of the logic. Now test-udev.py will now be called
via 'upstream'.

13 months agotest: drop udev-test.pl
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 06:49:18 +0000 (08:49 +0200)] 
test: drop udev-test.pl

13 months agotest: rewrite udev-test.pl in Python
Zbigniew Jędrzejewski-Szmek [Thu, 4 May 2023 20:40:38 +0000 (22:40 +0200)] 
test: rewrite udev-test.pl in Python

I tried to keep this a 1:1 rewrite with the same field names.
Nevertheless, some changes were made:
- exp_add_error and exp_rem_error are dropped. Those fields meant that
  "./test-udev add <devpath>" actually succeeded, but symlinks were not
  created, and exp_links was ignored and could contain bogus content.
  Instead, exp_links and not_exp_links are adjusted to not contain
  garbage and the tests check that "./test-udev add" succeeds and that
  the links are as expected from exp_links and not_exp_links.
- cleanup was only used in one rule, and that rule was expected to fail,
  so cleanup wasn't actually necessary. So the cleanup field and the
  logic to call cleanup from individual tests is removed.
- a bunch of fields were set, but didn't seem to be connected to any
  implementation: not_exp_name, not_exp_test.
  e62acc3159935781f05fa59c48e5a74e85c61ce2 did a rewrite of some of the
  tests and it seems that not_exp_test was added by mistake and
  not_exp_name was left behind by mistake.
  In Python, the field list is declared in the class, so it's harder to
  assign an unused attribute. Those uses were converted to not_exp_links.
- in most rules, r"""…""" is used, so that escaping is not necessary.
- the logic to generate devices was only used in one place, and the
  generator function also had provisions to handle arguments that were
  never given. all_block_devs() is made much simpler.
- Descriptions that started with a capital letter were shortened
  and lowercased.
- no special test case counting is done. pytest just counts the cases
  (Rules objects).
- the output for failures is also removed. If something goes wrong, the
  user can use pytest --pdb or such to debug the issue.
- perl version used a semaphore to manage udev runners, and would fork,
  optionally wait a bit, and then start the runner. In the python
  version, we just spawn them all and wait for them to exit. It's not
  very convenient to call fork() from python, so instead the runner
  was modified (in previous commit) to wait.

The test can be called as:
  (cd build && sudo pytest -v ../test/udev-test.py)
  sudo meson test -C build udev-test.py -v

I think this generally provides functionality that is close to the perl
version. It seems some of the checks are now more fully implemented.
Support for strace/gdb/valgrind is missing.

Runtime goes down: 8.36 s → 5.78 s.

13 months agocheck-includes: print path relative to project root
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 07:38:15 +0000 (09:38 +0200)] 
check-includes: print path relative to project root

Instead of /home/zbyszek/src/systemd-work/build/../src/xdg-autostart-generator/xdg-autostart-service.h:11,
print just src/xdg-autostart-generator/xdg-autostart-service.h:11.

This is a bit annoying that this requires so much verbosity, but the output
with the full names was too annoying.

13 months agomeson: fix indentation
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 07:36:00 +0000 (09:36 +0200)] 
meson: fix indentation

13 months agomeson: add check-includes test to the test suite
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 07:35:54 +0000 (09:35 +0200)] 
meson: add check-includes test to the test suite

Let's just call it always. It is quite fast (meson says 0.12 s).

13 months agomeson: include .cc files in tags too
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 07:33:12 +0000 (09:33 +0200)] 
meson: include .cc files in tags too

We only have one, but it seems reasonable to not exclude it.
Result tested with emacs.

13 months agoRewrite check-includes.pl in python
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 07:03:12 +0000 (09:03 +0200)] 
Rewrite check-includes.pl in python

13 months agopid1: drop duplicate include
Zbigniew Jędrzejewski-Szmek [Fri, 5 May 2023 06:54:01 +0000 (08:54 +0200)] 
pid1: drop duplicate include