platform/upstream/systemd.git
10 months agobsod: install the signal handler only just before we need it
Frantisek Sumsal [Tue, 21 Nov 2023 14:55:08 +0000 (15:55 +0100)]
bsod: install the signal handler only just before we need it

Otherwise we might get stuck in sd_journal_wait(), since it handles
EINTR internally.

Resolves: #30084

10 months agopo: Translated using Weblate (Hebrew)
Yaron Shahrabani [Tue, 21 Nov 2023 11:01:15 +0000 (12:01 +0100)]
po: Translated using Weblate (Hebrew)

Currently translated at 37.0% (84 of 227 strings)

po: Translated using Weblate (Hebrew)

Currently translated at 15.8% (36 of 227 strings)

po: Added translation using Weblate (Hebrew)

Co-authored-by: Yaron Shahrabani <sh.yaron@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/he/
Translation: systemd/main

10 months agokernel-install: do not resolve symlink in paths passed to plugins
Yu Watanabe [Tue, 21 Nov 2023 01:18:57 +0000 (10:18 +0900)]
kernel-install: do not resolve symlink in paths passed to plugins

When we resolve symlinks, paths (especially filenames) may be changed,
but plugins may expect to see the kernel added under the name specified,
not under the final name that the symlink chain resolves to.

This makes symlinks in specified paths that passed to plugins are not
resolved when neither --root nor --image specified.

Fixes #29317.

10 months agosystemd.pc: Keep support for rootprefix and root_prefix (#30115)
Arian van Putten [Tue, 21 Nov 2023 12:51:08 +0000 (13:51 +0100)]
systemd.pc: Keep support for rootprefix and root_prefix (#30115)

* systemd.pc: Keep support for rootprefix and root_prefix

We dropped support for split-usr in https://github.com/systemd/systemd/commit/b0d3095fd6cc1791a38f57a1982116b4475244ba
but kept the `rootprefix` variable in meson but ignore it to make sure we do
not break downstream builds that depend on systemd.

This is fine because we had logic in our meson.build that rootprefix and prefix need to be the
same when split-usr=false.

However we never had this logic in our systemd.pc.in file. This leads to a nasty breaking problem
downstream. Many packages [0,1,2]  (there might be more!) rely on overriding rootprefix or root_prefix when calling pkg-config to configure where
to install systemd units. This is because before split-usr we installed units in rootprefix. Setting prefix
on the pkg-config file didn't work. Even when split-usr=false people had to set rootprefix to install units
in the right position.

E.g. they have a line like:

    systemdunitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define: ['rootprefix', systemd_root_prefix])

With https://github.com/systemd/systemd/commit/b0d3095fd6cc1791a38f57a1982116b4475244ba landing
This would mean all these downstream packages need to be patched to use `prefix` next to `rootprefix`.
(Both need to be kept to keep backwards compat with using older versions of systemd).

This puts a big burden on downstream packages.
Instead we should not break the existing behaviour and keep the old behaviour of systemd.pc.in around.
I've changed systemd.pc.in such that either setting prefix, rootprefix or root_prefix will all have
the same effect. This way we do not break any downstream packages.

- [0](https://github.com/fwupd/fwupd/blob/caa788b37ff34334d83debb047335fd12f3a7836/meson.build#L464)
- [1](https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blame/main/meson.build#L204)
- [2](https://github.com/PipeWire/pipewire/blob/49cdb468c28ba366dbd08eef9cb6dbf2dea2a2e5/src/daemon/systemd/system/meson.build#L1)

10 months agosystemctl-show: only show available memory if it was artifically limited
Florian Schmaus [Tue, 21 Nov 2023 08:10:10 +0000 (09:10 +0100)]
systemctl-show: only show available memory if it was artifically limited

Systemd 255 changed the semantic of MemoryAvailable with 3565c709f587 ("cgroup:
Fix MemoryAvailable= by considering physical memory"). If there is no
artificial constraint, it will hold the amount of available physical memory,
while it previously contained UINT64_MAX.

While the change in MemoryAvailable's semantic is sensible, it causes
`systemctl status` to always display the available physical memory. This
creates a lot of noise, especially since systemd recently started to also show
the "peak" memory. For example

$ systemctl status foo

Memory: 3.9G (available: 21.2G peak: 5.4G)


However, while peak memory is a unit specific value, the available memory, when
not derived from artificial memory limits, is a generic property that holds the
same value for all units that are not under memory accounting
constraints. Displaying it under those circumstances can therefore be
considered being noisy.

Before 3565c709f587 ("cgroup: Fix MemoryAvailable= by considering physical
memory") "systemctl status" would only show the available memory if it was
caused by a explicit memory limitation due to MemoryHigh or MemoryMax.

This commit restores this behavior by supressing displaying the available
memory if is is merely the available phyiscal memory. For example

$ systemctl status foo

Memory: 3.9G (peak: 5.4G)


Fixes #30102.

10 months agoTODO: register more mime types
Lennart Poettering [Mon, 20 Nov 2023 15:21:52 +0000 (16:21 +0100)]
TODO: register more mime types

10 months agoin-addr: improve log message for e.g. [DHCPv4] AllowList=
Yu Watanabe [Mon, 20 Nov 2023 23:41:38 +0000 (08:41 +0900)]
in-addr: improve log message for e.g. [DHCPv4] AllowList=

Closes #30107.

10 months agoman: correct version tags in systemd-vmspawn
Luca Boccassi [Mon, 20 Nov 2023 20:07:00 +0000 (20:07 +0000)]
man: correct version tags in systemd-vmspawn

We ended up merging some changes earlier

Fixes https://github.com/systemd/systemd/issues/30091

10 months agoMerge pull request #30108 from mrc0mmand/packit-testing-farm
Luca Boccassi [Mon, 20 Nov 2023 23:02:42 +0000 (23:02 +0000)]
Merge pull request #30108 from mrc0mmand/packit-testing-farm

packit: run tests on Fedora Rawhide via Testing Farm

10 months agopackit: run tests on Fedora Rawhide via Testing Farm
Frantisek Sumsal [Wed, 12 Jul 2023 08:59:30 +0000 (10:59 +0200)]
packit: run tests on Fedora Rawhide via Testing Farm

Let's utilize the full power of Packit and run some tests with the just
built RPMs. This makes use of the Fedora infrastructure provided by
the Testing Farm project [0][1].

With the current configuration, the `tests` job runs tests from the
Fedora tests repository [2] in a very similar fashion like Ubuntu CI
does, just with different metadata all around it. ATTOW there are only
two tests, which are wrappers around unit tests and integration tests;
the latter one currently runs only nspawn-based tests, since there's no
KVM on the test VMs, and, for now, I'd like to see how well the infra is
going to manage our upstream traffic and how stable the whole thing is
end up being before increasing the work load.

[0] https://docs.testing-farm.io/Testing%20Farm/0.1/index.html
[1] https://packit.dev/docs/configuration/upstream/tests
[2] https://src.fedoraproject.org/tests/systemd

10 months agotest: don't use ddebug() before it's defined
Frantisek Sumsal [Mon, 20 Nov 2023 16:41:20 +0000 (17:41 +0100)]
test: don't use ddebug() before it's defined

I'm pretty sure this is not the only case, but it's the one I recently
noticed. Even though we call ddebug() from a function, that function is
called before ddebug() is defined, resulting in the same issue as if we
called just ddebug() in its place, i.e.:

..//test-functions: line 276: ddebug: command not found

10 months agotest: move a couple of binaries to the BASICTOOLS array
Frantisek Sumsal [Mon, 20 Nov 2023 15:26:49 +0000 (16:26 +0100)]
test: move a couple of binaries to the BASICTOOLS array

As they're not optional.

10 months agotest: support NO_BUILD=yes on Fedora
Frantisek Sumsal [Mon, 20 Nov 2023 11:33:58 +0000 (12:33 +0100)]
test: support NO_BUILD=yes on Fedora

10 months agotest: make the LOOKS_LIKE_* variables proper booleans
Frantisek Sumsal [Mon, 20 Nov 2023 11:17:05 +0000 (12:17 +0100)]
test: make the LOOKS_LIKE_* variables proper booleans

10 months agoMerge pull request #30074 from YHNdnzj/hibernate-unsupported
Luca Boccassi [Mon, 20 Nov 2023 15:46:21 +0000 (15:46 +0000)]
Merge pull request #30074 from YHNdnzj/hibernate-unsupported

hibernate-util: if asked to bypass space check, accept the case when we have no swap space at all

10 months agolibsystemd-network: introduce triple_timestamp_from_cmsg()
Yu Watanabe [Fri, 17 Nov 2023 20:25:08 +0000 (05:25 +0900)]
libsystemd-network: introduce triple_timestamp_from_cmsg()

Follow-up for 461ef3981f1a45150b6e2047bb3c789ac50ba3cf.

This should fix compile error on x32 and riscv32.

10 months agoMerge pull request #30104 from poettering/pcrlock-empty-object-fix
Luca Boccassi [Mon, 20 Nov 2023 15:43:25 +0000 (15:43 +0000)]
Merge pull request #30104 from poettering/pcrlock-empty-object-fix

pcrlock: fix for parsing corrupted userspace event log

10 months agoMerge pull request #30095 from yuwata/kernel-install-exit-code
Luca Boccassi [Mon, 20 Nov 2023 13:33:06 +0000 (13:33 +0000)]
Merge pull request #30095 from yuwata/kernel-install-exit-code

kernel-install: exit code

10 months agotest: add simple test case for invalid userspace log records
Luca Boccassi [Mon, 20 Nov 2023 13:26:44 +0000 (14:26 +0100)]
test: add simple test case for invalid userspace log records

10 months agopcrlock: check for embedded NUL bytes
Lennart Poettering [Mon, 20 Nov 2023 13:26:18 +0000 (14:26 +0100)]
pcrlock: check for embedded NUL bytes

10 months agopcrlock: make sure we don't choke on empty records
Lennart Poettering [Mon, 20 Nov 2023 13:25:56 +0000 (14:25 +0100)]
pcrlock: make sure we don't choke on empty records

Follow-up for a43427013949

CID#1523832

10 months agoman: add note about journald forwarding being sync
Vito Caputo [Fri, 17 Nov 2023 20:30:32 +0000 (12:30 -0800)]
man: add note about journald forwarding being sync

This footgun should at least be documented, if there's not going
to be a shortcut setting to establish the async `journalctl
--follow` equivalent.

Fixes: https://github.com/systemd/systemd/issues/2815

10 months agoman: Fix example for systemd-run
Martin Joerg [Mon, 20 Nov 2023 10:04:21 +0000 (11:04 +0100)]
man: Fix example for systemd-run

10 months agotest-condition: skip group test during Debian package build
Luca Boccassi [Sun, 19 Nov 2023 22:31:26 +0000 (22:31 +0000)]
test-condition: skip group test during Debian package build

The group names won't match in a package build chroot and the test might
fail, skip it.

https://buildd.debian.org/status/fetch.php?pkg=systemd&arch=hppa&ver=255%7Erc2-2&stamp=1700424353&raw=0

10 months agotest: add test cases about plugin exit code
Yu Watanabe [Mon, 20 Nov 2023 01:17:54 +0000 (10:17 +0900)]
test: add test cases about plugin exit code

10 months agokernel-install: propagate failures in plugins
Yu Watanabe [Mon, 20 Nov 2023 00:55:49 +0000 (09:55 +0900)]
kernel-install: propagate failures in plugins

This fixes a regression introduced by
42551ea7e923bac5df12b20e3e735a487d38dcd5.

In the shell script version, plugin failures are propagated to the
caller. But after the commit, failures in plugins are logged, but never
propagated as the exit code of the execution.

Fixes #30087.

10 months agohwdb: add Predator PHN16-71
onenowy [Sun, 19 Nov 2023 05:51:47 +0000 (14:51 +0900)]
hwdb: add Predator PHN16-71

enable microphone mute, predator sense button and fix the keyboard backlight up button changes display brightness.

10 months agoMerge pull request #30070 from weblate/weblate-systemd-master
Yu Watanabe [Sat, 18 Nov 2023 13:59:20 +0000 (22:59 +0900)]
Merge pull request #30070 from weblate/weblate-systemd-master

Translations update from Fedora Weblate

10 months agohibernate-util: if asked to bypass space check, accept the case when we
Mike Yuan [Sat, 18 Nov 2023 12:09:23 +0000 (20:09 +0800)]
hibernate-util: if asked to bypass space check, accept the case when we
have no swap space at all

But I shall still recommend
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
to everyone ;-)

Fixes #30083

10 months agohibernate-util: report no available swap as no enough swap space
Mike Yuan [Fri, 17 Nov 2023 14:17:06 +0000 (22:17 +0800)]
hibernate-util: report no available swap as no enough swap space

Otherwise, ENOENT or ENXIO may be directly returned as error through
bus.

Should help to generate clearer error message for #30083.

10 months agonetwork/dhcp: actually refuse to assign DHCP option when an invalid string is passed
Yu Watanabe [Fri, 17 Nov 2023 17:43:50 +0000 (02:43 +0900)]
network/dhcp: actually refuse to assign DHCP option when an invalid string is passed

Prompted by #30029.

10 months agoMerge pull request #30078 from yuwata/test-setup-logging
Luca Boccassi [Sat, 18 Nov 2023 11:18:22 +0000 (11:18 +0000)]
Merge pull request #30078 from yuwata/test-setup-logging

test: call test_setup_logging()

10 months agopo: Translated using Weblate (Chinese (Simplified) (zh_CN))
Charles Lee [Sat, 18 Nov 2023 11:17:27 +0000 (12:17 +0100)]
po: Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Charles Lee <lchopn@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/zh_CN/
Translation: systemd/main

10 months agopo: Update translation files
Weblate [Sat, 18 Nov 2023 11:17:27 +0000 (12:17 +0100)]
po: Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/
Translation: systemd/main

10 months agopo: Translated using Weblate (Chinese (Simplified) (zh_CN))
Charles Lee [Sat, 18 Nov 2023 11:17:27 +0000 (12:17 +0100)]
po: Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Charles Lee <lchopn@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/zh_CN/
Translation: systemd/main

10 months agofuzz: always call fuzz_setup_logging()
Yu Watanabe [Fri, 17 Nov 2023 17:09:04 +0000 (02:09 +0900)]
fuzz: always call fuzz_setup_logging()

10 months agotest: always call test_setup_logging()
Yu Watanabe [Fri, 17 Nov 2023 16:54:01 +0000 (01:54 +0900)]
test: always call test_setup_logging()

10 months agomkosi ci: enable jammy-proposed
Luca Boccassi [Fri, 17 Nov 2023 10:31:26 +0000 (10:31 +0000)]
mkosi ci: enable jammy-proposed

This will bring in the fix for rawhide/tumbleweed builds (new libsolv
capable of handling zstd). If all goes well it will migrate to jammy
proper in a week and it can be reverted

10 months agoNEWS: drop duplicate 'of'
Christian Hesse [Fri, 17 Nov 2023 12:35:48 +0000 (13:35 +0100)]
NEWS: drop duplicate 'of'

10 months agoMerge pull request #30064 from bluca/unbork_direct_io
Luca Boccassi [Fri, 17 Nov 2023 09:40:09 +0000 (09:40 +0000)]
Merge pull request #30064 from bluca/unbork_direct_io

loop-util: restart loop_configure and reopen FD when O_DIRECT fails

10 months agoMerge pull request #30066 from bluca/test
Luca Boccassi [Fri, 17 Nov 2023 09:39:48 +0000 (09:39 +0000)]
Merge pull request #30066 from bluca/test

fsck/shell test fixes

10 months agotest: avoid asserting on default user shell
Luca Boccassi [Thu, 16 Nov 2023 23:17:29 +0000 (23:17 +0000)]
test: avoid asserting on default user shell

In some build environments it might differ:

/* test_get_user_creds_one("root", "root", 0, 0, "/root", "/usr/bin/bash") */
got "root", 0, 0, "/root", "/bin/sh": Success
Assertion 'path_equal(rshell, shell)' failed at src/test/test-user-util.c:345, function test_get_user_creds_one(). Aborting.

https://buildd.debian.org/status/fetch.php?pkg=systemd&arch=alpha&ver=255%7Erc2-1&stamp=1700147880&raw=0

10 months agotest: minix fsck not found on alpha
Luca Boccassi [Thu, 16 Nov 2023 23:01:08 +0000 (23:01 +0000)]
test: minix fsck not found on alpha

It seems even this one is not everywhere, so relax the test:

/* test_fsck_exists */
Assertion 'fsck_exists_for_fstype("minix") == 1' failed at src/test/test-path-util.c:624, function test_fsck_exists(). Aborting.

https://buildd.debian.org/status/fetch.php?pkg=systemd&arch=alpha&ver=255%7Erc2-1&stamp=1700147880&raw=0

10 months agoloop-util: use the right error variable in log_debug_errno after fd_reopen
Luca Boccassi [Thu, 16 Nov 2023 21:13:10 +0000 (21:13 +0000)]
loop-util: use the right error variable in log_debug_errno after fd_reopen

10 months agoloop-util: restart loop_configure and reopen FD when O_DIRECT fails
Luca Boccassi [Thu, 16 Nov 2023 15:45:20 +0000 (15:45 +0000)]
loop-util: restart loop_configure and reopen FD when O_DIRECT fails

On kernel 5.10.178, when a squashfs file is stored on an EXT4 filesystem
backed by a dm-crypt volume, dissecting fails:

$ SYSTEMD_LOG_LEVEL=debug systemd-dissect /var/foo/bar.raw
Opened '/var/foo/bar.raw' in O_RDONLY access mode, with O_DIRECT enabled.
Couldn't find any partition table to derive sector size of.
loop2: Acquired exclusive lock.
Could not enable direct IO mode, proceeding in buffered IO mode.
Successfully acquired /dev/loop2, devno=7:2, nr=2, diskseq=87
Opened /dev/loop2 (fd=3, whole_block_devnum=7:2, diskseq=87).
      Name: bar.raw
      Size: 67.2M
 Sec. Size: 512
     Arch.: n/a

Successfully forked off '(sd-dissect)' as PID 4110.
Mounting /proc/self/fd/3 (squashfs) on /tmp/dissect-Zk3K5F (MS_RDONLY|MS_NODEV "")...
Failed to mount /proc/self/fd/3 (type squashfs) on /tmp/dissect-Zk3K5F (MS_RDONLY|MS_NODEV ""): Input/output error
Failed to mount dissected image: Input/output error
Failed to read /etc/hostname of image: No such file or directory
/etc/machine-id file of image is empty.
Failed to read has-init-system boolean: Input/output error
(sd-dissect) failed with exit status 1.
Failed to acquire image metadata: Input/output error

The kernel shows I/O errors:

kernel: blk_update_request: I/O error, dev loop2, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 0
kernel: SQUASHFS error: Failed to read block 0x0: -5
kernel: unable to read squashfs_super_block

This is independent of a particular filesystem and can be reproduced
reliably in my setup, starting from freshly formatted disks.

Instead of continuing when O_DIRECT fails, start over the setup
process without the flag, including opening a new FD, to make the
kernel happy.

10 months agoMerge pull request #30055 from YHNdnzj/logind-handle-action
Luca Boccassi [Thu, 16 Nov 2023 16:04:37 +0000 (16:04 +0000)]
Merge pull request #30055 from YHNdnzj/logind-handle-action

logind-action: several cleanups

10 months agoupdate TODO
Lennart Poettering [Thu, 16 Nov 2023 12:42:56 +0000 (13:42 +0100)]
update TODO

10 months agoupdate TODO
Lennart Poettering [Thu, 16 Nov 2023 12:34:07 +0000 (13:34 +0100)]
update TODO

10 months agologin: mark the TTY property as "emits change"
Frantisek Sumsal [Thu, 16 Nov 2023 09:26:45 +0000 (10:26 +0100)]
login: mark the TTY property as "emits change"

Triggered by the SetTTY() method.

Follow-up to 092e6cd19ad.
Addresses: https://github.com/systemd/systemd/pull/30043#pullrequestreview-1733628935

10 months agoMerge pull request #30052 from dtardon/udev-fixes
Luca Boccassi [Thu, 16 Nov 2023 11:25:24 +0000 (11:25 +0000)]
Merge pull request #30052 from dtardon/udev-fixes

Two small udev fixes

10 months agologind-action: check if inhibit_what is valid
Mike Yuan [Thu, 16 Nov 2023 09:47:47 +0000 (17:47 +0800)]
logind-action: check if inhibit_what is valid

Fixes #30037

10 months agologind-inhibit: introduce inhibit_what_is_valid
Mike Yuan [Thu, 16 Nov 2023 09:46:56 +0000 (17:46 +0800)]
logind-inhibit: introduce inhibit_what_is_valid

10 months agologind-action: split out logic for handle_action_sleep
Mike Yuan [Thu, 2 Nov 2023 10:23:21 +0000 (18:23 +0800)]
logind-action: split out logic for handle_action_sleep

Preparation for #29853

10 months agologind: return "no" if sleep operation is disabled
Mike Yuan [Tue, 31 Oct 2023 13:08:19 +0000 (21:08 +0800)]
logind: return "no" if sleep operation is disabled

According to org.freedesktop.login1:

> If "na" is returned, the operation is not available because
> hardware, kernel, or drivers do not support it. If "yes" is
> returned, the operation is supported and the user may execute
> the operation without further authentication. If "no" is returned,
> the operation is available but the user is not allowed to execute
> the operation.

Therefore, we should return "no" if sleep is explicitly disabled,
otherwise we return "na".

10 months agoTODO: remove an already implemented entry
Mike Yuan [Fri, 3 Nov 2023 12:43:18 +0000 (20:43 +0800)]
TODO: remove an already implemented entry

Follow-up for #23640

10 months agohwdb: Mark Dell platform accel sensor location to base
Yo-Jung Lin [Thu, 16 Nov 2023 06:05:40 +0000 (14:05 +0800)]
hwdb: Mark Dell platform accel sensor location to base

Dell would like to disable screen rotation for the platform eternally.
Mark the aceel sensor location base to disable it.

10 months agoMerge pull request #30047 from yuwata/sd-bus-assert-return
Luca Boccassi [Thu, 16 Nov 2023 09:34:31 +0000 (09:34 +0000)]
Merge pull request #30047 from yuwata/sd-bus-assert-return

sd-bus: several fixlets found by making assert_return() critical

10 months agolog: rename variables to store function call results
Yu Watanabe [Thu, 16 Nov 2023 01:47:45 +0000 (10:47 +0900)]
log: rename variables to store function call results

10 months agoudev-manager: fix log message
David Tardon [Tue, 14 Nov 2023 18:20:01 +0000 (19:20 +0100)]
udev-manager: fix log message

10 months agotest: read from the right device
David Tardon [Wed, 15 Nov 2023 07:15:59 +0000 (08:15 +0100)]
test: read from the right device

10 months agoMerge pull request #30043 from mrc0mmand/more-assert_return
Yu Watanabe [Thu, 16 Nov 2023 02:28:33 +0000 (11:28 +0900)]
Merge pull request #30043 from mrc0mmand/more-assert_return

More `assert_return()` shenanigans

10 months agoMerge pull request #30045 from poettering/discover-image-tweaklets
Yu Watanabe [Thu, 16 Nov 2023 02:28:04 +0000 (11:28 +0900)]
Merge pull request #30045 from poettering/discover-image-tweaklets

discover-image: tiny tweaklets

10 months agoMerge pull request #30044 from poettering/dissect-tool-tweaklets
Yu Watanabe [Thu, 16 Nov 2023 02:27:47 +0000 (11:27 +0900)]
Merge pull request #30044 from poettering/dissect-tool-tweaklets

systemd-dissect --discover tweaklets

10 months agosd-dhcp: use CMSG_FIND_AND_COPY_DATA to avoid build failures on x32 architectures
Luca Boccassi [Wed, 15 Nov 2023 21:08:30 +0000 (21:08 +0000)]
sd-dhcp: use CMSG_FIND_AND_COPY_DATA to avoid build failures on x32 architectures

On architectures where timeval is 64bit but size_t is 32bit
we have to use CMSG_FIND_AND_COPY_DATA. This affects x32 and riscv32.

Follow-up for 905d0ea7b0080dd

10 months agotest: sd_bus_process() may assign NULL even if it returns positive
Yu Watanabe [Thu, 16 Nov 2023 00:14:38 +0000 (09:14 +0900)]
test: sd_bus_process() may assign NULL even if it returns positive

Let's not trigger assert_return() needlessly.

Prompted by #30029.

10 months agotest: several cleanups for test-bus-chat
Yu Watanabe [Wed, 15 Nov 2023 19:37:02 +0000 (04:37 +0900)]
test: several cleanups for test-bus-chat

- use sd_bus_query_sender_creds() to retrieve credentials,
- read credentials only when we get credentials, to avoid triggering
  assert_return(),
- downgrade log level of expected failure, and update log message about
  unexpected success.

Prompted by #30029.

10 months agosd-bus: drop SD_BUS_CREDS_AUGMENT flag
Yu Watanabe [Wed, 15 Nov 2023 18:37:24 +0000 (03:37 +0900)]
sd-bus: drop SD_BUS_CREDS_AUGMENT flag

On checking if the message has enough credentials, the special flag
needs to be dropped.

Fixes a bug introduced by 705a415f684f8e9ee19983e5859de00bbb1477cb.

10 months agosd-bus: insert missing space
Yu Watanabe [Wed, 15 Nov 2023 19:46:24 +0000 (04:46 +0900)]
sd-bus: insert missing space

10 months agodiscover-image: use TAKE_PTR() where appropriate
Lennart Poettering [Wed, 15 Nov 2023 17:36:59 +0000 (18:36 +0100)]
discover-image: use TAKE_PTR() where appropriate

10 months agodiscover-image: reindent string table
Lennart Poettering [Wed, 15 Nov 2023 17:36:39 +0000 (18:36 +0100)]
discover-image: reindent string table

10 months agodissect: set dash as ersatz string
Lennart Poettering [Wed, 15 Nov 2023 21:36:41 +0000 (22:36 +0100)]
dissect: set dash as ersatz string

10 months agodissect: right-align size column in --discover table
Lennart Poettering [Wed, 15 Nov 2023 21:14:36 +0000 (22:14 +0100)]
dissect: right-align size column in --discover table

10 months agologin: mark the Display property as "emits change"
Frantisek Sumsal [Wed, 15 Nov 2023 21:21:16 +0000 (22:21 +0100)]
login: mark the Display property as "emits change"

With the introduction of SetDisplay() method in 4885d7490b2 the Display
property emits a "properties changed" message every time the display is
changed using this method, so mark it appropriately.

Caught by systemd/systemd#30029:

systemd-logind[1366]: Got message type=method_call sender=:1.165 destination=org.freedesktop.login1 path=/org/freedesktop/login1/session/_310 interface=org.freedesktop.login1.Session member=SetDisplay  cookie=8 reply_cookie=0 signature=s error-name=n/a error-message=n/a
systemd-logind[1366]: Assertion 'v->vtable->flags & SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE || v->vtable->flags & SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION' failed at src/libsystemd/sd-bus/bus-objects.c:2141, function emit_properties_changed_on_interface(). Ignoring.

Follow-up to 4885d7490b2.

10 months agosd-journal: don't assert on invalid field
Frantisek Sumsal [Wed, 15 Nov 2023 20:44:33 +0000 (21:44 +0100)]
sd-journal: don't assert on invalid field

Also, field_is_valid(field) already does isempty(field), so drop that as
well.

$ SYSTEMD_LOG_LEVEL=debug journalctl -o verbose -F foo-bar-baz
...
Assertion 'field_is_valid(field)' failed at src/libsystemd/sd-journal/sd-journal.c:2789, function sd_journal_query_unique(). Ignoring.
Failed to query unique data objects: Invalid argument

10 months agoMerge pull request #30040 from yuwata/assert-return-fixes
Frantisek Sumsal [Wed, 15 Nov 2023 21:05:06 +0000 (21:05 +0000)]
Merge pull request #30040 from yuwata/assert-return-fixes

several assert_return() fixes

10 months agorepart: Fix compilation warning when tpm2 is disabled
Krzesimir Nowak [Wed, 15 Nov 2023 16:39:10 +0000 (17:39 +0100)]
repart: Fix compilation warning when tpm2 is disabled

The warning is about unused variable "flags":

```
../src/partition/repart.c: In function ‘partition_encrypt’:
../src/partition/repart.c:3690:19: warning: unused variable ‘flags’ [-Wunused-variable]
 3690 |         TPM2Flags flags = 0;
      |                   ^~~~~
```

Move the flags variable into the scope where it is actually used, which happens
to be inside the HAVE_TPM2 block.

10 months agosd-device: do not trigger assertion by a bad udev rules
Yu Watanabe [Wed, 15 Nov 2023 17:27:19 +0000 (02:27 +0900)]
sd-device: do not trigger assertion by a bad udev rules

The assertion can be triggered by bad `$attr{[<subsys>/<sysname>]<attribute>}`
formatting. That's not a programmer's error, but a runtime error.

Prompted by #30029.

10 months agodhcp: do not trigger assertion by malformed messages
Yu Watanabe [Wed, 15 Nov 2023 17:17:22 +0000 (02:17 +0900)]
dhcp: do not trigger assertion by malformed messages

This also changes error code from -ENODATA -> -EBADMSG,
as we received bad message in that case.

Prompted by #30029.

10 months agonetwork: do not try to create netdev from tests
Yu Watanabe [Wed, 15 Nov 2023 17:12:09 +0000 (02:12 +0900)]
network: do not try to create netdev from tests

Prompted by #30029.

10 months agoNEWS: finalize for v255-rc2
Luca Boccassi [Wed, 15 Nov 2023 16:31:53 +0000 (16:31 +0000)]
NEWS: finalize for v255-rc2

10 months agoMerge pull request #30033 from mrc0mmand/assert_return-tweaks
Luca Boccassi [Wed, 15 Nov 2023 16:24:48 +0000 (16:24 +0000)]
Merge pull request #30033 from mrc0mmand/assert_return-tweaks

Dial back a couple of `assert_return()` uses

10 months agoMerge pull request #30035 from keszybz/buid-sys-cleanups
Luca Boccassi [Wed, 15 Nov 2023 16:05:29 +0000 (16:05 +0000)]
Merge pull request #30035 from keszybz/buid-sys-cleanups

Build system cleanups

10 months agoman/systemd-creds: fix a typo
Mike Yuan [Wed, 15 Nov 2023 14:28:52 +0000 (22:28 +0800)]
man/systemd-creds: fix a typo

10 months agohwdb/acpi-update.py: streamline python code
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2023 14:24:34 +0000 (15:24 +0100)]
hwdb/acpi-update.py: streamline python code

Use f-strings and simplify the code a bit.

When I call 'acpi-update.py' after those changes, the resulting .hwdb files are
the same except for two additions that appeared in the meantime. I don't think
it makes sense to update them again, because the ma-*.txt files changed and we
don't want to store big blobs unnecessarilly.

10 months agohwdb: rename .html=>.csv
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2023 14:21:26 +0000 (15:21 +0100)]
hwdb: rename .html=>.csv

The old suffix is now confusing.

10 months agotest: update Ubuntu CI instructions
Frantisek Sumsal [Wed, 15 Nov 2023 13:57:48 +0000 (14:57 +0100)]
test: update Ubuntu CI instructions

10 months agoMerge pull request #30030 from poettering/gpt-growfs-root-fix
Luca Boccassi [Wed, 15 Nov 2023 13:57:28 +0000 (13:57 +0000)]
Merge pull request #30030 from poettering/gpt-growfs-root-fix

make gpt flag 59 (growfs) actually work on the root fs

10 months agomeson: use ternary op for brevity
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2023 13:47:17 +0000 (14:47 +0100)]
meson: use ternary op for brevity

10 months agoNEWS: adjust indentation
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2023 13:52:36 +0000 (14:52 +0100)]
NEWS: adjust indentation

A non-breaking space is used between "PCR" and the number. I did
search&replace on the whole file, so that when people select&paste
later, they are more likely to use the same format.

10 months agosd-bus: don't treat invalid user/machine as a programming error
Frantisek Sumsal [Wed, 15 Nov 2023 12:56:50 +0000 (13:56 +0100)]
sd-bus: don't treat invalid user/machine as a programming error

$ SYSTEMD_LOG_LEVEL=debug machinectl status --machine=@
Assertion 'r > 0' failed at src/libsystemd/sd-bus/sd-bus.c:1694, function sd_bus_open_system_machine(). Ignoring.

10 months agomount: don't call sd_device_get_property_value() with a NULL pointer
Frantisek Sumsal [Wed, 15 Nov 2023 12:46:09 +0000 (13:46 +0100)]
mount: don't call sd_device_get_property_value() with a NULL pointer

Otherwise bad thing would've happened is this was a hard assert:

+ systemd-mount --umount /dev/loop0
Assertion 'device' failed at src/libsystemd/sd-device/sd-device.c:2202, function sd_device_get_property_value(). Ignoring.

10 months agosd-journal: don't treat invalid match as a programming error
Frantisek Sumsal [Wed, 15 Nov 2023 12:38:02 +0000 (13:38 +0100)]
sd-journal: don't treat invalid match as a programming error

Don't use assert_runtime() when we get an invalid match string, since
that's a runtime error:

$ SYSTEMD_LOG_LEVEL=debug coredumpctl info =
...
Adding match: =
Assertion 'match_is_valid(data, size)' failed at src/libsystemd/sd-journal/sd-journal.c:240, function sd_journal_add_match(). Ignoring.
Failed to add match "=": Invalid argument

10 months agoboot: measure config first, only then parse
Lennart Poettering [Wed, 15 Nov 2023 11:11:08 +0000 (12:11 +0100)]
boot: measure config first, only then parse

Fixes: #30026

10 months agogpt-auto-generator: hook in "growfs" for the root fs if the GPT flag 59 says so
Lennart Poettering [Wed, 15 Nov 2023 10:14:39 +0000 (11:14 +0100)]
gpt-auto-generator: hook in "growfs" for the root fs if the GPT flag 59 says so

Fixes: #29791

10 months agogpt-auto-generator: don't eat up errors of generator_enable_remount_fs_service()
Lennart Poettering [Wed, 15 Nov 2023 12:17:31 +0000 (13:17 +0100)]
gpt-auto-generator: don't eat up errors of generator_enable_remount_fs_service()

I cannot see a reason why we should ignore this error, so let's not. We
use RET_GATHER() on the returns anyway, i.e. collect errors but
continue, so it makes sense to collect this one too.

10 months agogpt-auto-generator: add comment + assert() explaining mode of invocation
Lennart Poettering [Wed, 15 Nov 2023 10:14:11 +0000 (11:14 +0100)]
gpt-auto-generator: add comment + assert() explaining mode of invocation

We are not invoked in the initrd, and that deserves a comment.

10 months agogpt-auto-generator: drop in_initrd() check in add_partition_root_rw()
Lennart Poettering [Wed, 15 Nov 2023 10:12:38 +0000 (11:12 +0100)]
gpt-auto-generator: drop in_initrd() check in add_partition_root_rw()

This call is never called in the initrd, hence we can drop the extra
check, as it is redundant. Let's keep it as an assert() though, as a
form of code-enforced documentation.

10 months agofuzz: don't panic without a C++ compiler
Frantisek Sumsal [Wed, 15 Nov 2023 10:41:45 +0000 (11:41 +0100)]
fuzz: don't panic without a C++ compiler

meson's `cpp_args` option is defined only if it detects a C++ compiler,
otherwise we get an error:

../test/fuzz/meson.build:56:28: ERROR: Tried to access unknown option 'cpp_args'.

10 months agoNEWS fixes
Lennart Poettering [Wed, 15 Nov 2023 10:52:27 +0000 (11:52 +0100)]
NEWS fixes

10 months agoMerge pull request #30028 from yuwata/duid-fix-size
Luca Boccassi [Wed, 15 Nov 2023 09:49:46 +0000 (09:49 +0000)]
Merge pull request #30028 from yuwata/duid-fix-size

dhcp: fix DUID size