Commit Graph
4716 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 8a7adccbdb various: try to use DEFAULT_USER_SHELL for root too
/bin/sh as a shell is punishing. There is no good reason to make
the occasional root login unpleasant.

Since /bin/sh is usually /bin/bash in compat mode, i.e. if one is
available, the other will be too, /bin/bash is almost as good as a default.
But to avoid a regression in the situation where /bin/bash (or
DEFAULT_USER_SHELL) is not installed, we check with access() and fall back
to /bin/sh. This should make this change in behaviour less risky.

(FWIW, e.g. Fedora/RHEL use /bin/bash as default for root.)

This is a follow-up of sorts for 53350c7bba,
which added the default-user-shell option, but most likely with the idea
of using /bin/bash less ;)

Fixes #24369.
2022-08-24 10:02:46 +02:00
Lennart Poettering 582fc142da random-util: drop unnecessary header file
(And some minor reindents)
2022-08-17 21:59:28 +09:00
Lennart Poettering 86b4e141a5 fs-util: make touch() an inline function 2022-08-17 21:58:33 +09:00
Yu Watanabe 3b703fe269 path-util: introduce path_glob_can_match() 2022-08-17 14:30:20 +09:00
wineway c8340822cf core/cgroup: CPUWeight/CPUShares support idle input
Signed-off-by: wineway <wangyuweihx@gmail.com>
2022-08-11 14:25:58 +02:00
Yu Watanabe eff6bc9294 Merge pull request #24244 from yuwata/device-enumerator
sd-device-enumerator: fix sysattr match
2022-08-09 04:57:48 +09:00
Yu Watanabe 52be2b43f5 hash-funcs: introduce string_hash_ops_free_strv_free 2022-08-08 23:41:28 +09:00
Yu Watanabe 069f5df051 ether-addr-util: introduce hw_addr_set() helper function 2022-08-06 04:53:36 +09:00
Michal Sekletar 03860190fe scope: allow unprivileged delegation on scopes
Previously it was possible to set delegate property for scope, but you
were not able to allow unprivileged process to manage the scope's cgroup
hierarchy. This is useful when launching manager process that  will run
unprivileged but is supposed to manage its own (scope) sub-hierarchy.

Fixes #21683
2022-08-04 17:01:13 +02:00
Lennart Poettering 71c943dc40 mountpoint-util: make fd_is_mountpoint() work reasonably with AT_EMPTYPATH
Inspired by: https://github.com/systemd/systemd/pull/24141

Calling fd_is_mountpoint() with AT_EMPTYPATH and an empty filename can
only work if we have new statx() available. If we do not, we can still
make things work for directories, but not for other inodes (since there
we cannot query information about the parent inode to compare things.)

Hence, let's handle and test this explicitly, to support this to the
level this is possible.
2022-08-02 20:01:59 +02:00
Yu Watanabe 5162b2a1c4 tree-wide: fix typo 2022-08-02 02:43:38 +09:00
Cristian Rodríguez 91375fb9cf gcrypt: switch to system rng before gcry_check_version (#24162)
Current docs claim this must be done before gcry_check_version.
2022-08-01 14:04:27 +09:00
Eli Schwartz 6c8892828c meson: use files in run_command with relativized path
Passing a file as a command argument in string form assumes that
run_command has the current subdir as its cwd, but Meson's documentation
*explicitly* calls this out as undefined and wrong to use.

Indeed, muon has a different implementation that uses a different cwd,
and this argument cannot be found. Instead, passing a files() object
means that it's the job of meson itself to verify the file exists, then
pass it to the run_command in some format that guarantees it is a valid
path reference.
2022-07-30 13:58:22 +09:00
Cristian Rodríguez 80f967311a gcrypt: prefer the OS RNG
by default, gcrypt defaults to an userspace RNG, this is
the wrong thing (tm) to do on linux.

Switch to the SYSTEM rng instead.
2022-07-29 16:08:48 +02:00
Fei Li c15d1ac2c4 virt: detect KubeVirt instance
Kubevirt is currently technically based on KVM (but not xen yet[1]).
The systemd-detect-virt command, used to differentiate the current
virtualization environment, works fine on x86 relying on CPUID, while
fails to get the correct value (none instead of kvm) on aarch64.

Let's fix this by adding a new 'vendor[KubeVirt] = kvm' classification
considering the sys_vendor is always KubeVirt.

[1] https://groups.google.com/g/kubevirt-dev/c/C6cUgzTOsVg

Signed-off-by: Fei Li <lifei.shirley@bytedance.com>
2022-07-29 11:10:29 +02:00
Yu Watanabe 0a58cd0045 home: drop conflicted headers
Fixes #24117.
2022-07-26 23:41:48 +09:00
Rudi Heitbaum 3657d3a01c glibc: Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36 2022-07-24 20:52:35 +09:00
Yu Watanabe 7c35b78a0b unit-file: avoid (null) in debugging logs
The variable `inst` was set to NULL by TAKE_PTR().

This fixes the following log message:
```
systemd[1]: Unit getty@tty2.service has alias (null).
```
2022-07-24 20:51:27 +09:00
Yu Watanabe d6985e76f2 sd-device: introduce device_unref_and_replace() 2022-07-23 08:16:38 +09:00
Zbigniew Jędrzejewski-Szmek a5d0919c9b Merge pull request #24051 from yuwata/json-fpclassify
json: use fpclassify() macro and refuse -ffinite-math-only
2022-07-21 09:35:19 +02:00
Daan De Meyer fc4c10b28b tree-wide: Introduce free_and_replace_full()
Let's have all our free_and_replace() functions use a single
implementation.
2022-07-21 09:45:55 +09:00
Yu Watanabe 1561db8ac2 json: use fpclassify() or its helper functions 2022-07-21 09:18:13 +09:00
Yu Watanabe fbccfa95c4 math-util: introduce iszero_safe() and fp_equal() 2022-07-21 09:18:08 +09:00
Lennart Poettering 4a0cb5474e Merge pull request #23963 from matoro/main
Replace __sync intrinsics with __atomic
2022-07-21 00:10:01 +02:00
Yu Watanabe 59159aee20 Merge pull request #24018 from keszybz/generator-cleanups
Make generators easier to test, fix various corner issues
2022-07-16 05:11:49 +09:00
Zbigniew Jędrzejewski-Szmek 494f4ee9c7 basic/log: split out invoked_by_systemd() utility function 2022-07-15 15:47:23 +02:00
matoro 5ba4295bea basic: replace __sync intrinsics with __atomic
Commented reasoning on why it's safe to replace
__sync_bool_compare_and_swap with __atomic_compare_exchange_n in each
location even though the latter has an additional side effect.

__sync_synchronize should be equivalent to __atomic_thread_fence with
__ATOMIC_SEQ_CST memory ordering.
2022-07-14 17:34:15 -04:00
matoro 8a75ba0a7f process-util: replace __sync intrinsics to __atomic
This one is rather tricky, but changing the initialization of
current_val should give this the same effect.  Based on ffmpeg's change
here: https://ffmpeg.org/pipermail/ffmpeg-devel/2014-October/164556.html

Quoting from them:
> The second reason is __atomic_compare_exchange_n(), and how it differs from
> __sync_val_compare_and_swap().
> While the latter returns *ptr as it was before the operation, the former
> doesn't and instead copies *ptr to oldval if the result of the
> comparison is false. This means that returning oldval will match the old behavoir
> without having to change the wrapper.
> A disassemble example from libavutil/buffer.o however hints that the
> __atomic function may be slower because of it writting oldval.
2022-07-14 17:34:10 -04:00
Yu Watanabe d3efcd2def network: refuse 169.254.0.0/24 and 169.254.255.0/24 for IPv4LLStartAddress=
Follow-up for #23927.
2022-07-15 03:37:09 +09:00
Lennart Poettering a586dc791c stat-util: replace is_dir() + is_dir_fd() by single is_dir_full() call
This new call can execute both of the old operations, but also do
generic fstatat() like behaviour.
2022-07-14 10:11:50 +02:00
Yu Watanabe 64d847b886 Merge pull request #23974 from yuwata/align-tables
basic: align tables
2022-07-11 22:43:45 +02:00
Lennart Poettering 39e419a2b5 tree-wide: trivial tweaks 2022-07-11 15:11:58 +02:00
Yu Watanabe ef674d0ea3 unit-def: align string tables 2022-07-11 14:19:59 +02:00
Yu Watanabe 5c86cec1f3 virt: align tables 2022-07-11 14:13:33 +02:00
Zbigniew Jędrzejewski-Szmek 4bd035153b manager: add taint flag "support-ended"
In the welcome line, use NAME= as the fallback for PRETTY_NAME=.
PRETTY_NAME= doesn't have to be set, but NAME= should.

Example output:
---
Welcome to Fedora Linux 37 (Rawhide Prerelease)!

[  !!  ] This OS version (Fedora Linux 37 (Rawhide Prerelease)) is past its end-of-support date (1999-01-01)
Queued start job for default target graphical.target.
[  OK  ] Created slice system-getty.slice.
---
2022-07-10 14:33:52 +02:00
Lennart Poettering 979055ba73 Merge pull request #23946 from poettering/tmpfiles-extrat-dir-fn
tmpfiles: port from basename()/dirname() → path_extract_direcory()/path_extract_filename()
2022-07-08 16:10:42 +02:00
Yu Watanabe 9102c625a6 time-util: fix buffer-over-run
Fixes #23928.
2022-07-08 16:09:46 +02:00
Lennart Poettering 70980a39b8 path-util: NULL strings are definitely not valid paths
Let's make this functions that check validity of paths a bit more
friendly towards one specific kind of invalid path: a NULL pointer.

This follows similar logic in path_is_valid(), path_is_normalized() and
so on.
2022-07-08 11:35:00 +02:00
Lennart Poettering a87af99ef1 Merge pull request #23855 from keszybz/drop-list-is-empty
basic/list: drop LIST_IS_EMPTY
2022-07-05 17:29:53 +02:00
Lennart Poettering ff25d3385d tree-wide: add global ascii_isdigit() + ascii_isalpha()
We now have a local implementation in string-util-fundamental.c, but
it's useful at a lot of other places, hence let's give it a more
expressive name and share it across the tree.

Follow-up for: 8d9156660d
2022-07-05 14:25:07 +02:00
Zbigniew Jędrzejewski-Szmek 64903d18df basic/list: drop LIST_IS_EMPTY
This was a trivial wrapper that didn't provide any added value. With more
complicated structures like strvs, hashmaps, sets, and arrays, it is possible
to have an empty container. But in case of a list, the list is empty only when
the head is missing.

Also, we generally want the positive condition, so we replace many
if (!LIST_IS_EMPTY(x)) with just if (x).
2022-07-02 12:46:16 +02:00
Zbigniew Jędrzejewski-Szmek 28e7e9347d basic/socket-util: rename fd_inc_rcvbuf → fd_increase_rxbuf
See previous commit for justification.
2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek b01f31954f Turn mempool_enabled() into a weak symbol
Before we had the following scheme:
mempool_enabled() would check mempool_use_allowed, and
libsystemd-shared would be linked with a .c file that provides mempool_use_allowed=true,
while other things would linked with a different .c file with mempool_use_allowed=false.

In the new scheme, mempool_enabled() itself is a weak symbol. If it's
not found, we assume false. So it only needs to be provided for libsystemd-shared,
where it can return false or true.

test-set-disable-mempool is libshared, so it gets the symbol. But then we
actually disable the mempool via envvar. mempool_enable() is called to check
its return value directly.
2022-06-29 16:51:52 +02:00
Yu Watanabe 840a49f3dc virt: fix detection of Parallels virtualization
If Parallels virtualization is detected from DMI, then trust that over CPUID.

Fixes issue caused by 28b1a3eac2.

Fixes #23856.
2022-06-29 14:03:54 +02:00
Yu Watanabe d5548eb618 Merge pull request #23821 from dtardon/ascii-logging
Allow ASCII fallback for Unicode characters in logs
2022-06-29 03:36:35 +09:00
Yu Watanabe 94f881fd8e Merge pull request #23849 from mbiebl/more-https
Use https for freedesktop.org
2022-06-29 03:22:51 +09:00
Michael Biebl 85fce6f42c Use https for gnu.org 2022-06-28 16:07:35 +02:00
Michael Biebl 41d6f3bf4d Use https for freedesktop.org
grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
2022-06-28 13:10:05 +02:00
David Tardon 28e5e1e97f tree-wide: allow ASCII fallback for … in logs 2022-06-28 12:50:44 +02:00
David Tardon e2341b6bc3 tree-wide: allow ASCII fallback for → in logs 2022-06-28 12:50:43 +02:00