1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-24 06:04:05 +03:00

63505 Commits

Author SHA1 Message Date
Daan De Meyer
3ceb96e018 test: Install systemd-networkd-tests.py when install_tests is enabled 2023-03-29 12:18:42 +02:00
Daan De Meyer
0beb2a95a4 mkosi: Update to latest
- ACLs are not set on generated directories anymore by default, so
we enable them explictly now so that when running unprivileged mkosi,
the user running mkosi can remove all generated files and directories.
- We don't explicitly set QemuHeadless= anymore as the option was removed
and made the default.
- We set the loglevel= kernel cmdline argument explicitly now as mkosi
doesn't set it by default anymore.
2023-03-29 11:13:33 +01:00
Dmitry V. Levin
139203e1d4 udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify
Make sure the ENOENT exception reintroduced by commit
9db7081d83d56cd2523b03f9eb9d67ef1c93c55f is not applied when the parser
is invoked by udevadm verify.
2023-03-29 18:50:29 +09:00
Daan De Meyer
ee2975a9d9 log: Add LOG_SET_PREFIX() macro
LOG_SET_PREFIX() sets a logging prefix for the current block. The
prefix is prepended to every logging message in the block, followed
by ": ". If a logging prefix is already configured, it is overridden
for the duration of the block, after which it is restored.

A use case for this macro is when we're operating on an image or
directory (using --root or --image). We can use LOG_SET_PREFIX() to
prefix all logging messages with the directory or image that we're
operating on.
2023-03-29 13:00:33 +09:00
Lennart Poettering
09ba6d1a14 TEST-80: synchronize explicitly instead of by time
This removes "sleep" invocations, and makes the notify access testcase a
lot more robust to runtime jitter. We use a pair of fifos in the fs to
sync instead.

Also various other improvoements, including comments.

(Also removes the unnecessary "no-qemu" restriction)
2023-03-29 12:59:53 +09:00
Luca Boccassi
49e8342965 test: do not remove state directory on failure
The test log is in the state directory, and we want to keep it around
when a test fails.

Follow-up for: 256a835f1c6c646a55039659aa2db186fbeb5c5d
2023-03-29 12:59:02 +09:00
Yu Watanabe
8d9c779cc8
Merge pull request #27046 from bluca/shellcheck
Fix some shellcheck warnings
2023-03-29 12:58:31 +09:00
Yu Watanabe
0290243acf
Merge pull request #27040 from keszybz/empty-path-skip-cleanup
Restore silent skipping of missing rules files by udev
2023-03-29 10:18:06 +09:00
Luca Boccassi
d79881c530 test: fix shellcheck warnings in test-sysusers.sh 2023-03-29 02:08:18 +01:00
Luca Boccassi
a5979f0bd5 man: fix shellcheck warning for html.in
SC2015: Note that A && B || C is not if-then-else. C may run when A is true.
2023-03-29 02:08:18 +01:00
Luca Boccassi
a02c4d469f
Merge pull request #27042 from fbuihuu/fixes-for-testsuite-74-mount
Fixes for testsuite 74 mount
2023-03-29 01:54:30 +01:00
Lennart Poettering
75f7e5e547 man: correct/tweak text about unit name syntax
Unit names can be 255 characters long, not 256.

We first say "name prefix" and then continue with "unit prefix".
Confusing. Couldn't figure out which term is better hence settled on
"unit name prefix".
2023-03-28 23:07:11 +01:00
Franck Bui
208d9ad168 test: fix regexp in testsuite-74.mount.sh
Several whitespaces can separate "ext4" and "sd-mount-test" strings.
2023-03-28 20:41:40 +02:00
Daan De Meyer
3a051522ce
Merge pull request #27035 from DaanDeMeyer/ukify-align
ukify: Add workarounds for older stubs
2023-03-28 19:45:04 +02:00
Frantisek Sumsal
e3201a69eb test: don't go through all time zones if slow tests are disabled
Let's skip going through all locally available time zones if we're built
with slow tests disabled, as that's quite slow, but do at least one test
with the UTC zone.
2023-03-28 18:16:38 +01:00
Luca Boccassi
f9b3f24463
Merge pull request #27030 from keszybz/bustctl-show-property-values-in-full
bustctl: show property values in full
2023-03-28 18:14:49 +01:00
Franck Bui
8607a39e08 test: drop extraneous bracket in testsuite-74.mount.sh 2023-03-28 19:00:44 +02:00
Zbigniew Jędrzejewski-Szmek
7d0c47dad0 shared/exec-util: null_or_empty_path() does not return boolean
We shouldn't report that the file is empty if the stating fails. Let's do the
same as in other places, and just ignore the error and let the subsequent
operation fail.
2023-03-28 18:50:31 +02:00
Luca Boccassi
a4d1d1f63d
Merge pull request #26941 from bluca/portable_version
portable: introduce SYSEXT_ fields to identify sysexts, and include more metadata in log messages via LogExtraFields=
2023-03-28 17:49:52 +01:00
Zbigniew Jędrzejewski-Szmek
3e2d735328 basic/stat-util: remove unused null_or_empty_fd() 2023-03-28 18:44:40 +02:00
Zbigniew Jędrzejewski-Szmek
9db7081d83 Revert "udev_rules_parse_file: do not skip ENOENT"
This reverts commit 42a467b55219384c7c3b137ab3cc8b6a309a8a14.

We need to skip -ENOENT when loading udev rules because new files with rules
may be added or removed at any time, and the loading of rules is triggered
asynchronously. Even though the window is fairly narrow, udev shouldn't throw
an error if a rules file is removed.
2023-03-28 18:42:24 +02:00
Daan De Meyer
ac3412c379 ukify: Add workarounds for older stubs
Older stubs are either not stripped, causing their total size to be
unaligned because of an unaligned symbol table at the end, or stripped,
causing the raw data pointers and sizes to be unaligned because strip
does not follow the PE spec correctly when stripping. Let's add
workarounds for both issues, so that we can use ukify with older stubs
as well.
2023-03-28 18:17:59 +02:00
Yu Watanabe
201423d801 process-util: introduce get_process_cmdline_strv()
The reason why get_process_cmdline() is so complicated is that we
need to escape and quote arguments for building a single result
string.

That's necessary when we want to log or print the command line.
However, when we want to parse the command line, it is not necessary
that the result is a single string, but can be strv.

This will be used when we parse the command line.
2023-03-28 17:09:15 +02:00
Daan De Meyer
61648c6976 Revert "ukify: Weaken file alignment assertions"
This reverts commit 23428bb19e49cf510c65e2896f1a7e4b12ca1dbc.
2023-03-28 13:31:38 +02:00
Luca Boccassi
38d1d10465 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.
2023-03-28 12:14:21 +01:00
Luca Boccassi
7d98295210 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
2023-03-28 12:14:21 +01:00
Luca Boccassi
e8114a4f86 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
2023-03-28 12:14:21 +01:00
Zbigniew Jędrzejewski-Szmek
f735076c54 busctl: also assume --full if not writing to terminal
If people grep the output, it probably shouldn't be ellipsized.
2023-03-28 11:55:21 +02:00
Luca Boccassi
8c8331fc50 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
2023-03-28 10:36:01 +01:00
Luca Boccassi
62b7c23f79 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.
2023-03-28 10:36:01 +01:00
Luca Boccassi
2ed74695b3 strv: add helper to find value in key/value pairs from list of keys 2023-03-28 10:36:01 +01:00
Luca Boccassi
6255bbe262 env: add load_env_file_pairs_fd() 2023-03-28 10:36:01 +01:00
Zbigniew Jędrzejewski-Szmek
bc1f1eba77 busctl: use size_t for set size
Also reduce the scope of variables.
2023-03-28 11:31:29 +02:00
Zbigniew Jędrzejewski-Szmek
d82267e567 busctl: do not truncate property values when --full 2023-03-28 11:26:01 +02:00
Yu Watanabe
19279652c0
Merge pull request #27013 from fbuihuu/test-fixlets
Test fixlets
2023-03-28 13:45:24 +09:00
Frantisek Sumsal
30dbadf65e 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.
2023-03-28 13:41:55 +09:00
Yu Watanabe
485d32d788
Merge pull request #27022 from yuwata/journal-remote-fix-relative-output-journal-file
journal-remote: support relative output journal file again
2023-03-28 13:41:13 +09:00
Lennart Poettering
bf82145576 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)
2023-03-28 13:40:47 +09:00
Lennart Poettering
8489c294f3 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.
2023-03-28 13:40:14 +09:00
Lennart Poettering
5f68f63e19 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
2023-03-28 13:39:48 +09:00
Yu Watanabe
1d4f517bba
Merge pull request #26993 from mrc0mmand/TEST-46-tweaks
test: explicitly pull in systemd-userdbd.service
2023-03-28 13:39:08 +09:00
Yu Watanabe
024ea9de1d
Merge pull request #26980 from ldv-alt/udevadm-verify
udevadm verify: add more checks
2023-03-28 13:38:12 +09:00
Hans de Goede
4e3a50169b 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
2023-03-28 03:03:02 +09:00
Yu Watanabe
409759634e env-util: introduce strv_env_assign_many() 2023-03-28 02:51:54 +09:00
Daan De Meyer
23428bb19e 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.
2023-03-27 19:33:16 +02:00
Daan De Meyer
ffa859388b
Merge pull request #27005 from poettering/fd-reopen-symlink
fd_reopen() symlink handling tweaks
2023-03-27 19:32:05 +02:00
Daan De Meyer
16d6acd08b
Merge pull request #26902 from YHNdnzj/restart-sec-step
core: add RestartSteps= and RestartSecMax= to dynamically increase interval between auto restarts
2023-03-27 19:31:21 +02:00
Yu Watanabe
7276d98cd2 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.
2023-03-28 02:29:19 +09:00
Yu Watanabe
8ee2fd9050 journal-remote: add missing log message for failure in journal_remote_get_writer() 2023-03-28 02:28:04 +09:00
Yu Watanabe
4c3d2523a0 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.
2023-03-28 02:26:33 +09:00