Commit graph

63429 commits

Author SHA1 Message Date
Dmitry V. Levin 4c61088497 rules: remove stray whitespace before comma between tokens 2023-03-27 10:00:30 +00:00
Frantisek Sumsal 4c9c91defc 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.
2023-03-27 11:00:30 +01:00
Yu Watanabe 830e52caa2 sd-id128: make id128_read() optionally take root directory 2023-03-27 11:05:25 +02:00
Daan De Meyer 4e24df3cc3
Merge pull request #26961 from DaanDeMeyer/chase-and-pin
chase-symlinks: Add chase_and_open_parent() + at() variant
2023-03-27 10:41:08 +02:00
Luca Boccassi 8e1a129136
Merge pull request #26870 from fbuihuu/move-unit-tests-in-a-dedicated-subdir
Move unit tests in a dedicated subdir
2023-03-27 09:38:15 +01:00
Mike Yuan c673fd52e0 journalctl: fix when --grep is used with --follow
Follow-up for #25147 (db4691961c)

--follow sets arg_lines to 10, which breaks
--grep as the latter implies --reverse.
So let's not set --reverse if --follow is used.
2023-03-27 10:28:59 +02:00
Zbigniew Jędrzejewski-Szmek 957b934f82
Merge pull request #26294 from yuwata/locale-verify-conf
locale: verify loaded keymap or friends
2023-03-27 10:26:24 +02:00
Yu Watanabe 9e43296fd2 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'.
2023-03-27 09:51:18 +02:00
Daan De Meyer 670afc182a 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.
2023-03-26 20:31:10 +02:00
Gertalitec 600362aa11 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
2023-03-26 16:54:16 +02:00
taniishkaaa f33c1c49a5
hwdb: Fixed thumb buttons reversed on CHERRY MW 2310 (#26992)
Fixes #12914.
2023-03-26 23:52:31 +09:00
Yu Watanabe 596ac132fb hwdb: drop redundant entry
Follow-up for ff155c8162.

The entry already matches with the generic rule defined at the beginning
of the hwdb file.
2023-03-26 19:01:49 +08:00
Franck Bui f8d527aa9a test: install symlinks with valid targets on SUSE and Debian 2023-03-26 10:44:09 +02:00
Yu Watanabe cccc14c5a8
Merge pull request #26973 from mrc0mmand/userdbctl-tests
test: add a couple of tests for userdbctl
2023-03-26 09:49:27 +09:00
Zbigniew Jędrzejewski-Szmek 14ecfc1cd2 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
26abdc73a2 as a bugfix. So my "fix" repeated
the same error that was fixed back then.
2023-03-26 09:48:14 +09:00
Yu Watanabe 6fc0d6b5ac
Merge pull request #26983 from mrc0mmand/coredump-test-followup
test: don't expand the subshell expression prematurely
2023-03-26 09:47:49 +09:00
Frantisek Sumsal 237d81fdb3 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.
2023-03-25 17:55:41 +01:00
Frantisek Sumsal 93fe228bb1 test: add a couple of tests for userdbctl 2023-03-25 14:13:00 +01:00
Frantisek Sumsal 7fdd6e157a 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.
2023-03-25 12:29:40 +00:00
Frantisek Sumsal 91c031f169 test: drop unnecessary return
Return code of the EXIT trap handler is ignored in bash.
2023-03-25 12:17:11 +01:00
Frantisek Sumsal 370fa624f5 test: don't touch the /failed marker in the subtest scripts
As it is already handled by the "main" script (testsuite-74.sh).
2023-03-25 12:15:33 +01:00
Frantisek Sumsal 0b189ac84c 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.
2023-03-25 12:10:58 +01:00
taniishkaaa ff155c8162
hwdb: Fix incorrect touchpad dimensions on Thinkpad L14 Gen1 (#26937)
Closes #22793.
2023-03-25 11:41:07 +01:00
Yu Watanabe fcf8b80d1d test: add test for invalid keymap setting 2023-03-25 15:36:53 +09:00
Yu Watanabe 566aba0bca 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.
2023-03-25 15:36:53 +09:00
Yu Watanabe 0327d5b20f locale: introduce x11_context_verify()
No functional change, preparation for later commits.
2023-03-25 15:36:48 +09:00
Yu Watanabe d45cbc0711 locale: split out xkbcommon related functions to xkbcommon-util.c
Then, use dlopen_many_sym_or_warn() with DLSYM_ARG() macro.
2023-03-25 15:27:23 +09:00
Yu Watanabe 384f22e39f locale: split out checking existence of keymap
No functional change, preparation for later commits.
2023-03-25 15:24:08 +09:00
Yu Watanabe 3017b9b1a6 locale: move x11_convert_to_vconsole() near the relevant functions
No functional changes, just refactoring.
2023-03-25 15:24:08 +09:00
Yu Watanabe 363ed18730
Merge pull request #26960 from poettering/syscall-catchup
syscall filter group updates
2023-03-25 13:39:27 +09:00
Zbigniew Jędrzejewski-Szmek b5a70eeecd 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.
2023-03-25 13:38:39 +09:00
Yu Watanabe 01c357b0ac
Merge pull request #26977 from poettering/find-line-startswith
add new find_line_startswith() helper
2023-03-25 13:38:24 +09:00
Yu Watanabe 87dc8b0851 bootctl: enable colored logging 2023-03-25 12:38:11 +09:00
Zbigniew Jędrzejewski-Szmek 4688b08984 core/main: fix setting of arguments for shutdown
Fixup for d2ebd50d7f
and 6920049fad:
- 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.)
2023-03-24 19:08:20 +00:00
Zbigniew Jędrzejewski-Szmek 85a336f81d 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.
2023-03-24 18:49:34 +00:00
Zbigniew Jędrzejewski-Szmek 61b69bec8e hwdb: drop boilerplate about match patterns in two more cases
Follow-up for adbe000e3d.
Somehow I missed those two files.
2023-03-25 03:11:23 +09:00
Lennart Poettering 90f5f3552c import: use truncate_nl() where appropriate 2023-03-24 18:33:59 +01:00
Lennart Poettering 50ed5cbf5f tree-wide: port various places to find_line_startswith() 2023-03-24 18:30:20 +01:00
Lennart Poettering 7b82d95f8d 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.
2023-03-24 18:30:20 +01:00
Frantisek Sumsal 5b09499cac 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
2023-03-24 17:17:31 +01:00
Zbigniew Jędrzejewski-Szmek 32e07cff96
Merge pull request #26920 from medhefgo/ukify
ukify: Use pefile to add sections to EFI stub
2023-03-24 17:00:31 +01:00
Frantisek Sumsal 13bf321610 docs: s/authorized_key/authorized_keys/ 2023-03-24 16:16:50 +01:00
Frantisek Sumsal 8f572d0d82 man: s/io.systemd.Dropin/io.systemd.DropIn/ 2023-03-24 15:43:04 +01:00
Frantisek Sumsal eedd1da9f9 userdbctl: don't show legend when dumping JSON with services 2023-03-24 15:19:21 +01:00
Lennart Poettering f452e0461f man: update syscal filter group list 2023-03-24 14:52:34 +01:00
Franck Bui fa2745a3e1 test: on openSUSE install the collection of unit test binaries in the target only for TEST-02-UNITTESTS 2023-03-24 14:10:04 +01:00
Franck Bui c18cc7f7fb 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.
2023-03-24 14:10:04 +01:00
Franck Bui 539ee7ab11 meson: define testdata_dir globally 2023-03-24 14:10:02 +01:00
Franck Bui 26c2b30277 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.
2023-03-24 14:08:57 +01:00
Daan De Meyer e5f2490200 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.
2023-03-24 13:53:45 +01:00