]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agotest: validate that fdstore pinning works 27135/head
Lennart Poettering [Tue, 4 Apr 2023 09:41:55 +0000 (11:41 +0200)] 
test: validate that fdstore pinning works

2 years agopid1: add some debug logging when stashing ds into the fdstore
Lennart Poettering [Wed, 12 Apr 2023 19:07:29 +0000 (21:07 +0200)] 
pid1: add some debug logging when stashing ds into the fdstore

2 years agoservice: rename service_close_socket_fd() → service_release_socket_fd()
Lennart Poettering [Tue, 4 Apr 2023 13:51:07 +0000 (15:51 +0200)] 
service: rename service_close_socket_fd() → service_release_socket_fd()

Just to match service_release_stdio_fd() and service_release_fd_store()
in the name, since they do similar things.

This follows the concept that we "release" resources, and this is all
generically wrapped in "service_release_resources()".

2 years agocore: move runtime directory removal into release_resource handler
Lennart Poettering [Tue, 4 Apr 2023 11:42:08 +0000 (13:42 +0200)] 
core: move runtime directory removal into release_resource handler

We already clear the various fds we keep from the release_resources()
handler, let's also destroy the runtime dir from there if this
preservation mode is selected.

This makes a minor semantic change: previously we'd keep a runtime
directory around if RuntimeDirectoryPreserve=restart is selected and at
least one JOB_START job was around. With this logic we'll keep it around
a tiny bit longer: as long as any job for the unit is around.

2 years agoservice: close fdstore asynchronously
Lennart Poettering [Tue, 4 Apr 2023 10:17:16 +0000 (12:17 +0200)] 
service: close fdstore asynchronously

The file descriptors we keep in the fdstore might be basically anything,
let's clean it up with our asynchronous closing feature, to not
deadlock on close().

(Let's also do the same for stdin/stdout/stderr fds, since they might
point to network services these days.)

2 years agoservice: allow freeing the fdstore via cleaning
Lennart Poettering [Wed, 29 Mar 2023 20:10:01 +0000 (22:10 +0200)] 
service: allow freeing the fdstore via cleaning

Now that we have a potentially pinned fdstore let's add a concept for
cleaning it explicitly on user requested. Let's expose this via
"systemctl clean", i.e. the same way as user directories are cleaned.

2 years agoservice: add ability to pin fd store
Lennart Poettering [Wed, 29 Mar 2023 20:07:22 +0000 (22:07 +0200)] 
service: add ability to pin fd store

Oftentimes it is useful to allow the per-service fd store to survive
longer than for a restart. This is useful in various scenarios:

1. An fd to some security relevant object needs to be stashed somewhere,
   that should not be cleaned automatically, because the security
   enforcement would be dropped then.

2. A user namespace fd should be allocated on first invocation and be
   kept around until the user logs out (i.e. systemd --user ends), á la
   #16328 (This does not implement what #16318 asks for, but should
   solve the use-case discussed there.)

3. There's interest in allow a concept of "userspace reboots" where the
   kernel stays running, and userspace is swapped out (i.e. all services
   exit, and the rootfs transitioned into a new version of it) while
   keeping some select resources pinned, very similar to how we
   implement a switch root. Thus it is useful to allow services to exit,
   while leaving their fds around till the very end.

This is exposed through a new FileDescriptorStorePreserve= setting that
is closely modelled after RuntimeDirectoryPreserve= (in fact it reused
the same internal type), since we want similar behaviour in the end, and
quite often they probably want to be used together.

2 years agoservice: rework how we release resources
Lennart Poettering [Wed, 29 Mar 2023 20:06:39 +0000 (22:06 +0200)] 
service: rework how we release resources

Let's normalize how we release service resources, i.e. the three types
of fds we maintain for each service:

1. the fdstore
2. the socket fd for per-connection socket activated services
3. stdin/stdout/stderr

The generic service_release_resources() hook now calls into
service_release_fd_store() + service_close_socket_fd()
service_release_stdio_fd() one after the other, releasing them all for
the generic "release_resources" infra of the unit lifecycle.

We do no longer close the socket fd from service_set_state(), moving
this exclusively into service_release_resources(), so that all fds are
closed the same way.

2 years agoservice: release resources from a seperate queue, not unit_check_gc()
Lennart Poettering [Wed, 29 Mar 2023 19:52:41 +0000 (21:52 +0200)] 
service: release resources from a seperate queue, not unit_check_gc()

The per-unit-type release_resources() hook (most prominent use: to
release a service unit's fdstore once a unit is entirely dead and has no
jobs more) was currently invoked as part of unit_check_gc(), whose
primary purpose is to determine if a unit should be GC'ed. This was
always a bit ugly, as release_resources() changes state of the unit,
while unit_check_gc() is otherwise (and was before release_resources()
was added) a "passive" function that just checks for a couple of
conditions.

unit_check_gc() is called at various places, including when we wonder if
we should add a unit to the gc queue, and then again when we take it out
of the gc queue to dtermine whether to really gc it now. The fact that
these checks have side effects so far wasn't too problematic, as the
state changes (primarily: that services would empty their fdstores) were
relatively limited and scope.

A later patch in this series is supposed to extend the service state
engine with a separate state distinct from SERVICE_DEAD that is very
much like it but indicates that the service still has active resources
(specifically the fdstore). For cases like that the releasing of the
fdstore would result in state changes (as we'd then return to a classic
SERVICE_DEAD state).  And this is where the fact that the
release_resources() is called as side-effect becomes problematic: it
would mean that unit state changes would instantly propagate to state
changes elsewhere, though we usually want this to be done through the
run queue for coalescing and avoidance of recursion.

Hence, let's clean this up: let's move the release_resources() logic
into a queue of its own, and then enqueue items into it from the general
state change notification handle in unit_notify().

2 years agocore: fix property getter method for NFileDescriptorStore bus property
Lennart Poettering [Wed, 12 Apr 2023 18:51:23 +0000 (20:51 +0200)] 
core: fix property getter method for NFileDescriptorStore bus property

Since da6053d0a7c16795e7fac1f9ba6694863918a597 this is a size_t, not an
unsigned. The difference doesn't matter on LE archs, but it matters on
BE (i.e. s390x), since we'll return entirely nonsensical data.

Let's fix that.

Follow-up-for: da6053d0a7c16795e7fac1f9ba6694863918a597

An embarassing bug introduced in 2018... That made me scratch my head
for way too long, as it made #27135 fail on s390x while it passed
everywhere else.

2 years agoFix cross-reference of manual for LogsDirectory
Franklin Yu [Thu, 13 Apr 2023 00:29:43 +0000 (17:29 -0700)] 
Fix cross-reference of manual for LogsDirectory

2 years agopid1: fix coredump_filter setting
David Schroeder [Wed, 12 Apr 2023 23:48:21 +0000 (16:48 -0700)] 
pid1: fix coredump_filter setting

Correct what appears to be a copy/paste error in config_parse_exec_coredump_filter that is preventing the coredump_filter setting from working correctly.

2 years agoman: add util-linux to the package list for Fedora container
Michal Sekletar [Wed, 12 Apr 2023 16:58:21 +0000 (18:58 +0200)] 
man: add util-linux to the package list for Fedora container

/bin/login is shipped in util-linux, however, systemd.spec on Fedora has
"Requires: (util-linux-core or util-linux)". If the dependency is
fulfilled just by installation of util-linux-core then users won't be
able to log in into the container after it boots. Let's add util-linux
package to the package list so that /bin/login is always present.

2 years agoMerge pull request #27153 from poettering/varlin-fd-pass
Lennart Poettering [Wed, 12 Apr 2023 18:34:01 +0000 (20:34 +0200)] 
Merge pull request #27153 from poettering/varlin-fd-pass

varlink: implement file descriptor passing

2 years agoMerge pull request #27212 from DaanDeMeyer/notify-exit
Mike Yuan [Wed, 12 Apr 2023 17:12:03 +0000 (01:12 +0800)] 
Merge pull request #27212 from DaanDeMeyer/notify-exit

core: Propagate exit status via notify socket when running in VM

2 years agoMerge pull request #27229 from poettering/dissect-policy-confext
Mike Yuan [Wed, 12 Apr 2023 16:14:30 +0000 (00:14 +0800)] 
Merge pull request #27229 from poettering/dissect-policy-confext

dissect: follow-up for image policy merge

2 years agoman: link to Fedora 37
Zbigniew Jędrzejewski-Szmek [Wed, 12 Apr 2023 16:00:49 +0000 (18:00 +0200)] 
man: link to Fedora 37

Fedora 36 is a bit old at this point and will be EOL in about 6 weeks.
Fedora 38 is not out yet, so the cloud link wouldn't work.

2 years agoMerge pull request #27217 from yuwata/boot-entry-at
Yu Watanabe [Wed, 12 Apr 2023 13:59:54 +0000 (22:59 +0900)] 
Merge pull request #27217 from yuwata/boot-entry-at

boot-entry: introduce _at() variant

2 years agovarlink: honour "sensitive" flag of json variant objects all the way into the socket 27153/head
Lennart Poettering [Wed, 12 Apr 2023 09:21:01 +0000 (11:21 +0200)] 
varlink: honour "sensitive" flag of json variant objects all the way into the socket

Let's honour the flag if it is set, just to be safe.

(This only handles the case for the writing side: whenever the client
code hands us a json object with the flag set we'll honour it till the
it's out of reach for us. This does *not* handle the reading side, which
is left for a later patch once needed. We probably should add a
per-connection flag that simply globally enables the sensitive logic for
all messages coming in on a specific varlink conneciton.)

2 years agotest: add varlink fd passing test
Lennart Poettering [Wed, 5 Apr 2023 13:54:52 +0000 (15:54 +0200)] 
test: add varlink fd passing test

2 years agovarlink: implement file descriptor passing
Lennart Poettering [Wed, 5 Apr 2023 14:03:38 +0000 (16:03 +0200)] 
varlink: implement file descriptor passing

Let's add infrastructure to implement fd passing in varlink, when used
over AF_UNIX.

This will optionally associate one or more fds with a message sent via
varlink and deliver it to the server.

2 years agovarlink: add helper that clears the currently processed incoming message JSON object
Lennart Poettering [Wed, 5 Apr 2023 14:08:15 +0000 (16:08 +0200)] 
varlink: add helper that clears the currently processed incoming message JSON object

Some minor refactoring. This adds a helper call whose only job is to
unref the JSON object of the currently processed incoming message.

This doesn't make too much sense on its own, given this just replaces
one line by another. However, in a later patch when we'll add fd passing
we'll extend the function to also destroy associated fds, and then it
will start to make more sense.

2 years agovarlink: get rid of "reply" field
Lennart Poettering [Wed, 5 Apr 2023 13:57:44 +0000 (15:57 +0200)] 
varlink: get rid of "reply" field

So far, if we do a synchronous varlink call from the client side via
varlink_call(), we'll
move the returned json object from "v->current" into "v->reply", and
keep it referenced there until the next call. We then return a pointer
to it. This ensures that the json object remains valid between two
varlink_call() invocations.

But the thing is, we don't need a separate field for that, we can just
leave the data in "v->current". This means VARLINK_IDLE_CLIENT state
will be permitted with and without v->current initialized. Initially,
after connection setup it will be set to NULL, but after the first
varlink_call() it will be set to the most recent response, pinning it
into memory.

2 years agovarlink: add some comments explaining what by various errors are defined
Lennart Poettering [Wed, 5 Apr 2023 13:53:55 +0000 (15:53 +0200)] 
varlink: add some comments explaining what by various errors are defined

2 years agocore: Send ERRNO= via notify socket on exit 27212/head
Daan De Meyer [Wed, 12 Apr 2023 10:08:27 +0000 (12:08 +0200)] 
core: Send ERRNO= via notify socket on exit

2 years agocore: Propagate exit status via notify socket when running in VM
Daan De Meyer [Tue, 11 Apr 2023 11:17:13 +0000 (13:17 +0200)] 
core: Propagate exit status via notify socket when running in VM

When running in a container, we can propagate the exit status of
pid1 as usual via the process exit status. This is not possible
when running in a VM. Instead, let's send EXIT_STATUS=%i via the
notify socket if one is configured. The user running the VM can then
pick up the exit status from the notify socket after the VM has shut
down.

2 years agonotify: Add EXIT_STATUS field
Daan De Meyer [Wed, 12 Apr 2023 09:56:00 +0000 (11:56 +0200)] 
notify: Add EXIT_STATUS field

Whenever one of our tools or daemons exits, let's send the exit status
via sd-notify in the EXIT_STATUS field.

2 years agosysext: define a default image dissection policy for confext images 27229/head
Lennart Poettering [Wed, 12 Apr 2023 12:27:20 +0000 (14:27 +0200)] 
sysext: define a default image dissection policy for confext images

2 years agodiscover-image: bring discover path list up-to-date.
Lennart Poettering [Wed, 12 Apr 2023 12:26:56 +0000 (14:26 +0200)] 
discover-image: bring discover path list up-to-date.

While merge 3af48a86d99b3117a44bc22258ab4d34d0ba7655 was for a working
PR it was based on an older version of git main. Let's catch up with the
search path changes from de862276eddbbe76b436213b4d427205356d1886.

2 years agoFix compilation error
Daan De Meyer [Wed, 12 Apr 2023 12:11:23 +0000 (14:11 +0200)] 
Fix compilation error

2 years agonspawn: container network interface naming
Thierry Martin [Mon, 5 Sep 2022 13:02:06 +0000 (15:02 +0200)] 
nspawn: container network interface naming

systemd-nspawn now optionally supports colon-separated pair of
host interface name and container interface name for --network-macvlan, --network-ipvlan and --network-interface options.
Also supported in .nspawn configuration files (i.e Interface=, MACVLAN=, IPVLAN= parameters).

man page changed for ntwk interface naming

2 years agoMerge pull request #25608 from poettering/dissect-moar
Lennart Poettering [Wed, 12 Apr 2023 11:46:08 +0000 (13:46 +0200)] 
Merge pull request #25608 from poettering/dissect-moar

dissect: add dissection policies

2 years agoMerge pull request #27165 from poettering/fdstore-envvar
Luca Boccassi [Wed, 12 Apr 2023 11:13:43 +0000 (12:13 +0100)] 
Merge pull request #27165 from poettering/fdstore-envvar

service: tell service processes that the fdstore is available via an e…

2 years agoboot-entry: introduce boot_entry_token_ensure_at() 27217/head
Yu Watanabe [Sat, 8 Apr 2023 17:42:47 +0000 (02:42 +0900)] 
boot-entry: introduce boot_entry_token_ensure_at()

2 years agoMerge pull request #27223 from dtardon/install-changes
Yu Watanabe [Wed, 12 Apr 2023 10:30:51 +0000 (19:30 +0900)] 
Merge pull request #27223 from dtardon/install-changes

Simplify use of bus_deserialize_and_dump_unit_file_changes()

2 years agoMerge pull request #27220 from yuwata/sd-device-follow-ups-for-devlink
Daan De Meyer [Wed, 12 Apr 2023 09:49:08 +0000 (11:49 +0200)] 
Merge pull request #27220 from yuwata/sd-device-follow-ups-for-devlink

sd-device: several follow-ups about devlink creation

2 years agoman: rebreak all of sd_notify(3) 27165/head
Lennart Poettering [Wed, 12 Apr 2023 08:29:14 +0000 (10:29 +0200)] 
man: rebreak all of sd_notify(3)

No change of contents, just some rebreaking of the full file to match
our current line break settings.

2 years agoservice: tell service processes that the fdstore is available via an env var
Lennart Poettering [Wed, 5 Apr 2023 13:48:31 +0000 (15:48 +0200)] 
service: tell service processes that the fdstore is available via an env var

2 years agosystemctl: reduce variable scope 27223/head
David Tardon [Tue, 11 Apr 2023 15:35:38 +0000 (17:35 +0200)] 
systemctl: reduce variable scope

2 years agotree-wide: drop unneeded output params
David Tardon [Tue, 11 Apr 2023 15:25:42 +0000 (17:25 +0200)] 
tree-wide: drop unneeded output params

Neither of the callers of bus_deserialize_and_dump_unit_file_changes()
touches the changes array, so let's simplify things and keep it internal
to the function.

2 years agoMerge pull request #27033 from dtardon/array-cleanup
Yu Watanabe [Wed, 12 Apr 2023 07:43:39 +0000 (16:43 +0900)] 
Merge pull request #27033 from dtardon/array-cleanup

Use CLEANUP_ARRAY more

2 years agoboot-entry: use chase_and_fopen_unlocked() to open /etc/kernel/entry-token
Yu Watanabe [Wed, 12 Apr 2023 07:15:03 +0000 (16:15 +0900)] 
boot-entry: use chase_and_fopen_unlocked() to open /etc/kernel/entry-token

Otherwise, when 'root' is specified, the file may be a symlink to a host
file, and we may read wrong entry.

2 years agoudev-test: add more testcases for SYMLINK 27220/head
Yu Watanabe [Wed, 12 Apr 2023 01:27:07 +0000 (10:27 +0900)] 
udev-test: add more testcases for SYMLINK

2 years agotest: drop binary stripping stuff
Frantisek Sumsal [Tue, 11 Apr 2023 15:23:23 +0000 (17:23 +0200)] 
test: drop binary stripping stuff

Stripping the binaries in the test images makes potential stack straces
quite useless, so let's drop the stripping stuff to make test fails a bit
more developer friendly.

Related: https://github.com/systemd/systemd-centos-ci/pull/616

2 years agosd-device: absolute devlink must start with /dev/
Yu Watanabe [Wed, 12 Apr 2023 00:01:45 +0000 (09:01 +0900)] 
sd-device: absolute devlink must start with /dev/

This also makes device node path is handled with the same logic.

Addresses https://github.com/systemd/systemd/pull/27169#discussion_r1162739511.

Follow-up for 2c5f119c3cc78bd7da0c7c56b57eca43bac464c1.

2 years agoboot-entry: prioritize machine ID only when it is not randomly generated
Yu Watanabe [Wed, 29 Mar 2023 02:14:02 +0000 (11:14 +0900)] 
boot-entry: prioritize machine ID only when it is not randomly generated

Preparation for later commits. The parameter will be used in
kernel-install later.

2 years agoMerge pull request #27214 from DaanDeMeyer/firstboot
Daan De Meyer [Tue, 11 Apr 2023 20:30:09 +0000 (22:30 +0200)] 
Merge pull request #27214 from DaanDeMeyer/firstboot

firstboot: Use root directory file descriptor for everything

2 years agoModified to use STRV_MAKE() in strv_env_name_is_valid() function listed in env-util.c
Tanishka [Tue, 4 Apr 2023 13:00:31 +0000 (18:30 +0530)] 
Modified to use STRV_MAKE() in strv_env_name_is_valid() function listed in env-util.c

2 years agoMerge pull request #27209 from jamacku/patch-1
Zbigniew Jędrzejewski-Szmek [Tue, 11 Apr 2023 18:44:48 +0000 (20:44 +0200)] 
Merge pull request #27209 from jamacku/patch-1

Don't run release workflow on `systemd-security` & drop checkout action

2 years agosystemctl: suppress error for try-* if unit is masked
Mike Yuan [Tue, 4 Apr 2023 14:12:32 +0000 (22:12 +0800)] 
systemctl: suppress error for try-* if unit is masked

Closes #16521

2 years agoboot: Fix alignment of long long inside structs on x86
Jan Janssen [Mon, 10 Apr 2023 09:43:56 +0000 (11:43 +0200)] 
boot: Fix alignment of long long inside structs on x86

On x86 EFI follows the windows ABI, which expects 8-byte aligned long
long. The x86 sysv ELF ABI expects them to be 8-byte aligned when used
alone, but 4-byte aligned when they appear inside of structs:

    struct S {
        int i;
        long long ll;
    };

    // _Static_assert(sizeof(struct S) == 12, "x86 sysv ABI");
    _Static_assert(sizeof(struct S) == 16, "EFI/MS ABI");

To get the behavior we need when building with sysv ELF ABI we need to
pass '-malign-double' to the compiler as done by EDK2.

This in turn will make ubsan unhappy as the stack may not be properly
aligned on entry, so we have to tell the compiler explicitly to re-align
the stack on entry to efi_main.

This fixes loading EFI drivers on x86 that were previously always
rejected as the EFI_LOADED_IMAGE_PROTOCOL had a wrong memory layout.

See also: https://github.com/rhboot/shim/pull/516

2 years agoci: drop checkout from release workflow 27209/head
Jan Macku [Tue, 11 Apr 2023 07:33:46 +0000 (09:33 +0200)] 
ci: drop checkout from release workflow

It's not required as per comment - https://github.com/systemd/systemd/pull/27110#issuecomment-1499653913

2 years agoci: don't run release wf on `systemd-security`
Jan Macku [Tue, 11 Apr 2023 07:30:15 +0000 (09:30 +0200)] 
ci: don't run release wf on `systemd-security`

2 years agoportabled-image-bus: use CLEANUP_ARRAY 27033/head
David Tardon [Tue, 28 Mar 2023 11:44:16 +0000 (13:44 +0200)] 
portabled-image-bus: use CLEANUP_ARRAY

2 years agoportabled-image-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:39:04 +0000 (13:39 +0200)] 
portabled-image-bus: use CLEANUP_ARRAY

2 years agoportabled-image-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:38:18 +0000 (13:38 +0200)] 
portabled-image-bus: use CLEANUP_ARRAY

2 years agoportabled-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:33:48 +0000 (13:33 +0200)] 
portabled-bus: use CLEANUP_ARRAY

2 years agosd-bus: use _cleanup_
David Tardon [Tue, 28 Mar 2023 11:30:26 +0000 (13:30 +0200)] 
sd-bus: use _cleanup_

2 years agosd-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:27:02 +0000 (13:27 +0200)] 
sd-bus: use CLEANUP_ARRAY

2 years agoexecute: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:28:13 +0000 (11:28 +0200)] 
execute: use CLEANUP_ARRAY

2 years agoexecute: use more automatic cleanup
David Tardon [Tue, 28 Mar 2023 09:22:35 +0000 (11:22 +0200)] 
execute: use more automatic cleanup

2 years agohwdb: add matrix for Asus BR1100F (#27197)
Bill Peterson [Tue, 11 Apr 2023 14:11:16 +0000 (09:11 -0500)] 
hwdb: add matrix for Asus BR1100F (#27197)

2 years agoexecute: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:17:09 +0000 (11:17 +0200)] 
execute: use CLEANUP_ARRAY

2 years agosystemctl-set-default: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:05:06 +0000 (11:05 +0200)] 
systemctl-set-default: use CLEANUP_ARRAY

2 years agosystemctl-preset-all: shorten code a tiny bit
David Tardon [Tue, 28 Mar 2023 09:03:13 +0000 (11:03 +0200)] 
systemctl-preset-all: shorten code a tiny bit

2 years agosystemctl-preset-all: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:02:38 +0000 (11:02 +0200)] 
systemctl-preset-all: use CLEANUP_ARRAY

2 years agosystemctl-enable: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:00:23 +0000 (11:00 +0200)] 
systemctl-enable: use CLEANUP_ARRAY

2 years agosystemctl-add-dependency: shorten code a tiny bit
David Tardon [Tue, 28 Mar 2023 08:57:02 +0000 (10:57 +0200)] 
systemctl-add-dependency: shorten code a tiny bit

2 years agosystemctl-add-dependency: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 08:51:29 +0000 (10:51 +0200)] 
systemctl-add-dependency: use CLEANUP_ARRAY

2 years agoportablectl: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 08:46:20 +0000 (10:46 +0200)] 
portablectl: use CLEANUP_ARRAY

2 years agomachinectl: do not repeat the same comparison
David Tardon [Thu, 30 Mar 2023 10:49:15 +0000 (12:49 +0200)] 
machinectl: do not repeat the same comparison

2 years agomachinectl: drop unneeded else
David Tardon [Thu, 30 Mar 2023 10:38:24 +0000 (12:38 +0200)] 
machinectl: drop unneeded else

2 years agomachinectl: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 08:44:46 +0000 (10:44 +0200)] 
machinectl: use CLEANUP_ARRAY

2 years agodbus-manager: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 08:39:33 +0000 (10:39 +0200)] 
dbus-manager: use CLEANUP_ARRAY

2 years agofirstboot: Use root directory file descriptor for everything 27214/head
Daan De Meyer [Tue, 11 Apr 2023 13:22:08 +0000 (15:22 +0200)] 
firstboot: Use root directory file descriptor for everything

There were a few remaining cases where we used arg_root instead of
the root directory file descriptor. Let's port those over to use the
root directory file descriptor as well.

2 years agouser-util: Add default_root_shell_at()
Daan De Meyer [Tue, 11 Apr 2023 13:21:51 +0000 (15:21 +0200)] 
user-util: Add default_root_shell_at()

2 years agodbus-manager: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 08:37:33 +0000 (10:37 +0200)] 
dbus-manager: use CLEANUP_ARRAY

2 years agoMerge pull request #27186 from yuwata/os-release
Daan De Meyer [Tue, 11 Apr 2023 12:54:56 +0000 (14:54 +0200)] 
Merge pull request #27186 from yuwata/os-release

os-util: several cleanups and introduce _at() variants of os-release parsers

2 years agoMerge pull request #27169 from yuwata/udev-rule-refuse-unsafe-path
Zbigniew Jędrzejewski-Szmek [Tue, 11 Apr 2023 12:43:50 +0000 (14:43 +0200)] 
Merge pull request #27169 from yuwata/udev-rule-refuse-unsafe-path

sd-device,udev: refuse unsafe path in SYMLINK= and TAG=

2 years agohwdb: fix ambiguous glob pattern for Lenovo machines
Yu Watanabe [Tue, 11 Apr 2023 10:20:49 +0000 (19:20 +0900)] 
hwdb: fix ambiguous glob pattern for Lenovo machines

Fixes #27195.

Follow-up for a5c0ad9a9a2964079a19a1db42f79570a3582bee.

2 years agoos-util: introduce several _at() variants of os-release parsers 27186/head
Yu Watanabe [Sat, 8 Apr 2023 09:48:57 +0000 (18:48 +0900)] 
os-util: introduce several _at() variants of os-release parsers

2 years agoos-util: make $SYSTEMD_OS_RELEASE prefixed with the root directory
Yu Watanabe [Sat, 8 Apr 2023 13:33:40 +0000 (22:33 +0900)] 
os-util: make $SYSTEMD_OS_RELEASE prefixed with the root directory

To make it consistent with other env vars, e.g. $SYSTEMD_ESP_PATH or
$SYSTEMD_XBOOTLDR_PATH.

This is useful when the root is specified by a file descriptor, instead
of a path.

2 years agoos-util: merge parse_{extension,os}_release()
Yu Watanabe [Sat, 8 Apr 2023 09:16:04 +0000 (18:16 +0900)] 
os-util: merge parse_{extension,os}_release()

2 years agoos-util: invert order of arguments in extension release parser
Yu Watanabe [Sat, 8 Apr 2023 13:10:25 +0000 (22:10 +0900)] 
os-util: invert order of arguments in extension release parser

For consistency with other functions.
Unfortunately, va_start() requires that the previous argument is a
pointer, hence the order of the arguments in the internal function
cannot be changed.

2 years agoos-util: shorten temporal variable names
Yu Watanabe [Sat, 8 Apr 2023 16:38:34 +0000 (01:38 +0900)] 
os-util: shorten temporal variable names

No functional change, just refactoring.

2 years agoos-util: log one more error cause
Yu Watanabe [Sat, 8 Apr 2023 16:37:16 +0000 (01:37 +0900)] 
os-util: log one more error cause

2 years agoos-util: do not use 'r' for storing loop status
Yu Watanabe [Sat, 8 Apr 2023 16:31:29 +0000 (01:31 +0900)] 
os-util: do not use 'r' for storing loop status

The variable 'r' is usually used for storing return value of functional
call. Let's introduce another boolean to store the current loop status.

No functional change, just refactoring.

2 years agoos-util: return earlier when unsupported image class is specified
Yu Watanabe [Sat, 8 Apr 2023 16:16:26 +0000 (01:16 +0900)] 
os-util: return earlier when unsupported image class is specified

2 years agoos-util: return earlier when extension release file is found
Yu Watanabe [Sat, 8 Apr 2023 16:09:09 +0000 (01:09 +0900)] 
os-util: return earlier when extension release file is found

No functional change, just refactoring.

2 years agoos-util: split-out open_os_release() from open_extension_release()
Yu Watanabe [Sat, 8 Apr 2023 16:02:13 +0000 (01:02 +0900)] 
os-util: split-out open_os_release() from open_extension_release()

The logics of opening os-release and extension-release are completely
different.
No functional change, just refactoring.

2 years agoos-util: fix fd leak on failure
Yu Watanabe [Sat, 8 Apr 2023 16:11:52 +0000 (01:11 +0900)] 
os-util: fix fd leak on failure

2 years agoos-util: make open_extension_release() return O_PATH fd
Yu Watanabe [Sat, 8 Apr 2023 09:00:31 +0000 (18:00 +0900)] 
os-util: make open_extension_release() return O_PATH fd

2 years agoos-util: drop fopen_extension_release()
Yu Watanabe [Sat, 8 Apr 2023 08:15:09 +0000 (17:15 +0900)] 
os-util: drop fopen_extension_release()

2 years agocompress: replace compress_blob() with compress_blob_explicit()
Yu Watanabe [Sat, 8 Apr 2023 06:15:25 +0000 (15:15 +0900)] 
compress: replace compress_blob() with compress_blob_explicit()

And make compress_xyz() return 0 on success, as we know which compression
algorithm is used when calling compress_blob().

Follow-up for 2360352ef02548723ac0c8eaf5ff6905eb9eeca5.

2 years agoMerge pull request #27206 from yuwata/udev-rename
Daan De Meyer [Tue, 11 Apr 2023 07:12:21 +0000 (09:12 +0200)] 
Merge pull request #27206 from yuwata/udev-rename

udev: rename arguments and options, update comments

2 years agochase: drop redundant call of delete_trailing_chars()
Yu Watanabe [Mon, 10 Apr 2023 19:50:32 +0000 (04:50 +0900)] 
chase: drop redundant call of delete_trailing_chars()

In that branch, 'root' is a non-root and absolute path.
Hence, delete_trailing_chars() does not make the path empty.
And, if the path contains redundant slashes at the end, that will be
dropped by path_simplify().

2 years agoMerge pull request #27207 from masatake/busctl--help-msg
Yu Watanabe [Tue, 11 Apr 2023 05:42:27 +0000 (14:42 +0900)] 
Merge pull request #27207 from masatake/busctl--help-msg

busctl: add --xml-interface to the help message

2 years agoMerge pull request #27201 from yuwata/o-path-support
Yu Watanabe [Tue, 11 Apr 2023 03:37:37 +0000 (12:37 +0900)] 
Merge pull request #27201 from yuwata/o-path-support

Support O_PATH more

2 years agotree-wide: A few more uses of "unmet" for conditions
Colin Walters [Mon, 10 Apr 2023 20:22:25 +0000 (16:22 -0400)] 
tree-wide: A few more uses of "unmet" for conditions

This is a followup to
413e8650b71d4404a7453403797f93d73d88c466
> tree-wide: Use "unmet" for condition checks, not "failed"

Since I noticed when running `systemctl status` on a recent
systemd still seeing
`Condition: start condition failed`

To recap the original rationale here for "unmet" is that it's
normal for some units to be conditional, so the term "failure"
here is too strong.

2 years agoMerge pull request #27199 from yuwata/find-esp
Yu Watanabe [Tue, 11 Apr 2023 03:36:13 +0000 (12:36 +0900)] 
Merge pull request #27199 from yuwata/find-esp

path-util: introduce path_prefix_root_cwd(), and use it in find_esp() and friends