Commit Graph
84737 Commits
Author SHA1 Message Date
Yu Watanabe a580dd4e53 musl: format-util: use %llu for formatting rlim_t
glibc uses uint32_t or uint64_t for rlim_t, while musl uses unsigned long long.
2025-11-13 08:02:05 +09:00
Yu Watanabe 4b774c740b musl: build-path: fix reading DT_RUNPATH or DT_RPATH
musl records DT_STRTAB as offset, rather than address. So, need to add
obtained bias to read runpath or rpath.
2025-11-13 08:02:05 +09:00
Yu Watanabe 3866923a68 musl: core: there is one less usable signal when built with musl
musl internally reserves one more signal, hence we can only use 29
signals.
2025-11-13 08:02:05 +09:00
Yu Watanabe ebbc0ea7fd musl: avoid multiple evaluations in CPU_ISSET_S() macro
musl's CPU_ISSET_S() macro does not avoid multiple evaluations, and it
only accepts simple variable or constant.

Fixes the following error.
```
../src/shared/cpu-set-util.c: In function ‘cpu_set_to_mask_string’:
../src/shared/cpu-set-util.c:101:41: warning: operation on ‘i’ may be undefined [-Werror=sequence-point]
  101 |                         if (CPU_ISSET_S(--i, c->allocated, c->set))
      |                                         ^
```
2025-11-13 08:02:05 +09:00
Yu Watanabe 5bb9063505 musl: hostname-util: introduce LINUX_HOST_NAME_MAX
glibc defines HOST_NAME_MAX as 64 and our code rely on that, but musl
defines the constant as 255. Let's provide our own definition for the
maximum length.
2025-11-13 08:02:05 +09:00
Zbigniew Jędrzejewski-Szmek e1ddcb1125 man: fedora 43 is the latest stable 2025-11-12 23:01:48 +00:00
Zbigniew Jędrzejewski-Szmek aff5c0af8b docs/BACKPORTS: update
We now keep stable branches in the main repo. Update the description
to match current practice.

Closes https://github.com/systemd/systemd/issues/35846.
2025-11-12 23:01:35 +00:00
Luca Boccassi 56d19b633d boot: coding style cleanups 2025-11-12 23:44:06 +01:00
Yu Watanabe 43e4c91fc0 musl: avoid conflict between fcntl.h and basic-forward.h
glibc defines AT_FDCWD as -100, but musl defines it as (-100).
In basic-forward.h, we also define AT_FDCWD as -100, hence musl's fcntl.h
conflicts with forward.h. This is for avoiding the conflict.
2025-11-12 23:28:01 +01:00
Yu Watanabe fe6e6cb6a0 time-util: several fixlets/workarounds for supporting musl (#39688) 2025-11-13 05:18:25 +09:00
Yu Watanabe d278d5bc3d sd-journal: fix relative path handling (#38681)
Fixes #38667.
2025-11-13 05:12:00 +09:00
Yu Watanabe ca3933bf49 core/dbus-service: validate type of received ExecContext fds (#39680) 2025-11-13 05:11:07 +09:00
Yu Watanabe 7ebfcfc17b meson: add musl support (#39686) 2025-11-13 05:10:22 +09:00
Yu Watanabe 7dad0db2ee musl: meson: gracefully disable gshadow, nss, and idn support
- musl does not support gshadow, and does not provide gshadow.h,
- musl does not support nss, and does not provide nss.h which is necessary
  for each nss modules,
- musl does not provide NI_IDN.
2025-11-13 04:44:32 +09:00
Yu Watanabe 17e343b58b musl: meson: check existence of renameat2()
musl-1.2.5 does not provide renameat2(). Note, it is added by
https://github.com/kraj/musl/commit/05ce67fea99ca09cd4b6625cff7aec9cc222dd5a,
hence hopefully it will be provided by musl-1.2.6 or newer.
2025-11-13 04:44:00 +09:00
Yu Watanabe 0736854da9 musl: meson: make musl not define wchar_t in their header
Otherwise, musl defines wchar_t as int, which conflicts with the
assumption by sd-boot, i.e. wchar_t is 2 bytes.

Fixes the following build error:
```
In file included from ../src/boot/efi-log.h:4,
                 from ../src/boot/linux_x86.c:13:
../src/boot/efi.h:19:24: error: conflicting types for 'wchar_t'; have 'short unsigned int'
   19 | typedef __WCHAR_TYPE__ wchar_t;
      |                        ^~~~~~~
In file included from /usr/include/stddef.h:19,
                 from ../src/boot/efi.h:9:
/usr/include/bits/alltypes.h:10:13: note: previous declaration of 'wchar_t' with type 'wchar_t' {aka 'int'}
   10 | typedef int wchar_t;
      |             ^~~~~~~
```
2025-11-13 04:44:00 +09:00
Yu Watanabe fb33d20c07 musl: meson: explicitly set _LARGEFILE64_SOURCE
glibc sets it when _GNU_SOURCE is defined, however, musl does not.
Let's explicitly define it to make getdents64() and struct dirent64
available even when building with musl.
2025-11-13 04:44:00 +09:00
Yu Watanabe bd19ffd9cb musl: meson: explicitly link with libintl when necessary
On some musl based distributions dgettext() may be provided by libintl.so.
Hence, we need to add dependency in that case.
2025-11-13 04:44:00 +09:00
Yu Watanabe a4c45279a7 musl: meson: allow to choose libc implementation
This also introduces skeleton directories for storing musl specific code.
2025-11-13 04:44:00 +09:00
Daan De Meyer e182d66faa test-varlink: Migrate to new assertion macros 2025-11-12 19:59:05 +01:00
Daan De Meyer 3150c34270 run0: Never ask --empower sessions for polkit auth
A --empower session is effectively root without being UID 0, so it
doesn't make sense to enforce polkit authentication in those. Let's
add the empower group, add --empower sessions to that group and ship
a polkit rule to skip authentication for all users in the empower
group.

(As a side-effect this will also allow users to add themselves to this
group outside of 'run0 --empower' to mimick NOPASSWD from sudo)
2025-11-12 19:55:35 +01:00
Yu Watanabe f8a3ae1be6 musl: test-time-util: skip parsing back when currently unused timezone is set 2025-11-13 03:13:59 +09:00
Yu Watanabe 8d5b306bb9 musl: time-util: skip tm.tm_wday check
musl does not set tm_wday when it is explicitly requested.
The check is not necessary at all, it is just for safety.
Let's skip it when built with musl.
2025-11-13 03:13:59 +09:00
Yu Watanabe 6431f2e072 musl: time-util: introduce get_tzname() helper function
musl leaves the DST timezone name unset if there is no DST.
The helper function maps that back to no DST.
2025-11-13 03:13:55 +09:00
Yu Watanabe 3ac4d68498 musl: time-util: make parse_gmtoff() accept extended timezone offset format
musl v1.2.5 does not support %z specifier in strptime(). Since
https://github.com/kraj/musl/commit/fced99e93daeefb0192fd16304f978d4401d1d77
%z is supported, but it only supports strict RFC-822/ISO 8601 format,
that is, 4 digits with sign (e.g. +0900 or -1400), but does not support
extended format: 2 digits or colon separated 4 digits (e.g. +09 or -14:00).
Let's add fallback logic to make it support the extended timezone spec.
2025-11-13 02:40:32 +09:00
Daan De Meyer d82d500b40 Migrate various tests to new assertion macros (#39691)
Split out of #39608
2025-11-12 16:17:38 +01:00
Mike Yuan 8be3780699 core/dbus-service: validate type of received ExecContext fds 2025-11-12 15:44:51 +01:00
Mike Yuan 51bb3a0932 logind-session-dbus: use fd_vet_accmode() where appropriate 2025-11-12 15:44:50 +01:00
Mike YuanandChris Down 2c5d73660e test-fd-util: add unit test for fd_vet_accmode()
Co-authored-by: Chris Down <chris@chrisdown.name>
2025-11-12 15:44:50 +01:00
Mike Yuan 7cf4f07567 fd-util: introduce fd_vet_accmode()
Inspired by #39674
2025-11-12 15:44:50 +01:00
Yu Watanabe 733c5c98ad sd-journal: resolve paths passed to sd_journal_open_files() and friends
Fixes #38667.
2025-11-12 15:18:40 +01:00
Yu Watanabe 09811f99f4 sd-journal: use -EBADF for invalidated file descriptor 2025-11-12 15:18:40 +01:00
Daan De Meyer e81dc81a5c test-rm-rf: Migrate to new assertion macros 2025-11-12 14:24:14 +01:00
Daan De Meyer 13027e040a test-bus-chat: Migrate to TEST() and new assertion macros
- Also contains various other small cleanups
2025-11-12 14:24:14 +01:00
Daan De Meyer e59ed77e13 test-bus-watch-bind: Migrate to new assertion macros 2025-11-12 14:24:14 +01:00
Daan De Meyer 0fd7280fbc test-bus-server: Migrate to new assertion macros 2025-11-12 14:24:14 +01:00
Daan De Meyer 4fd7bec2c9 test-bus-peersockaddr: Migrate to new assertion macros 2025-11-12 14:24:12 +01:00
Daan De Meyer 491706368b test-bus-objects: Migrate to new assertion macros 2025-11-12 14:20:24 +01:00
Daan De Meyer 6b136bcd02 test-event: Migrate to new assertion macros 2025-11-12 14:20:24 +01:00
Daan De Meyer 0d21ab7377 tests: Return result from some ASSERT() macros 2025-11-12 14:20:24 +01:00
Zbigniew Jędrzejewski-Szmek 3b3113b87c locale-util: two fixlets for supporting musl (#39689) 2025-11-12 10:38:29 +01:00
Yu Watanabe 6b656a5b40 test-bus-error: use STRERROR() at several more places 2025-11-12 14:17:44 +08:00
Yu Watanabe 9b55c4b859 tree-wide: drop redundant inclusion of linux/prctl.h
sys/prctl.h anyway includes linux/prctl.h and actually these .c files
includes sys/prctl.h. Hence, it is not necessary to explicitly include
linux/prctl.h.
2025-11-12 14:17:44 +08:00
Yu Watanabe 907ce9c315 libc: drop unnecessary __THROW attribute
It is for C++, not necessary for us.
2025-11-12 14:17:44 +08:00
Yu Watanabe 361beb82a5 musl: locale-util: explicitly check existence of locale file
musl's newlocale() always provides a locale object even the requested
locale does not exist. Let's explicitly check the existence of the
requested locale file.
2025-11-12 11:43:13 +09:00
Yu Watanabe b2a2f670ae musl: locale-util: introduce musl specific locale enumerator
Both add_locales_from_archive() and add_locales_from_libdir() are glibc
specific, and the logic cannot be applied when built with musl.
2025-11-12 11:43:13 +09:00
Yu Watanabe a2366debce core/exec-credentials: port to new mount API, ensure atomicity for creds installation (#39637) 2025-11-12 09:00:23 +09:00
Yu Watanabe 19db9a99e6 systemctl: fix edit and cat verbs with --global flag (#39606)
The --global flag has been broken since commit 
d77d42ed3a, which added a
blanket restriction on acquiring D-Bus connections when
arg_runtime_scope is RUNTIME_SCOPE_GLOBAL. This was done to prevent
crashes, but inadvertently broke legitimate use cases like 'systemctl
edit --global' and 'systemctl cat --global'.

The issue is that verb_edit() and verb_cat() were unconditionally
calling acquire_bus(), which triggers the restriction and fails with
"--global is not supported for this operation."

This commit fixes the issue by making bus acquisition conditional,
following the same pattern used in verb_enable():

- Only acquire the bus when install_client_side() returns NO (i.e., for
system and user scopes)
- For client-side operations (--global, --root, etc.), skip bus
acquisition and use mangle_names() instead of expand_unit_names()
- Update find_paths_to_edit() and verb_cat() to handle NULL bus by
forcing client-side path lookups
- Skip bus-dependent checks (unit_is_masked, need_daemon_reload) when
bus is NULL

This allows both 'systemctl edit --global' and 'systemctl cat --global'
to work correctly by performing all operations client-side without
requiring a connection to the system or user manager.

Fixes #31272
2025-11-12 08:59:06 +09:00
Yu Watanabe a1cb4fae86 sd-path: add new type SD_PATH_SEARCH_SYSCTL (#38680)
Aim of this patches set, is to add a new type SD_PATH_SEARCH_SYSCTL for
sd_path_lookup() and sd_path_lookup_strv(). This new type is used to get the
directories list used by systemd-sysctl:

-  /etc/sysctl.d/
-  /run/sysctl.d/
-  /usr/local/lib/sysctl.d/
-  /usr/lib/sysctl.d/

This implements the change in libsystemd, systemd-path, and systemd-sysctl.
2025-11-12 08:54:09 +09:00
Goffredo Baroncelli f379784550 systemd-sysctl: add SD_PATH_SEARCH_SYSCTL
Update systemd-sysctl to use libsystemd with the new type
SD_PATH_SEARCH_SYSCTL to get the directories list from which
load the .conf files.
2025-11-12 08:49:55 +09:00