David Tardon [Wed, 10 Jan 2024 14:54:28 +0000 (15:54 +0100)]
man: update udev.conf man page
David Tardon [Fri, 5 Jan 2024 15:11:24 +0000 (16:11 +0100)]
udev: factor out config parser call into function
... which is then called from both places. This makes sure that the
configuration is parsed by udevd and other tools in exactly the same
way.
David Tardon [Fri, 5 Jan 2024 14:48:31 +0000 (15:48 +0100)]
udev-util: drop unused function
David Tardon [Fri, 5 Jan 2024 14:45:04 +0000 (15:45 +0100)]
udev-util: use config. parser to parse udev.conf
David Tardon [Fri, 5 Jan 2024 14:31:24 +0000 (15:31 +0100)]
udevd: use config. parser to parse udev.conf
This adds support for the usual config. file hierarchy (including
dropins).
Fixes #30460.
David Tardon [Fri, 5 Jan 2024 13:30:37 +0000 (14:30 +0100)]
conf-parser: generalize config_parse_config_file()
Luca Boccassi [Fri, 5 Jan 2024 08:27:21 +0000 (09:27 +0100)]
Merge pull request #30743 from bluca/coverity
Assorted coverity fixes
Luca Boccassi [Fri, 5 Jan 2024 08:26:42 +0000 (09:26 +0100)]
Merge pull request #30774 from mrc0mmand/test-tweaks
test: install correct kpartx udev rules (again) and dump cores of sanitized binaries
Luca Boccassi [Fri, 5 Jan 2024 08:26:19 +0000 (09:26 +0100)]
Merge pull request #30759 from mrc0mmand/resolved-followup
resolve: initialize `r` during OOM
Sergei Zhmylev [Mon, 11 Dec 2023 19:23:47 +0000 (22:23 +0300)]
journalctl: add --exclude-identifier option
Lennart Poettering [Tue, 21 Nov 2023 08:59:46 +0000 (09:59 +0100)]
creds-util: automatically append NUL byte to decrypted creds
Both as safety net and as convenience feature of a string is contained
in the credential
Lennart Poettering [Mon, 20 Nov 2023 15:22:33 +0000 (16:22 +0100)]
creds: rename "tpm2-absent" encryption to "null" encryption
This is what it is after all: encryption with a NULL key. This is more
descriptive, but also relevant since we want to use this kind of
credentials in a different context soon: for carrying pcrlock data into
a UKI. In that case we don#t want encryption, since the pcrlock data is
intended to help unlocking secrets, hence should not be a secret itself.
This only changes the code labels and the way this is labelled in the
output. We retain compat with the old name.
Lennart Poettering [Mon, 20 Nov 2023 16:42:38 +0000 (17:42 +0100)]
find-esp: adjust parameter indentating to our usual coding style
Lennart Poettering [Wed, 29 Nov 2023 10:21:21 +0000 (11:21 +0100)]
logind: use unlink_and_free() at once more place
Lennart Poettering [Thu, 4 Jan 2024 14:17:19 +0000 (15:17 +0100)]
json: drop redundant check
The same check is done exactly one line later, because this is one of
the things that json_variant_is_regular() checks.
As per: https://github.com/systemd/systemd/pull/30578/commits/
fa9a6db478e3f0f2753e4633af6d0d4881707c2b#r1441792019
Lennart Poettering [Thu, 4 Jan 2024 21:55:23 +0000 (22:55 +0100)]
Merge pull request #30749 from poettering/tmpfiles-verb-fix
tmpfiles: correctly apply globbing when cleaning 'x' lines
Lennart Poettering [Thu, 4 Jan 2024 21:54:41 +0000 (22:54 +0100)]
Merge pull request #30758 from YHNdnzj/vpick-not-ptr
vpick: trivial follow-up
Frantisek Sumsal [Thu, 4 Jan 2024 16:51:40 +0000 (17:51 +0100)]
ci: build with -O2 and -Wmaybe-uninitialized
According to the comment in meson.build this should be a supported
configuration, so let's test it in the CI as well.
Frantisek Sumsal [Thu, 4 Jan 2024 16:50:13 +0000 (17:50 +0100)]
shared: initialize a couple of values explicitly
As gcc has trouble figuring this itself with -O2 and -Wmaybe-initialized.
Frantisek Sumsal [Thu, 4 Jan 2024 15:48:10 +0000 (16:48 +0100)]
resolve: initialize `r` during OOM
Otherwise we'd use some garbage value in the error path.
../src/resolve/resolved-dns-query.c: In function ‘dns_query_accept’:
../src/resolve/resolved-dns-query.c:944:27: error: ‘r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
944 | q->answer_errno = -r;
| ^~
cc1: all warnings being treated as errors
Follow-up for
9ca133e97a0.
Frantisek Sumsal [Thu, 4 Jan 2024 19:31:32 +0000 (20:31 +0100)]
test: allow sanitized binaries to dump a core
If a binary built with ASan crashes for a reason unrelated to ASan
stuff, we're left with pretty much nothing, as there is neither an ASan
trace nor a coredump. Let's make this slightly more debug-able by
allowing such binaries to dump a core, but without the huge shadow map
(we should be actually fine by just setting disable_coredump=0, since
use_madv_dontdump defaults to true, but let's play it safe and not
potentially dump a 16+ TB core file).
Frantisek Sumsal [Thu, 4 Jan 2024 19:28:37 +0000 (20:28 +0100)]
test: install correct kpartx udev rules on Ubuntu
Follow-up for
519f0074cf.
Luca Boccassi [Wed, 12 Oct 2022 22:46:28 +0000 (23:46 +0100)]
tmpfiles: add --purge switch
Any file/directory created by a tmpfiles.d will be deleted. Useful for
purge/factory reset patterns.
Mike Yuan [Thu, 4 Jan 2024 15:31:37 +0000 (23:31 +0800)]
shared/vpick: don't say "ptr" for TAKE_PICK_RESULT (struct)
Mike Yuan [Thu, 4 Jan 2024 15:30:53 +0000 (23:30 +0800)]
vpick-tool: sort includes
Lennart Poettering [Thu, 4 Jan 2024 15:02:20 +0000 (16:02 +0100)]
Merge pull request #30744 from poettering/logind-trivial-tweaks
logind: 3 trivial cleanups
Lennart Poettering [Wed, 29 Nov 2023 10:09:20 +0000 (11:09 +0100)]
logind: do TTY idle logic only for sessions marked as "tty"
Otherwise things might be weird, because background sessions might
become "idle", wich doesn#t really make much sense.
This shouldn't change much in 99% of the cases, but slightly corrects
behaviour as it ensures only "primary"/"foreground" sessions get the
idle logic, i.e. where a user exists that could actually make it
non-idle.
Lennart Poettering [Fri, 24 Nov 2023 12:24:49 +0000 (13:24 +0100)]
update TODO
Lennart Poettering [Wed, 29 Nov 2023 10:07:08 +0000 (11:07 +0100)]
logind: don't make idle action timer accuracy more coarse than timeout
If we allow the timer accuracy to grow larger then the timeout itself
things are very confusing, because people might set a 1s time-out and we
turn that into 30s.
Hence, let's just cut off the 30s accuracy to the time-out itself, so
that we stay close to what users configured.
Yu Watanabe [Thu, 4 Jan 2024 14:28:34 +0000 (23:28 +0900)]
Merge pull request #30739 from poettering/pam-util-many
pam-util: add pam_get_item_many() to shorten some code
Lennart Poettering [Fri, 13 May 2022 22:03:01 +0000 (00:03 +0200)]
homed: when empty username is passed to bus calls, operate on client's UID
Lennart Poettering [Tue, 28 Nov 2023 08:52:17 +0000 (09:52 +0100)]
homed: fix home_count_bad_authentication() counting
We want to cover not only regular bad password entries, but also bad
recovery key entries. Hence let's move the list of errors into the
function, and add more.
Lennart Poettering [Tue, 28 Nov 2023 08:59:30 +0000 (09:59 +0100)]
homed: tone down log message about bad passwords a bit
We usually start out out authentication cycles with an "empty" password
attempt, to give homed the chance to authenticated via any plugged in
tokens. Hence frequently the first attempt will just fail, which is no
reason to complain about.
Yu Watanabe [Thu, 4 Jan 2024 14:25:18 +0000 (23:25 +0900)]
Merge pull request #30610 from YHNdnzj/logind-serialize-pidref
logind: serialize session leader pidfd to fdstore
Yu Watanabe [Tue, 2 Jan 2024 19:42:22 +0000 (04:42 +0900)]
network/route: make the route section invalid when an invalid MTUBytes= is specified
We usually set the invalid flag for a section if a setting in the section has
an invalid value. Let's also do the same thing for MTUBytes= in [Route].
Lennart Poettering [Thu, 4 Jan 2024 14:15:45 +0000 (15:15 +0100)]
Merge pull request #30578 from bluca/polkit-varlink
varlink: add glue to allow authenticating varlink connections via polkit
Frantisek Sumsal [Thu, 4 Jan 2024 10:31:11 +0000 (11:31 +0100)]
update-man-rules: skip over standard-conf.xml
bc6fdcbf5d switched its doctype to refentry, so the script started
picking it up and complaining that it's missing required stuff. Since
this file is only included from other man pages, let's skip it when
putting together a list of valid targets.
Resolves: #30715
Follow-up for:
bc6fdcbf5d
Lennart Poettering [Thu, 4 Jan 2024 14:02:05 +0000 (15:02 +0100)]
Merge pull request #30736 from YHNdnzj/loginctl-self
man/loginctl: some improvements
Lennart Poettering [Mon, 27 Nov 2023 16:10:35 +0000 (17:10 +0100)]
homed: add missing bus call to homed access policy
Lennart Poettering [Mon, 27 Nov 2023 16:22:54 +0000 (17:22 +0100)]
pam_systemd: drop unnecessary strempty() of 'tty' variable
This probably predates our introduction of streq_ptr(). Let's drop this
now however, as we actually want this to be NULL, further down, and
handle that just fine. In particular as all the special cases we have
explicitly set this to NULL anyway.
No real change in behaviour, just some normalization of handling.
Lennart Poettering [Thu, 4 Jan 2024 13:58:40 +0000 (14:58 +0100)]
tmpfiles: 'x' takes globs, hence clean it with globbing
Lennart Poettering [Thu, 4 Jan 2024 13:57:59 +0000 (14:57 +0100)]
tmpfiles: always list tmpfiles line types in same order
otherwise it just gets too confusing to follow.
Luca Boccassi [Thu, 4 Jan 2024 11:55:51 +0000 (12:55 +0100)]
sd-dhcp-client: add assert_not_reached in switch case
Tell static analysis that r is always initialised
Follow-up for
1809132064d2fd3479e316b615cd05698984852c
CID#
1533109
Luca Boccassi [Thu, 4 Jan 2024 11:52:25 +0000 (12:52 +0100)]
udev: add upper bound of 5 hours to SYSTEMD_UDEV_EXTRA_TIMEOUT_SEC=
Follow-up for
b16c6076cb334c9da9602d4bafbf60381d6d630e
CID#
1533111
Luca Boccassi [Thu, 4 Jan 2024 11:47:18 +0000 (12:47 +0100)]
dissect: add assert to guide static analysis
CID#
1533112
Luca Boccassi [Thu, 4 Jan 2024 11:44:31 +0000 (12:44 +0100)]
core: add an assert to guide static analysis
Follow-up for
4fb0d2dc140c9a2c01c236d2a8dc09a44157e896
CID#
1533110
Lennart Poettering [Wed, 29 Nov 2023 11:49:37 +0000 (12:49 +0100)]
execute: make sure Type=exec and PAMName= work together
If PAMName= is used we'll spawn a PAM session for the service, and leave
a process around that closes the PAM session eventually. That process
must close the "exec_fd" that we use to implement Type=exec. After all
the logic relies on the fact that execve() will implicitly close the
exec_fd, and the EOF seen on it is hence indication for the service
manager that execve() has worked. But if we keep an fd open in the PAM
service process, then this is not going to work.
Hence close the fd explicitly so that it definitely doesn't stay pinned
in the child.
Alberto Planas [Thu, 4 Jan 2024 12:32:59 +0000 (13:32 +0100)]
Fix typo in verb_make_policy explanation
Signed-off-by: Alberto Planas <aplanas@suse.com>
Mike Yuan [Thu, 4 Jan 2024 12:34:41 +0000 (20:34 +0800)]
Merge pull request #30725 from YHNdnzj/string-util
string-util,strv: follow-ups
Yu Watanabe [Wed, 3 Jan 2024 19:10:31 +0000 (04:10 +0900)]
network/netdev: call done() per netdev kind before freeing netdev name or so
Otherwise, log_netdev_xyz() does not provide netdev name if it is called
in done(). It is hard to debug.
This should not change any effective behavior, at least with the current
implementation of done() per netdev kind.
Mike Yuan [Thu, 4 Jan 2024 08:53:45 +0000 (16:53 +0800)]
tpm2-generator: sort includes
Lennart Poettering [Mon, 27 Nov 2023 15:55:31 +0000 (16:55 +0100)]
logind: use FOREACH_ARRAY() where appropriate
Lennart Poettering [Tue, 28 Nov 2023 14:42:08 +0000 (15:42 +0100)]
pam_systemd_home: minor coding style adjustment
Lennart Poettering [Mon, 27 Nov 2023 16:10:14 +0000 (17:10 +0100)]
homed: add some function parameter assert()s
Lennart Poettering [Wed, 29 Nov 2023 10:06:36 +0000 (11:06 +0100)]
logind: cast various calls that return errors we ignore to (void)
Luca Boccassi [Thu, 4 Jan 2024 11:42:23 +0000 (12:42 +0100)]
Luca Boccassi [Thu, 4 Jan 2024 11:41:31 +0000 (12:41 +0100)]
Lennart Poettering [Tue, 28 Nov 2023 08:31:04 +0000 (09:31 +0100)]
pam_systemd_home: port over to pam_get_item_many()
Lennart Poettering [Tue, 28 Nov 2023 08:30:32 +0000 (09:30 +0100)]
pam_systemd: move over to pam_get_item_many()
Mike Yuan [Thu, 4 Jan 2024 11:08:38 +0000 (19:08 +0800)]
man/loginctl: document "self" and "auto" special session IDs
session-status automatically uses "auto" if no ID is specified,
but show-session shows the manager's properties. Let's document
these special values so that users of show-session can benefit too.
Lennart Poettering [Tue, 28 Nov 2023 08:29:58 +0000 (09:29 +0100)]
pam-util: add pam_get_item_many() helper that gets many PAM items at once
Just to shorten a bit of code.
Mike Yuan [Thu, 4 Jan 2024 10:59:38 +0000 (18:59 +0800)]
man/loginctl: use <literal> to quote possible values of --kill-whom=
Mike Yuan [Thu, 4 Jan 2024 09:02:17 +0000 (17:02 +0800)]
TEST-35-LOGIN: enable FileDescriptorStorePreserve= for coldplug test
Lennart Poettering [Thu, 4 Jan 2024 08:59:19 +0000 (09:59 +0100)]
Merge pull request #30513 from rpigott/resolved-ede
resolved: support RFC 8914 EDE error codes
Mike Yuan [Thu, 4 Jan 2024 08:45:54 +0000 (16:45 +0800)]
strv: rename strv_endswith to endswith_strv and dedup ENDSWITH_SET
Mike Yuan [Thu, 4 Jan 2024 08:44:15 +0000 (16:44 +0800)]
string-util: move startswith_strv to strv
Mike Yuan [Thu, 4 Jan 2024 08:48:42 +0000 (16:48 +0800)]
string-util: use strneq
Mike Yuan [Thu, 4 Jan 2024 08:30:10 +0000 (16:30 +0800)]
string-util-fundamental: postfix -> suffix, use streq
Mike Yuan [Sun, 24 Dec 2023 11:06:01 +0000 (19:06 +0800)]
logind-session: watch pidfd in session_set_leader_consume
Mike Yuan [Tue, 21 Nov 2023 09:25:23 +0000 (17:25 +0800)]
logind: serialize session leader pidfd to fdstore
Mike Yuan [Sat, 23 Dec 2023 11:08:22 +0000 (19:08 +0800)]
process-util: ensure pidref_is_alive only return ESRCH if not set
Mike Yuan [Wed, 3 Jan 2024 04:13:42 +0000 (12:13 +0800)]
logind-session: use one_zero where appropriate
Mike Yuan [Tue, 26 Dec 2023 06:20:36 +0000 (14:20 +0800)]
logind-session: be tolerant if we failed to remove leader from hashmap
If something wrong happened before hashmap_put(), session_free()
may be called through gc logic, and the assertion is triggered.
Mike Yuan [Tue, 21 Nov 2023 10:00:48 +0000 (18:00 +0800)]
logind: use RET_GATHER more, return first error
Ronan Pigott [Fri, 22 Dec 2023 04:50:45 +0000 (21:50 -0700)]
resolved: add transaction result for upstream failures
This new transaction result is emitted when the upstream server
indicates a fatal error that we will not try to recover from.
Currently, it is emitted when a validating recursive resolver reports an
error validating dnssec records for a domain. The extended error message
should help give context to the admin.
Ronan Pigott [Mon, 18 Dec 2023 05:33:31 +0000 (22:33 -0700)]
resolved: support RFC 8914 EDE error codes
If the server is able to indicate an extended error to us, using a
degraded feature set is unlikely to help.
Ronan Pigott [Wed, 20 Dec 2023 22:16:41 +0000 (15:16 -0700)]
resolved: delay server feature detection
Some fields of the DnsPacket are not populated until we extract an
answer, like p->opt, despite being referenced by macros like
DNS_PACKET_RCODE. We can reorder some of the basic checks to follow
dns_packet_extract.
Ronan Pigott [Mon, 18 Dec 2023 04:30:03 +0000 (21:30 -0700)]
dns: remove some magic numbers
Let's use enum values for the EDNS codes now that we have them, for
readability.
Ronan Pigott [Mon, 18 Dec 2023 00:41:47 +0000 (17:41 -0700)]
dns: introduce more EDNS codes from IANA
Lennart Poettering [Wed, 3 Jan 2024 21:17:32 +0000 (22:17 +0100)]
Merge pull request #26663 from poettering/vpick
add new "vpick" concept for automatically picking newest resource from .v/ dir containing versioned files
Yu Watanabe [Wed, 3 Jan 2024 20:38:06 +0000 (05:38 +0900)]
Merge pull request #28797 from Werkov/eff_limits
Add MemoryMaxEffective=, MemoryHighEffective= and TasksMaxEff… …ective= properties
Michal Sekletar [Tue, 12 Dec 2023 18:03:39 +0000 (19:03 +0100)]
logind: don't setup idle session watch for lock-screen and greeter
Reason to skip the idle session logic for these session classes is that
they are idle by default.
Rose [Tue, 2 Jan 2024 15:13:27 +0000 (10:13 -0500)]
basic: fix overflow detection in sigbus_pop
The current check checks for n_sigbus_queue
being greater than or equal to SIGBUS_QUEUE_MAX,
when it should be just greater than as
n_sigbus_queue being SIGBUS_QUEUE_MAX indicates
that the queue is full, but not overflowed.
Yu Watanabe [Wed, 3 Jan 2024 20:25:41 +0000 (05:25 +0900)]
Merge pull request #30710 from YHNdnzj/logind-ret-gather
logind-session: modernization
Frantisek Sumsal [Wed, 3 Jan 2024 18:00:39 +0000 (19:00 +0100)]
test: temporarily adjust the default mount rate limit
(Hopefully) a temporary workaround for #30573 where starting a user
session when PID 1 is rate limited stalls even after it leaves the rate
limited state:
[ 11.658201] H systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=UnitRemoved cookie=4208 reply_cookie=0 signature=so error-name=n/a error-mes>
[ 11.658233] H systemd[1]: Event source 0x559babdd8bb0 (mount-monitor-dispatch) left rate limit state.
[ 101.562697] H busctl[784]: Failed to get credentials: Transport endpoint is not connected
[ 101.563480] H systemd[1]: systemd-journald.service: Got notification message from PID 300 (WATCHDOG=1)
[ 101.563725] H testsuite-74.sh[784]: BusAddress=unixexec:path=systemd-run,argv1=-M.host,argv2=-PGq,argv3=--wait,argv4=-pUser%3dtestuser,argv5=-pPAMName%3dlogin,argv6=systemd-stdio-bridge,argv7=-punix:path%3d%24%7bXDG_RUNTIME_DIR%7d/bus
[ 101.564136] H systemd[1]: Successfully forked off '(sd-expire)' as PID 787.
[ 101.564754] H systemd[1]: Successfully forked off '(sd-expire)' as PID 788.
[ 101.564831] H testsuite-74.sh[381]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-74.busctl.sh failed'
The issue appeared after
ee07fff03b which does a bunch of mounts/umounts
that get PID 1 into a rate limited state, and is frequent enough to be
annoying, so let's temporarily bump the rate limit to alleviate that.
Frantisek Sumsal [Wed, 3 Jan 2024 16:24:03 +0000 (17:24 +0100)]
test: install correct kpartx udev rules on Debian
Resolves: #30703
Yu Watanabe [Wed, 3 Jan 2024 20:21:50 +0000 (05:21 +0900)]
Merge pull request #30532 from yuwata/udev-extend-timeout-kill-worker
udev: extend timeout to prevent kill worker
Yu Watanabe [Wed, 3 Jan 2024 19:52:39 +0000 (04:52 +0900)]
Merge pull request #28836 from msekletar/aux-scope
core/manager: add dbus API to create auxiliary scope from running service
Dmitry Konishchev [Sat, 16 Dec 2023 16:41:57 +0000 (19:41 +0300)]
Fix KeepCarrier tun/tap device option
When KeepCarrier is set, networkd doesn't close tun/tap file descriptor
preserving the active interface state, but doesn't disable its queue
which makes kernel to think that it's still active and send packets to
it.
This patch disables the created queue right after tun/tap interface
creation.
Here is the steps to reproduce the bug:
Having:
systemd/network/10-tun-test.netdev:
[NetDev]
Name=tun-test
Kind=tun
[Tun]
MultiQueue=yes
KeepCarrier=yes
systemd/network/10-tun-test.network:
[Match]
Name=tun-test
[Network]
DHCP=no
IPv6AcceptRA=false
LLMNR=false
MulticastDNS=false
Address=172.31.0.1/24
app.c:
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <linux/if.h>
#include <sys/ioctl.h>
#include <linux/if_tun.h>
int main() {
int fd;
struct ifreq ifr;
memset(&ifr, 0, sizeof ifr);
strcpy(ifr.ifr_name, "tun-test");
ifr.ifr_flags = IFF_TUN | IFF_NO_PI | IFF_MULTI_QUEUE;
if((fd = open("/dev/net/tun", O_RDWR)) < 0) {
perror("Open error");
return 1;
}
if(ioctl(fd, TUNSETIFF, &ifr)) {
perror("Configure error");
return 1;
}
puts("Ready.");
char buf[1500];
while(1) {
int size = read(fd, buf, sizeof buf);
if(size < 0) {
perror("Read error");
return 1;
}
printf("Read %d bytes.\n", size);
}
return 0;
}
Run:
* gcc -o app app.c && ./app
* ping -I tun-test 172.31.0.2
Before the patch the app shows no pings, but after it works properly.
Lennart Poettering [Fri, 3 Mar 2023 17:55:18 +0000 (18:55 +0100)]
update TODO
Lennart Poettering [Thu, 16 Nov 2023 15:40:54 +0000 (16:40 +0100)]
tests: add integration tests for vpick logic
Lennart Poettering [Thu, 16 Nov 2023 10:31:02 +0000 (11:31 +0100)]
man: document the new vpick concept
Lennart Poettering [Wed, 15 Nov 2023 17:36:24 +0000 (18:36 +0100)]
discover-image: add support for vpick
Lennart Poettering [Mon, 13 Nov 2023 17:01:19 +0000 (18:01 +0100)]
execute: teach RootDirectory= and RootImage= the new vpick logic
Lennart Poettering [Tue, 20 Jun 2023 20:05:53 +0000 (22:05 +0200)]
dissect: port to vpick for selecting image
Lennart Poettering [Fri, 3 Mar 2023 17:25:37 +0000 (18:25 +0100)]
nspawn: hook up --image=/--directory=/--template= with vpick logic
Lennart Poettering [Fri, 3 Mar 2023 17:26:45 +0000 (18:26 +0100)]
vpick: add new tool "systemd-vpick" which exposes vpick on the command line
Usecase:
$ du $(systemd-vpick /srv/myimages.v/foo___.raw)
In order to determine size of newest image in /srv/myimages.v/
Lennart Poettering [Fri, 3 Mar 2023 17:18:05 +0000 (18:18 +0100)]
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.
Lennart Poettering [Tue, 20 Jun 2023 14:18:37 +0000 (16:18 +0200)]
stat-util: add inode_type_from_string() helper
Lennart Poettering [Fri, 3 Mar 2023 13:01:02 +0000 (14:01 +0100)]
string-util: add strrstr() helper