Commit Graph
4080 Commits
Author SHA1 Message Date
Antonio Alvarez Feijoo b431c090be tree-wide: use SPECIAL_BASIC_TARGET 2024-01-04 15:22:42 +01:00
Mike Yuan 2e6f012bf0 strv: rename strv_endswith to endswith_strv and dedup ENDSWITH_SET 2024-01-04 16:51:57 +08:00
Lennart Poettering 2a02a8db91 Merge pull request #26663 from poettering/vpick
add new "vpick" concept for automatically picking newest resource from .v/ dir containing versioned files
2024-01-03 22:17:32 +01:00
Yu Watanabe aea57b1415 Merge pull request #28836 from msekletar/aux-scope
core/manager: add dbus API to create auxiliary scope from running service
2024-01-04 04:52:39 +09:00
Lennart Poettering 76511c1bd3 shared: add new "vpick" concept for ".v/" directories that contain versioned resources
This adds a new concept for handling paths. At appropriate places, if a
path such as /foo/bar/baz.v/ is specified, we'll
automatically enumerate all entries in /foo/bar/baz.v/baz* and then
do a version sort and pick the newest file.

A slightly more complex syntax is available, too:

/foo/bar/baz.v/quux___waldo

if that's used, then we'll look for all files matching
/foo/bar/baz.v/quux*waldo, and split out the middle, and version sort
it, and pick the nwest.

The ___ wildcard indicates both a version string, and if needed an
architecture ID, in case per-arch entries shall be supported.

This is a very simple way to maintain versioned resources in a dir, and
make systemd's components automatically pick the newest. Example:

    /srv/myimages.v/foobar_1.32.65_x86-64.raw
    /srv/myimages.v/foobar_1.33.45_x86-64.raw
    /srv/myimages.v/foobar_1.31.5_x86-64.raw
    /srv/myimages.v/foobar_1.31.5_arm64.raw

If now nspawn is invoked like this:

    systemd-nspawn --image=/srv/myimages.v/foobar___.raw

Then it will automatically pick
/srv/myimages.v/foobar_1.33.45_x86-64.raw as the version to boot on
x86-64, and /srv/myimages.v/foobar_1.31.5_arm64.raw on arm64.

This commit only adds the basic implementation for picking files from a
dir, but no hook-up anywhere.
2024-01-03 18:38:46 +01:00
Lennart Poettering cc03788086 stat-util: add inode_type_from_string() helper 2024-01-03 18:38:46 +01:00
Lennart Poettering 63566c6b6f string-util: add strrstr() helper 2024-01-03 18:38:46 +01:00
Lennart Poettering cb599f881a strv: add new strv_endswith() helper 2024-01-03 18:38:46 +01:00
Michal Sekletar fd7fd59b6d tests: add test for StartAuxiliaryScope() 2024-01-03 13:50:46 +01:00
Lennart Poettering d4fee8941a confext: make sure we pick up configuration extensions passed to us from the stub
With fixes from Maanya Goenka.
2024-01-03 11:23:27 +01:00
Frantisek Sumsal b8e0dd3939 test: use timestamp_is_set() 2023-12-27 11:15:48 +01:00
Frantisek Sumsal cfae9ec203 test: use set_isempty() in one more place 2023-12-27 11:15:48 +01:00
Frantisek Sumsal 6f8b3838c9 test: use IN_SET()/ERRNO_IS_NEG_*() more 2023-12-27 11:15:48 +01:00
Yu Watanabe fe3fcb9492 Merge pull request #30633 from mrc0mmand/cocci-shenanigans
coccinelle: rework how we run the Coccinelle transformations
2023-12-26 05:45:58 +09:00
Frantisek Sumsal dd1b1dae7e test: use FLAGS_SET() in one more place 2023-12-25 18:26:59 +01:00
Frantisek Sumsal cd1c510f0c test: use ERRNO_IS_NEG_NOT_SUPPORTED() in one more place 2023-12-25 18:26:59 +01:00
Mike Yuan 0a0f49556f Merge pull request #30622 from yuwata/space
tree-wide: drop unnecessary space or insert missing space
2023-12-25 17:52:48 +08:00
Yu Watanabe c01a5c0527 siphash24: introduce siphash24_compress_typesafe() macro
To prevent copy-and-paste mistake.

This also introduce in_addr_hash_func().

No functional change, just refactoring.
2023-12-25 15:38:59 +09:00
Yu Watanabe b3a9d980f3 tree-wide: drop space between variable and an increment/decrement 2023-12-25 01:56:40 +09:00
Yu Watanabe 1d03d970a1 tree-wide: insert space after for and switch 2023-12-25 01:29:38 +09:00
Yu Watanabe 8161f6086e test: make assert_return() critical by default on fuzzer and unit tests
Several test cases intentionally trigger assert_return(). So, to avoid
the entire test fails, this introduces several macros that tentatively
make assert_return() not critical.
2023-12-24 02:02:18 +09:00
Luca Boccassi 4f276e97de test: fix check for device in test-execute
The unit actually uses /dev/kmsg, not /dev/kvm

Follow-up for ae7482b994
2023-12-22 15:32:28 +01:00
Lennart Poettering c5c74d85d3 networkd: add basic Varlink interface
Let's get networkd onto Varlink. This only adds the most basic of
operations.

I'd love to see networkd do Varlink for all its basic operations so that
networkctl can use that, and work correctly before D-Bus is up. Right
now, many of networkctls calls simply don't work before D-Bus, and I'd
like to see that improved.
2023-12-22 11:54:43 +09:00
Lennart Poettering aafd495af8 Merge pull request #30547 from poettering/uid0
add new "uid0" command as alternative multi-call interface for systemd-run, as sudo replacement
2023-12-21 22:45:15 +01:00
Daan De Meyer bacad14f94 Drop /dev test in test-mountpoint-util
Even /dev isn't always guaranteed to be a mount point, so let's drop
this part of the test.
2023-12-22 06:28:01 +09:00
Lennart Poettering 644f19c75c creds: add varlink API for encrypting/decrypting credentials 2023-12-21 19:19:12 +01:00
Lennart Poettering 447bcbfc90 color-util: add helper to convert RGB → HSV
We already have HSV → RGB, add the opposite operation.
2023-12-21 19:15:01 +01:00
Lennart Poettering 63e9c38370 terminal-util: add helper that determines terminal default bg color 2023-12-21 19:15:01 +01:00
Lennart Poettering 20f8b345db env-util: add strv_env_assignf() helper 2023-12-21 19:07:29 +01:00
Yu Watanabe e2ceb696d6 Merge pull request #30493 from teknoraver/main
Add verbose output on unit start #5717
2023-12-20 13:42:59 +09:00
Daan De Meyer a412a1b92a test: Skip various tests when /sys is not mounted
When running tests in a container, /sys might not be mounted, so
let's make sure we skip tests that depend on /sys in this case.
2023-12-19 16:38:57 +01:00
Matteo Croce e22ad53d5c dbus-wait-for-jobs: change 'quiet' flag to enum
Change the 'quiet' flag to `bus_wait_for_jobs()` to an enum, so we can
select with more granularity the type of information logged.
2023-12-19 04:52:41 -08:00
Frantisek Sumsal c15e51bde2 test: update comment style & drop one extraneous newline
Follow-up to 9fb2a61830.
2023-12-14 23:08:44 +01:00
Lennart Poettering 21c43631d7 rlimit-util: add pid_getrlimit() helper
This is gets the resource limits off a specified process, and is very
similar to prlimit() with a NULL new_rlimit argument. In fact, it tries
that first. However, it then falls back to use /proc/$PID/limits. Why?
Simply because Linux prohibits access to prlimit() for processes with a
different UID, but /proc/$PID/limits still works.

This is preparation to allow nspawn to run unprivileged.
2023-12-14 08:31:29 +00:00
Lennart Poettering bb59b92256 mount-util: make sure mount_switch_root() works as clean NOP when '/' is specified as target 2023-12-14 13:13:45 +09:00
Yu Watanabe 2527b725ba Merge pull request #30156 from yuwata/network-mtu
network: accept arbitrary size of MTU in .network
2023-12-12 19:03:21 +09:00
ksaleem 9fb2a61830 bootctl: fix case-sensitive comparisons in reporting bootloader entries
Fixes #30159
2023-12-11 10:51:56 +00:00
Luca Boccassi ae7482b994 core: do not make private /dev/ read-only too soon
The read-only bit is flipped after setting up all the mounts, so that
bind mounts can be added. Remove the early config, and add a unit
test.

Fixes https://github.com/systemd/systemd/issues/30372
2023-12-08 11:09:14 +09:00
Yu Watanabe a0460dfed6 parse-util: accept arbitrary MTU size when AF_UNSPEC
When [Link] MTU= is specified in a .network file, we have no idea about
that what kind of interface will be configured with the .network file.
The maximum and minimum MTU size depend on the kind of interface.
So, we should not filter MTU eagerly in the parser.

Closes #30140.
2023-12-08 10:47:42 +09:00
Lennart Poettering 4482ea0c24 Merge pull request #30271 from YHNdnzj/executor-cloexec
fdset,core/executor: ocloexecification ™️
2023-12-06 22:26:40 +01:00
Lennart Poettering 6498a0c2cc user-util: add new helper fully_set_uid_gid()
Usually when we do setresuid() we also do setesgid() and setgroups().
Let's add a common helper that does all three, and use it everywhere.
2023-12-06 22:11:38 +01:00
Luca Boccassi 5134e54625 basic: add fds_are_same_mount() helper 2023-12-05 17:20:27 +00:00
Zbigniew Jędrzejewski-Szmek 72420d39d7 test-macro: use capital test names for macro tests
It's just easier if the test is named as the thing being tested. Also, this way
inconsistent, because lower in the file uppercase test names are used.
2023-12-02 09:47:11 +01:00
Luca Boccassi f4a35f2ad9 core: do not drop CAP_SETUID if it is in AmbientCapabilities=
Follow-up for 24832d10b6
2023-12-01 10:48:14 +00:00
Mike Yuan a2467ea894 fdset: set all collected fds to CLOEXEC in fdset_new_fill() 2023-12-01 00:14:37 +08:00
Zbigniew Jędrzejewski-Szmek 78b95ccad8 test-time-util: suppress timestamp conversion failures for Africa/Khartoum timezone
Our timestamp conversion roundtrip test was failing. But I think that this
is not our bug:

$ TZ='Africa/Khartoum' date --date='@1509482094'
Tue Oct 31 23:34:54 EAT 2017
$ TZ='Africa/Khartoum' date --date='Tue Oct 31 23:34:54 EAT 2017' +%s
1509485694
$ TZ='Africa/Khartoum' date --date='@1509485694'
Tue Oct 31 23:34:54 CAT 2017
$ echo $[1509485694 - 1509482094]
3600

This is essentially the same as what happens in our test. After a round-trip, we
end up one hour ahead.

> For 1509482094632752, from the change log of tzdata:
>
> Release 2017c - 2017-10-20 14:49:34 -0700
>
>  Changes to future timestamps
>    Sudan will switch from +03 to +02 on 2017-11-01.

Fixes https://github.com/systemd/systemd/issues/28472.
2023-11-27 16:22:09 +00:00
Yu Watanabe fa3ab903f3 test: add test for draw_cylon() 2023-11-22 08:59:29 +09:00
Luca Boccassi 514c70eb52 test-condition: skip group test during Debian package build
The group names won't match in a package build chroot and the test might
fail, skip it.

https://buildd.debian.org/status/fetch.php?pkg=systemd&arch=hppa&ver=255%7Erc2-2&stamp=1700424353&raw=0
2023-11-20 10:51:42 +00:00
Yu Watanabe 965040d811 test: always call test_setup_logging() 2023-11-18 03:04:27 +09:00
Luca Boccassi dcddb2fc6b test: avoid asserting on default user shell
In some build environments it might differ:

/* test_get_user_creds_one("root", "root", 0, 0, "/root", "/usr/bin/bash") */
got "root", 0, 0, "/root", "/bin/sh": Success
Assertion 'path_equal(rshell, shell)' failed at src/test/test-user-util.c:345, function test_get_user_creds_one(). Aborting.

https://buildd.debian.org/status/fetch.php?pkg=systemd&arch=alpha&ver=255%7Erc2-1&stamp=1700147880&raw=0
2023-11-16 23:17:31 +00:00