]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
14 months agoman: further shorten print-unit-path example
Luca Boccassi [Wed, 29 Mar 2023 20:45:10 +0000 (21:45 +0100)] 
man: further shorten print-unit-path example

14 months agoman: link up new online coredump docs from man page
Lennart Poettering [Thu, 30 Mar 2023 14:44:31 +0000 (16:44 +0200)] 
man: link up new online coredump docs from man page

14 months agoMerge pull request #27074 from bluca/revert_rm
Luca Boccassi [Thu, 30 Mar 2023 17:07:27 +0000 (18:07 +0100)] 
Merge pull request #27074 from bluca/revert_rm

Revert rm-rf changes that are causing test failures

14 months agoRevert "rm-rf: also chmod() directory if it cannot be opened" 27074/head
Luca Boccassi [Thu, 30 Mar 2023 15:48:22 +0000 (16:48 +0100)] 
Revert "rm-rf: also chmod() directory if it cannot be opened"

This reverts commit 808c8b25eece33c503430151641f5f77676af38c.

14 months agoRevert "test: add more testcases for rm_rf()"
Luca Boccassi [Thu, 30 Mar 2023 15:48:18 +0000 (16:48 +0100)] 
Revert "test: add more testcases for rm_rf()"

This reverts commit 0278b1c80101cc0d857c1becd0c3a51b2eb14a44.

14 months agopid1: fully disable coredumping to $PWD
Zbigniew Jędrzejewski-Szmek [Thu, 30 Mar 2023 08:04:18 +0000 (10:04 +0200)] 
pid1: fully disable coredumping to $PWD

We have three states:
- ENABLE_COREDUMP and systemd-coredump is installed,
- ENABLE_COREDUMP but systemd-coredump is not installed,
- !ENABLE_COREDUMP.

In the last case we would not do any coredumping-related setup in pid1, which
means that coredumps would go to to the working directory of the process, but
actually limits are set to 0. This is inherited by children of pid1.

As discussed extensively in https://github.com/systemd/systemd/pull/26607, this
default is bad: dumps are written to arbitrary directories and not cleaned up.

Nevertheless, the kernel cannot really fix it. It doesn't know where to write,
and it doesn't know when that place would become available. It is only the
userspace that can tell this to the kernel. So the only sensible change in the
kernel would be to default to '|/bin/false', i.e. do what we do now.

In the middle case, we disabled writing of coredumps via a pattern, but raise
the RLIMIT_CORE. We need to raise the limit because we can't raise it later
after processes have been forked off. This means we behave correctly, but allow
coredumping to be enabled at a later point without a reboot.

This patch makes the last case behave like the middle case. This means that
even if systemd is compiled with systemd-coredump, it still does the usual
setup. If users want to restore the kernel default, they need to provide two
drop-in files:
  for sysctl.d, with 'kernel.core_pattern=core'
  for systemd.conf, with 'DefaultLimitCORE=0'.

The general idea is that pid1 does the safe thing. A distro may want to use
something different than the systemd-coredump machinery, and then that would
could packaged together with the drop-ins to change the configuration.

Alternative-for: #26607

14 months agodocs: add a document with an overview over systemd's coredump handling
Lennart Poettering [Thu, 30 Mar 2023 09:50:27 +0000 (11:50 +0200)] 
docs: add a document with an overview over systemd's coredump handling

14 months agobasic: update the Arch tuples for LoongArch
Xiaotian Wu [Tue, 8 Mar 2022 03:15:25 +0000 (11:15 +0800)] 
basic: update the Arch tuples for LoongArch

After this commit[1], LoongArch now uses these Multiarch specs:

- Double float: loongarch64-linux-gnu
- Single float: loongarch64-linux-gnuf32
- Soft float: loongarch64-linux-gnusf

You can visit here[2] to view the full documentation.

[1]: https://github.com/loongson/LoongArch-Documentation/commit/55dbaadaaa90b5f5d08a74d96b866af42c8c3c82
[2]: https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html

14 months agoMerge pull request #26883 from yuwata/rm-rf
Zbigniew Jędrzejewski-Szmek [Thu, 30 Mar 2023 12:54:59 +0000 (14:54 +0200)] 
Merge pull request #26883 from yuwata/rm-rf

rm-rf: also chmod directory if cannot be opened

14 months agotmpfiles: Try to take a BSD lock on files as well
Daan De Meyer [Tue, 28 Mar 2023 09:05:46 +0000 (11:05 +0200)] 
tmpfiles: Try to take a BSD lock on files as well

Similar to what we do for directories, just before we remove a file,
let's try to take a BSD lock on it. If that fails, skip removing the
file.

14 months agoMerge pull request #27064 from DaanDeMeyer/chase-fixes
Daan De Meyer [Thu, 30 Mar 2023 09:44:33 +0000 (11:44 +0200)] 
Merge pull request #27064 from DaanDeMeyer/chase-fixes

Chase fixes

14 months agoMerge pull request #27063 from yuwata/chase-graceful
Daan De Meyer [Thu, 30 Mar 2023 09:44:17 +0000 (11:44 +0200)] 
Merge pull request #27063 from yuwata/chase-graceful

chase: gracefully drop CHASE_AT_RESOLVE_IN_ROOT when AT_FDCWD is specified

14 months agoMerge pull request #27041 from poettering/fdstore-dump
Daan De Meyer [Thu, 30 Mar 2023 07:32:13 +0000 (09:32 +0200)] 
Merge pull request #27041 from poettering/fdstore-dump

add ability to show contents of service fdstore + teach systemd-notify passing fds into the fdstore

14 months agochase: add CHASE_AT_RESOLVE_IN_ROOT only when it is necessary 27063/head
Yu Watanabe [Thu, 30 Mar 2023 07:15:19 +0000 (16:15 +0900)] 
chase: add CHASE_AT_RESOLVE_IN_ROOT only when it is necessary

14 months agochase: drop CHASE_AT_RESOLVE_IN_ROOT when AT_FDCWD or root dir fd is specified
Yu Watanabe [Thu, 30 Mar 2023 04:15:59 +0000 (13:15 +0900)] 
chase: drop CHASE_AT_RESOLVE_IN_ROOT when AT_FDCWD or root dir fd is specified

If we get AT_FDCWD or root dir fd, we always resolve symlinks relative to the host's root.
Hence, the flag is meaningless.

14 months agotest-kernel-install: several cleanups
Yu Watanabe [Mon, 27 Mar 2023 19:14:03 +0000 (04:14 +0900)] 
test-kernel-install: several cleanups

- allow to run without $PROJECT_BUILD_ROOT,
- drop unnecessary export for bootctl,
- enable -x option to show commands,
- use 'test ! -e' to check the nonexistence of files,
- show more debugging logs.

14 months agoman: drop trailing space and mention uki_generator at one more place
Yu Watanabe [Wed, 29 Mar 2023 01:50:01 +0000 (10:50 +0900)] 
man: drop trailing space and mention uki_generator at one more place

Follow-up for 600362aa11af5af90125aacc8ad7612a5cb80a68.

14 months agochase: Simplify chase_and_open() and chase_and_openat() 27064/head
Daan De Meyer [Fri, 24 Mar 2023 19:50:48 +0000 (20:50 +0100)] 
chase: Simplify chase_and_open() and chase_and_openat()

xopenat() now calls fd_reopen() if an empty path is specified, so
let's make use of that to simplify the chase open helpers.

14 months agofs-util: Strip O_NOFOLLOW in xopenat() when calling fd_reopen()
Daan De Meyer [Fri, 24 Mar 2023 19:48:23 +0000 (20:48 +0100)] 
fs-util: Strip O_NOFOLLOW in xopenat() when calling fd_reopen()

We definitely want to follow symlinks when calling fd_reopen() so
let's strip O_NOFOLLOW when we call it from xopenat().

14 months agochase: Fix error code check
Daan De Meyer [Fri, 24 Mar 2023 19:47:41 +0000 (20:47 +0100)] 
chase: Fix error code check

14 months agochase: Fix formatting
Daan De Meyer [Fri, 24 Mar 2023 19:17:03 +0000 (20:17 +0100)] 
chase: Fix formatting

14 months agoMerge pull request #27062 from yuwata/chase-trivial
Daan De Meyer [Thu, 30 Mar 2023 06:45:38 +0000 (08:45 +0200)] 
Merge pull request #27062 from yuwata/chase-trivial

chase: trivial cleanups

14 months agoservice: drop redundant unit_ref_unset() call
Lennart Poettering [Wed, 29 Mar 2023 20:04:26 +0000 (22:04 +0200)] 
service: drop redundant unit_ref_unset() call

The immediately preceeding service_close_socket_fd() call does that
internally anyway. No need to do this again right after.

14 months agoMerge pull request #27060 from yuwata/fd-get-path
Daan De Meyer [Thu, 30 Mar 2023 05:59:25 +0000 (07:59 +0200)] 
Merge pull request #27060 from yuwata/fd-get-path

fd-util: make fd_get_path() support AT_FDCWD

14 months agochase: fix indentation 27062/head
Yu Watanabe [Thu, 30 Mar 2023 04:14:48 +0000 (13:14 +0900)] 
chase: fix indentation

14 months agochase: fix comment
Yu Watanabe [Thu, 30 Mar 2023 04:13:57 +0000 (13:13 +0900)] 
chase: fix comment

14 months agoMerge pull request #27061 from yuwata/test-chase
Daan De Meyer [Thu, 30 Mar 2023 05:17:40 +0000 (07:17 +0200)] 
Merge pull request #27061 from yuwata/test-chase

test: split out tests for chase() and friends

14 months agotest: split-out tests for chase() and friends to test-chase.c 27061/head
Yu Watanabe [Thu, 30 Mar 2023 03:15:28 +0000 (12:15 +0900)] 
test: split-out tests for chase() and friends to test-chase.c

14 months agotest: rename test-chase -> test-chase-manual
Yu Watanabe [Thu, 30 Mar 2023 03:13:55 +0000 (12:13 +0900)] 
test: rename test-chase -> test-chase-manual

14 months agofd-util: make fd_get_path() support AT_FDCWD 27060/head
Yu Watanabe [Thu, 30 Mar 2023 02:42:21 +0000 (11:42 +0900)] 
fd-util: make fd_get_path() support AT_FDCWD

14 months agotest: add tests for fd_get_path()
Yu Watanabe [Thu, 30 Mar 2023 01:57:04 +0000 (10:57 +0900)] 
test: add tests for fd_get_path()

14 months agounits: let's establish the coredump socket before writting core_pattern sysctl
Lennart Poettering [Wed, 29 Mar 2023 16:06:00 +0000 (18:06 +0200)] 
units: let's establish the coredump socket before writting core_pattern sysctl

It's a bit nicer if we only write the sysctl core_pattern once the
coredump socket is established, since it's the backend for the handler.

Given the systemd-coredump.socket basically has no dependencies that run
before it this should not really make things slower or so, it just
removes the tiny window where core pattern is in effect that wants to
connect to the backend socket but cannot.

The status quo isn't terrible, and not too different in effect: either
way, until the socket unit is up we won't process coredumps. It's mostly
what kind of behaviour you get then: an error due to /bin/false being
invoked, or an error because systemd-coredump can't connect to its
socket. After this patch we'll exclusively see the former.

14 months agoMerge pull request #27053 from DaanDeMeyer/firstboot-followups
Mike Yuan [Wed, 29 Mar 2023 20:22:16 +0000 (04:22 +0800)] 
Merge pull request #27053 from DaanDeMeyer/firstboot-followups

Firstboot followups

14 months agoMerge pull request #26971 from poettering/autostart-dead-failed
Lennart Poettering [Wed, 29 Mar 2023 19:41:31 +0000 (21:41 +0200)] 
Merge pull request #26971 from poettering/autostart-dead-failed

pid1: introduce new SERVICE_{DEAD|FAILED}_BEFORE_AUTO_RESTART service…

14 months agoMerge pull request #26968 from DaanDeMeyer/exec-runtime
Lennart Poettering [Wed, 29 Mar 2023 19:40:48 +0000 (21:40 +0200)] 
Merge pull request #26968 from DaanDeMeyer/exec-runtime

core: Introduce unit private exec runtime

14 months agoupdate TODO 27041/head
Lennart Poettering [Tue, 28 Mar 2023 09:39:44 +0000 (11:39 +0200)] 
update TODO

14 months agotest: add test case for fdstore dumping logic, and systemd-notify --fd=
Lennart Poettering [Tue, 28 Mar 2023 16:28:15 +0000 (18:28 +0200)] 
test: add test case for fdstore dumping logic, and systemd-notify --fd=

14 months agonotify: add support for sending fds with notification messages
Lennart Poettering [Tue, 28 Mar 2023 09:17:44 +0000 (11:17 +0200)] 
notify: add support for sending fds with notification messages

This exposes the fd passing we support via sd_pid_notify_with_fds() also
via the command line tool systemd-notify.

14 months agofdset: add new fdset_consume() helper
Lennart Poettering [Wed, 29 Mar 2023 16:52:25 +0000 (18:52 +0200)] 
fdset: add new fdset_consume() helper

14 months agofdset: add new helper to convert an fdset to an array
Lennart Poettering [Tue, 28 Mar 2023 09:17:23 +0000 (11:17 +0200)] 
fdset: add new helper to convert an fdset to an array

14 months agofdset: minor modernizations
Lennart Poettering [Tue, 28 Mar 2023 08:26:56 +0000 (10:26 +0200)] 
fdset: minor modernizations

Let's use more _cleanup_ expressions. Various other modernizations. No
actual code changes, except for maybe a conversion to use heap memory
when generating an array of fds, instead of stack as before. Given that
fdstores are typically user controlled, that should be a wise idea.

14 months agoanalyze: add new fdstore verb
Lennart Poettering [Mon, 27 Mar 2023 16:16:03 +0000 (18:16 +0200)] 
analyze: add new fdstore verb

14 months agopid1: add DumpFileDescriptorStore() bus call that returns fdstore content info
Lennart Poettering [Mon, 27 Mar 2023 16:16:40 +0000 (18:16 +0200)] 
pid1: add DumpFileDescriptorStore() bus call that returns fdstore content info

14 months agoformat-table: add new cell type for displaying major/minor devnums
Lennart Poettering [Mon, 27 Mar 2023 16:14:39 +0000 (18:14 +0200)] 
format-table: add new cell type for displaying major/minor devnums

14 months agoformat-table: add inode type cell type
Lennart Poettering [Mon, 27 Mar 2023 16:14:02 +0000 (18:14 +0200)] 
format-table: add inode type cell type

14 months agofd-util: add helper for converting O_RDONLY/WRONLY/RDWR to strings
Lennart Poettering [Mon, 27 Mar 2023 19:57:53 +0000 (21:57 +0200)] 
fd-util: add helper for converting O_RDONLY/WRONLY/RDWR to strings

14 months agodevnum-util: add new devnum_is_zero() helper
Lennart Poettering [Mon, 27 Mar 2023 16:11:18 +0000 (18:11 +0200)] 
devnum-util: add new devnum_is_zero() helper

14 months agostat-util: add inode_type_to_string() helper for showing mode_t inode type as string
Lennart Poettering [Mon, 27 Mar 2023 16:08:27 +0000 (18:08 +0200)] 
stat-util: add inode_type_to_string() helper for showing mode_t inode type as string

14 months agofirstboot: Refactor should_configure() 27053/head
Daan De Meyer [Wed, 29 Mar 2023 16:03:32 +0000 (18:03 +0200)] 
firstboot: Refactor should_configure()

14 months agofirstboot: Check for errors returned by dir_fd_is_root()
Daan De Meyer [Wed, 29 Mar 2023 15:59:50 +0000 (17:59 +0200)] 
firstboot: Check for errors returned by dir_fd_is_root()

14 months agouser-util: Rename ETC_PASSWD_LOCK_NAME to ETC_PASSWD_LOCK_FILENAME
Daan De Meyer [Wed, 29 Mar 2023 15:52:35 +0000 (17:52 +0200)] 
user-util: Rename ETC_PASSWD_LOCK_NAME to ETC_PASSWD_LOCK_FILENAME

14 months agopid1: add debug log about selected restart interval 26971/head
Lennart Poettering [Tue, 28 Mar 2023 20:25:51 +0000 (22:25 +0200)] 
pid1: add debug log about selected restart interval

14 months agopid1: introduce new SERVICE_{DEAD|FAILED}_BEFORE_AUTO_RESTART service substates
Lennart Poettering [Fri, 24 Mar 2023 15:04:34 +0000 (16:04 +0100)] 
pid1: introduce new SERVICE_{DEAD|FAILED}_BEFORE_AUTO_RESTART service substates

When a service deactivates and is then automatically restarted via
Restart= we currently quickly transition through
SERVICE_DEAD/SERVICE_FAILED. Which is weird given it's not the
normal ("permanent") dead/failed state, but a transitory one we
immediately leave from again. We do this so that software that looks for
failures/successes can take notice, even if we restart as a consequence
of the deactivation.

Let's clean this up a bit: let's introduce two new states:
SERVICE_DEAD_BEFORE_AUTO_RESTART and SERVICE_FAILED_BEFORE_AUTO_RESTART
that are used for the transitory states. Both the SERVICE_DEAD and
SERVICE_DEAD_BEFORE_AUTO_RESTART will map to the high-level
UNIT_INACTIVE state though. (and similar for the respective failed
states). This means the high-level state machine won't change by this,
only the low-level one.

This clearly seperates the substates, which makes the state engine
cleaner, and allows clients to follow precisely whether we are in a
transitory dead/failed state, or a permanent one, by looking at the
service substate. Moreover it allows us to remove the 'n_keep_fd_store'
which so far we used to ensure the fdstore was not released during this
transitory dead/failed state but only during the permanent one. Since we
can now distinguish these states properly we can just use that.

This has been bugging me for a while. Let's clean this up.

Note that the unit restart logic is already nicely covered in the
testsiute, hence this adds no new tests for that.

And yes, this could be considered a compat break, but sofar we took the
liberty to make changes to the low-level state machine (i.e. SERVICE_xyz
states, sometimes called "substates") without considering this a bad
breakage – the high-level state machine (i.e.  UNIT_xyz states) should
be considered API that cannot be changed.

14 months agoMerge pull request #26707 from DaanDeMeyer/firstboot-modernize
Zbigniew Jędrzejewski-Szmek [Wed, 29 Mar 2023 15:08:44 +0000 (17:08 +0200)] 
Merge pull request #26707 from DaanDeMeyer/firstboot-modernize

firstboot: modernize path handling

14 months agomkosi: Drop python-docutils 27065/head
Daan De Meyer [Wed, 29 Mar 2023 11:57:52 +0000 (13:57 +0200)] 
mkosi: Drop python-docutils

We don't seem to use anything from python-docutils at all, so let's
drop the dependency.

14 months agoMerge pull request #27049 from DaanDeMeyer/update-mkosi
Daan De Meyer [Wed, 29 Mar 2023 11:48:37 +0000 (13:48 +0200)] 
Merge pull request #27049 from DaanDeMeyer/update-mkosi

mkosi: Update to latest

14 months agomkosi: Update to latest 27049/head
Daan De Meyer [Wed, 29 Mar 2023 08:42:23 +0000 (10:42 +0200)] 
mkosi: Update to latest

- Drop Netdev= as it was removed in mkosi
- Always install python-psutil in the final image (required for networkd tests)
- Always Install python-pytest in the final image (required for ukify tests)
- Use the narrow glob for all centos python packages
- Drop the networkd mkosi config files (the default image can be used instead)
- Use ".conf" as the mkosi config file suffix everywhere
- Copy src/ to /root/src in the final image and set gdb substitute path in
  .gdbinit to make gdb work properly

14 months agoMerge pull request #27020 from 1awesomeJ/nit
Luca Boccassi [Wed, 29 Mar 2023 11:24:08 +0000 (12:24 +0100)] 
Merge pull request #27020 from 1awesomeJ/nit

systemd-cryptenroll: adding integration test cases

14 months agotest: Install systemd-networkd-tests.py when install_tests is enabled
Daan De Meyer [Wed, 29 Mar 2023 10:15:24 +0000 (12:15 +0200)] 
test: Install systemd-networkd-tests.py when install_tests is enabled

14 months agomkosi: Update to latest
Daan De Meyer [Wed, 29 Mar 2023 08:42:23 +0000 (10:42 +0200)] 
mkosi: Update to latest

- ACLs are not set on generated directories anymore by default, so
we enable them explictly now so that when running unprivileged mkosi,
the user running mkosi can remove all generated files and directories.
- We don't explicitly set QemuHeadless= anymore as the option was removed
and made the default.
- We set the loglevel= kernel cmdline argument explicitly now as mkosi
doesn't set it by default anymore.

14 months agoudev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify
Dmitry V. Levin [Tue, 28 Mar 2023 20:00:00 +0000 (20:00 +0000)] 
udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify

Make sure the ENOENT exception reintroduced by commit
9db7081d83d56cd2523b03f9eb9d67ef1c93c55f is not applied when the parser
is invoked by udevadm verify.

14 months agofirstboot: Modernize path handling 26707/head
Daan De Meyer [Thu, 22 Dec 2022 13:29:13 +0000 (14:29 +0100)] 
firstboot: Modernize path handling

Let's open a file descriptor to the root directory and perform all
path operations using that file descriptor. On top of that, let's
make sure we pin the directory containing the file we want to work
on and use atomic copies and writes everywhere we can..

14 months agouser-util: Add ETC_PASSWD_LOCK_NAME
Daan De Meyer [Thu, 9 Mar 2023 12:06:45 +0000 (13:06 +0100)] 
user-util: Add ETC_PASSWD_LOCK_NAME

14 months agolog: Add LOG_SET_PREFIX() macro
Daan De Meyer [Mon, 27 Mar 2023 14:55:17 +0000 (16:55 +0200)] 
log: Add LOG_SET_PREFIX() macro

LOG_SET_PREFIX() sets a logging prefix for the current block. The
prefix is prepended to every logging message in the block, followed
by ": ". If a logging prefix is already configured, it is overridden
for the duration of the block, after which it is restored.

A use case for this macro is when we're operating on an image or
directory (using --root or --image). We can use LOG_SET_PREFIX() to
prefix all logging messages with the directory or image that we're
operating on.

14 months agoTEST-80: synchronize explicitly instead of by time
Lennart Poettering [Tue, 28 Mar 2023 14:35:35 +0000 (16:35 +0200)] 
TEST-80: synchronize explicitly instead of by time

This removes "sleep" invocations, and makes the notify access testcase a
lot more robust to runtime jitter. We use a pair of fifos in the fs to
sync instead.

Also various other improvoements, including comments.

(Also removes the unnecessary "no-qemu" restriction)

14 months agotest: do not remove state directory on failure
Luca Boccassi [Tue, 28 Mar 2023 23:07:45 +0000 (00:07 +0100)] 
test: do not remove state directory on failure

The test log is in the state directory, and we want to keep it around
when a test fails.

Follow-up for: 256a835f1c6c646a55039659aa2db186fbeb5c5d

14 months agoMerge pull request #27046 from bluca/shellcheck
Yu Watanabe [Wed, 29 Mar 2023 03:58:31 +0000 (12:58 +0900)] 
Merge pull request #27046 from bluca/shellcheck

Fix some shellcheck warnings

14 months agoMerge pull request #27040 from keszybz/empty-path-skip-cleanup
Yu Watanabe [Wed, 29 Mar 2023 01:18:06 +0000 (10:18 +0900)] 
Merge pull request #27040 from keszybz/empty-path-skip-cleanup

Restore silent skipping of missing rules files by udev

14 months agotest: fix shellcheck warnings in test-sysusers.sh 27046/head
Luca Boccassi [Wed, 29 Mar 2023 00:10:15 +0000 (01:10 +0100)] 
test: fix shellcheck warnings in test-sysusers.sh

14 months agoman: fix shellcheck warning for html.in
Luca Boccassi [Wed, 29 Mar 2023 00:17:50 +0000 (01:17 +0100)] 
man: fix shellcheck warning for html.in

SC2015: Note that A && B || C is not if-then-else. C may run when A is true.

14 months agoMerge pull request #27042 from fbuihuu/fixes-for-testsuite-74-mount
Luca Boccassi [Wed, 29 Mar 2023 00:54:30 +0000 (01:54 +0100)] 
Merge pull request #27042 from fbuihuu/fixes-for-testsuite-74-mount

Fixes for testsuite 74 mount

14 months agoadded more test cases 27020/head
OMOJOLA JOSHUA DAMILOLA [Mon, 27 Mar 2023 15:24:03 +0000 (15:24 +0000)] 
added more test cases

14 months agoman: correct/tweak text about unit name syntax
Lennart Poettering [Tue, 28 Mar 2023 21:25:52 +0000 (23:25 +0200)] 
man: correct/tweak text about unit name syntax

Unit names can be 255 characters long, not 256.

We first say "name prefix" and then continue with "unit prefix".
Confusing. Couldn't figure out which term is better hence settled on
"unit name prefix".

14 months agotest: fix regexp in testsuite-74.mount.sh 27042/head
Franck Bui [Tue, 28 Mar 2023 18:41:38 +0000 (20:41 +0200)] 
test: fix regexp in testsuite-74.mount.sh

Several whitespaces can separate "ext4" and "sd-mount-test" strings.

14 months agoMerge pull request #27035 from DaanDeMeyer/ukify-align
Daan De Meyer [Tue, 28 Mar 2023 17:45:04 +0000 (19:45 +0200)] 
Merge pull request #27035 from DaanDeMeyer/ukify-align

ukify: Add workarounds for older stubs

14 months agotest: don't go through all time zones if slow tests are disabled
Frantisek Sumsal [Tue, 28 Mar 2023 10:36:23 +0000 (12:36 +0200)] 
test: don't go through all time zones if slow tests are disabled

Let's skip going through all locally available time zones if we're built
with slow tests disabled, as that's quite slow, but do at least one test
with the UTC zone.

14 months agoMerge pull request #27030 from keszybz/bustctl-show-property-values-in-full
Luca Boccassi [Tue, 28 Mar 2023 17:14:49 +0000 (18:14 +0100)] 
Merge pull request #27030 from keszybz/bustctl-show-property-values-in-full

bustctl: show property values in full

14 months agotest: drop extraneous bracket in testsuite-74.mount.sh
Franck Bui [Tue, 28 Mar 2023 17:00:41 +0000 (19:00 +0200)] 
test: drop extraneous bracket in testsuite-74.mount.sh

14 months agoshared/exec-util: null_or_empty_path() does not return boolean 27040/head
Zbigniew Jędrzejewski-Szmek [Tue, 28 Mar 2023 16:50:31 +0000 (18:50 +0200)] 
shared/exec-util: null_or_empty_path() does not return boolean

We shouldn't report that the file is empty if the stating fails. Let's do the
same as in other places, and just ignore the error and let the subsequent
operation fail.

14 months agoMerge pull request #26941 from bluca/portable_version
Luca Boccassi [Tue, 28 Mar 2023 16:49:52 +0000 (17:49 +0100)] 
Merge pull request #26941 from bluca/portable_version

portable: introduce SYSEXT_ fields to identify sysexts, and include more metadata in log messages via LogExtraFields=

14 months agobasic/stat-util: remove unused null_or_empty_fd()
Zbigniew Jędrzejewski-Szmek [Tue, 28 Mar 2023 16:44:40 +0000 (18:44 +0200)] 
basic/stat-util: remove unused null_or_empty_fd()

14 months agoRevert "udev_rules_parse_file: do not skip ENOENT"
Zbigniew Jędrzejewski-Szmek [Tue, 28 Mar 2023 16:42:24 +0000 (18:42 +0200)] 
Revert "udev_rules_parse_file: do not skip ENOENT"

This reverts commit 42a467b55219384c7c3b137ab3cc8b6a309a8a14.

We need to skip -ENOENT when loading udev rules because new files with rules
may be added or removed at any time, and the loading of rules is triggered
asynchronously. Even though the window is fairly narrow, udev shouldn't throw
an error if a rules file is removed.

14 months agoukify: Add workarounds for older stubs 27035/head
Daan De Meyer [Tue, 28 Mar 2023 11:32:03 +0000 (13:32 +0200)] 
ukify: Add workarounds for older stubs

Older stubs are either not stripped, causing their total size to be
unaligned because of an unaligned symbol table at the end, or stripped,
causing the raw data pointers and sizes to be unaligned because strip
does not follow the PE spec correctly when stripping. Let's add
workarounds for both issues, so that we can use ukify with older stubs
as well.

14 months agoprocess-util: introduce get_process_cmdline_strv()
Yu Watanabe [Wed, 22 Mar 2023 16:05:38 +0000 (01:05 +0900)] 
process-util: introduce get_process_cmdline_strv()

The reason why get_process_cmdline() is so complicated is that we
need to escape and quote arguments for building a single result
string.

That's necessary when we want to log or print the command line.
However, when we want to parse the command line, it is not necessary
that the result is a single string, but can be strv.

This will be used when we parse the command line.

14 months agoRevert "ukify: Weaken file alignment assertions"
Daan De Meyer [Tue, 28 Mar 2023 11:31:38 +0000 (13:31 +0200)] 
Revert "ukify: Weaken file alignment assertions"

This reverts commit 23428bb19e49cf510c65e2896f1a7e4b12ca1dbc.

14 months agoos-release: add 'SYSEXT_' fields for version/id 26941/head
Luca Boccassi [Fri, 24 Mar 2023 15:10:11 +0000 (15:10 +0000)] 
os-release: add 'SYSEXT_' fields for version/id

sysext DDI cannot carry an os-release file, but have to carry
an extension-release file. But so far, this was only used to
match the sysext DDI with the base DDI/rootdir. It is also
useful to describe the sysext DDI itself, just like we do in
os-release.

So document that the same fields used in os-release can also
be added to an extension-release, with the 'SYSEXT_' prefix,
and in that case they are understood to define the sysext DDI
itself, rather than for matching purposes.

14 months agoportablectl: display sysext-specific fields
Luca Boccassi [Tue, 28 Mar 2023 09:36:49 +0000 (10:36 +0100)] 
portablectl: display sysext-specific fields

The wrong fields were being displayed, if at all.
ID and VERSION_ID in sysexts are used for matching, they
don't identify the sysext itself. Parse the newly defined
fields and display them separately from the compatibility
fields.

Before:

Image:
        /home/bluca/git/systemd/base.raw
Portable Service:
        n/a
Operating System:
        Debian GNU/Linux 10 (buster)
Extension:
        /home/bluca/git/systemd/app0.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Operating System:
                n/a (debian 10)
Extension:
        /home/bluca/git/systemd/app1.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Operating System:
                n/a (debian 10)
Unit files:
        app0.service
        app1.service

After:

Image:
        /home/bluca/git/systemd/base.raw
Portable Service:
        n/a
Operating System:
        Debian GNU/Linux 10 (buster)
Extension:
        /home/bluca/git/systemd/app0.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Extension Compatibility OS:
                debian
        Extension Compatibility OS Version:
                10
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Extension Image:
                ID: app Version: 0
Extension:
        /home/bluca/git/systemd/app1.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Extension Compatibility OS:
                debian
        Extension Compatibility OS Version:
                10
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Extension Image:
                ID: app Version: 1
Unit files:
        app0.service
        app1.service

14 months agoportable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=
Luca Boccassi [Thu, 23 Mar 2023 01:23:04 +0000 (01:23 +0000)] 
portable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=

This is useful to identify log messages with metadata from the images
they run on. Look for ID/VERSION_ID/IMAGE_ID/IMAGE_VERSION/BUILD_ID,
with a SYSEXT_ prefix if we are looking at an extension, and append via
LogExtraFields= as respectively PORTABLE_NAME_AND_VERSION= in case of a
single image. In case of extensions, append as PORTABLE_ROOT_NAME_AND_VERSION=
for the base and one PORTABLE_EXTENSION_AND_VERSION= for each extension.

Example with a base and two extensions, with the unit coming from the
first extension:

[Service]
RootImage=/home/bluca/git/systemd/base.raw
Environment=PORTABLE=app0.raw
BindReadOnlyPaths=/etc/os-release:/run/host/os-release
LogExtraFields=PORTABLE=app0.raw
Environment=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT_NAME_AND_VERSION=debian_10

ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_0

ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_1

14 months agobusctl: also assume --full if not writing to terminal 27030/head
Zbigniew Jędrzejewski-Szmek [Tue, 28 Mar 2023 09:55:21 +0000 (11:55 +0200)] 
busctl: also assume --full if not writing to terminal

If people grep the output, it probably shouldn't be ellipsized.

14 months agoportable: include base and extension images in log fields
Luca Boccassi [Wed, 22 Mar 2023 22:44:31 +0000 (22:44 +0000)] 
portable: include base and extension images in log fields

When a portable service uses extensions, we use the 'main' image name
(the one where the unit was found in) as PORTABLE=. It is useful to
also list all the images actually used at runtime, as they might
contain libraries and so on.

Use PORTABLE_ROOT= for the image/directory that is used as RootImage=
or RootDirectory=, and PORTABLE_EXTENSION= for the image/directory that
is used as ExtensionImages= or ExtensionDirectories=.

Note that these new fields are only added if extensions are used,
there's no change for single-DDI portables.

Example with a base and two extensions, with the unit coming from the
first extension:

[Service]
RootImage=/home/bluca/git/systemd/base.raw
Environment=PORTABLE=app0.raw
BindReadOnlyPaths=/etc/os-release:/run/host/os-release
LogExtraFields=PORTABLE=app0.raw
LogExtraFields=PORTABLE_ROOT=base.raw

ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw

ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw

14 months agoportable: use parse_env_file_fd to keep FD valid
Luca Boccassi [Thu, 23 Mar 2023 01:02:47 +0000 (01:02 +0000)] 
portable: use parse_env_file_fd to keep FD valid

take_fdopen_unlocked invalidates the FD in the PortableMetadata object,
so it cannot be used later. Use parse_env_file_fd instead which is non
destructive.

14 months agostrv: add helper to find value in key/value pairs from list of keys
Luca Boccassi [Mon, 27 Mar 2023 11:05:28 +0000 (12:05 +0100)] 
strv: add helper to find value in key/value pairs from list of keys

14 months agoenv: add load_env_file_pairs_fd()
Luca Boccassi [Thu, 23 Mar 2023 10:47:06 +0000 (10:47 +0000)] 
env: add load_env_file_pairs_fd()

14 months agobusctl: use size_t for set size
Zbigniew Jędrzejewski-Szmek [Tue, 28 Mar 2023 09:30:07 +0000 (11:30 +0200)] 
busctl: use size_t for set size

Also reduce the scope of variables.

14 months agobusctl: do not truncate property values when --full
Zbigniew Jędrzejewski-Szmek [Tue, 28 Mar 2023 09:26:01 +0000 (11:26 +0200)] 
busctl: do not truncate property values when --full

14 months agoMerge pull request #27013 from fbuihuu/test-fixlets
Yu Watanabe [Tue, 28 Mar 2023 04:45:24 +0000 (13:45 +0900)] 
Merge pull request #27013 from fbuihuu/test-fixlets

Test fixlets

14 months agocryptenroll: fix a memory leak
Frantisek Sumsal [Mon, 27 Mar 2023 14:51:00 +0000 (16:51 +0200)] 
cryptenroll: fix a memory leak

$ dd if=/dev/zero of=luks.img bs=1M count=64
$ echo 1231dfsd234d | cryptsetup luksFormat luks.img
$ build-san/systemd-cryptenroll luks.img
SLOT TYPE
   0 password

=================================================================
==640364==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f43ffeb95b5 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xb95b5)
    #1 0x7f43ff0a4f2f in greedy_realloc ../src/basic/alloc-util.c:70
    #2 0x404d9f in list_enrolled ../src/cryptenroll/cryptenroll-list.c:30
    #3 0x40f149 in run ../src/cryptenroll/cryptenroll.c:673
    #4 0x40f149 in main ../src/cryptenroll/cryptenroll.c:692
    #5 0x7f43fd64a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
Aborted (core dumped)

Reported in https://github.com/systemd/systemd/pull/27007.

14 months agoMerge pull request #27022 from yuwata/journal-remote-fix-relative-output-journal...
Yu Watanabe [Tue, 28 Mar 2023 04:41:13 +0000 (13:41 +0900)] 
Merge pull request #27022 from yuwata/journal-remote-fix-relative-output-journal-file

journal-remote: support relative output journal file again

14 months agosystemctl: show service status string in other color
Lennart Poettering [Fri, 24 Mar 2023 21:52:51 +0000 (22:52 +0100)] 
systemctl: show service status string in other color

Let's add a dash of colour to separate our own status info from the the
status info supplied by the service.

(I wanted to make this italics, but apparently popular terminal
emulators don't support that, such as xterm)

14 months agosystemctl: show fd store info in status output
Lennart Poettering [Fri, 24 Mar 2023 21:37:42 +0000 (22:37 +0100)] 
systemctl: show fd store info in status output

The fdstore might pin a non-trivial amount of resources. Let's hence
display for services that enable it how many entries there are and what
the size limit is.