1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00
Commit Graph

52731 Commits

Author SHA1 Message Date
Lennart Poettering
56ce4adafe import-util: tweak url patching helper
let's share some code between import_url_last_component() and
import_url_change_last_component(), and make sure we never eat up the
hostname component of the URL when parsing out the last component.

Let's also make import_url_change_last_component() more generic so that
we can also use it for append components to paths, instead of replacing
suffixes.
2021-07-30 16:23:20 +02:00
Lennart Poettering
30763a32b2 util: add one more helper for generating colored check mark glyphs
This one is useful for a outputs with a slightly more "positive"
outlook, i.e. where only the checkmarks are shown but the crossmarks are
replaced by spaces.

(Usecase: a larger table with many checkmarks, where the red crossmarks
might just be too much negative noise)
2021-07-30 16:18:40 +02:00
Lennart Poettering
bf18f4b671 glyph-util: add three more emojis to emoji list 2021-07-30 16:18:05 +02:00
Lennart Poettering
1f0fb7d544 rm-rf: refactor rm_rf_children(), split out body of directory iteration loop
This splits out rm_rf_children_inner() as body of the loop. We can use
that to implement rm_rf_child() for deleting one specific entry in a
directory.
2021-07-30 16:14:37 +02:00
Lennart Poettering
d844529dc7 macro: change DECIMAL_STR_WIDTH() return type to size_t, like strlen() and so on 2021-07-30 15:59:29 +02:00
Lennart Poettering
777003365a macro: sizeof() returns size_t, and that's good
Now that CONST_MAX() is a bit more foregiving, let's stick to the native
return type of sizeof() everywhere, which is size_t, instead of casting
to "unsigned", so that on the common archs we don't unnecessarily lose
the upper 32bits.

This semi-reverts d3e4029457.
2021-07-30 15:58:09 +02:00
Lennart Poettering
addae96a1a macro: relax CONST_MAX() type check a tiny bit
This checked for strict type compatibility so far, which mean CONST_MAX()
couldn't be used on two differently signed integers, even though
conceptually there's nothing wrong with allowing that here, as C
correctly picks the larger type in the ternary op.

hence, let's explicitly whitelist integer comparisons here, as long as
the signedness matches.
2021-07-30 15:56:56 +02:00
Luca Boccassi
a4d9c121cc
Merge pull request #20348 from poettering/free-and-replace-double-eval
make free_and_replace() double eval free
2021-07-30 11:38:13 +01:00
Frantisek Sumsal
8bf79f0553 test: correctly detect ASan on s390x
s390x uses BRAS(L) instead of CALL(Q), e.g.:

```
 1009528:	c0 e5 ff ff f8 a0 	brasl	%r14,1008668 <__asan_report_load1@plt>
 10095f0:	c0 e5 ff ff ea ec 	brasl	%r14,1006bc8 <__asan_stack_malloc_4@plt>
 10097f8:	c0 e5 ff ff f8 f8 	brasl	%r14,10089e8 <__asan_report_load8@plt>
```

x86_64 for reference:

```
  4011f3:	e8 48 fe ff ff       	callq  401040 <__asan_report_load1@plt>
  401227:	e8 24 fe ff ff       	callq  401050 <__asan_report_load8@plt>
  401251:	e8 da fd ff ff       	callq  401030 <__asan_init@plt>
```
2021-07-29 23:59:08 +01:00
Lennart Poettering
19fd72df5b main: fix type confusion in do_reexecute()
Let's use size_t for stuff we count in memory. This doesn't matter much,
but is certainly more correct and less eyebrow-raising.

Follow-up for: 846f1da465

See: https://github.com/systemd/systemd/pull/20273#discussion_r679250180
2021-07-29 21:14:38 +02:00
Lennart Poettering
0ddd5e547e xdg-autostart-service: rely on the new double-eval-free free_and_replace()
These semi-reverts 2744c7bb01
2021-07-29 21:13:03 +02:00
Lennart Poettering
7ecc424fbe alloc-util: drop double eval from free_and_replace()
Inspired by: 2744c7bb01
2021-07-29 21:12:58 +02:00
Frantisek Sumsal
7925d693a7 meson: add the versiondep to the static lib deplist as well
Follow-up to 99c645b81a.
2021-07-29 14:56:52 +01:00
Zbigniew Jędrzejewski-Szmek
23a0ffa59f systemctl: allow set-property to be called with a glob pattern
We call "systemctl set-property … Markers=+needs-restart" and this should
also work for globs, e.g. "user@*.service" or "syncthing@*.service".

https://bugzilla.redhat.com/show_bug.cgi?id=1986258
2021-07-29 10:47:28 +02:00
Lennart Poettering
5b74168814
Merge pull request #20337 from poettering/oom-adj-fix
make oom_score_adjust_is_valid() shared again
2021-07-29 10:47:10 +02:00
Lennart Poettering
78d4d37401
Merge pull request #20339 from poettering/bus-vtable-indent-fix
sd-bus: fix indentation in macros
2021-07-29 10:46:50 +02:00
Lennart Poettering
0c4801738e sd-bus: add brief inline comment explaining the "reserved" field in the bus vtable structure
Follow-up for: #20253
2021-07-28 20:44:49 +02:00
Lennart Poettering
02f2d2b33b sd-bus: fix indentation in macros
We use multiples of 8 spaces indentation in our C code, do it here too.
2021-07-28 20:39:18 +02:00
Franck Bui
463aef23a7 manager: reexecute on SIGRTMIN+25, user instances only
Before this patch, there was no way to request all running user instances for
reexecuting. However this can be useful especially during package updates
otherwise user instances are never updated and keep running a potentially very
old version of the binaries.

Now assuming that we have enough priviledge, it's possible to request
reexecution of all user instances:

  systemctl kill --signal=SIGRTMIN+25 "user@*.service"

Note that this request is obviously asynchronous as it relies on a
signal. Keeping "systemctl kill" as the only interface should be good enough to
make this obvious and that's the reason why another interface, such as
"systemctl --global daemon-reexec" has not been considered.

PID1 already uses SIGTERM for reexecuting hence sending it SIGRTMIN+25 is a
nop.
2021-07-28 18:50:30 +02:00
Lennart Poettering
c62f67f730 parse-util: use oom_score_adjust_is_valid() at one more place 2021-07-28 18:39:41 +02:00
Lennart Poettering
c4412d4d33 Revert "Make oom_score_adjust_is_valid() static"
This reverts commit 6bf3c6c900.
2021-07-28 18:39:41 +02:00
Lennart Poettering
fac5588944 update TODO 2021-07-28 18:39:17 +02:00
Yegor Alexeyev
caf8c6ea3f added missing handling of button release events 2021-07-28 17:34:31 +02:00
Yao Wei
f238549b5a Use SKU to identify Dell clamshell models for accelerometer properties
As per request from Dell, we need to use sku property of modalias that
is patched into linux 5.13 for model identification:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e26f023e01ef26b4138bc1099af309bdc4523d23
2021-07-28 17:10:22 +02:00
Luca Boccassi
a8d1a8e96d
Merge pull request #20326 from keszybz/meson-0.53.2
Use some more new meson features
2021-07-28 13:30:37 +01:00
Luca Boccassi
8d5b391b19
Merge pull request #20311 from keszybz/manpage-l10n-report
Man pages cleanups
2021-07-28 12:37:39 +01:00
Frantisek Sumsal
8f876748d3 ci: bump meson version in LGTM
Otherwise LGTM fails to detect the build system:

```
[2021-07-27 23:18:47] [build-stdout] The Meson build system
[2021-07-27 23:18:47] [build-stdout] Version: 0.51.2
[2021-07-27 23:18:47] [build-stdout] Source dir: /opt/src
[2021-07-27 23:18:47] [build-stdout] Build dir: /opt/src/_lgtm_build_dir
[2021-07-27 23:18:47] [build-stdout] Build type: native build
[2021-07-27 23:18:47] [build-stdout] meson.build:3:0: ERROR: Meson version is 0.51.2 but project requires >= 0.53.2
[2021-07-27 23:18:47] [build-stdout] A full log can be found at /opt/src/_lgtm_build_dir/meson-logs/meson-log.txt
```
2021-07-28 11:26:10 +02:00
Zbigniew Jędrzejewski-Szmek
e04eae5e1c man/systemctl: rework descriptions of bind and mount-image
The text used "unit's view" to mean mount namespace. But we talk about
mount namespaces in the later part of the paragraph anyway, so trying to
use an "approachable term" only makes the whole thing harder to understand.
Let's use the precise term.

Some paragraph-breaking and re-indentation is done too.
2021-07-28 10:21:21 +02:00
Zbigniew Jędrzejewski-Szmek
12085ebb40 meson: use meson's summary()
The output is similar to our hand-crafted status message, but it's nice to use
the built-in functionality. After all, it was amended during development to
support our use case.
2021-07-28 10:04:06 +02:00
Luca Boccassi
c1597f07bf
Merge pull request #20319 from keszybz/meson-0.53.2
Bump required meson version to 0.53.2
2021-07-27 23:15:18 +01:00
Luca Boccassi
59ff79f19f
Merge pull request #20318 from poettering/seccomp-getrandom-fix
seccomp: getrandom() fix + more
2021-07-27 21:17:38 +01:00
Zbigniew Jędrzejewski-Szmek
f12c5d36a9 meson: use alias_target for doc update commands
This undoes part of 4c890ad3cc: the
implementations of update-dbus-docs and update-man-rules are moved back to
man/meson.build, and alias_target() is used to keep the visible target names
unchanged.

The rules for man pages are reworked so that it's possible to invoke the
targets even if xstlproc is not available. After all, xsltproc is only needed
for the final formatted output, and not other processing.
2021-07-27 20:34:40 +02:00
Zbigniew Jędrzejewski-Szmek
6839ce3318 meson: use alias_target in one place
It was added in meson 0.52.0, and fits very nicely here.
See https://mesonbuild.com/Release-notes-for-0-52-0.html#alias_target.
2021-07-27 19:58:55 +02:00
Zbigniew Jędrzejewski-Szmek
fce9abb227 meson: use a/b instead of join_paths(a,b)
It is nicer and shorter.
2021-07-27 19:32:35 +02:00
Zbigniew Jędrzejewski-Szmek
0b5f1bd49e meson: use maps for udev program paths 2021-07-27 18:58:42 +02:00
Zbigniew Jędrzejewski-Szmek
68e101da7a meson: adjust comment about find_program() usage
The FIXME was not correct: with 'dirs' we'd put the fixed path first
(see the docs for find_program()).
2021-07-27 18:53:31 +02:00
Zbigniew Jędrzejewski-Szmek
81875efe20 meson: use project_build_root
As documented in /meson.build where the variable is defined,
meson.build_root() doesn't work as expected with project nesting. I have
no idea why anyone would want to embed systemd in another meson project,
but let's use the variable if we have it.
2021-07-27 18:53:22 +02:00
Lennart Poettering
7df660e456 seccomp: move sched_getaffinity() from @system-service to @default
See: https://github.com/systemd/systemd/pull/20191#issuecomment-881982739

In general, we shouldn't blanket move syscalls like this into @default,
given that glibc actually does have fallbacks, afaics. However, as
long as the syscalls are "read-only" and thus benign, I figure it's a
safe thing to do. But we should probably stick to a "if in doubt, don't"
rule, and put these syscalls in @system-service as default, but not into
@default.

I think in the real world @system-service is the sensible group people
should use, and not @default actually.
2021-07-27 17:14:06 +02:00
Lennart Poettering
67347f3740 seccomp: drop getrandom() from @system-service
It's included in @default now, since
14f4b1b568, and since @system-service
pulls that in we can drop it from @system-service.

Follow-up for #20191
2021-07-27 17:13:53 +02:00
Zbigniew Jędrzejewski-Szmek
9247df5a88 meson: require 0.53.2 and drop some workarounds for old meson
Ubuntu Bionic 18.04 has 0.45, so it was below the previously required
minimum version already. Focal 20.04 has 0.53.2. Let's require that
and use various features that are available.
2021-07-27 16:46:46 +02:00
Frantisek Sumsal
99c645b81a meson: add a missing versiondep to libcryptsetup-plugins target
Otherwise the build sometimes fails in a racy way:

```
[274/1850] Compiling C object src/cryptsetup/cryptsetup-tokens/libcryptsetup-token-systemd-tpm2_static.a.p/cryptsetup-token-systemd-tpm2.c.o
FAILED: src/cryptsetup/cryptsetup-tokens/libcryptsetup-token-systemd-tpm2_static.a.p/cryptsetup-token-systemd-tpm2.c.o
cc -Isrc/cryptsetup/cryptsetup-tokens/libcryptsetup-token-systemd-tpm2_static.a.p (...) -c ../build/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c
../build/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c:12:10: fatal error: version.h: No such file or directory
   12 | #include "version.h"
         |          ^~~~~~~~~~~
         compilation terminated.
```

Follow-up to d1ae38d85a.
2021-07-27 14:44:30 +01:00
Riccardo Schirone
148369deef Check return value of pam_get_item/pam_get_data functions 2021-07-27 11:59:46 +02:00
Zbigniew Jędrzejewski-Szmek
dab1fe1a8e man/tmpfiles.d: rewrite the description of age-by 2021-07-27 09:43:29 +02:00
Zbigniew Jędrzejewski-Szmek
d6029680df man: use title of docs/ pages when referring to them
There is some inconsistency, partially caused by the awkward naming
of the docs/ pages. But let's be consistent and use the "official" title.
If we ever change plural↔singular, we should use the same form everywhere.
2021-07-27 09:43:29 +02:00
Zbigniew Jędrzejewski-Szmek
be0d27ee0c man: fix assorted issues reported by the manpage-l10n project
Fixes #20297.
2021-07-27 09:43:29 +02:00
Khem Raj
2a0d07d6a0 networkd: Include linux/netdevice.h header
This header provides definitions for NET_NAME_UNKNOWN ånd NET_NAME_ENUM
Fixes build issue found with non-glibc systems

../git/src/network/networkd-link.c:1203:52: error: 'NET_NAME_UNKNOWN' undeclared (first use in this function)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-07-26 22:48:57 +01:00
Zbigniew Jędrzejewski-Szmek
b4f0261337 udev: when setting up lo, do not return an error
From #20300:
> commit 70f32a260b
> Author: Yu Watanabe <watanabe.yu+github@gmail.com>
> Date:   Sun May 23 16:59:40 2021 +0900

>     udev/net: do not manage loopback interfaces

>     There are nothing we can configure in udevd for loopback interfaces;
>     no ethertool configs can be applied, MAC address, interface name should

> introduced a regression for 'udevadm test-builtin net_setup_link /sys/class/net/lo/'.
> Prior to this commit this command would exit with 0 whereas after this commit
> it exists with 1. This causes cloud-init on Archlinux to fail as this command
> is run by it and likely also netplan to have networkd rescan and re-apply a
> bunch of things on NICs.

I think it's reasonable to keep returning 0 here: we are intentatinally doing
nothing for the device, and that is not an error, but a (noop) success.

Fixes #20300.
2021-07-26 14:47:03 +01:00
Ondrej Kozina
d1ae38d85a Add support for systemd-tpm2 libcryptsetup plugin.
Add support for systemd-tpm2 based LUKS2 device activation
via libcryptsetup plugin. This make the feature (tpm2 sealed
LUKS2 keyslot passphrase) usable from both systemd utilities
and cryptsetup cli.

The feature is configured via -Dlibcryptsetup-plugins combo
with default value set to 'auto'. It get's enabled automatically
when cryptsetup 2.4.0 or later is installed in build system.
2021-07-26 15:15:16 +02:00
Luca Boccassi
c5a421b3b9
Merge pull request #20276 from keszybz/rpm-restart-wip
Reload user daemons and restart user services at the end of the rpm transaction
2021-07-26 11:02:37 +01:00
Zbigniew Jędrzejewski-Szmek
1262e824a4 update-helper: also add "user-reexec" verb
This is not called from the systemd.triggers or systemd.macros files. Instead,
it would be called from the scriptlets in systemd rpm package itself, at the
place where we call systemctl daemon-reexec.

See https://github.com/systemd/systemd/pull/20289#issuecomment-885622200 .
2021-07-24 13:11:13 +02:00