]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoos-release: add 'SYSEXT_' fields for version/id 26941/head
Luca Boccassi [Fri, 24 Mar 2023 15:10:11 +0000 (15:10 +0000)] 
os-release: add 'SYSEXT_' fields for version/id

sysext DDI cannot carry an os-release file, but have to carry
an extension-release file. But so far, this was only used to
match the sysext DDI with the base DDI/rootdir. It is also
useful to describe the sysext DDI itself, just like we do in
os-release.

So document that the same fields used in os-release can also
be added to an extension-release, with the 'SYSEXT_' prefix,
and in that case they are understood to define the sysext DDI
itself, rather than for matching purposes.

2 years agoportablectl: display sysext-specific fields
Luca Boccassi [Tue, 28 Mar 2023 09:36:49 +0000 (10:36 +0100)] 
portablectl: display sysext-specific fields

The wrong fields were being displayed, if at all.
ID and VERSION_ID in sysexts are used for matching, they
don't identify the sysext itself. Parse the newly defined
fields and display them separately from the compatibility
fields.

Before:

Image:
        /home/bluca/git/systemd/base.raw
Portable Service:
        n/a
Operating System:
        Debian GNU/Linux 10 (buster)
Extension:
        /home/bluca/git/systemd/app0.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Operating System:
                n/a (debian 10)
Extension:
        /home/bluca/git/systemd/app1.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Operating System:
                n/a (debian 10)
Unit files:
        app0.service
        app1.service

After:

Image:
        /home/bluca/git/systemd/base.raw
Portable Service:
        n/a
Operating System:
        Debian GNU/Linux 10 (buster)
Extension:
        /home/bluca/git/systemd/app0.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Extension Compatibility OS:
                debian
        Extension Compatibility OS Version:
                10
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Extension Image:
                ID: app Version: 0
Extension:
        /home/bluca/git/systemd/app1.raw
        Extension Scope:
                n/a
        Extension Compatibility Level:
                n/a
        Extension Compatibility OS:
                debian
        Extension Compatibility OS Version:
                10
        Portable Service:
                n/a
        Portable Prefixes:
                n/a
        Extension Image:
                ID: app Version: 1
Unit files:
        app0.service
        app1.service

2 years agoportable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=
Luca Boccassi [Thu, 23 Mar 2023 01:23:04 +0000 (01:23 +0000)] 
portable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=

This is useful to identify log messages with metadata from the images
they run on. Look for ID/VERSION_ID/IMAGE_ID/IMAGE_VERSION/BUILD_ID,
with a SYSEXT_ prefix if we are looking at an extension, and append via
LogExtraFields= as respectively PORTABLE_NAME_AND_VERSION= in case of a
single image. In case of extensions, append as PORTABLE_ROOT_NAME_AND_VERSION=
for the base and one PORTABLE_EXTENSION_AND_VERSION= for each extension.

Example with a base and two extensions, with the unit coming from the
first extension:

[Service]
RootImage=/home/bluca/git/systemd/base.raw
Environment=PORTABLE=app0.raw
BindReadOnlyPaths=/etc/os-release:/run/host/os-release
LogExtraFields=PORTABLE=app0.raw
Environment=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT_NAME_AND_VERSION=debian_10

ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_0

ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_1

2 years agoportable: include base and extension images in log fields
Luca Boccassi [Wed, 22 Mar 2023 22:44:31 +0000 (22:44 +0000)] 
portable: include base and extension images in log fields

When a portable service uses extensions, we use the 'main' image name
(the one where the unit was found in) as PORTABLE=. It is useful to
also list all the images actually used at runtime, as they might
contain libraries and so on.

Use PORTABLE_ROOT= for the image/directory that is used as RootImage=
or RootDirectory=, and PORTABLE_EXTENSION= for the image/directory that
is used as ExtensionImages= or ExtensionDirectories=.

Note that these new fields are only added if extensions are used,
there's no change for single-DDI portables.

Example with a base and two extensions, with the unit coming from the
first extension:

[Service]
RootImage=/home/bluca/git/systemd/base.raw
Environment=PORTABLE=app0.raw
BindReadOnlyPaths=/etc/os-release:/run/host/os-release
LogExtraFields=PORTABLE=app0.raw
LogExtraFields=PORTABLE_ROOT=base.raw

ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw

ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw

2 years agoportable: use parse_env_file_fd to keep FD valid
Luca Boccassi [Thu, 23 Mar 2023 01:02:47 +0000 (01:02 +0000)] 
portable: use parse_env_file_fd to keep FD valid

take_fdopen_unlocked invalidates the FD in the PortableMetadata object,
so it cannot be used later. Use parse_env_file_fd instead which is non
destructive.

2 years agostrv: add helper to find value in key/value pairs from list of keys
Luca Boccassi [Mon, 27 Mar 2023 11:05:28 +0000 (12:05 +0100)] 
strv: add helper to find value in key/value pairs from list of keys

2 years agoenv: add load_env_file_pairs_fd()
Luca Boccassi [Thu, 23 Mar 2023 10:47:06 +0000 (10:47 +0000)] 
env: add load_env_file_pairs_fd()

2 years agoMerge pull request #27013 from fbuihuu/test-fixlets
Yu Watanabe [Tue, 28 Mar 2023 04:45:24 +0000 (13:45 +0900)] 
Merge pull request #27013 from fbuihuu/test-fixlets

Test fixlets

2 years agocryptenroll: fix a memory leak
Frantisek Sumsal [Mon, 27 Mar 2023 14:51:00 +0000 (16:51 +0200)] 
cryptenroll: fix a memory leak

$ dd if=/dev/zero of=luks.img bs=1M count=64
$ echo 1231dfsd234d | cryptsetup luksFormat luks.img
$ build-san/systemd-cryptenroll luks.img
SLOT TYPE
   0 password

=================================================================
==640364==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f43ffeb95b5 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xb95b5)
    #1 0x7f43ff0a4f2f in greedy_realloc ../src/basic/alloc-util.c:70
    #2 0x404d9f in list_enrolled ../src/cryptenroll/cryptenroll-list.c:30
    #3 0x40f149 in run ../src/cryptenroll/cryptenroll.c:673
    #4 0x40f149 in main ../src/cryptenroll/cryptenroll.c:692
    #5 0x7f43fd64a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
Aborted (core dumped)

Reported in https://github.com/systemd/systemd/pull/27007.

2 years agoMerge pull request #27022 from yuwata/journal-remote-fix-relative-output-journal...
Yu Watanabe [Tue, 28 Mar 2023 04:41:13 +0000 (13:41 +0900)] 
Merge pull request #27022 from yuwata/journal-remote-fix-relative-output-journal-file

journal-remote: support relative output journal file again

2 years agosystemctl: show service status string in other color
Lennart Poettering [Fri, 24 Mar 2023 21:52:51 +0000 (22:52 +0100)] 
systemctl: show service status string in other color

Let's add a dash of colour to separate our own status info from the the
status info supplied by the service.

(I wanted to make this italics, but apparently popular terminal
emulators don't support that, such as xterm)

2 years agosystemctl: show fd store info in status output
Lennart Poettering [Fri, 24 Mar 2023 21:37:42 +0000 (22:37 +0100)] 
systemctl: show fd store info in status output

The fdstore might pin a non-trivial amount of resources. Let's hence
display for services that enable it how many entries there are and what
the size limit is.

2 years agosystemctl: dont's how memory limits that aren't available via D-Bus props
Lennart Poettering [Fri, 24 Mar 2023 21:41:57 +0000 (22:41 +0100)] 
systemctl: dont's how memory limits that aren't available via D-Bus props

When using an old systemctl on a new PID 1 the "startup" memory limit
props are not initialized and currently be shown in status output as
zero, even though there's code to suppress the output in that case. Alas
it doesn't work, because the relevant fields are not marked as
"unset"... Fix that.

Follow-up for: 53fda560dc2c66502da7ad68db7d79b515a3601a

2 years agoMerge pull request #26993 from mrc0mmand/TEST-46-tweaks
Yu Watanabe [Tue, 28 Mar 2023 04:39:08 +0000 (13:39 +0900)] 
Merge pull request #26993 from mrc0mmand/TEST-46-tweaks

test: explicitly pull in systemd-userdbd.service

2 years agoMerge pull request #26980 from ldv-alt/udevadm-verify
Yu Watanabe [Tue, 28 Mar 2023 04:38:12 +0000 (13:38 +0900)] 
Merge pull request #26980 from ldv-alt/udevadm-verify

udevadm verify: add more checks

2 years agohwdb: Move MSI touchpad-toggle mapping to generic MSI section
Hans de Goede [Mon, 27 Mar 2023 14:34:22 +0000 (16:34 +0200)] 
hwdb: Move MSI touchpad-toggle mapping to generic MSI section

Like other MSI laptops the MSI Summit E16 Flip A12UCT laptop also send
atkbd scancode 0x76 for the Fn + F4 touchpad-toggle hotkey combo.

Move the existing mapping for this from the MSI Prestige And MSI Modern
section to the generic MSI laptop section.

While at it also drop the KEYBOARD_KEY_f1=f20 mapping from
the MSI Prestige And MSI Modern section, as that is already listed
in the generic MSI laptop section.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216824
2 years agoenv-util: introduce strv_env_assign_many()
Yu Watanabe [Mon, 27 Mar 2023 09:21:06 +0000 (18:21 +0900)] 
env-util: introduce strv_env_assign_many()

2 years agoukify: Weaken file alignment assertions
Daan De Meyer [Mon, 27 Mar 2023 11:41:59 +0000 (13:41 +0200)] 
ukify: Weaken file alignment assertions

Older versions of the stub are not aligned to the PE file alignment
size. If we remove the assertions, the UKI still boots without issues,
so let's drop the assertions and print a message about it instead.

2 years agoMerge pull request #27005 from poettering/fd-reopen-symlink
Daan De Meyer [Mon, 27 Mar 2023 17:32:05 +0000 (19:32 +0200)] 
Merge pull request #27005 from poettering/fd-reopen-symlink

fd_reopen() symlink handling tweaks

2 years agoMerge pull request #26902 from YHNdnzj/restart-sec-step
Daan De Meyer [Mon, 27 Mar 2023 17:31:21 +0000 (19:31 +0200)] 
Merge pull request #26902 from YHNdnzj/restart-sec-step

core: add RestartSteps= and RestartSecMax= to dynamically increase interval between auto restarts

2 years agojournal-remote: make specified output file absolute 27022/head
Yu Watanabe [Mon, 27 Mar 2023 17:07:31 +0000 (02:07 +0900)] 
journal-remote: make specified output file absolute

After f12b399dd6362a03379cb769954ebfb9972236ed, the output path is
also used to determine the directory to be vacuumed. And if a filename
only path is specified, `writer_new()` fails since the commit.

This makes the specified path is always made absolute. This should not
change any behavior before the offending commit, as `journal_open()` opens
the specified journal file with `AT_FDCWD`.

Fixes #27012.

2 years agojournal-remote: add missing log message for failure in journal_remote_get_writer()
Yu Watanabe [Mon, 27 Mar 2023 17:28:04 +0000 (02:28 +0900)] 
journal-remote: add missing log message for failure in journal_remote_get_writer()

2 years agojournal-remote: make writer_new() return negative errno on failure
Yu Watanabe [Mon, 27 Mar 2023 17:26:33 +0000 (02:26 +0900)] 
journal-remote: make writer_new() return negative errno on failure

After f12b399dd6362a03379cb769954ebfb9972236ed, writer_new() may fail
with non-OOM error. Let's return the error cause, and logs the failure
in the caller side.

This also drops logs in journal_remote_get_writer(), adds its caller
typically logs the failure.

2 years agotest: don't export $TOOLS_DIR 27013/head
Franck Bui [Wed, 22 Mar 2023 09:33:58 +0000 (10:33 +0100)] 
test: don't export $TOOLS_DIR

It's not (and shouldn't be) used by any test scripts.

2 years agotest: clean up $STATEDIR too
Franck Bui [Tue, 21 Mar 2023 15:47:06 +0000 (16:47 +0100)] 
test: clean up $STATEDIR too

2 years agotest: $STATEDIR should not point to /usr/lib/systemd/tests when NO_BUILD=1
Franck Bui [Tue, 21 Mar 2023 15:44:41 +0000 (16:44 +0100)] 
test: $STATEDIR should not point to /usr/lib/systemd/tests when NO_BUILD=1

When testing the binaries from the host, make sure to not store the state data
below /usr but use a dedicated directory in /var/tmp/ instead.

The working directories of the tests, initially located in /var/tmp, are also
moved in a dedicated directory /var/tmp/systemd-tests.

2 years agolocale: Add missing libxkbcommon dependency to tests
Daan De Meyer [Mon, 27 Mar 2023 11:58:02 +0000 (13:58 +0200)] 
locale: Add missing libxkbcommon dependency to tests

Fixes opensuse mkosi CI build

2 years agoupdate TODO
Lennart Poettering [Fri, 24 Mar 2023 21:52:13 +0000 (22:52 +0100)] 
update TODO

2 years agoMerge pull request #26932 from dtardon/journal-vacuum
Lennart Poettering [Mon, 27 Mar 2023 13:49:58 +0000 (15:49 +0200)] 
Merge pull request #26932 from dtardon/journal-vacuum

Count size of all journal files when vacuuming

2 years agomkosi: Narrow glob used to install python packages
Daan De Meyer [Mon, 27 Mar 2023 11:23:40 +0000 (13:23 +0200)] 
mkosi: Narrow glob used to install python packages

Let's make sure we only install the python3 and python39 python
packages, instead of all the packages of all versions that are
packaged.

This also fixes the CentOS 8 CI because python3.11-pytest was failing
to install.

We have to ship our own powertools repo definition because we need to
enable module_hotfixes for powertools to coerce dnf into installing
some of the python packages.

2 years agocore/dbus-service: add RestartUSecCurrent property 26902/head
Mike Yuan [Fri, 24 Mar 2023 18:06:42 +0000 (02:06 +0800)] 
core/dbus-service: add RestartUSecCurrent property

This new property shows how much time we actually
waits before restarting.

2 years agocore: add RestartSteps= and RestartSecMax= for exponentially increasing
Mike Yuan [Mon, 20 Mar 2023 10:49:39 +0000 (18:49 +0800)] 
core: add RestartSteps= and RestartSecMax= for exponentially increasing
interval between restarts

RestartSteps= accepts a positive integer as the number of steps
to take to increase the interval between auto-restarts from
RestartSec= to RestartSecMax=, or 0 to disable it.

Closes #6129

2 years agouserdb: rename the destructor to follow our coding style 26993/head
Frantisek Sumsal [Mon, 27 Mar 2023 11:19:30 +0000 (13:19 +0200)] 
userdb: rename the destructor to follow our coding style

2 years agouserdb: fix a memory leak
Frantisek Sumsal [Sun, 26 Mar 2023 10:23:43 +0000 (12:23 +0200)] 
userdb: fix a memory leak

[   49.275617] testsuite-46.sh[1862]: =================================================================
[   49.275870] testsuite-46.sh[1862]: ==1862==ERROR: LeakSanitizer: detected memory leaks
[   49.276039] testsuite-46.sh[1862]: Direct leak of 103 byte(s) in 14 object(s) allocated from:
[   49.276515] testsuite-46.sh[1862]:     #0 0x7f4dbc07243b in strdup (/lib64/libasan.so.8+0x7243b)
[   49.276707] testsuite-46.sh[1862]:     #1 0x7f4dbb3900d5 in free_and_strdup ../src/basic/string-util.c:952
[   49.276931] testsuite-46.sh[1862]:     #2 0x7f4dbb15c67d in json_dispatch_user_group_name ../src/shared/json.c:4699
[   49.277134] testsuite-46.sh[1862]:     #3 0x7f4dbb16da9b in json_dispatch ../src/shared/json.c:4395
[   49.277352] testsuite-46.sh[1862]:     #4 0x7f4dbb25b28e in userdb_on_query_reply ../src/shared/userdb.c:305
[   49.277603] testsuite-46.sh[1862]:     #5 0x7f4dbb2748b9 in varlink_dispatch_reply ../src/shared/varlink.c:760
[   49.277766] testsuite-46.sh[1862]:     #6 0x7f4dbb2748b9 in varlink_process ../src/shared/varlink.c:951
[   49.277975] testsuite-46.sh[1862]:     #7 0x7f4dbb27a001 in defer_callback ../src/shared/varlink.c:1897
[   49.278197] testsuite-46.sh[1862]:     #8 0x7f4dbb5d57dd in source_dispatch ../src/libsystemd/sd-event/sd-event.c:4191
[   49.278421] testsuite-46.sh[1862]:     #9 0x7f4dbb5d685d in sd_event_dispatch ../src/libsystemd/sd-event/sd-event.c:4780
[   49.278675] testsuite-46.sh[1862]:     #10 0x7f4dbb5d70bf in sd_event_run ../src/libsystemd/sd-event/sd-event.c:4841
[   49.278873] testsuite-46.sh[1862]:     #11 0x7f4dbb257e7c in userdb_process ../src/shared/userdb.c:591
[   49.279048] testsuite-46.sh[1862]:     #12 0x7f4dbb25f78f in membershipdb_iterator_get ../src/shared/userdb.c:1411
[   49.279280] testsuite-46.sh[1862]:     #13 0x7f4dbb23a98c in user_record_show ../src/shared/user-record-show.c:187
[   49.279504] testsuite-46.sh[1862]:     #14 0x404ae3 in show_user ../src/userdb/userdbctl.c:93
[   49.279710] testsuite-46.sh[1862]:     #15 0x40b4f5 in display_user ../src/userdb/userdbctl.c:418
[   49.279961] testsuite-46.sh[1862]:     #16 0x7f4dbb2804d2 in dispatch_verb ../src/shared/verbs.c:110
[   49.280233] testsuite-46.sh[1862]:     #17 0x40dcf3 in run ../src/userdb/userdbctl.c:1327
[   49.280434] testsuite-46.sh[1862]:     #18 0x40dcf3 in main ../src/userdb/userdbctl.c:1330
[   49.280657] testsuite-46.sh[1862]:     #19 0x7f4db9e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
[   49.280907] testsuite-46.sh[1862]: SUMMARY: AddressSanitizer: 103 byte(s) leaked in 14 allocation(s).

2 years agotest: explicitly pull in systemd-userdbd.socket
Frantisek Sumsal [Sun, 26 Mar 2023 09:53:04 +0000 (11:53 +0200)] 
test: explicitly pull in systemd-userdbd.socket

Since we don't run preset-all on the test image, the
systemd-userdbd.socket remains disabled. Let's pull it in explicitly
to give systemd-userdbd some coverage as well.

2 years agoupdate TODO
Lennart Poettering [Mon, 27 Mar 2023 11:20:11 +0000 (13:20 +0200)] 
update TODO

2 years agotest-fd-util: use stat_inode_same() where appropriate 27005/head
Lennart Poettering [Mon, 27 Mar 2023 10:06:55 +0000 (12:06 +0200)] 
test-fd-util: use stat_inode_same() where appropriate

2 years agofd-util: cover some corner cases with fd_reopen() on symlinks
Lennart Poettering [Mon, 27 Mar 2023 10:04:57 +0000 (12:04 +0200)] 
fd-util: cover some corner cases with fd_reopen() on symlinks

The /proc/self/fd/ interface cannot be used to follow symlinks pinned
via O_PATH. Add a comment + test for that. Moreover, using fd_reopen()
with O_NOFOLLOW cannot work. Add an explicit check and test for that, to
make behaviour uniform.

2 years agoudev-rules: fix grammar in diagnostics about lines that have no effect 26980/head
Dmitry V. Levin [Mon, 27 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev-rules: fix grammar in diagnostics about lines that have no effect

Fixes: 25de7aa7b90c ("udev: modernize udev-rules.c")
2 years agotest: verify the journal with and without a sealing key
Frantisek Sumsal [Sun, 26 Mar 2023 15:04:57 +0000 (17:04 +0200)] 
test: verify the journal with and without a sealing key

The bit flips during journal verification cause various types of journal
corruptions, so it's useful to go through it even without a sealing key
to see how we handle corrupted stuff.

Also, provide a sealing key if running in "CI mode" (i.e. arguments),
to check the FSS-related codepaths in CIs as well.

2 years agoudev-rules: extend the check for conflicting expressions
Dmitry V. Levin [Fri, 24 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev-rules: extend the check for conflicting expressions

Log an error when a rule line contains the following kind of conflicting
match expressions:

  KEY=="foo*", KEY=="bar*"

2 years agoudev-rules: check token delimiters
Dmitry V. Levin [Thu, 23 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev-rules: check token delimiters

When udev_rules_parse_file() is called by udevadm verify, issue warnings
about the following conditions in udev rules:
* the first token in the rule is preceded with a comma
* the last token in the rule is followed by a comma
* there is no comma between tokens
* there is no whitespace between tokens
* there is more than a single comma between tokens
* there is whitespace between a token and a comma
* there is no whitespace after comma

2 years agoudev-rules: move udev_check_rule_line() invocation
Dmitry V. Levin [Wed, 22 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev-rules: move udev_check_rule_line() invocation

Move udev_check_rule_line() invocation from udev_rule_file_get_issues()
to udev_rules_parse_file(), invoke udev_check_rule_line() only when
udev_rules_parse_file() is called by udevadm verify.

Subsequent commits are going to perform more checks invoked from
udev_rules_parse_file().

2 years agoudev-rules: move udev_rules_parse_file() after udev_check_rule_line()
Dmitry V. Levin [Wed, 22 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev-rules: move udev_rules_parse_file() after udev_check_rule_line()

Move udev_rules_parse_file() after udev_check_rule_line() as
the former us going to use the latter.

2 years agotestsuite-17.11.sh: add commas between tokens
Dmitry V. Levin [Tue, 21 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
testsuite-17.11.sh: add commas between tokens

2 years agorules: add whitespace after comma before the line continuation
Dmitry V. Levin [Sat, 25 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
rules: add whitespace after comma before the line continuation

2 years agorules: remove stray whitespace before comma between tokens
Dmitry V. Levin [Tue, 21 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
rules: remove stray whitespace before comma between tokens

2 years agosd-id128: make id128_read() optionally take root directory
Yu Watanabe [Sun, 26 Mar 2023 05:03:10 +0000 (14:03 +0900)] 
sd-id128: make id128_read() optionally take root directory

2 years agoMerge pull request #26961 from DaanDeMeyer/chase-and-pin
Daan De Meyer [Mon, 27 Mar 2023 08:41:08 +0000 (10:41 +0200)] 
Merge pull request #26961 from DaanDeMeyer/chase-and-pin

chase-symlinks: Add chase_and_open_parent() + at() variant

2 years agoMerge pull request #26870 from fbuihuu/move-unit-tests-in-a-dedicated-subdir
Luca Boccassi [Mon, 27 Mar 2023 08:38:15 +0000 (09:38 +0100)] 
Merge pull request #26870 from fbuihuu/move-unit-tests-in-a-dedicated-subdir

Move unit tests in a dedicated subdir

2 years agojournalctl: fix when --grep is used with --follow
Mike Yuan [Thu, 23 Mar 2023 14:17:40 +0000 (22:17 +0800)] 
journalctl: fix when --grep is used with --follow

Follow-up for #25147 (db4691961ca52759fe6645d0fddb659ee4299ac2)

--follow sets arg_lines to 10, which breaks
--grep as the latter implies --reverse.
So let's not set --reverse if --follow is used.

2 years agoMerge pull request #26294 from yuwata/locale-verify-conf
Zbigniew Jędrzejewski-Szmek [Mon, 27 Mar 2023 08:26:24 +0000 (10:26 +0200)] 
Merge pull request #26294 from yuwata/locale-verify-conf

locale: verify loaded keymap or friends

2 years agobootctl: split-out entry token related definitions into boot-entry.[ch]
Yu Watanabe [Sun, 26 Mar 2023 07:33:43 +0000 (16:33 +0900)] 
bootctl: split-out entry token related definitions into boot-entry.[ch]

No functional change, just preparation for later commits.
These can be used in kernel-install later.

Note, unlike the our usual coding style, the arguments for
boot_entry_token_ensure() and parse_boot_entry_token_type() are
referenced, updated, and may freed, hence, always pass initialized
values. That's why they are not named as 'ret_xyz'.

2 years agochase-symlinks: Add chase_and_open_parent() + at() variant 26961/head
Daan De Meyer [Fri, 24 Mar 2023 11:10:16 +0000 (12:10 +0100)] 
chase-symlinks: Add chase_and_open_parent() + at() variant

Helper to chase a path, pin its parent directory and return the filename
of the resolved path in its parent directory.

2 years agoDefine $KERNEL_INSTALL_UKI_GENERATOR
Gertalitec [Wed, 22 Mar 2023 21:09:10 +0000 (01:09 +0400)] 
Define $KERNEL_INSTALL_UKI_GENERATOR

Define $KERNEL_INSTALL_UKI_GENERATOR in case one wants it to be different from $KERNEL_INSTALL_INITRD_GENERATOR. This can be useful if one wants to use mkinitcpio / Dracut to generate the initrd, but without creating the UKI so this can be left for e.g. ukify or something else. Right now these initrd generators will read /etc/kernel/install.conf and generate the UKI

2 years agohwdb: Fixed thumb buttons reversed on CHERRY MW 2310 (#26992)
taniishkaaa [Sun, 26 Mar 2023 14:52:31 +0000 (20:22 +0530)] 
hwdb: Fixed thumb buttons reversed on CHERRY MW 2310 (#26992)

Fixes #12914.

2 years agohwdb: drop redundant entry
Yu Watanabe [Sun, 26 Mar 2023 00:44:48 +0000 (09:44 +0900)] 
hwdb: drop redundant entry

Follow-up for ff155c81620bc4e1ccce27d4d5194707048d8143.

The entry already matches with the generic rule defined at the beginning
of the hwdb file.

2 years agotest: install symlinks with valid targets on SUSE and Debian 26870/head
Franck Bui [Fri, 24 Mar 2023 12:46:24 +0000 (13:46 +0100)] 
test: install symlinks with valid targets on SUSE and Debian

2 years agoMerge pull request #26973 from mrc0mmand/userdbctl-tests
Yu Watanabe [Sun, 26 Mar 2023 00:49:27 +0000 (09:49 +0900)] 
Merge pull request #26973 from mrc0mmand/userdbctl-tests

test: add a couple of tests for userdbctl

2 years agocore/main: restore the correct assert about array position
Zbigniew Jędrzejewski-Szmek [Sat, 25 Mar 2023 10:58:49 +0000 (11:58 +0100)] 
core/main: restore the correct assert about array position

'pos' is incremented after each assignment. If we use the maximum number
of arguments, we end up with pos==9 after all the assignments, and it
points to where the next value would be assigned. This position must remain
NULL.

The assert I "fixed" was intentionally introduced in
26abdc73a212b90f7c4b71808a1028d2e87ab09f as a bugfix. So my "fix" repeated
the same error that was fixed back then.

2 years agoMerge pull request #26983 from mrc0mmand/coredump-test-followup
Yu Watanabe [Sun, 26 Mar 2023 00:47:49 +0000 (09:47 +0900)] 
Merge pull request #26983 from mrc0mmand/coredump-test-followup

test: don't expand the subshell expression prematurely

2 years agotest: filter the merged coverage report instead
Frantisek Sumsal [Sat, 25 Mar 2023 13:39:13 +0000 (14:39 +0100)] 
test: filter the merged coverage report instead

So we don't have to do this twice - once for the base report and then
for each "real" one.

Follow-up to 7fdd6e157a.

2 years agotest: add a couple of tests for userdbctl 26973/head
Frantisek Sumsal [Fri, 24 Mar 2023 16:26:48 +0000 (17:26 +0100)] 
test: add a couple of tests for userdbctl

2 years agotest: do an initial coverage capture
Frantisek Sumsal [Fri, 24 Mar 2023 20:15:28 +0000 (21:15 +0100)] 
test: do an initial coverage capture

I noticed that our coverage reports miss some files completely - this
happens when the test doesn't touch the code in them at all, so the
generated coverage data (and resulting reports) have no information
about them. Let's fix this by doing an initial zero coverage capture
that contains a zeroed counter for every instrumented line in every
file, so when we later merge it with a capture from the test, it shows up
with a missing coverage instead of not showing at all.

2 years agotest: drop unnecessary return 26983/head
Frantisek Sumsal [Sat, 25 Mar 2023 11:17:11 +0000 (12:17 +0100)] 
test: drop unnecessary return

Return code of the EXIT trap handler is ignored in bash.

2 years agotest: don't touch the /failed marker in the subtest scripts
Frantisek Sumsal [Sat, 25 Mar 2023 11:15:33 +0000 (12:15 +0100)] 
test: don't touch the /failed marker in the subtest scripts

As it is already handled by the "main" script (testsuite-74.sh).

2 years agotest: don't expand the subshell expression prematurely
Frantisek Sumsal [Sat, 25 Mar 2023 11:02:15 +0000 (12:02 +0100)] 
test: don't expand the subshell expression prematurely

We need to expand the subshell expression during the `bash -c`
invocation, not before, to take the desired effect, as now it expands to:

timeout 30 bash -c 'while [[ 0 -eq 0 ]]; do sleep 1; done'

instead of the expected:

timeout 30 bash -c 'while [[ $(coredumpctl list -q --no-legend 770 | wc -l) -eq 0 ]]; do sleep 1; done'

Follow-up to aadbd81f7f.

2 years agohwdb: Fix incorrect touchpad dimensions on Thinkpad L14 Gen1 (#26937)
taniishkaaa [Sat, 25 Mar 2023 10:41:07 +0000 (16:11 +0530)] 
hwdb: Fix incorrect touchpad dimensions on Thinkpad L14 Gen1 (#26937)

Closes #22793.

2 years agotest: add test for invalid keymap setting 26294/head
Yu Watanabe [Wed, 1 Feb 2023 19:29:43 +0000 (04:29 +0900)] 
test: add test for invalid keymap setting

2 years agolocale: also verify keymaps loaded from config file and converted keymaps
Yu Watanabe [Wed, 1 Feb 2023 18:23:50 +0000 (03:23 +0900)] 
locale: also verify keymaps loaded from config file and converted keymaps

If vconsole.conf or friends contain an invalid keymap, then let's
ignore the settings.

2 years agolocale: introduce x11_context_verify()
Yu Watanabe [Wed, 1 Feb 2023 17:53:35 +0000 (02:53 +0900)] 
locale: introduce x11_context_verify()

No functional change, preparation for later commits.

2 years agolocale: split out xkbcommon related functions to xkbcommon-util.c
Yu Watanabe [Wed, 1 Feb 2023 17:47:47 +0000 (02:47 +0900)] 
locale: split out xkbcommon related functions to xkbcommon-util.c

Then, use dlopen_many_sym_or_warn() with DLSYM_ARG() macro.

2 years agolocale: split out checking existence of keymap
Yu Watanabe [Wed, 1 Feb 2023 16:50:37 +0000 (01:50 +0900)] 
locale: split out checking existence of keymap

No functional change, preparation for later commits.

2 years agolocale: move x11_convert_to_vconsole() near the relevant functions
Yu Watanabe [Wed, 1 Feb 2023 16:34:24 +0000 (01:34 +0900)] 
locale: move x11_convert_to_vconsole() near the relevant functions

No functional changes, just refactoring.

2 years agoMerge pull request #26960 from poettering/syscall-catchup
Yu Watanabe [Sat, 25 Mar 2023 04:39:27 +0000 (13:39 +0900)] 
Merge pull request #26960 from poettering/syscall-catchup

syscall filter group updates

2 years agoxdg-autostart-generator: do not warn about unknown fields
Zbigniew Jędrzejewski-Szmek [Fri, 24 Mar 2023 16:51:52 +0000 (17:51 +0100)] 
xdg-autostart-generator: do not warn about unknown fields

My user manager says:
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.gnome.Terminal.desktop:256: Unknown key name 'Actions' in section 'Desktop Entry', ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.gnome.Terminal.desktop:258: Unknown section 'Desktop Action new-window'. Ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.gnome.Terminal.desktop:343: Unknown section 'Desktop Action preferences'. Ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop:12: Unknown key name 'Actions' in section 'Desktop Entry', ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop:13: Unknown key name 'SingleMainWindow' in section 'Desktop Entry', ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop:19: Unknown section 'Desktop Action Quit'. Ignoring.

This is not useful. Those are externally-provided files, and they are likely to
have entries which we know nothing about.

2 years agoMerge pull request #26977 from poettering/find-line-startswith
Yu Watanabe [Sat, 25 Mar 2023 04:38:24 +0000 (13:38 +0900)] 
Merge pull request #26977 from poettering/find-line-startswith

add new find_line_startswith() helper

2 years agobootctl: enable colored logging
Yu Watanabe [Fri, 24 Mar 2023 21:58:35 +0000 (06:58 +0900)] 
bootctl: enable colored logging

2 years agocore/main: fix setting of arguments for shutdown
Zbigniew Jędrzejewski-Szmek [Fri, 24 Mar 2023 13:11:48 +0000 (14:11 +0100)] 
core/main: fix setting of arguments for shutdown

Fixup for d2ebd50d7f9740dcf30e84efc75610af173967d2
and 6920049fad4fa39db5fec712f82f7f75b98fd4b9:
- add a comment that the last arg must be NULL and adjust the assert.
- move initialization around so that fields are declared,
  initialized, and consumed in the same order.
- move declaration of pos adjacent do declaration of command_line.
  This makes it easy to see that it was not initialized correctly.
- initialize buffers before writing the pointer into the args array.
  This makes no difference for the compiler, but it just feels "wrong"
  to do it in opposite order.

Because pos was off, we would ignore args after the timeout, and also
overwrite the buffer if enough args were used.

I think this is case shows clearly that declaring all variables at the
top of the function, with some initialized and other not, is very
error-prone. The compiler has no issue with declaring variables whereever,
and we should take advantage of this to make it keep declaration,
initialization, and use close. (Within reason of course.)

2 years agotools: add dump-auxv.py
Zbigniew Jędrzejewski-Szmek [Fri, 24 Mar 2023 13:54:34 +0000 (14:54 +0100)] 
tools: add dump-auxv.py

This is a little helper I used when preparing the tests for auxv
parsing. Just looking at hexdump output is pretty hard. We could
enhance it to display some specific data types better.

2 years agohwdb: drop boilerplate about match patterns in two more cases
Zbigniew Jędrzejewski-Szmek [Fri, 24 Mar 2023 16:25:59 +0000 (17:25 +0100)] 
hwdb: drop boilerplate about match patterns in two more cases

Follow-up for adbe000e3df5f91572bf4a77a2acd84ff5b87320.
Somehow I missed those two files.

2 years agoimport: use truncate_nl() where appropriate 26977/head
Lennart Poettering [Fri, 24 Mar 2023 17:27:03 +0000 (18:27 +0100)] 
import: use truncate_nl() where appropriate

2 years agotree-wide: port various places to find_line_startswith()
Lennart Poettering [Fri, 24 Mar 2023 17:25:13 +0000 (18:25 +0100)] 
tree-wide: port various places to find_line_startswith()

2 years agostring-util: add new helper for finding line starting with specific string in a text...
Lennart Poettering [Fri, 24 Mar 2023 17:02:32 +0000 (18:02 +0100)] 
string-util: add new helper for finding line starting with specific string in a text buffer

We have implemented this manually a couple of times, and always wrong.
Hence let's implement this correctly for once and use everywhere.

2 years agouserdbctl: flush stdout before running the chain command
Frantisek Sumsal [Fri, 24 Mar 2023 16:17:31 +0000 (17:17 +0100)] 
userdbctl: flush stdout before running the chain command

Otherwise it's quite difficult to capture the entire output:

$ userdbctl ssh-authorized-keys dropinuser --chain /bin/echo hello
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA//dxI2xLg4MgxIKKZv1nqwTEIlE/fdakii2Fb75pG+ foo@bar.tld
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMlaqG2rTMje5CQnfjXJKmoSpEVJ2gWtx4jBvsQbmee2XbU/Qdq5+SRisssR9zVuxgg5NA5fv08MgjwJQMm+csc= hello@world.tld
hello
$ userdbctl ssh-authorized-keys dropinuser --chain /bin/echo hello | tee
hello

2 years agoMerge pull request #26920 from medhefgo/ukify
Zbigniew Jędrzejewski-Szmek [Fri, 24 Mar 2023 16:00:31 +0000 (17:00 +0100)] 
Merge pull request #26920 from medhefgo/ukify

ukify: Use pefile to add sections to EFI stub

2 years agodocs: s/authorized_key/authorized_keys/
Frantisek Sumsal [Fri, 24 Mar 2023 15:16:50 +0000 (16:16 +0100)] 
docs: s/authorized_key/authorized_keys/

2 years agoman: s/io.systemd.Dropin/io.systemd.DropIn/
Frantisek Sumsal [Fri, 24 Mar 2023 14:43:04 +0000 (15:43 +0100)] 
man: s/io.systemd.Dropin/io.systemd.DropIn/

2 years agouserdbctl: don't show legend when dumping JSON with services
Frantisek Sumsal [Fri, 24 Mar 2023 14:19:21 +0000 (15:19 +0100)] 
userdbctl: don't show legend when dumping JSON with services

2 years agoman: update syscal filter group list 26960/head
Lennart Poettering [Fri, 24 Mar 2023 13:52:34 +0000 (14:52 +0100)] 
man: update syscal filter group list

2 years agotest: on openSUSE install the collection of unit test binaries in the target only...
Franck Bui [Mon, 20 Mar 2023 17:23:33 +0000 (18:23 +0100)] 
test: on openSUSE install the collection of unit test binaries in the target only for TEST-02-UNITTESTS

2 years agomeson: make sure the unit test scripts find testdata/ even if they are not installed...
Franck Bui [Fri, 17 Mar 2023 13:18:50 +0000 (14:18 +0100)] 
meson: make sure the unit test scripts find testdata/ even if they are not installed in the same directory

testdata/ is shared by both the unit tests and the integration tests. Hence it
makes sense to place them right under /usr/lib/systemd/tests/ while the tests
themself are located under dedicated sub-directories:

     /usr/lib/systemd/tests/
     ├── integration-tests
     ├── testdata
     └── unit-tests
         ├── testdata -> ../testdata

However the unit tests implemented as shell scripts (such as
test-fstab-generator.sh) expect to find testdata/ where the scripts are
installed, ie they do something like:

  src="$(dirname "$0")/testdata/test-fstab-generator"

This patch installs a symlink in 'unitestsdir' named "testdata" and that points
to whatever value 'testdata_dir' is set.

2 years agomeson: define testdata_dir globally
Franck Bui [Fri, 17 Mar 2023 13:14:16 +0000 (14:14 +0100)] 
meson: define testdata_dir globally

2 years agotest: install unit tests in a dedicated subdirectory below '$testsdir'
Franck Bui [Thu, 26 Jan 2023 15:07:17 +0000 (16:07 +0100)] 
test: install unit tests in a dedicated subdirectory below '$testsdir'

/usr/lib/systemd/tests may contain more than the unit tests. For example on
SUSE we also install the integration tests there.

Putting the unit tests in a dedicated directory named 'unit-tests' makes the
layout cleaner.

Note that `run-unit-tests.py` has not been moved so we don't need to adjust
(Fedora) packaging and users also don't need to descend into the subdirectory.

2 years agochase-symlinks: Allow optional path with CHASE_EXTRACT_FILENAME
Daan De Meyer [Fri, 24 Mar 2023 11:21:45 +0000 (12:21 +0100)] 
chase-symlinks: Allow optional path with CHASE_EXTRACT_FILENAME

This allows helpers to set it unconditionally even if the caller
is not interested in the path.

2 years agochase-symlinks: Rename chase_symlinks() to chase()
Daan De Meyer [Tue, 21 Mar 2023 20:17:22 +0000 (21:17 +0100)] 
chase-symlinks: Rename chase_symlinks() to chase()

Chasing symlinks is a core function that's used in a lot of places
so it deservers a less verbose names so let's rename it to chase()
and chaseat().

We also slightly change the pattern used for the chaseat() helpers
so we get chase_and_openat() and similar.

2 years agoMerge pull request #26785 from keszybz/udev-distcheck
Zbigniew Jędrzejewski-Szmek [Fri, 24 Mar 2023 12:38:54 +0000 (13:38 +0100)] 
Merge pull request #26785 from keszybz/udev-distcheck

Implement --help/--version in all udev builtins

2 years agoukify: Add riscv32 and loongarch support 26920/head
Jan Janssen [Tue, 21 Mar 2023 16:10:19 +0000 (17:10 +0100)] 
ukify: Add riscv32 and loongarch support

2 years agoukify: Use pefile to add sections to EFI stub
Jan Janssen [Tue, 21 Mar 2023 16:07:06 +0000 (17:07 +0100)] 
ukify: Use pefile to add sections to EFI stub

2 years agoanalyze: don't claim "@known" was an unlisted syscall
Lennart Poettering [Fri, 24 Mar 2023 10:35:55 +0000 (11:35 +0100)] 
analyze: don't claim "@known" was an unlisted syscall

It's a sycall group of our own definition, and the output is erroneous
to claim otherwise. Let's hide it.

This adds syscall_set_add() which is nicely symmetric to the existing
syscall_set_remove().

Follow-up for: 6d6a08547c03f96dc798cda1ef4a8d3013d292d5