]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
16 months agocore/service: fix accept-socket deserialization 33374/head
Mike Yuan [Mon, 17 Jun 2024 05:47:20 +0000 (07:47 +0200)] 
core/service: fix accept-socket deserialization

Follow-up for 45b1017488cef2a5bacdf82028ce900a311c9a1c

16 months agocore: cast ignored retval of deserialize_* to void
Mike Yuan [Mon, 17 Jun 2024 05:21:43 +0000 (07:21 +0200)] 
core: cast ignored retval of deserialize_* to void

Fixes CID#1547098

16 months agocore/socket: use FOREACH_ARRAY at one more place
Mike Yuan [Mon, 17 Jun 2024 14:39:59 +0000 (16:39 +0200)] 
core/socket: use FOREACH_ARRAY at one more place

16 months agohwdb: add support for AIPTEK Media Tablet Ultimate (#33371)
reDBo0n [Mon, 17 Jun 2024 14:05:23 +0000 (16:05 +0200)] 
hwdb: add support for AIPTEK Media Tablet Ultimate (#33371)

The "AIPTEK Media Tablet Ultimate", detected as "Waltop International Corp. Batteryless Tablet",
is missing the resolution of the x-/y-axes.

Adding a new rule to 60-evdev.hwdb with the same values as another entry
"WALTOP International Corp. Batteryless Tablet" just with another matching string makes the
device usable.

Fixes #33362.

16 months agoMerge pull request #33355 from YHNdnzj/shutdown-cad
Luca Boccassi [Mon, 17 Jun 2024 08:19:08 +0000 (09:19 +0100)] 
Merge pull request #33355 from YHNdnzj/shutdown-cad

shutdown: re-enable CAD handling in kernel at start, several other cleanups

16 months agoMerge pull request #33363 from YHNdnzj/service-serialization-cleanup
Luca Boccassi [Sun, 16 Jun 2024 22:01:35 +0000 (23:01 +0100)] 
Merge pull request #33363 from YHNdnzj/service-serialization-cleanup

core/service: several cleanups for serialization logic

16 months agoMerge pull request #33364 from YHNdnzj/utf8-modernization
Luca Boccassi [Sun, 16 Jun 2024 21:33:08 +0000 (22:33 +0100)] 
Merge pull request #33364 from YHNdnzj/utf8-modernization

basic/utf8: some modernizations

16 months agostring-util: introduce string_is_safe_ascii helper 33364/head
Mike Yuan [Thu, 9 May 2024 14:01:07 +0000 (22:01 +0800)] 
string-util: introduce string_is_safe_ascii helper

16 months agobasic/utf8: modernize ascii_is_valid_n, make ascii_is_valid static inline
Mike Yuan [Thu, 9 May 2024 13:58:36 +0000 (21:58 +0800)] 
basic/utf8: modernize ascii_is_valid_n, make ascii_is_valid static inline

16 months agobasic/utf8: modernize utf8_is_valid_n a bit
Mike Yuan [Thu, 9 May 2024 13:55:09 +0000 (21:55 +0800)] 
basic/utf8: modernize utf8_is_valid_n a bit

16 months agocore/service: use r to store parsed int values 33363/head
Mike Yuan [Sun, 16 Jun 2024 16:58:42 +0000 (18:58 +0200)] 
core/service: use r to store parsed int values

16 months agocore/service: drop unused bus_name_owner
Mike Yuan [Sun, 16 Jun 2024 16:40:39 +0000 (18:40 +0200)] 
core/service: drop unused bus_name_owner

Follow-up for fc67a943d989d5e74577adea9676cdc7928b08fc

After the mentioned comment, we no longer need to record
the owner to restore the previous bus owner state.
Therefore, bus_name_owner is effectively unused. Kill it.

16 months agocore/service: also serialize/dump status_errno
Mike Yuan [Sun, 16 Jun 2024 16:34:27 +0000 (18:34 +0200)] 
core/service: also serialize/dump status_errno

16 months agocore/service: use serialize_usec where appropriate, drop redundant debug log
Mike Yuan [Sun, 16 Jun 2024 16:16:23 +0000 (18:16 +0200)] 
core/service: use serialize_usec where appropriate, drop redundant debug log

16 months agoMerge pull request #33214 from keszybz/system-clock-epoch
Mike Yuan [Sun, 16 Jun 2024 15:42:47 +0000 (17:42 +0200)] 
Merge pull request #33214 from keszybz/system-clock-epoch

Rework the setting and description of system clock to the epoch

16 months agoMerge pull request #33352 from YHNdnzj/freeconp-void
Luca Boccassi [Sat, 15 Jun 2024 18:57:13 +0000 (19:57 +0100)] 
Merge pull request #33352 from YHNdnzj/freeconp-void

Trivial follow-ups for recent PRs

16 months agoshutdown: re-enable CAD handling in kernel at start 33355/head
Mike Yuan [Wed, 5 Jun 2024 15:57:07 +0000 (17:57 +0200)] 
shutdown: re-enable CAD handling in kernel at start

16 months agoshutdown: clean up sync_with_progress a bit
Mike Yuan [Wed, 5 Jun 2024 15:53:27 +0000 (17:53 +0200)] 
shutdown: clean up sync_with_progress a bit

Also, ignore the error on caller's side.

16 months agostring-util: modernize first_word a bit
Mike Yuan [Wed, 5 Jun 2024 14:54:29 +0000 (16:54 +0200)] 
string-util: modernize first_word a bit

16 months agocore/manager: correct alignment in manager_handle_ctrl_alt_del
Mike Yuan [Wed, 12 Jun 2024 13:48:06 +0000 (15:48 +0200)] 
core/manager: correct alignment in manager_handle_ctrl_alt_del

16 months agoman,units: drop "temporary" from description of systemd-tmpfiles
Mike Yuan [Sat, 15 Jun 2024 15:27:33 +0000 (17:27 +0200)] 
man,units: drop "temporary" from description of systemd-tmpfiles

Historically, systemd-tmpfiles was designed to manager temporary
files, but nowadays it has become a generic tool for managing
all kinds of files. To avoid user confusion, let's remove "temporary"
from the tool's description.

As discussed in #33349

16 months agoman: describe setting of the clock by systemd and systemd-timesyncd 33214/head
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2024 12:15:21 +0000 (14:15 +0200)] 
man: describe setting of the clock by systemd and systemd-timesyncd

The setting of systemd clock is important and deserves an accurate description,
see for example:
https://discussion.fedoraproject.org/t/f38-to-f39-40-dnf-system-upgrade-can-fail-on-raspberry-pi/92403
https://bugzilla.redhat.com/show_bug.cgi?id=2242759

The meat of the description was in systemd-timesyncd.service(8), but
actually it's systemd that sets the clock. In particular, systemd-timesyncd
doesn't know anything about /usr/lib/clock-epoch, and since systemd sets
the clock to the epoch when initializing, systemd-timesyncd would only
get to advance the clock to the epoch under special circumstances.
Also, systemd-timesyncd is an optional component, so we can't even rely
on its man page being installed in all circumstances. The description needs
to be moved to systemd(1).

The description is updated to describe the changes that were made in
previous commits.

16 months agomanager: add structured log message about clock bump
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jun 2024 09:55:14 +0000 (11:55 +0200)] 
manager: add structured log message about clock bump

Requested in https://github.com/systemd/systemd/pull/33214#discussion_r1630251308.
Also, reword error messages a bit. When /usr/lib/clock-epoch was introduced,
"build time" stopped being acurate. Just say "epoch" instead.

The same message ID is used in the manager and timesyncd. The event is
essentially equivalent for the user, and it seems reasonable that to search for
both at the same time.

The catalog entry is dropped. It provided almost no additional information above
the message. When the same message ID is now applied to messages from PID1 and
timesyncd, and the clock can be both advanced and rewound, it becomes very hard
to make the catalog entry provide something useful, because catalog entries don't
allow conditionalization.

16 months agotimesyncd: simplify handling of timestamps
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2024 11:31:07 +0000 (13:31 +0200)] 
timesyncd: simplify handling of timestamps

We would attempt to take the built-in epoch twice. Since
advance_tstamp() is only called from one place, we don't need to do that.
Also, just pass usec_t instead of a pointer to stat buf.

Don't say we set the clock to "recorded timestamp" if we just set it
to the built-in epoch. Also, consistently say "advance" to make it clear
that we'll not attempt to rewind the clock here.

16 months agomanager: apply clock epoch on updates too
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2024 11:21:45 +0000 (13:21 +0200)] 
manager: apply clock epoch on updates too

If we're updating on a system with an invalid clock, and we're installing
a newer system version with a higher update, adjust the clock. This
way the invariant that the clock is always later than
max(compile time, timestamp file, other timestamp file) is maintained.

Also, adjust the wording of messages. When /usr/lib/clock-epoch was
introduced, "build time" stopped being acurate. Just say "epoch" instead.

16 months agomanager: use max of: compile epoch, epoch file, timesyncd file
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2024 10:50:52 +0000 (12:50 +0200)] 
manager: use max of: compile epoch, epoch file, timesyncd file

Previously systemd would not use /var/lib/systemd/timesync/clock. This means
that even if /var/ is mounted when systemd is started and the file is
available, we would potentially make one time jump and than another time jump.
From a user's POV, this doesn't seem useful at all.

Also, we would always let /usr/lib/clock-epoch take priority over the built-in
epoch. But there is no guarantee that this file is actually fresh. In
particular, a user may touch /usr/lib/clock-epoch to work around a broken clock
during installation (as recommended in [1]), and then this file will grow stale
over time.

So just load the three timestamps and use the highest one as the epoch.

[1] https://discussion.fedoraproject.org/t/f38-to-f39-40-dnf-system-upgrade-can-fail-on-raspberry-pi/92403

16 months agoshared/clock-util: small modernization
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jun 2024 08:24:52 +0000 (10:24 +0200)] 
shared/clock-util: small modernization

16 months agorandom-util: add crypto_random_bytes_allocate_iovec()
Lennart Poettering [Thu, 6 Jun 2024 09:21:02 +0000 (11:21 +0200)] 
random-util: add crypto_random_bytes_allocate_iovec()

Just a simple helper that allocates some memory, initializes it
randomly, and places this in a struct iovec.

16 months agoimportd: unify setup of bus connectivity in one place
Lennart Poettering [Tue, 7 May 2024 15:44:31 +0000 (17:44 +0200)] 
importd: unify setup of bus connectivity in one place

16 months agoselinux-util: make type of cleanup func void 33352/head
Mike Yuan [Sat, 15 Jun 2024 10:55:45 +0000 (12:55 +0200)] 
selinux-util: make type of cleanup func void

Follow-up for 6623c64a02fae52103cdc9c80dfcabec9eeaf8ba

Return values are pointless for _cleanup_ functions, and
this matches what we do in DEFINE_TRIVIAL_CLEANUP_FUNC().

16 months agomissing_loop: add missing assertions for fallback values
Mike Yuan [Sat, 15 Jun 2024 10:55:21 +0000 (12:55 +0200)] 
missing_loop: add missing assertions for fallback values

16 months agomacro-fundamental: correct comment and remove trailing ';' for macro
Mike Yuan [Sat, 15 Jun 2024 10:54:44 +0000 (12:54 +0200)] 
macro-fundamental: correct comment and remove trailing ';' for macro

Follow-up for 3c2f2146f50c75662987541719bedc4aee9df939

16 months agoMerge pull request #33037 from keszybz/dlopen-open-code-definitions
Mike Yuan [Sat, 15 Jun 2024 10:49:59 +0000 (12:49 +0200)] 
Merge pull request #33037 from keszybz/dlopen-open-code-definitions

Make dlopen macros more explicit and drop mac_selinux_free()

16 months agojson: extend JsonDispatch flags with nullable and refuse-null flags
Lennart Poettering [Wed, 8 May 2024 07:42:12 +0000 (09:42 +0200)] 
json: extend JsonDispatch flags with nullable and refuse-null flags

currently when dispatching json objects into C structs we either insist
on the field type or we don't. Let's extend this model a bit: depending
on two new fields either allow or refuse null types in addition to the
specified type.

This is useful for example when dispatch enums as this allows us
explicitly refuse null in various scenarios where we allow multiple
types.

16 months agovarlink: handle NULL varlink server object gracefully in varlink_server_current_conne...
Lennart Poettering [Wed, 8 May 2024 08:40:48 +0000 (10:40 +0200)] 
varlink: handle NULL varlink server object gracefully in varlink_server_current_connections()

let's treat a NULL server as a server with zero connections, to make
things more convenient to use.

16 months agomachined: use bus_message_read_id128() at one more place
Lennart Poettering [Mon, 13 May 2024 13:02:37 +0000 (07:02 -0600)] 
machined: use bus_message_read_id128() at one more place

16 months agoMerge pull request #33329 from poettering/varlink-idl-tweaks
Luca Boccassi [Sat, 15 Jun 2024 00:18:37 +0000 (01:18 +0100)] 
Merge pull request #33329 from poettering/varlink-idl-tweaks

varlink-idl: align continuation line character \

16 months agopretty-print: enable stdio buffering while outputting progress bar
Lennart Poettering [Fri, 24 May 2024 09:56:13 +0000 (11:56 +0200)] 
pretty-print: enable stdio buffering while outputting progress bar

Writing the progress bar so far was irritatingly slow, which was caused
by the fact that the various things we output so far resulted in one
write() syscall each because STDERR is unbuffered by default.

Let's fix that, and temporarily turn on full buffering for stderr,
restoring the normal unbuffered output right after.

This makes progress bar print visibly more efficient (and flicker free
too, since terminals no longer will move the cursor around during
output).

16 months agoutf8: let utf8_console_width() handle NULL strings somewhat reasonably
Lennart Poettering [Fri, 26 Apr 2024 15:41:38 +0000 (17:41 +0200)] 
utf8: let utf8_console_width() handle NULL strings somewhat reasonably

16 months agoMerge pull request #33325 from poettering/vsock-ret-optional
Luca Boccassi [Fri, 14 Jun 2024 23:45:28 +0000 (00:45 +0100)] 
Merge pull request #33325 from poettering/vsock-ret-optional

socket-util: make return parameter for socket_address_parse_vsock() o…

16 months agojson: add sd_json_dispatch_double() helper
Lennart Poettering [Wed, 8 May 2024 07:11:13 +0000 (09:11 +0200)] 
json: add sd_json_dispatch_double() helper

16 months agoMerge pull request #33334 from poettering/machined-more-pidfd
Luca Boccassi [Fri, 14 Jun 2024 23:13:50 +0000 (00:13 +0100)] 
Merge pull request #33334 from poettering/machined-more-pidfd

machined: prefer pinning clients via pidfd when creating machine, rat…

16 months agoMerge pull request #33330 from poettering/copy-tweaks
Luca Boccassi [Fri, 14 Jun 2024 23:12:48 +0000 (00:12 +0100)] 
Merge pull request #33330 from poettering/copy-tweaks

Minor tweaks to copy_bytes()

16 months agosrc/basic/missing_loop.h: fix missing LOOP_SET_BLOCK_SIZE
Raphaël Mélotte [Fri, 14 Jun 2024 12:37:29 +0000 (14:37 +0200)] 
src/basic/missing_loop.h: fix missing LOOP_SET_BLOCK_SIZE

Builds with kernels headers < 4.14 fail with:

../src/shared/loop-util.c: In function ‘loop_configure_fallback’:
../src/shared/loop-util.c:237:31: error: ‘LOOP_SET_BLOCK_SIZE’ undeclared (first use in this function); did you mean ‘LOOP_SET_DIRECT_IO’?
                 if (ioctl(fd, LOOP_SET_BLOCK_SIZE, (unsigned long) c->block_size) < 0)
                               ^~~~~~~~~~~~~~~~~~~
                               LOOP_SET_DIRECT_IO

Fixes: https://github.com/systemd/systemd/issues/33341
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
16 months agoman: add a bit of a warning to systemd-tmpfiles --purge
Nick Rosbrook [Fri, 14 Jun 2024 21:31:22 +0000 (17:31 -0400)] 
man: add a bit of a warning to systemd-tmpfiles --purge

Mention that by default, /home is managed by tmpfiles.d/home.conf, and
recommend that users run systemd-tmpfiles --dry-run --purge first to
see exactly what will be removed.

16 months agocreds-util: add common helper for determinign global boot credentials path
Lennart Poettering [Thu, 6 Jun 2024 10:14:35 +0000 (12:14 +0200)] 
creds-util: add common helper for determinign global boot credentials path

It's very useful being able to determine the directory where to write
global boot credentials to, that are picked up by all kernels.

16 months agofs-util: add simple open_mkdir() wrapper
Lennart Poettering [Thu, 6 Jun 2024 13:23:01 +0000 (15:23 +0200)] 
fs-util: add simple open_mkdir() wrapper

16 months agostring-util: make sure strrepa() doesn't doubly evaluate expressions
Lennart Poettering [Wed, 22 May 2024 13:42:56 +0000 (15:42 +0200)] 
string-util: make sure strrepa() doesn't doubly evaluate expressions

16 months agopcrlock: move event_log_reduce_to_safe_pcrs() down a bit
Lennart Poettering [Wed, 5 Jun 2024 19:47:43 +0000 (21:47 +0200)] 
pcrlock: move event_log_reduce_to_safe_pcrs() down a bit

Let's keep the verb_lock_xyz() and verb_unlock_xyz() calls together, and
move event_log_reduce_to_safe_pcrs() which so far was in betwee them all
further down closer to where the function is actually used.

16 months agopcrlock: don't override conf_root parameter for boot_entry_token_ensure()
Lennart Poettering [Mon, 10 Jun 2024 12:57:18 +0000 (14:57 +0200)] 
pcrlock: don't override conf_root parameter for boot_entry_token_ensure()

if we pass NULL boot_entry_token_ensure() will use its own default,
which is the same as what we passed so far explicitly, hence let's make
use of that.

16 months agofileio: add new helper write_base64_file_at() which encodes a binary object into...
Lennart Poettering [Mon, 10 Jun 2024 12:50:18 +0000 (14:50 +0200)] 
fileio: add new helper write_base64_file_at() which encodes a binary object into base64 and writes it to a file

16 months agovmspawn: report "systemd-vmspawn" as "service" to machined
Lennart Poettering [Mon, 27 May 2024 12:34:10 +0000 (14:34 +0200)] 
vmspawn: report "systemd-vmspawn" as "service" to machined

The "service" field that one is supposed to pass to machine is supposed
to indicate the implementation of the client, not the service unit the
client runs in (which is typically even a scope unit, not a system
unit). Hence fix that, and make it closely match what systemd-nspawn
does.

16 months agonspawn: use parse_boolean_argument() at two places
Lennart Poettering [Mon, 27 May 2024 11:29:45 +0000 (13:29 +0200)] 
nspawn: use parse_boolean_argument() at two places

16 months agoutf8: assume tabs are 8 characters wide when written to console
Lennart Poettering [Fri, 26 Apr 2024 15:41:15 +0000 (17:41 +0200)] 
utf8: assume tabs are 8 characters wide when written to console

16 months agofundamental: declare flex array updated for gcc15 and clang 19
Cristian Rodríguez [Thu, 13 Jun 2024 15:59:28 +0000 (11:59 -0400)] 
fundamental: declare flex array updated for gcc15 and clang 19

Silly workaround that:
- allowed flexible arrays in unions
- allowed flexible arrays in otherwise empty structs

Is no longer needed since https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=adb1c8a0f167c3a1f7593d75f5a10eb07a5d741a
(GCC15) or clang 19 https://github.com/llvm/llvm-project/commit/14ba782a87e16e9e15460a51f50e67e2744c26d9

16 months agocopy: increase copy buffer from 16K to 64K 33330/head
Lennart Poettering [Fri, 24 May 2024 10:18:23 +0000 (12:18 +0200)] 
copy: increase copy buffer from 16K to 64K

In my tests here this tremendously speeds up things when initializing a
1G file from /dev/urandom

16 months agocopy: when a progress callback is provided, never copy more than 1M per iteration
Lennart Poettering [Fri, 24 May 2024 10:17:00 +0000 (12:17 +0200)] 
copy: when a progress callback is provided, never copy more than 1M per iteration

Otherwise if we have to fill GB of data we might never call into the
callback, hence put some limit on how much to copy per iteration.

16 months agocopy: rework how we determine the number of bytes to copy in copy_bytes_full()
Lennart Poettering [Fri, 24 May 2024 10:02:42 +0000 (12:02 +0200)] 
copy: rework how we determine the number of bytes to copy in copy_bytes_full()

Let's freshly calculate "m" on each iteration and always start with the maximum
size we can. If sendfile() is used we must adhere to its limit of
SSIZE_MAX minus the current offset. Otherwise we can copy more, i.e.
SSIZE_MAX without any restrictions.

Also, if we get too close to having copied SSIZE_MAX, let's turn off
sendfile() for the rest.

16 months agoiovec-util: add exported constant empty but valid (i.e. non-NULL) iovec
Lennart Poettering [Mon, 3 Jun 2024 15:39:04 +0000 (17:39 +0200)] 
iovec-util: add exported constant empty but valid (i.e. non-NULL) iovec

Also, make sure the NUL byte iovec becomes an exported constant too.

This is better than the previous situation where this was a macro
resolving to a compount expression, since the lifetime of the expression
is limited to its invoking scope. By turning this into a proper variable
the lifetime becomes unbounded, which makes it easier to use in various
scenarios, such as "if" blocks.

16 months agoanalyze: show pcrs also in sha384 bank
Lennart Poettering [Tue, 4 Jun 2024 09:02:34 +0000 (11:02 +0200)] 
analyze: show pcrs also in sha384 bank

SHA384 is pretty much the bank we actually *want* to use, since it's
faster to calculate than SHA256, hence at the very least, start
considering.

16 months agomachined: use pidref instead of just pid when determining unit of pid when registerin... 33334/head
Lennart Poettering [Mon, 27 May 2024 10:03:35 +0000 (12:03 +0200)] 
machined: use pidref instead of just pid when determining unit of pid when registering machine

16 months agomachined: prefer pinning clients via pidfd when creating machine, rather than PID
Lennart Poettering [Mon, 13 May 2024 13:06:30 +0000 (07:06 -0600)] 
machined: prefer pinning clients via pidfd when creating machine, rather than PID

16 months agomachined: modernize method_create_or_register_machine() return parameter naming
Lennart Poettering [Mon, 13 May 2024 13:05:49 +0000 (07:05 -0600)] 
machined: modernize method_create_or_register_machine() return parameter naming

16 months agoMerge pull request #33312 from poettering/cryptsetup-merge-no-token
Lennart Poettering [Fri, 14 Jun 2024 11:24:08 +0000 (13:24 +0200)] 
Merge pull request #33312 from poettering/cryptsetup-merge-no-token

cryptsetup: merge two mostly equivalent functions

16 months agotpm2-util: make one sd_json_dispatch_field[] table static const
Lennart Poettering [Mon, 3 Jun 2024 15:50:55 +0000 (17:50 +0200)] 
tpm2-util: make one sd_json_dispatch_field[] table static const

16 months agovarlink-idl: include line/column in a parse log msg 33329/head
Lennart Poettering [Thu, 23 May 2024 09:01:31 +0000 (11:01 +0200)] 
varlink-idl: include line/column in a parse log msg

16 months agovarlink-idl: align continuation line character \
Lennart Poettering [Fri, 26 Apr 2024 15:43:42 +0000 (17:43 +0200)] 
varlink-idl: align continuation line character \

16 months agomachined: initialize CID of '.host' pseudo-machine to 1 (i.e. the loopback vsock... 33325/head
Lennart Poettering [Thu, 23 May 2024 21:34:39 +0000 (23:34 +0200)] 
machined: initialize CID of '.host' pseudo-machine to 1 (i.e. the loopback vsock address)

16 months agosocket-util: make return parameter for socket_address_parse_vsock() optional
Lennart Poettering [Thu, 23 May 2024 21:33:38 +0000 (23:33 +0200)] 
socket-util: make return parameter for socket_address_parse_vsock() optional

16 months agocryptsetup: downgrade log message to warning, when we ignore it 33312/head
Lennart Poettering [Mon, 10 Jun 2024 15:46:52 +0000 (17:46 +0200)] 
cryptsetup: downgrade log message to warning, when we ignore it

16 months agocryptsetup: merge two mostly equivalent functions
Lennart Poettering [Mon, 10 Jun 2024 15:47:43 +0000 (17:47 +0200)] 
cryptsetup: merge two mostly equivalent functions

16 months agosd-json: make static analyzers shut up
Lennart Poettering [Thu, 13 Jun 2024 13:22:27 +0000 (15:22 +0200)] 
sd-json: make static analyzers shut up

https://github.com/systemd/systemd/pull/32628#pullrequestreview-2115501478

16 months agoMerge pull request #33046 from poettering/varlinkctl-quiet
Luca Boccassi [Thu, 13 Jun 2024 15:17:17 +0000 (16:17 +0100)] 
Merge pull request #33046 from poettering/varlinkctl-quiet

varlinkctl: add --quiet/-q switch for suppressing method call reply output

16 months agoio-util: move fputs_with_newline to fileio
Mike Yuan [Thu, 13 Jun 2024 11:57:25 +0000 (13:57 +0200)] 
io-util: move fputs_with_newline to fileio

Follow-up for cdf6f34a2fd1448c5d1b75f4717c57b057dd51b2

We already have other fputs()-like helpers in fileio rather than
io-util. While at it, switch the order of params.

16 months agonamespace: rename 'n' to 'n_mount_images'
Lennart Poettering [Thu, 13 Jun 2024 13:26:23 +0000 (15:26 +0200)] 
namespace: rename 'n' to 'n_mount_images'

Let's make clear what this actually counts (at least initially).

16 months agocryptsetup: manual FIDO2 PIN, UP and UV configuration
Kamil Szczęk [Fri, 7 Jun 2024 14:48:41 +0000 (16:48 +0200)] 
cryptsetup: manual FIDO2 PIN, UP and UV configuration

When in FIDO2 mode with manual parameters, i.e. when not reading the
parameters off the LUKS2 header, the current behavior in regards to PIN,
UP and UV features is to default to v248 logic, where we use PIN + UP
when needed, and do not configure UV at all. Let's allow users to
configure those features in manual mode too.

16 months agoMerge pull request #33257 from YHNdnzj/unit-notify-cleanup
Luca Boccassi [Thu, 13 Jun 2024 10:30:42 +0000 (11:30 +0100)] 
Merge pull request #33257 from YHNdnzj/unit-notify-cleanup

core/unit: several cleanups

16 months agovarlinkctl: as convencience to users, accept empty string in place of {} for empty... 33046/head
Lennart Poettering [Mon, 27 May 2024 09:37:33 +0000 (11:37 +0200)] 
varlinkctl: as convencience to users, accept empty string in place of {} for empty parameter list

It makes it a bit easier to use "varlinkctl call", since you can just
hit ^D to call a function without params, instead of spelling out {}.

16 months agoci: add superficial --quiet testcase
Lennart Poettering [Mon, 27 May 2024 15:40:35 +0000 (17:40 +0200)] 
ci: add superficial --quiet testcase

16 months agovarlinkctl: tell user we are expecting method call parameters on STDIN
Lennart Poettering [Mon, 27 May 2024 09:28:48 +0000 (11:28 +0200)] 
varlinkctl: tell user we are expecting method call parameters on STDIN

When calling a method and the user hasn't provided any method call
parameters on the command line we expect them on stdin instead. This
might be confusing for people using varlinkctl for the first time, since
omitting the parameters will just throw you at a blinking cursor.

Let's be a bit more helpful, and show a friendly message when we are
connected to a TTY (i.e. run interactively).

16 months agovarlinkctl: add "-q" switch for suppressing varlinkctl output
Lennart Poettering [Wed, 8 May 2024 08:40:10 +0000 (10:40 +0200)] 
varlinkctl: add "-q" switch for suppressing varlinkctl output

16 months agojson: move empty string check from json_parse_file_at() to json_parse_with_source()
Lennart Poettering [Mon, 27 May 2024 09:36:48 +0000 (11:36 +0200)] 
json: move empty string check from json_parse_file_at() to json_parse_with_source()

That way this error is generalized and applies to either function, since
one is just a wrapper to the other, normalizing behaviour.

16 months agoMerge pull request #33012 from poettering/varlinkctl-list-methods
Lennart Poettering [Thu, 13 Jun 2024 09:05:07 +0000 (11:05 +0200)] 
Merge pull request #33012 from poettering/varlinkctl-list-methods

varlinkctl: make interface parameter for "varlinkctl introspect" optional, and add "list-methods" verb

16 months agoCODING_STYLE: document "reterr_" return parameters
Lennart Poettering [Wed, 12 Jun 2024 16:31:56 +0000 (18:31 +0200)] 
CODING_STYLE: document "reterr_" return parameters

In some recent PRs (e.g. #32628) I started to systematically name return
parameters that shall only be initialized on failure (because they carry
additional error meta information, such as the line/column number of
parse failures or so). Let's make this official in the coding style.

16 months agotest: add test for new varlinkctl features 33012/head
Lennart Poettering [Fri, 24 May 2024 15:02:52 +0000 (17:02 +0200)] 
test: add test for new varlinkctl features

16 months agovarlinkctl: add new list-methods verb
Lennart Poettering [Fri, 24 May 2024 14:34:12 +0000 (16:34 +0200)] 
varlinkctl: add new list-methods verb

For putting together "varlinkctl call" command lines it's useful to
quickly enumerate all methods implemented by a service. Hence, let's add
a new "list-methods" which uses the introspection data of a service to
quickly list methods.

This is implemented as a special flavour of the "introspect" logic,
and just suppresses all output except for the method names.

16 months agovarlinkctl: make interface argument to "introspect" optional, and allow more than one
Lennart Poettering [Fri, 24 May 2024 13:25:23 +0000 (15:25 +0200)] 
varlinkctl: make interface argument to "introspect" optional, and allow more than one

let's make it easier to use the introspection functionality of
"varlinkctl": if no interface name is shown, display the introspection
data of all available interfaces. Moreover, allow that multiple
interfaces can be listed, in which case we enumerate them all.

This relieves the user from having to list interfaces first in order to
find the ones which to introspect.

16 months agovarlinkctl: be friendly to later extensions of GetInfo Varlink call
Lennart Poettering [Fri, 24 May 2024 13:24:23 +0000 (15:24 +0200)] 
varlinkctl: be friendly to later extensions of GetInfo Varlink call

16 months agopretty-print: make separator line grey
Lennart Poettering [Fri, 24 May 2024 13:23:24 +0000 (15:23 +0200)] 
pretty-print: make separator line grey

Let's deemphasize the line in the output a bit.

16 months agoio-util: add new helper fputs_with_newline()
Lennart Poettering [Thu, 13 Jun 2024 07:29:10 +0000 (09:29 +0200)] 
io-util: add new helper fputs_with_newline()

16 months agoMerge pull request #32628 from poettering/json-public
Lennart Poettering [Thu, 13 Jun 2024 07:03:13 +0000 (09:03 +0200)] 
Merge pull request #32628 from poettering/json-public

Make our JSON APIs a public interface sd-json.h

16 months agosd-json: rename SD_JSON_SAFE → SD_JSON_STRICT 32628/head
Lennart Poettering [Wed, 22 May 2024 20:40:33 +0000 (22:40 +0200)] 
sd-json: rename SD_JSON_SAFE → SD_JSON_STRICT

The flag is fairly generic these days and just selects a slightly
stricter validation, with details depending on the selected dispatch
function. Hence, let's give it more precise name, in particular one that
mirrors the SD_JSON_RELAXED flag nicely (which does the opposite:
relaxes parsing)

16 months agotest: extend JSON test coverage
Lennart Poettering [Mon, 6 May 2024 13:25:11 +0000 (15:25 +0200)] 
test: extend JSON test coverage

16 months agoman: add brief intro page to new sd-json APIs
Lennart Poettering [Thu, 2 May 2024 12:44:37 +0000 (14:44 +0200)] 
man: add brief intro page to new sd-json APIs

16 months agolibsystemd: turn json.[ch] into a public API
Lennart Poettering [Thu, 2 May 2024 12:26:21 +0000 (14:26 +0200)] 
libsystemd: turn json.[ch] into a public API

This is preparation for making our Varlink API a public API. Since our
Varlink API is built on top of our JSON API we need to make that public
first (it's a nice API, but JSON APIs there are already enough, this is
purely about the Varlink angle).

I made most of the json.h APIs public, and just placed them in
sd-json.h. Sometimes I wasn't so sure however, since the underlying data
structures would have to be made public too. If in doubt I didn#t risk
it, and moved the relevant API to src/libsystemd/sd-json/json-util.h
instead (without any sd_* symbol prefixes).

This is mostly a giant search/replace patch.

16 months agojson: merge json_dispatch_path() + json_dispatch_absolute_path()
Lennart Poettering [Wed, 22 May 2024 20:13:57 +0000 (22:13 +0200)] 
json: merge json_dispatch_path() + json_dispatch_absolute_path()

The functions more or less do the same thing. Merge them.

This makes json_dispatch_path() the common resulting implementation. it
learnt:

1. Will reset the path to NULL if specified as null in JSON
2. Depending on the JSON_SAFE flag will insist on normalized path or not

With this the two implementations are identical, except for the
differences now toggable via JSON_SAFE flag

16 months agoReapply "network: add "mac" to alternatives name policy by default"
Yu Watanabe [Tue, 11 Jun 2024 18:53:12 +0000 (03:53 +0900)] 
Reapply "network: add "mac" to alternatives name policy by default"

This reverts commit 152c8946b3a93bb2c086568832d614cb54f11e13.

The kernel patch
https://lore.kernel.org/linux-usb/20240605153340.25694-1-gmazyland@gmail.com/
is now in net-next branch, and will be hopefully merged soon.

Note that Debian's 73-usb-net-by-mac.link now also supports the kernel patch:
https://salsa.debian.org/systemd-team/systemd/-/commit/c1afbb2dc295929085be86072c7942c8517ec598

So, hopefully, the change is ready. Let's reapply it.

16 months agoMerge pull request #33100 from dtardon/crypttab-parse-all
Lennart Poettering [Wed, 12 Jun 2024 16:04:11 +0000 (18:04 +0200)] 
Merge pull request #33100 from dtardon/crypttab-parse-all

cryptsetup-generator: continue parsing after error

16 months agoMerge pull request #33045 from poettering/exit-on-idle-tweaks
Lennart Poettering [Wed, 12 Jun 2024 15:35:56 +0000 (17:35 +0200)] 
Merge pull request #33045 from poettering/exit-on-idle-tweaks

bus-util: honour new env var $SYSTEMD_ALLOW_IDLE to permit turning off exit-on-idle logic in hostnamed, timedated, …

16 months agocreds-util: fix "weak" vs. "secure" display for tmpfs/noswap backed credentials
Lennart Poettering [Wed, 12 Jun 2024 10:11:50 +0000 (12:11 +0200)] 
creds-util: fix "weak" vs. "secure" display for tmpfs/noswap backed credentials

When we display passed credentials we show a brief safety level based on
how the credential is pass in: if it's backed by swappable memory we
give it a "weak" level. This check was so far done by checking if the
file is backed by ramfs. However, since
1155f44f48f8fd59c863d71b3938e34a0b2fec2a we actually prefer tmpfs with
the new "noswap" option for this.

Hence, fix this, and explicitly look for "noswap" among the mount
options in case we detect tmpfs.