]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoboot: Take advantage of packed device paths 26542/head
Jan Janssen [Sat, 7 Jan 2023 11:03:28 +0000 (12:03 +0100)] 
boot: Take advantage of packed device paths

Now that device path types are marked as packed we can safely cast and
access them. If we ever take the address of a member, we would get a
compiler warning.

2 years agoboot: Add GUID format helper macro
Jan Janssen [Wed, 22 Feb 2023 14:19:14 +0000 (15:19 +0100)] 
boot: Add GUID format helper macro

2 years agoboot: Move more device path helpers to device-path-util.c
Jan Janssen [Sat, 7 Jan 2023 10:58:14 +0000 (11:58 +0100)] 
boot: Move more device path helpers to device-path-util.c

This also renames them to stay consistent with our naming style.

2 years agoboot: Remove some device path helper macros
Jan Janssen [Sat, 7 Jan 2023 10:46:41 +0000 (11:46 +0100)] 
boot: Remove some device path helper macros

In gnu-efi/EDK2 device paths are not marked as packed and instead the
Length field is split into 2 bytes. Accessing those requires these
helper macros as device paths may be unaligned.

Since our own efi headers define device path structs as packed, we can
access these directly, making code much more readable.

2 years agoboot: Split out device path functions
Jan Janssen [Sat, 7 Jan 2023 10:39:07 +0000 (11:39 +0100)] 
boot: Split out device path functions

No code changes aside from renaming path_replace_hd() and making its
parameter take any device path node type.

2 years agoboot: Move disk_get_part_uuid into part-discovery.c
Jan Janssen [Sat, 7 Jan 2023 10:21:56 +0000 (11:21 +0100)] 
boot: Move disk_get_part_uuid into part-discovery.c

Thematically, they are similar and disk.c is awfully small to warrant
the separation.

2 years agoMerge pull request #26540 from poettering/systemctl-list-tweaks
Lennart Poettering [Wed, 22 Feb 2023 20:19:40 +0000 (21:19 +0100)] 
Merge pull request #26540 from poettering/systemctl-list-tweaks

small tweaks to "systemctl list-automounts" + "systemctl list-timers" tabular output

2 years agotest: add coverage for #24177
Frantisek Sumsal [Wed, 22 Feb 2023 15:43:42 +0000 (16:43 +0100)] 
test: add coverage for #24177

Original issue: https://bugzilla.redhat.com/show_bug.cgi?id=1985288

2 years agosmack-util: Fix compilation error when smack is disabled
Daan De Meyer [Wed, 22 Feb 2023 14:47:54 +0000 (15:47 +0100)] 
smack-util: Fix compilation error when smack is disabled

2 years agosystemctl: read 64bit integers into uint64_t 26540/head
Lennart Poettering [Wed, 22 Feb 2023 18:00:28 +0000 (19:00 +0100)] 
systemctl: read 64bit integers into uint64_t

usec_t is also a uint64_t internally, hence this doesn't actually change
anything. However, on the conceptual level, sd-bus expects a uint64_t
hence give it one.

2 years agosystemctl: suppress timeout display if unset in list-automounts
Lennart Poettering [Wed, 22 Feb 2023 12:42:02 +0000 (13:42 +0100)] 
systemctl: suppress timeout display if unset in list-automounts

If the timeout is zero it's not set, let's suppress the output then.

2 years agosystemctl: right-align left/passed columns in list-timers
Lennart Poettering [Wed, 22 Feb 2023 12:40:53 +0000 (13:40 +0100)] 
systemctl: right-align left/passed columns in list-timers

Timespans are probably best right-aligned, in particular if they
systematically end in either " ago" or " left" because they are used as
"relative timestamps".

2 years agoMerge pull request #26448 from poettering/sd-event-mempress
Lennart Poettering [Wed, 22 Feb 2023 15:23:59 +0000 (16:23 +0100)] 
Merge pull request #26448 from poettering/sd-event-mempress

sd-event: add memory pressure event source

2 years agosystemctl: warn if units disabled in user scope are still enabled globally
Mike Yuan [Sun, 12 Feb 2023 13:08:28 +0000 (21:08 +0800)] 
systemctl: warn if units disabled in user scope are still enabled globally

Fixes #18271

2 years agosystemctl: show "Until:" field only for service and scope units
Yu Watanabe [Wed, 22 Feb 2023 04:26:28 +0000 (13:26 +0900)] 
systemctl: show "Until:" field only for service and scope units

Only service and scope units have RuntimeMaxUSec bus property.
To suppress the "Until:" field for other unit types, the entry must be
initialized with USEC_INFINITY.

Fixes #26473.

2 years agoMerge pull request #26528 from keszybz/valgrind-simplification
Yu Watanabe [Wed, 22 Feb 2023 14:04:12 +0000 (23:04 +0900)] 
Merge pull request #26528 from keszybz/valgrind-simplification

Drop the -Dvalgrind configuration option

2 years agoMerge pull request #26500 from DaanDeMeyer/repart-mountpoints
Daan De Meyer [Wed, 22 Feb 2023 13:25:45 +0000 (14:25 +0100)] 
Merge pull request #26500 from DaanDeMeyer/repart-mountpoints

repart: Several CopyFiles= improvements

2 years agoman: document the new sd_event_add_memory_pressure() API 26448/head
Lennart Poettering [Thu, 16 Feb 2023 16:24:28 +0000 (17:24 +0100)] 
man: document the new sd_event_add_memory_pressure() API

2 years agotest: add test for new memory pressure logic
Lennart Poettering [Fri, 10 Feb 2023 12:29:58 +0000 (13:29 +0100)] 
test: add test for new memory pressure logic

it tests both real PSI stuff (if available) and fake pressure via
AF_UNIX and FIFO notification.

2 years agosd-event: add high-level sd_event_add_memory_pressure() event source
Lennart Poettering [Fri, 10 Feb 2023 15:44:24 +0000 (16:44 +0100)] 
sd-event: add high-level sd_event_add_memory_pressure() event source

Typically, in reasonably complex programs we want to realease various
caches (such as glibc allocation caches) in case of memory pressure.
Let's add explicit infrastructure for that to sd-event, that can hook
Linux' Pressure Stall Information (PSI) logic with our event loop.

This adds sd_event_add_memory_pressure() as easy, one-step API to
install an even source that is called under memory pressure.

The parameters which file to watch (the per-cgroup PSI file, or the
system-wide file /proc/pressure/memory) can be configured via env vars.
The idea is that the service manager sooner or later gains controls for
setting this up correctly.

Alternatively to the PSI a similar logic is supported but instead of
waiting for POLLPRI on a procfs/cgroupfs fd we'll wait for POLLIN on
FIFO or AF_UNIX sockets. This is useful for testing, and possibly in
other environments, for example to hook up this protocol directly with
GNOME's low memory monitor.

By default this watches on the cgroup-local PSI so that we aren't
affected by pressure on cgroups we are not related to.

2 years agorepart: Exclude APIVFS mountpoint directories 26500/head
Daan De Meyer [Mon, 20 Feb 2023 15:39:34 +0000 (16:39 +0100)] 
repart: Exclude APIVFS mountpoint directories

Also exclude APIVFS and temporary files directories from the copy
operation so that these files don't accidentally end up in images.

2 years agocopy: Support both inode exclusion and contents exclusion
Daan De Meyer [Mon, 20 Feb 2023 19:30:44 +0000 (20:30 +0100)] 
copy: Support both inode exclusion and contents exclusion

In some cases, we want to exclude a directory's contents but not
the directory itself. In other cases, we want to exclude a directory
and its contents. Let's extend the denylist logic in copy.h to support
both by changing the denylist from a set to hashmap so we can store the
deny type as the value.

We also modify the repart ExcludeFiles= option to make use of this. If
a directory to exclude ends with a "/", we'll only exclude its contents.
Otherwise, we'll exclude the full directory.

2 years agorepart: Refactor make_copy_files_denylist() a bit
Daan De Meyer [Mon, 20 Feb 2023 15:18:08 +0000 (16:18 +0100)] 
repart: Refactor make_copy_files_denylist() a bit

2 years agotest-set: inline two iterator declarations 26528/head
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 10:15:22 +0000 (11:15 +0100)] 
test-set: inline two iterator declarations

2 years agosd-journal: use a dynamic check for valgrind
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 10:35:25 +0000 (11:35 +0100)] 
sd-journal: use a dynamic check for valgrind

I left this one as a separate commit because it is more involved.
We want people to compile with valgrind support, but we don't want to
use a slow hash function unless we're actually running under valgrind.
So the compile-time check is changed to a runtime check. When compiled
with optimization, the compiler should elide the checks on the constants,
and only leave the check for RUNNING_ON_VALGRIND. It is wrapped with
_unlikely_ so that the else branch is put in the hot path.

2 years agomeson: merge our two valgrind configuration conditions into one
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2023 18:59:57 +0000 (19:59 +0100)] 
meson: merge our two valgrind configuration conditions into one

Most of the support for valgrind was under HAVE_VALGRIND_VALGRIND_H, i.e. we
would enable if the valgrind headers were found. The operations then we be
conditionalized on RUNNING_UNDER_VALGRIND.

But in a few places we had code which was conditionalized on VALGRIND, i.e. the
config option. I noticed because I compiled with -Dvalgrind=true on a machine
that didn't have valgrind.h, and the build failed because
RUNNING_UNDER_VALGRIND was not defined. My first idea was to add a check that
the header is present if the option is set, but it seems better to just remove
the option. The code to support valgrind is trivial, and if we're
!RUNNING_UNDER_VALGRIND, it has negligible cost. And the case of running under
valgrind is always some special testing/debugging mode, so we should just do
those extra steps to make valgrind output cleaner. Removing the option makes
things simpler and we don't have to think if something should be covered by the
one or the other configuration bit.

I had a vague recollection that in some places we used -Dvalgrind=true not
for valgrind support, but to enable additional cleanup under other sanitizers.
But that code would fail to build without the valgrind headers anyway, so
I'm not sure if that was still used. If there are uses like that, we can
extend the condition for cleanup_pools().

2 years agotest-set: drop left-over valgrind check
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2023 10:13:48 +0000 (11:13 +0100)] 
test-set: drop left-over valgrind check

In b01f31954f1c7c4601925173ae2638b572224e9a mempool_use_allowed
was dropped, but apparently it was forgotten here.

2 years agohwdb: fix swapped buttons for Logitech Lift left
Vít Zikmund [Wed, 22 Feb 2023 07:27:17 +0000 (08:27 +0100)] 
hwdb: fix swapped buttons for Logitech Lift left

2 years agotest: add another stress test for devlink creation
Yu Watanabe [Mon, 16 Jan 2023 02:00:04 +0000 (11:00 +0900)] 
test: add another stress test for devlink creation

2 years agotree-wide: fix typo
Yu Watanabe [Wed, 22 Feb 2023 05:46:19 +0000 (14:46 +0900)] 
tree-wide: fix typo

2 years agoMerge pull request #26203 from medhefgo/meson
Yu Watanabe [Wed, 22 Feb 2023 01:27:16 +0000 (10:27 +0900)] 
Merge pull request #26203 from medhefgo/meson

meson: Use dicts for test/fuzzer definitions

2 years agoMerge pull request #26529 from medhefgo/boot-misc
Yu Watanabe [Wed, 22 Feb 2023 01:16:23 +0000 (10:16 +0900)] 
Merge pull request #26529 from medhefgo/boot-misc

boot: Misc changes

2 years agoMerge pull request #26491 from dtardon/list-paths
Yu Watanabe [Wed, 22 Feb 2023 00:29:54 +0000 (09:29 +0900)] 
Merge pull request #26491 from dtardon/list-paths

Add systemctl list-paths

2 years agopo: Translated using Weblate (Lithuanian)
mooo [Tue, 21 Feb 2023 23:20:58 +0000 (00:20 +0100)] 
po: Translated using Weblate (Lithuanian)

Currently translated at 78.2% (151 of 193 strings)

Co-authored-by: mooo <hazap@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/lt/
Translation: systemd/main

2 years agoMerge pull request #26527 from mrc0mmand/more-tests
Yu Watanabe [Tue, 21 Feb 2023 23:01:07 +0000 (08:01 +0900)] 
Merge pull request #26527 from mrc0mmand/more-tests

test: provide coverage for #26467 and #26483

2 years agosocket-proxyd: support Type=notify
Дамјан Георгиевски [Wed, 1 Feb 2023 16:13:45 +0000 (17:13 +0100)] 
socket-proxyd: support Type=notify

update examples in the man page too

2 years agoMerge pull request #26349 from yuwata/safe-fork-rearrange-stdio
Luca Boccassi [Tue, 21 Feb 2023 22:58:52 +0000 (22:58 +0000)] 
Merge pull request #26349 from yuwata/safe-fork-rearrange-stdio

process-util: introduce FORK_REARRANGE_STDIO

2 years agopam-systemd: split up weight helper funcs
Lennart Poettering [Fri, 17 Feb 2023 21:48:50 +0000 (22:48 +0100)] 
pam-systemd: split up weight helper funcs

There are three conditionalizations in the status quo ante function,
which kinda indicates this should not be the same function in the first
place. Hence split this up, simplify it, and have two distinct functions
without conditionalizations.

2 years agojournal: move journal_file_compare_locations() from journal-file.c → sd-journal.c
Lennart Poettering [Wed, 8 Feb 2023 10:16:05 +0000 (11:16 +0100)] 
journal: move journal_file_compare_locations() from journal-file.c → sd-journal.c

It's only used from sd-journal.c, and we soon would like to pass in an
sd_journal object, hence let's move this over.

This only moves code, doesn't change behaviour

2 years agoboot: Drop _harder suffix 26529/head
Jan Janssen [Sat, 7 Jan 2023 10:06:33 +0000 (11:06 +0100)] 
boot: Drop _harder suffix

Since there is no use of gnu-efi functions anymore, we don't need to
distinguish them by name.

2 years agoboot: Do not use errno.h/inttypes.h
Jan Janssen [Sat, 7 Jan 2023 08:19:23 +0000 (09:19 +0100)] 
boot: Do not use errno.h/inttypes.h

These are provided by libc instead of the compiler and are not supposed
to be used in freestanding environments.
When cross-compiling with clang and the corresponding gcc
cross-toolchain is not around, clang may pick up the wrong header from
the host system.

2 years agofundamental: Drop some unnecessary ifdefs
Jan Janssen [Sat, 7 Jan 2023 08:14:41 +0000 (09:14 +0100)] 
fundamental: Drop some unnecessary ifdefs

With gnu-efi headers gone, we don't need these guards anymore.

2 years agoEnable TPM by default with SetCredentialEncrypted
Aidan Dang [Tue, 21 Feb 2023 13:02:31 +0000 (00:02 +1100)] 
Enable TPM by default with SetCredentialEncrypted

2 years agostub: Fix unaligned read
Jan Janssen [Tue, 21 Feb 2023 17:05:10 +0000 (18:05 +0100)] 
stub: Fix unaligned read

2 years agoMerge pull request #26446 from medhefgo/efi-headers
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2023 19:59:33 +0000 (20:59 +0100)] 
Merge pull request #26446 from medhefgo/efi-headers

boot: Provide our own EFI API headers

2 years agoefi: drop executable-stack bit from .elf file
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2023 08:16:29 +0000 (09:16 +0100)] 
efi: drop executable-stack bit from .elf file

An rpminspect test in Fedora/RHEL is flagging our stub files as having an
executable stack. The check is correct:

$ readelf --wide --program-headers build/src/boot/efi/linuxx64.elf.stub | rg -i stack
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10

It seems to be just an omission in the linker script… None of the objects that
are linked into the stub are marked as requiring an executable stack:

$ readelf --wide --sections build/src/boot/efi/*.c.o \
  /usr/lib/gnuefi/x64/libgnuefi.a \
  /usr/lib/gnuefi/x64/libefi.a \
  /usr/lib/gcc/x86_64-redhat-linux/12/libgcc.a \
  | rg '.note.GNU-stack.*X'
(nothing)

On aarch64 we end up with a nonexecutable stack, but on ia32 and x64 we get one,
so this might be just a matter of defaults in the linker. It doesn't matter
greatly, but let's mark the stack as non-executable to avoid the warning.

Note: '-Wl,-z' is not needed, things work with just '-z'.

2 years agologind-session: make stopping of idle session visible to admins
David Tardon [Tue, 21 Feb 2023 09:41:47 +0000 (10:41 +0100)] 
logind-session: make stopping of idle session visible to admins

2 years agosleep: check if we're on AC power before checking battery capacity
Mike Yuan [Mon, 20 Feb 2023 12:12:19 +0000 (20:12 +0800)] 
sleep: check if we're on AC power before checking battery capacity

Before this commit, battery_is_low() returns
true if there's no battery on the system.
It's now modified to check if the system is
on AC power first, and returns false early
if that's the case.

Fixes #26492

2 years agotest: add coverage for #26483 26527/head
Frantisek Sumsal [Tue, 21 Feb 2023 18:30:58 +0000 (19:30 +0100)] 
test: add coverage for #26483

2 years agotest: add coverage for #26467
Frantisek Sumsal [Tue, 21 Feb 2023 18:15:13 +0000 (19:15 +0100)] 
test: add coverage for #26467

2 years agoinstall: fail early if specifier expansion failed
David Tardon [Tue, 21 Feb 2023 13:10:33 +0000 (14:10 +0100)] 
install: fail early if specifier expansion failed

Before:

systemd[1]: Assertion 'path' failed at src/shared/install.c:288, function install_changes_add(). Aborting.
systemd[1]: Caught <ABRT> from our own process.
systemd[1]: Caught <ABRT>, dumped core as pid 2525.
systemd[1]: Freezing execution

After:

Failed to enable unit: Invalid specifier in user-%J.service

Fixes #26467.

Follow-up for: f5a0162

2 years agotest: add a minimal test for list-paths 26491/head
David Tardon [Mon, 20 Feb 2023 19:14:59 +0000 (20:14 +0100)] 
test: add a minimal test for list-paths

2 years agoshell-completion: add systemctl list-paths
David Tardon [Mon, 20 Feb 2023 19:11:57 +0000 (20:11 +0100)] 
shell-completion: add systemctl list-paths

2 years agoman: document systemctl list-paths
David Tardon [Mon, 20 Feb 2023 18:17:14 +0000 (19:17 +0100)] 
man: document systemctl list-paths

2 years agosystemctl: add list-paths verb
David Tardon [Fri, 17 Feb 2023 16:27:50 +0000 (17:27 +0100)] 
systemctl: add list-paths verb

Fixes #6054.

2 years agoMerge pull request #26518 from DaanDeMeyer/mkosi-stuff
Daan De Meyer [Tue, 21 Feb 2023 17:23:06 +0000 (18:23 +0100)] 
Merge pull request #26518 from DaanDeMeyer/mkosi-stuff

mkosi: Drop build script workarounds

2 years agobootctl: add new --print-root-device option
Lennart Poettering [Mon, 20 Feb 2023 16:25:14 +0000 (17:25 +0100)] 
bootctl: add new --print-root-device option

We already have this nice code in system that determines the block
device backing the root file system, but it's only used internally in
systemd-gpt-generator. Let's make this more accessible and expose it
directly in bootctl.

It doesn't fit immediately into the topic of bootctl, but I think it's
close enough and behaves very similar to the existing "bootctl
--print-boot-path" and "--print-esp-path" tools.

If --print-root-device (or -R) is specified once, will show the block device
backing the root fs, and if specified twice (probably easier: -RR) it
will show the whole block device that block device belongs to in case it
is a partition block device.

Suggested use:

        # cfdisk `bootctl -RR`

To get access to the partition table, behind the OS install, for
whatever it might be.

2 years agoMerge pull request #26265 from poettering/journal-refresh-fixes
Lennart Poettering [Tue, 21 Feb 2023 17:19:12 +0000 (18:19 +0100)] 
Merge pull request #26265 from poettering/journal-refresh-fixes

journal: journal file header IDs refresh fixes and corrections

2 years agosystemctl: prepend machine ID to unit ID in list-sockets
David Tardon [Mon, 20 Feb 2023 19:00:29 +0000 (20:00 +0100)] 
systemctl: prepend machine ID to unit ID in list-sockets

We do it that way in all other list-* functions, so let's be consistent.

2 years agosystemctl: extract common code to a function
David Tardon [Mon, 20 Feb 2023 18:58:36 +0000 (19:58 +0100)] 
systemctl: extract common code to a function

2 years agosystemctl: use table_add_triggered
David Tardon [Mon, 20 Feb 2023 18:39:25 +0000 (19:39 +0100)] 
systemctl: use table_add_triggered

2 years agosystemctl: extract code to a helper function
David Tardon [Mon, 20 Feb 2023 18:23:17 +0000 (19:23 +0100)] 
systemctl: extract code to a helper function

It will be used more in subsequent commits.

2 years agomkosi: Reduce postinst script indentation 26518/head
Daan De Meyer [Tue, 21 Feb 2023 14:23:15 +0000 (15:23 +0100)] 
mkosi: Reduce postinst script indentation

2 years agomkosi: Simplify BUILDDIR/SRCDIR handling a bit
Daan De Meyer [Tue, 21 Feb 2023 14:19:06 +0000 (15:19 +0100)] 
mkosi: Simplify BUILDDIR/SRCDIR handling a bit

2 years agomkosi: Move more logic to the postinst script
Daan De Meyer [Tue, 21 Feb 2023 14:09:38 +0000 (15:09 +0100)] 
mkosi: Move more logic to the postinst script

Let's move stuff that only applies to the final image to the
postinst script. Let's also move out some of the static files to
mkosi.extra/ instead of hardcoding them in scripts.

2 years agomeson: Use dicts for fuzzer definitions 26203/head
Jan Janssen [Wed, 25 Jan 2023 16:39:12 +0000 (17:39 +0100)] 
meson: Use dicts for fuzzer definitions

2 years agomeson: Add simple_fuzzers list
Jan Janssen [Fri, 27 Jan 2023 12:22:36 +0000 (13:22 +0100)] 
meson: Add simple_fuzzers list

2 years agomeson: Use dicts for test definitions
Jan Janssen [Wed, 25 Jan 2023 16:19:52 +0000 (17:19 +0100)] 
meson: Use dicts for test definitions

Although this slightly more verbose it makes it much easier to reason
about. The code that produces the tests heavily benefits from this.

Test lists are also now sorted by test name.

2 years agomeson: Add simple_tests list
Jan Janssen [Fri, 27 Jan 2023 11:57:35 +0000 (12:57 +0100)] 
meson: Add simple_tests list

A lot of tests can be defined by just their filename. Moving into their
own list keeps things simpler, especially with the next commit. It also
makes it easier to keep the lists sorted.

2 years agomkosi: Remove preset workaround
Daan De Meyer [Tue, 21 Feb 2023 13:57:29 +0000 (14:57 +0100)] 
mkosi: Remove preset workaround

A "disable *" preset is already shipped on debian so no need to add
one ourselves.

2 years agomkosi: Add more debugging
Daan De Meyer [Thu, 16 Feb 2023 09:23:01 +0000 (10:23 +0100)] 
mkosi: Add more debugging

2 years agoboot: Provide our own EFI API headers 26446/head
Jan Janssen [Fri, 6 Jan 2023 17:07:18 +0000 (18:07 +0100)] 
boot: Provide our own EFI API headers

We want to get away from gnu-efi and the only really usable source of
EFI headers would be EDK2, which is somewhat impractical to use and
quite large to require to be around just for some headers.

As a bonus point, the new headers are safe to be included in userspace
code.

This should not have any behavior changes as it is mostly changing
header includes. There are some renames to conform to standard names
and a few minor device path fixups as the struct is defined slightly
different.

Of note is that this removes usage of uchar.h and wchar.h as they are
not guaranteed to be available in a freestanding environment. Instead
efi.h will provide the needed types.

2 years agoboot: Query EFI var size before fetching them
Jan Janssen [Sat, 7 Jan 2023 10:17:29 +0000 (11:17 +0100)] 
boot: Query EFI var size before fetching them

2 years agoboot: Use C escape sequence for control chars
Jan Janssen [Fri, 6 Jan 2023 16:07:23 +0000 (17:07 +0100)] 
boot: Use C escape sequence for control chars

This makes things less magical by emphasizing that these are just
regular ascii/unicode chars.

2 years agoboot: Drop use of efigpt.h
Jan Janssen [Fri, 6 Jan 2023 15:50:05 +0000 (16:50 +0100)] 
boot: Drop use of efigpt.h

2 years agomkosi: Use 4 space indentation for scripts
Daan De Meyer [Tue, 21 Feb 2023 13:22:52 +0000 (14:22 +0100)] 
mkosi: Use 4 space indentation for scripts

mkosi scripts are shell scripts and for shell scripts we use 4 space
indentation.

2 years agotmpfiles.d: drop misleading comment
Zbigniew Jędrzejewski-Szmek [Mon, 20 Feb 2023 18:57:30 +0000 (19:57 +0100)] 
tmpfiles.d: drop misleading comment

I'm not sure what "suffix" was meant by this comment, but the file has the usual suffix.
The file was added with the current name back in c4708f132381e4bbc864d5241381b5cde4f54878.
Maybe an earlier version of the patch did something different.

2 years agohomectl: add missing break
Lennart Poettering [Fri, 17 Feb 2023 21:24:10 +0000 (22:24 +0100)] 
homectl: add missing break

2 years agomkosi: Drop opensuse workaround
Daan De Meyer [Tue, 21 Feb 2023 12:03:36 +0000 (13:03 +0100)] 
mkosi: Drop opensuse workaround

2 years agomkosi: Drop bootctl workaround in postinst script
Daan De Meyer [Tue, 21 Feb 2023 12:11:37 +0000 (13:11 +0100)] 
mkosi: Drop bootctl workaround in postinst script

2 years agomkosi: Drop locale workaround
Daan De Meyer [Tue, 21 Feb 2023 11:51:28 +0000 (12:51 +0100)] 
mkosi: Drop locale workaround

mkosi will always run all commands with the C.UTF-8 locale so we
don't need a workaround in the build script anymore.

2 years agomkosi: Drop ld workaround
Daan De Meyer [Tue, 21 Feb 2023 11:25:43 +0000 (12:25 +0100)] 
mkosi: Drop ld workaround

Build scripts will always run in an environment with /etc/ available
now, so we don't need this workaround anymore.

2 years agomkosi: Update to latest
Daan De Meyer [Tue, 21 Feb 2023 12:01:22 +0000 (13:01 +0100)] 
mkosi: Update to latest

2 years agocore/manager: falling back to execute generators without sandboxing
Yu Watanabe [Sat, 18 Feb 2023 17:42:52 +0000 (02:42 +0900)] 
core/manager: falling back to execute generators without sandboxing

When running in a container, like podman, docker or so, creating new mount
namespace may be disabled.

Fixes #26474.
Fixes RHBZ#2165004 (https://bugzilla.redhat.com/show_bug.cgi?id=2165004).

2 years agodocs: document the new HEADER_COMPATIBLE_TAIL_ENTRY_BOOT_ID flag 26265/head
Lennart Poettering [Tue, 31 Jan 2023 15:09:58 +0000 (16:09 +0100)] 
docs: document the new HEADER_COMPATIBLE_TAIL_ENTRY_BOOT_ID flag

2 years agojournal-file: drop checking if files are from the future at time of open
Lennart Poettering [Thu, 26 Jan 2023 16:24:15 +0000 (17:24 +0100)] 
journal-file: drop checking if files are from the future at time of open

We nowadays check for ordering anyway at time of writing entries, hence
we don't have to do that at moment of opening, too.

Benefit of dropping this check: we can safely archive files from the
future instead of marking them as broken.

2 years agojournal-file: allow opening journal files for write when machine ID is not initialized
Lennart Poettering [Wed, 1 Feb 2023 11:23:54 +0000 (12:23 +0100)] 
journal-file: allow opening journal files for write when machine ID is not initialized

We allow reading them, and we allow creating them, but we so far did not
allow opening existing ones for write – if the machine ID is not
initialized.

Let's fix that.

(This is just to fix an asymmetry. I have no immediate use for this. But
test code should in theory be able to use this, if it runs in an
incompletely initialized environment.)

2 years agojournal-file: lazily fill in machine ID into journal header, if needed
Lennart Poettering [Tue, 31 Jan 2023 12:37:12 +0000 (13:37 +0100)] 
journal-file: lazily fill in machine ID into journal header, if needed

Previously, if we ran in an environment where /etc/machine-id was
not defined, we'd never bother to write it ever again. So it would stay
at all zeroes till the end of times.

Let's make this more robust: whenever we try to append an entry, let's
try to refresh it from the status quo if not initialized yet. Moreover,
when copying records from a different journal file, let's propagate the
machine ID from there.

This should make things more robust and systematic, and match how we
propagate the boot ID and the seqnum ID to some level.

2 years agojournal-file: write machine ID when create the file, not when we open it for writing
Lennart Poettering [Thu, 26 Jan 2023 16:12:25 +0000 (17:12 +0100)] 
journal-file: write machine ID when create the file, not when we open it for writing

This doesn't actually change much, but makes the code less surprising.

Status quo ante:

1. Open a journal file
2. If newly created set header machine ID to zero
3. If existing and open for write check if machine ID in header matches
   local one, if not, refuse.
4. if open for writing, now refresh the machine ID from the local system

Of course, step 4 is pretty much pointless for existing files, as the
check in 3 made sure it is already in order or we'd refuse operating on
it anyway. With this patch this is simplified to:

1. Open a journal file
2. If newly created initialized machine ID to local machine ID
3. If existing, compare machine ID in header with local one, if not
   matching refuse.

Outcome is the same.

2 years agojournal-file: don't update boot_id in journal header on open
Lennart Poettering [Thu, 26 Jan 2023 15:49:36 +0000 (16:49 +0100)] 
journal-file: don't update boot_id in journal header on open

The header of the journal file contains a boot ID field that is
currently updated whenever we open the journal file. This is not ideal:
pretty often we want to archive a journal file, and need to open it for
that. Archiving a foreign journal file should not mark it as ours, it
should just change the status flag in the file header.

The boot ID in the header is aleady rewritten whenever we write a
journal entry to the file anyway, hence all this patch effectively does
is slightly "delay" when the boot ID in the header is updated: instead
of immediately on open it is updated on the first entry that is written.

Net effect: archived journal files don't all look like they were written
to on a boot newer then they actually were

And more importantly: the "tail_entry_monotonic" field suddenly becomes
useful, since we know which boot it belongs to. Generally, monotonic
timestamps without boot ID information are useless, and this fixes it.

A new (compatible) header flag marks file where the boot_id can be
understood this way. This can be used by code that wants to make use of
the "tail_entry_monotonic" field to ensure it actually can do so safely.

This also renames the structure definition in journal-def accordingly,
to indicate we now follow the stricter semantics for it.

2 years agoupdate TODO
Lennart Poettering [Tue, 21 Feb 2023 08:49:30 +0000 (09:49 +0100)] 
update TODO

2 years agotree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS 26349/head
Yu Watanabe [Tue, 7 Feb 2023 09:55:39 +0000 (18:55 +0900)] 
tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS

2 years agoprocess-util: rename FORK_NULL_STDIO -> FORK_REARRANGE_STDIO
Yu Watanabe [Tue, 7 Feb 2023 09:19:55 +0000 (18:19 +0900)] 
process-util: rename FORK_NULL_STDIO -> FORK_REARRANGE_STDIO

And make safe_fork_full() takes fds to be assigned to stdio.

2 years agoman: add DefaultStartupMemoryLow= as term in term list
Steve Ramage [Mon, 20 Feb 2023 21:49:29 +0000 (13:49 -0800)] 
man: add DefaultStartupMemoryLow= as term in term list

2 years agomeson: adjust whitespace handling in jinja2 rendering
Zbigniew Jędrzejewski-Szmek [Mon, 20 Feb 2023 14:07:44 +0000 (15:07 +0100)] 
meson: adjust whitespace handling in jinja2 rendering

In 6abe882bae1bb12827ef395c60f21ab8bb1bc61b the renderer was made to
unconditionally append a newline to output. This works, but is ugly. A nicer
solution is to tell jinja2 to not strip the newline in the first place, via
keep_trailing_newline=True. It seems that the result is unchanged because all
our source files have exactly one trailing newline.

Also, enable lstrip_blocks=True. This would cause whitespace on the line before
an {%if block to be automatically stripped. It seems reasonable to enable that
if trim_blocks=True.

Overall, no change is expected, though I didn't test combinations of
configurations, so there might be a change in some cases. But now the rules of
rendering are more logical, e.g. we should be able to indent nested conditional
statements without getting unexpected whitespace in the output.

2 years agoMerge pull request #26506 from keszybz/tiny-cleanups
Yu Watanabe [Mon, 20 Feb 2023 21:41:01 +0000 (06:41 +0900)] 
Merge pull request #26506 from keszybz/tiny-cleanups

Various trivial cleanups and follow-ups

2 years agoMerge pull request #26499 from mrc0mmand/assorted-tweaks
Yu Watanabe [Mon, 20 Feb 2023 20:55:37 +0000 (05:55 +0900)] 
Merge pull request #26499 from mrc0mmand/assorted-tweaks

A couple of test tweaks for recent CI fails

2 years agoukify: Set fast_load option when parsing PE files
Daan De Meyer [Mon, 20 Feb 2023 13:45:19 +0000 (14:45 +0100)] 
ukify: Set fast_load option when parsing PE files

Let's skip parsing of some irrelevant information that we don't use
to speed up building UKIs with large initrds from +-15s to less than
1s.

2 years agoMerge pull request #26508 from poettering/cap-fixes
Lennart Poettering [Mon, 20 Feb 2023 18:04:13 +0000 (19:04 +0100)] 
Merge pull request #26508 from poettering/cap-fixes

various fixes to capability handling

2 years agocapability-util: use UINT32_MAX as shortcut where appropriatea 26508/head
Lennart Poettering [Mon, 20 Feb 2023 15:26:46 +0000 (16:26 +0100)] 
capability-util: use UINT32_MAX as shortcut where appropriatea