Commit Graph
4080 Commits
Author SHA1 Message Date
Daan De Meyer 28aa650eb7 chase-symlinks: Add CHASE_PARENT
Let's simplify chasing the parent directory of some path by adding
CHASE_PARENT.
2023-03-06 13:42:43 +01:00
Yu Watanabe ce16d177dd tree-wide: replace IOVEC_INIT with IOVEC_MAKE
We use gnu11 to build, hence we can use structured initializer with
casting, and it is not necessary to use different patterns on
initialization and assignment.

Addresses https://github.com/systemd/systemd/pull/26560#discussion_r1118875447.
2023-03-06 09:30:28 +09:00
Yu Watanabe f482e22484 Merge pull request #26653 from poettering/tmpfile-linkable-replace
teach link_tmpfile() to optionally replace files
2023-03-04 02:53:59 +09:00
Yu Watanabe 600ed5c242 test-execute: add test for NetworkNamespacePath=
Prompted by https://github.com/systemd/systemd/issues/26422#issuecomment-1435772839.
2023-03-04 02:50:15 +09:00
Yu Watanabe 31c35de1a4 test: add tests for error code propagation from mkdir_xyz() 2023-03-03 22:58:49 +09:00
Lennart Poettering 23e208e742 tmpfile-util: teach link_tmpfile() to optionally replace files 2023-03-03 13:44:12 +01:00
Yu Watanabe b66b3c4099 meson: extend timeout for test-time-util
The test forks so many child processes, and may hit the default time
limit on slow environment or running with sanitizers.
2023-03-03 20:39:19 +09:00
Yu Watanabe d8f3ad627c test: test parse_timestamp() in various timezone 2023-03-03 20:39:10 +09:00
Yu Watanabe 8677fdc78b test: clear tzname[] after timezone is changed
Fixes the issue reported in fe56f21ae3.
2023-03-03 19:45:32 +09:00
Yu Watanabe 0b20d70d1c test: use get_timezones() to iterate all known timezones 2023-03-03 19:45:32 +09:00
msizanoen1 582843ee37 test-escape: Add tests for escaping bogus UTF-8 sequences 2023-03-02 19:55:47 +07:00
Luca Boccassi fe56f21ae3 tests: temporarily disable time-util failing tests
These are failing since https://github.com/systemd/systemd/pull/26409
disable for now
2023-02-27 21:37:58 +00:00
Yu Watanabe 8b51c41fd0 test: add tests for format_timestamp() and parse_timestamp() with various timezone 2023-02-24 08:55:28 +09:00
Zbigniew Jędrzejewski-Szmek 20b569a4c6 Merge pull request #26563 from dtardon/fd-init
Initialize fds with -EBADF + drop one unneeded initialization
2023-02-23 11:43:09 +01:00
Zbigniew Jędrzejewski-Szmek a34180a22f Merge pull request #26556 from keszybz/list-timers-optimize-left
Do not say " left" on every timer in LEFT column
2023-02-23 11:37:48 +01:00
David Tardon 92651a7a2d tree-wide: initialize fds with -EBADF 2023-02-23 09:48:54 +01:00
Yu Watanabe 752e92615d test-execute: add test for PrivateNetwork= with/without mount namespacing 2023-02-23 15:09:13 +09:00
Yu Watanabe f63a2c4821 mount-util: introduce remount_sysfs()
This is useful when creating a new network namespace. Unlike procfs,
we need to remount sysfs, otherwise properties of the network interfaces
in the main network namespace are still accessible through the old sysfs,
e.g. /sys/class/net/eth0. All sub-mounts previously mounted on the sysfs
are moved onto the new sysfs mount.

The function will be used in later commits.
2023-02-23 15:09:13 +09:00
Lennart Poettering ff3f1464ec memory-util: add a concept for gcc cleanup attribute based array destruction 2023-02-23 11:43:43 +09:00
Lennart Poettering a649419aae capability-util: add new capability_get_ambient() helper 2023-02-22 23:45:40 +01:00
Lennart Poettering 66c1e440c7 cap-list: add capability_set_to_string_negative() 2023-02-22 23:45:40 +01:00
Lennart Poettering 8cf4674d86 cap-list: add capability_set_to_strv() 2023-02-22 23:45:40 +01:00
Zbigniew Jędrzejewski-Szmek d5e6f36c7a shared/format-table: optionally print timestamps without "left"
This just adds the base functionality and some unit tests.
With TABLE_TIMESTAMP_RELATIVE we print "5s ago" and "5s left",
with the new TABLE_TIMESTAMP_LEFT, we print "5s ago" but "5s".
This is more useful for cases where we generally only want to
print timestamps in the future.
2023-02-22 23:43:33 +01:00
Lennart Poettering 921330af40 Merge pull request #26448 from poettering/sd-event-mempress
sd-event: add memory pressure event source
2023-02-22 16:23:59 +01:00
Yu Watanabe 58fbf167d7 Merge pull request #26528 from keszybz/valgrind-simplification
Drop the -Dvalgrind configuration option
2023-02-22 23:04:12 +09:00
Lennart Poettering b7dc40e663 test: add test for new memory pressure logic
it tests both real PSI stuff (if available) and fake pressure via
AF_UNIX and FIFO notification.
2023-02-22 13:14:36 +01:00
Daan De Meyer b63bd125d4 copy: Support both inode exclusion and contents exclusion
In some cases, we want to exclude a directory's contents but not
the directory itself. In other cases, we want to exclude a directory
and its contents. Let's extend the denylist logic in copy.h to support
both by changing the denylist from a set to hashmap so we can store the
deny type as the value.

We also modify the repart ExcludeFiles= option to make use of this. If
a directory to exclude ends with a "/", we'll only exclude its contents.
Otherwise, we'll exclude the full directory.
2023-02-22 12:44:36 +01:00
Zbigniew Jędrzejewski-Szmek 18e100172c test-set: inline two iterator declarations 2023-02-22 11:39:44 +01:00
Zbigniew Jędrzejewski-Szmek 3f275dcb84 test-set: drop left-over valgrind check
In b01f31954f mempool_use_allowed
was dropped, but apparently it was forgotten here.
2023-02-22 11:13:57 +01:00
Yu Watanabe 4788f635e3 Merge pull request #26203 from medhefgo/meson
meson: Use dicts for test/fuzzer definitions
2023-02-22 10:27:16 +09:00
Jan Janssen 822cd3ff25 meson: Use dicts for test definitions
Although this slightly more verbose it makes it much easier to reason
about. The code that produces the tests heavily benefits from this.

Test lists are also now sorted by test name.
2023-02-21 15:10:26 +01:00
Jan Janssen c12e10d785 meson: Add simple_tests list
A lot of tests can be defined by just their filename. Moving into their
own list keeps things simpler, especially with the next commit. It also
makes it easier to keep the lists sorted.
2023-02-21 15:10:26 +01:00
Yu Watanabe 0c2aedb451 tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS 2023-02-21 07:39:18 +09:00
Yu Watanabe 911f8f0183 process-util: rename FORK_NULL_STDIO -> FORK_REARRANGE_STDIO
And make safe_fork_full() takes fds to be assigned to stdio.
2023-02-21 07:37:51 +09:00
Lennart Poettering c52c4d6974 cap-list: add CAPABILITY_TO_STRING() macro using compound initialization to allocate fallback buffer
Let's add a helper that can return a numeric string in case we don't
recognize a name for a capability.
2023-02-20 16:27:26 +01:00
Lennart Poettering d0e67c69ba cap-list: refuse parsing numeric capability 63
We refuse it otherwise currently, simply because we cannot store it in a
uint64_t caps mask value anymore while retaining the ability to use
UINT64_MAX as "unset" marker.

The check actually was in place already, just one off.
2023-02-20 16:13:49 +01:00
Lennart Poettering 3f444e94f5 cap-list: modernize capability_set_from_string() a bit
Make return parameter optional. And return whether there were any caps
we didn't recognize via 0/1 return value.
2023-02-20 16:13:49 +01:00
Lennart Poettering 8142d73574 cap-list: rename capability_set_to_string_alloc() → capability_set_to_string()
We typically don't use the _alloc() suffix anymore for anything, hence
drop it here too.
2023-02-20 16:13:49 +01:00
Lennart Poettering c144696e12 tests: add test for mempool logic 2023-02-17 15:05:13 +01:00
Lennart Poettering 6aa90884a0 process-util: add helper get_process_threads()
Let's add a proper helper for querying the number of threads in a
process.
2023-02-17 14:27:58 +01:00
Luca Boccassi b8933fa843 Merge pull request #26341 from DaanDeMeyer/chase-fixes
chase-symlinks fixes
2023-02-17 11:44:47 +00:00
Lennart Poettering fdc2ad76b4 Merge pull request #26447 from poettering/sigqueue
pid1/systemctl: add ability to enqueue POSIX RT sigs with associated value to service processes
2023-02-17 10:51:58 +01:00
Lennart Poettering 48445827e3 Merge pull request #26450 from yuwata/fd-is-opath
util: introduce fd_is_opath() and use it in xsetxattr()
2023-02-17 10:28:32 +01:00
Lennart Poettering 4ea517a6e0 strv: add strv_copy_n() helper for copying part of a n strv 2023-02-17 09:55:35 +01:00
Lennart Poettering a721cd0016 pid1: add a new D-Bus method for enquing POSIX signals with values to unit processes
This augments the existing KillUnit() + Kill() methods with
QueueSignalUnit() + QueueSignal(), which are what sigqueue() is to
kill().

This is useful for sending our new SIGRTMIN+18 control signals to system
services.
2023-02-17 09:55:35 +01:00
Yu Watanabe d51e31ac41 test-execute: also mount tmpfs on /dev/shm
Otherwise, if /dev/shm has a directory that cannot be accessible by
unprivileged user, then we cannot pick a dynamic user, and test service
may fail with unexpected error code:
---
Failed to enter shared memory directory /dev/shm/systemd-watch-bind-BqAGlN: Permission denied
exec-dynamicuser-supplementarygroups.service: Failed to update dynamic user credentials: Device or resource busy
exec-dynamicuser-supplementarygroups.service: Failed at step USER spawning /bin/sh: Device or resource busy
src/test/test-execute.c:885:test_exec_dynamicuser: exec-dynamicuser-supplementarygroups.service: can_unshare=no: exit status 217, expected 216
---

Follow-up for 4e032f654b.
2023-02-17 09:55:05 +01:00
Yu Watanabe d7e32d0558 test: add tests for xsetxattr() 2023-02-17 11:42:14 +09:00
Yu Watanabe c56c26c906 test: use mkdtemp_open() 2023-02-17 11:18:49 +09:00
Luca Boccassi 010c73c68e Merge pull request #26307 from yuwata/test-execute-credentials
test-execute: drop capabilities when testing with user manager
2023-02-15 19:59:28 +00:00
Dmitry V. Levin 30fd9a2dab treewide: fix a few typos in NEWS, docs and comments 2023-02-15 10:41:03 +00:00