Commit Graph
90764 Commits
Author SHA1 Message Date
Rasmus Villemoes ccace17d2f profile/systemd-osc-context: fold emitting cwd= field into __systemd_osc_context_common
Now that the %s specifier used to embed the common fields in the output appears
immediately before the cwd= field, we can just emit that cwd= field as part of
the common fields.
2026-07-21 11:06:30 +02:00
Rasmus Villemoes ac4c3e4290 profile/systemd-osc-context: emit type= field first
Not because it is required by the specification, but it will make the following
patches simpler. Also, the fact that the spec explicitly does call out that
type= can appear at the end or in the middle suggests that people would
normally expect it to appear at the beginning.
2026-07-21 11:06:30 +02:00
Rasmus Villemoes ba95ad74e2 profile/systemd-osc-context: don't do arithmetic expansion on systemd_exitstatus
There's really no point in having bash do arithmetic expansion on the
systemd_exitstatus variable, i.e. have it convert the string to a number, do no
actual arithmetic, then convert it back to a string to be used as the argument to
the printf, which will again convert it to a number for the %d specifier, and
finally emit it as a decimal. Also, it deviates for no obvious reason from how
it is passed to printf in the "probably died by signal" case just above.
2026-07-21 11:06:30 +02:00
Rasmus Villemoes 10a356629a profile/systemd-osc-context: do not zero-pad pid value
The %.20d specifier was introduced in 2d738a0aee ("profile/systemd-osc-context:
Enforce length limits"). But, for numeric conversions, the precision is not an
upper bound, but rather a lower bound on the output width, padding as necessary
with 0 on the left. So as-is, this does not in fact limit the output to at most
20 characters.

Of course, in practice, pids on linux are never greater than 2^22, and
certainly never larger than what would fit in a 20-digit decimal. On the other
hand, that more or less guarantees that the pid= field is always emitted with
12+ leadings zeroes, which is a bit silly. Moreover, a leading 0 can cause a
parser to treat it as octal.

Since $$ does expand to the PID in decimal, just print that as a string, with the
enforced 20 character limit.
2026-07-21 11:06:30 +02:00
Rasmus Villemoes 9ca5488046 profile/systemd-osc-context: do not use sed for escaping
Bash is perfectly capable of performing the simple substitutions needed for
escaping according to the OSC 3008 spec, so there is no need for the fork+exec
and other overhead of calling sed.

In fact, when writing a test for ensuring that this is a drop-in replacement, I
found out that the current sed method is flawed: If $PWD contains newline
characters, they are passed through unchanged, because sed obviously is
line-oriented.

I do not know which bash version started supporting
${foo//pattern/replacement}, but I ran the below on all Debian images from docker
hub going back to Debian 6 (EOL 2016), carrying BASH_VERSION =
4.1.5(1)-release, and they all succeeded. Since the logic otherwise relies on
PROMPT_COMMAND being an array variable, which happened in 5.1, this should be
all good.

=== test.sh ===
#!/bin/bash

echo "BASH_VERSION = $BASH_VERSION"
ret=0

using_sed() {
    echo "$1" | sed -e 's/\\/\\x5c/g' -e 's/;/\\x3b/g' -e 's/[[:cntrl:]]/⍰/g'
}

pure_bash() {
    local str="$1"
    str="${str//\\/\\x5c}"
    str="${str//;/\\x3b}"
    str="${str//[[:cntrl:]]/⍰}"
    printf "%s" "${str}"
}

do_test() {
    local r0="$1"
    local r1="$(using_sed "$r0")"
    local r2="$(pure_bash "$r0")"
    local s0="$(printf '%s' "$r0" | od -A x -t x1z -w40 | head -n1)"
    local s1="$(printf '%s' "$r1" | od -A x -t x1z -w40 | head -n1)"
    local s2="$(printf '%s' "$r2" | od -A x -t x1z -w40 | head -n1)"
    if [ "$r1" != "$r2" ] || [ "$s1" != "$s2" ] ; then
        echo "Input: $s0"
        echo "sed:   $s1"
        echo "bash:  $s2"
        ret=1
    fi
}

do_test ''
do_test "one ; semicolon"
do_test "two ; semicolons ;"
do_test 'bs \ sc ; bs \ sc ;'
do_test $'\t'
do_test $'sc ; cntrl \x01 \x02 \x03 \x1f \t bs \\ bs \\ sc ; '
do_test $'sc ; tab \x09 del \x7f  bs \\ ;'

# The last cases show that the existing function doesn't actually work in
# the case of $PWD containing a newline character, because sed is
# line-oriented, so a newline character will never be replaced.
if [ "$1" = "all" ] ; then
    do_test $'embedded \n newline'
    do_test $'ending in newline\n'
fi

exit "$ret"
=== test.sh ===
2026-07-21 11:06:26 +02:00
Yu Watanabe 843bba839a po: update Japanese translation 2026-07-20 12:40:02 +01:00
Yu Watanabe e11f211326 man/network: fix default value for RequiredFamilyForOnline=
It was unexpectedly changed by c89efaf9e5.

Fixes #43074.
2026-07-20 12:39:18 +01:00
Luca Boccassi cab511f5f5 Fix typos reported by Fossies (#43084) 2026-07-20 12:38:47 +01:00
Luca Boccassi e304d559e8 udev: drop home-grown udev-ctrl socket (#40802)
Nowadays, varlink is used to control systemd-udevd. Let's drop the
legacy socket.

Note, the existence of /run/udev/control socket is widely used in both
our code and external projects. Also, the dependency to
systemd-udevd-control.socket is widely used in many projects. Hence, we
need to create a symlink to the socket file and .socket unit file.
2026-07-20 12:37:27 +01:00
Luca Boccassi 368eb65155 mkosi: update debian commit reference to 56402b2bde258999a8f01a8b04465fde9242d6a1
* 56402b2bde Drop symlink to systemd-udevd-control.socket
* 3afaaf4f89 Install new files for upstream build
2026-07-20 10:58:51 +01:00
Armaan Sandhu 79f25def86 hostname-util: strip all trailing separators in hostname_cleanup() (#43077)
Fixes #43054.
2026-07-20 16:35:12 +09:00
Yu Watanabe 38116b79ba sysinstall: fix typo
Follow-up for c17d0c7e85.
2026-07-20 16:23:04 +09:00
Yu Watanabe 38f9b660c3 tpm2-util: fix typo
Follow-up for 2348941b5d.
2026-07-20 16:23:04 +09:00
Yu Watanabe 9bbd947083 tpm2-util: fix typo
Follow-ups for 5a80137aa4.
2026-07-20 16:23:04 +09:00
Yu Watanabe 50f58d0e15 network: fix typo
Follow-up for d094067547.
2026-07-20 16:23:04 +09:00
Yu Watanabe 3fb89fc69e string-util: fix typo
Follow-up for 093cac3fe8.
2026-07-20 16:23:04 +09:00
Yu Watanabe 3fcd5cec3b report: fix typo
Follow-up for 3c2f7c6002.
2026-07-20 16:23:04 +09:00
Yu Watanabe 4476d35081 sysupdate: fix typo
Follow-up for d82e256bb9.
2026-07-20 16:22:40 +09:00
Yu Watanabe e10e1c4c5e TODO: fix typo
Follow-ups for f61e1e5cf4 and
3d0309ac0f.
2026-07-20 15:03:37 +09:00
Nandakumar Raghavan 13aec9fddf networkctl,networkd: add --no-reconfigure flag to networkctl reload
Add a new --no-reconfigure flag to 'networkctl reload' that reloads
.network and .netdev files from disk without reconfiguring any network
interfaces. This may be useful to avoid reconfiguring multiple interfaces
simultaneously when multiple .network files are updated, or when an updated
.network file is applied to multiple interfaces.

On the networkd side, manager_reload() gains a reconfigure_links parameter
that gates the per-link reconfiguration loop. A new io.systemd.Network.Reload
varlink method is added that exposes this as an optional reconfigureLinks
boolean (defaults to true). Both plain 'networkctl reload' and
'--no-reconfigure' now unconditionally call this method first. If an older
networkd returns MethodNotFound, plain reload falls back to
io.systemd.service.Reload for backward compatibility; '--no-reconfigure'
fails with a clear error in that case.
2026-07-20 14:35:04 +09:00
Sinity 1166f4472d core/dbus: do not block the manager on GetId during bus (re-)connection
bus_init_api() issued a synchronous GetId call on every API bus
(re-)connection to decide whether saved subscription state could be
coldplugged onto the new connection.

If the D-Bus socket unit is listening while the message bus daemon
behind it is gone, connect() succeeds against the socket backlog but
nothing answers the authentication handshake. The synchronous call
then blocks PID 1 for BUS_AUTH_TIMEOUT (90 seconds by default), and
queued bus operations can trigger repeated reconnection attempts.
This was observed during shutdown as roughly 15 minutes of teardown
progressing only in 90-second intervals.

Query the instance ID asynchronously on every connection. Defer API
setup until the reply is processed, so saved subscriptions are
validated and coldplugged before new subscription requests can arrive.
If the query cannot be queued or its reply is invalid, discard the
unvalidated state and expose the API without blocking the manager.

Reset the live bus ID on every connection and serialize pending bus ID
and subscription state across reload and reexec. During daemon-reload,
preserve state that was already awaiting the asynchronous reply while
discarding the duplicate state produced by the reload itself.

Also remove the now-unused synchronous bus_get_instance_id() helper.
2026-07-20 11:53:34 +09:00
Zbigniew Jędrzejewski-Szmek d751846043 Manage dlopen notes at beginning of execution, and downgrade priorities in shared libraries (#43060) 2026-07-19 21:23:47 +02:00
Zbigniew Jędrzejewski-Szmek 0f81431e35 portable: tighten image handling and command error reporting (#43033)
Let's further improve portable image handling and command error
reporting.
2026-07-19 21:09:24 +02:00
Zbigniew Jędrzejewski-Szmek 787853bd78 Improve sysinstall messages (#43050)
I was trying to use systemd-sysinstall and those are the fixes for
various ugly parts that are immediately obvious when it is used.
2026-07-19 20:16:06 +02:00
dongshengyuan 4368db3219 boot: cover BCD offsets past the buffer
Add a zero-length test for offset > max so the first bounds guard
is covered separately from the length overflow check.

Follow-up: 231857cfe8
2026-07-19 20:21:47 +09:00
Alexey Shabalin f9a9b6b4f5 password-quality-util-passwdqc: restore password-quality-util.h include
suggest_passwords() references the N_SUGGESTIONS macro, which is defined in
password-quality-util.h. Commit ff33c8f87d ("Extend test-dlopen-so to also
cover cases when built without support") introduced the per-backend split
headers: for the pwquality backend it added the new
password-quality-util-pwquality.h include while keeping password-quality-util.h,
but for the passwdqc backend it replaced password-quality-util.h with
password-quality-util-passwdqc.h (which only pulls in shared-forward.h). As a
result N_SUGGESTIONS is no longer declared in the passwdqc translation unit and
the build fails when the passwdqc backend is enabled.

The passwdqc backend is not exercised by the default CI, so this went
unnoticed. Add the include back, matching the pwquality backend.
2026-07-19 20:19:48 +09:00
Arian van Putten 78a8170a8a systemd-imds-generator: fix import docs
We only run import in the initrd by default. Clarify this.
2026-07-19 10:59:59 +01:00
Lennart Poettering 215ad044d3 run: split out polkit ops into separate .c file (#43047) 2026-07-18 11:03:36 +02:00
Lennart Poettering 1f360f0abd run: simplify timer property handling
Let's make timer prop handling less special, and more like path/socket
handling. Let's move the checks for at least one OnXYZ= setting to a
common place at the end of parsing, instead of explicit checks for each
property.
2026-07-18 00:01:47 +02:00
Lennart Poettering 9793dde16e run: split out polkit ops into separate .c file
Let's shorten an already very long .c file, by splitting it apart a bit.

Splitting out the polkit code is relatively easy, since it does not
touch any of the arg_xyz variables.
2026-07-18 00:01:47 +02:00
Yu Watanabe 8e54afe8da mkosi/opensuse: do not try to package non-existent symlink to systemd-udevd-control.socket 2026-07-18 05:29:59 +09:00
Yu Watanabe 20ef89f646 NEWS: mention the removeal of legacy udev control socket 2026-07-18 05:29:59 +09:00
Yu Watanabe 17e911ffc8 udev: drop home-grown udev-ctrl socket
Nowadays, varlink is used to control systemd-udevd. Let's drop the
legacy socket.

Note, the existence of /run/udev/control socket is widely used in both
our code and external projects. Also, the dependency to
systemd-udevd-control.socket is widely used in many projects.
Hence, we need to create a symlink to the socket file and .socket unit
file.
2026-07-18 05:29:59 +09:00
Yu Watanabe 14f934df35 nspawn: do not try to connect udevd
nspawn itself does not require to control udevd process.

Only necessary points are
- udevd is available, and
- we are in the main network namespace.

Let's check them explicitly.

This also makes the check is skipped when we are talking to mountfsd, as
the check is pointless in that case.
2026-07-18 05:29:59 +09:00
Yu Watanabe 7f1ca24bb9 sd-device: use network_namespace_is_init() 2026-07-18 05:29:59 +09:00
Yu Watanabe dfe19f1350 namespace-util: introduce network_namespace_is_init() 2026-07-18 05:29:59 +09:00
acandoo bb3fcd73ce docs: clarify scope of portable services
Removed note clarifying that portable services are only for system services and not user services, and changed comparisons to "system services" with just "services". With newer systemd versions, `systemd-portabled` can be run as a user service.
2026-07-17 21:13:08 +01:00
Yu Watanabe 796580518e dlopen-note: downgrade all dlopen notes in libsystemd.so and libsystemd-shared.so
Since all executables now manage their required dlopen notes directly
within their own source code with explicit priority levels, it is no
longer necessary to declare high-priority dlopen notes in the shared
libraries themselves.
2026-07-18 04:57:00 +09:00
Yu Watanabe 661ab8b6fd tree-wide: drop DLOPEN_FOO() macros
Since 4c0d8d9673, most dlopen notes are
set at the beginning of the executables. Let's manage all dlopen notes
there, rather than setting them where dlopen is called.

Note that the only exceptions are the LIBBPF_NOTE for networkd and
nsresource. Since dlopen_bpf() is wrapped in an `#if` guard, the notes
are instead set within the corresponding functionality.

As a result, the DLOPEN_FOO() wrapper macros are no longer needed and
can be dropped completely.
2026-07-18 04:56:32 +09:00
Luca Boccassi e056e2a707 sd-dlopen: make header self-standing again
The purpose of this header was to provide MIT-0 sources that can be copied
and pasted liberally. Including an LGPL-2.1+ header from it deafeats its
purpose. Make it self-standing again.

Follow-up for aa0db003cf
2026-07-18 01:55:07 +09:00
Lennart Poettering 6eb6a61a96 update TODO 2026-07-17 16:38:14 +02:00
Luca Boccassi 6308a7c2e7 nspawn: use chase() for creating dev nodes (#43037) 2026-07-17 09:02:28 +01:00
Zbigniew Jędrzejewski-Szmek a48ff4de46 repart: fix varlink description string
Fixup for 1c76e204d3.
2026-07-17 09:21:59 +02:00
Zbigniew Jędrzejewski-Szmek d094067547 network: silence false warning about unitialized variable
[1177/3647] Compiling C object systemd-networkd.p/src_network_networkd-bridge-vlan.c.o
In function ‘bridge_vlan_append_set_info’,
    inlined from ‘bridge_vlan_set_message’ at ../src/network/networkd-bridge-vlan.c:257:21:
../src/network/networkd-bridge-vlan.c:162:28: warning: ‘untagged’ may be used uninitialized [-Wmaybe-uninitialized]
  162 |                         if (untagged == u)
      |                            ^
../src/network/networkd-bridge-vlan.c: In function ‘bridge_vlan_set_message’:
../src/network/networkd-bridge-vlan.c:111:14: note: ‘untagged’ was declared here
  111 |         bool untagged, pvid_is_untagged;
      |              ^~~~~~~~
2026-07-17 09:18:58 +02:00
Zbigniew Jędrzejewski-Szmek 9d8f8d55ed sysinstall: don't ask whether to erase a disk that contains no partitions
When the target disk carried no partitions, the installer still asked:

    Please type 'keep' to install the OS in addition to what the disk
    already contains, or 'erase' to erase all data on the disk:

The question is meaningless in that case: there's nothing on the disk
worth preserving, and both answers lead to the same result.

Modify fsystemd-repart to report in the dry-run reply of
io.systemd.Repart.Run() the number of partitions currently on the disk.
The field is only included if the existing partition table was actually
read, i.e. in the 'refuse' and 'allow' empty modes, and omitted
otherwise.

Make systemd-sysinstall skip the erase question if the reply positively
indicates that there are no partitions, proceeding as if 'keep' was
selected.
2026-07-17 09:18:33 +02:00
Zbigniew Jędrzejewski-Szmek efbc4481cb sysinstall: suppress 'no' prompt to begin installation
The user has to type 'yes', but it doesn't mean that the default of
'no' is ever useful. Suppress it, so the user doesn't have to press
backspace twice.
2026-07-17 09:15:09 +02:00
Luca Boccassi 15d0b477f0 nspawn: use chase() for creating dev nodes
Follow-up for de40a3037a
2026-07-16 22:46:31 +01:00
Luca Boccassi 2ef10ee3f1 nspawn: log at error level before exiting if parsing OCI fails
Currently it silently errors out, with nothing at all printed on the
console

Follow-up for de40a3037a
2026-07-16 17:41:27 +01:00
Lennart Poettering 8009fa4984 boot: fix MEMMAP_DEVICE_PATH EndingAddress field calculation
Let's do what EDK2 does.

Fixes: #43038
2026-07-17 01:17:14 +09:00
Yu Watanabe 95648d612a udev-util: bound leading whitespace skip in udev_replace_whitespace (#42757)
udev_replace_whitespace() is documented to read at most 'len' bytes from
'str':
- the strspn() skip of leading whitespace stops at a non-space byte or
NUL, not at 'len'
- ata_id passes the space padded, non-NUL-terminated ATA IDENTIFY
model/serial/fw fields
- an all-blank field reads off the end of the 512-byte hd_driveid stack
struct
Capped the skip to 'len'; existing outputs are unchanged. Added a
regression test.
2026-07-17 01:16:07 +09:00