Commit Graph
64402 Commits
Author SHA1 Message Date
Yu Watanabe 3facdc7da8 memory-util: make ArrayCleanup passed to array_cleanup() const
Should not change any behavior, preparation for later commits.
2023-05-09 17:53:42 +09:00
Yu Watanabe d94027ad16 bus-util: drop unnecessary continue 2023-05-09 08:08:53 +09:00
Yu Watanabe d421db6e8b units: add/fix Documentation= about bus interface 2023-05-09 06:10:23 +09:00
Daan De Meyer d0287dc1d7 test-journal-verify: Use a more thorough machine ID check
Let's not only check if the file exists but also check if it contains
a valid machine ID.
2023-05-09 06:09:43 +09:00
Yu Watanabe 8d3beb00c0 Merge pull request #27579 from YHNdnzj/refuse-dbus-activation
core: refuse dbus activation if dbus is not running
2023-05-09 06:09:25 +09:00
Yu Watanabe aa7b8755b6 Merge pull request #27578 from yuwata/sd-dhcp-client-client-id-len
sd-dhcp-client: several cleanups for client_id_len
2023-05-09 06:08:32 +09:00
Yu Watanabe f86a388de3 core/service: fix error cause in the log
Fixes a bug caused by a5648b8094.
Fixes #27575.
2023-05-09 06:08:14 +09:00
Daan De Meyer cdccdea2ad Merge pull request #27553 from yuwata/sd-journal-generic-array-bisect
sd-journal: several fixes for generic_array_bisect()
2023-05-08 20:29:24 +02:00
Mike Yuan 53964fd26b core: refuse dbus activation if dbus is not running
dbus-broker issues StartUnit directly for activation requests,
so let's add a check on bus state in bus_unit_queue_job to refuse
that if dbus is not running.

Replaces #27570
Closes #26799
2023-05-09 01:42:25 +08:00
Mike Yuan e886315065 core/manager: export manager_dbus_is_running 2023-05-09 01:42:25 +08:00
Daan De Meyer 7429c8fe57 test-specifier: Ignore -ENOPKG from specifier_printf()
If /etc/machine-id contains "uninitialized", specifier_printf() with
%m will fail with ENOPKG, so ignore that error as well.
2023-05-08 18:53:27 +02:00
Marko Korhonen 2ad681f53c shell completion: add timesync-status and show-timesync to zsh completion file (#27574)
Fixes #27560
2023-05-09 01:01:16 +09:00
Yu Watanabe e69c281ad2 sd-dhcp-client: do not use implicit cast to boolean 2023-05-09 00:37:29 +09:00
Yu Watanabe f04c991a2f sd-dhcp-client: make return arguments for sd_dhcp_client_get_client_id() optional 2023-05-09 00:34:06 +09:00
Yu Watanabe 22e299fc5e sd-dhcp-client: drop redundant condition
Closes #27561.
2023-05-09 00:27:24 +09:00
Yu Watanabe 16cda99c73 nulstr-util: make ret_size in strv_make_nulstr() optional 2023-05-08 21:40:56 +08:00
Daan De Meyer 6840e89a57 Merge pull request #27569 from keszybz/mkosi-nicer-output
Prettification for mkosi build output
2023-05-08 15:37:22 +02:00
Miao Wang 4fad639a13 doc: remove legacy DefaultControlGroup from dbus properties
DefaultControlGroup does not exist any more.
2023-05-08 22:23:00 +09:00
Zbigniew Jędrzejewski-Szmek 1bcad2de7c mkosi.build: print important build commands
This undoes the effect of 1394a3ec35 partially.
We print the fairly verbose output of the build commands, so let's also
print the commands themselves. This makes it much easier to understand what
is going on.

(The style was copied from other scripts where we do 'set -x' for one command.)
2023-05-08 15:04:02 +02:00
Zbigniew Jędrzejewski-Szmek 385fb4e323 mkosi/fedora: silence warning about sysusers config mismatch 2023-05-08 15:04:02 +02:00
Zbigniew Jędrzejewski-Szmek dede53943f mkosi.build: use bash, use array for configuration options, shellcheckify
With bash, we can use an array for options. This is nice because we can
construct the commandline more easily. The file is now shellcheck-clean.
2023-05-08 15:04:02 +02:00
Yu Watanabe 210cb8d690 core/unit: check the validity of unit type with activation_details_vtable
Follow-up for 24e91e08f8.
2023-05-08 09:49:55 +02:00
Yu Watanabe d2132d3d8d parse-util: make parse_fd() return -EBADF
The previous error code -ERANGE is slightly ambiguous, and use more
specific one. This also drops unnecessary error handlings.

Follow-up for 754d8b9c33 and
e652663a04.
2023-05-08 09:49:55 +02:00
Ronan Pigott b3d12ac0da zsh: add service-log-{level,target} completions for systemctl 2023-05-08 01:08:36 +01:00
Janne Sirén 78e0dd2244 hwdb: add landscape IdeaPad Miix 310 sensor orientation (#27555)
Enables support for landscape orientated display variants of the IdeaPad Miix 310 2-in-1 laptop.
2023-05-07 09:18:55 +09:00
Klaus Zipfel 703902400d crypttab: Support for VeraCrypt PIM and detached headers for TrueCrypt/VeraCrypt (#27548)
* Added veracrypt-pim=<PIM> LUKS option for crypttab
2023-05-06 21:55:05 +01:00
Luca Boccassi 3be6943e07 Merge pull request #26357 from ddstreet/tpm2_policy_session
Tpm2 policy session
2023-05-06 17:02:26 +01:00
Yu Watanabe fa1071819c sd-journal: split out generic_array_bisect_one() from generic_array_bisect()
This also makes journal corruption always handled gracefully, and drop
potentially unsatisfied assertion on corrupted journal.

Fixes #27533.
2023-05-07 00:28:19 +09:00
Yu Watanabe e562f13158 sd-journal: re-read entry array object
`test_object()` may call `journal_file_move_to_object()` and thus
the `array` object may be invalidated.
2023-05-07 00:26:49 +09:00
Yu Watanabe 03fdf95714 sd-journal: drop unnecessary initialization 2023-05-07 00:26:49 +09:00
Yu Watanabe de6b162d35 sd-journal: rebreak comments 2023-05-07 00:26:49 +09:00
Yu Watanabe dd03d91527 sd-journal: fix comment 2023-05-07 00:26:49 +09:00
Zbigniew Jędrzejewski-Szmek 9dfed0d4cc Merge pull request #27262 from keszybz/ukify-install
Add kernel-install plugin that calls ukify
2023-05-06 13:34:08 +02:00
Yu Watanabe 5b5e54e058 hwdb: do not include '#' in modalias
Follow-up for 7bd3d6e35a.
Fixes #27516.
2023-05-06 10:27:34 +02:00
Luca Boccassi 8069cdc7e7 Merge pull request #27527 from mrc0mmand/fuzz-manager-serialize
core: a couple of follow-ups for issues found by fuzz-manager-serialize
2023-05-06 01:53:26 +01:00
Dan Streetman 2cd9d57548 tpm2: move policy building out of policy session creation
This retains the use of policy sessions instead of trial sessions
in most cases, based on the code comment that some TPMs do not
implement trial sessions correctly. However, it's likely that the
issue was not the TPMs, but our code's incorrect use of PolicyPCR
inside a trial session; we are not providing expected PCR values
with our call to PolicyPCR inside a trial session, but the spec
indicates that in a trial session, the TPM *may* return error if
the expected PCR value(s) are not provided. That may have been the
source of the original confusion about trial sessions.

More details:
https://github.com/systemd/systemd/pull/26357#pullrequestreview-1409983694

Also, future commits will replace the use of trial sessions with
policy calculations, which avoids the problem entirely.
2023-05-05 18:34:46 -04:00
Dan Streetman e976445d03 tpm2: add tpm2_is_encryption_session() 2023-05-05 18:32:39 -04:00
Ronan Pigott 8139407ec1 zsh: remove usage of PREFIX in _systemctl
The usage of PREFIX in this completion is mostly counter to the intended
usage of compsys in zsh. It is generally expected that completion code
provide the available completions and tags in that word position so that
compsys, with user configuration, can filter them to the appropriate set.

One egregious error caused by the usage of PREFIX here is the caching of
SYS_ALL_UNITS, which stored only the unit names prematurely filtered by
the completion prefix, affecting all future completions. For example,

  $ systemctl cat nonsense<TAB>

might find no matching units if nonsense* has no matches, but now

  $ systemctl cat <TAB>

will fail in all future completions even though every unit file
is a valid match, because the cached set has been erroneously filtered
by the last prefix.
2023-05-05 22:12:50 +01:00
Frantisek Sumsal 380a36582d test: add a test case for #27521
Which got resolved by e652663a04.
2023-05-05 22:15:23 +02:00
Frantisek Sumsal 24e91e08f8 core: check the unit type more thoroughly when deserializing
Resolves: #27523
2023-05-05 22:15:23 +02:00
Frantisek Sumsal cc938f1ce0 shared: refuse fd == INT_MAX
Since we do `FD_TO_PTR(fd)` that expands to `INT_TO_PTR(fd) + 1` which
triggers an integer overflow.

Resolves: #27522
2023-05-05 22:15:23 +02:00
Frantisek Sumsal 77be02ad3c core: use extract_first_word() instead of sscanf() 2023-05-05 22:15:23 +02:00
Nick Rosbrook 362235bf59 basic/audit-util: make a test request before enabling use of audit
If a container manager does not follow the guidance in
https://systemd.io/CONTAINER_INTERFACE/ regarding audit capabilities,
then the current check may not be sufficient to determine that audit
will function properly. In particular, when calling bind() on the audit
fd, we will get EPERM if running in a user-namespaced container.

Expand the check to make an AUDIT_GET_FEATURE request on the audit fd to
test if it is working. If this fails with ECONNREFUSED, we know it is
because the kernel does not support the use of audit outside of the
initial user namespace.

Note that the approach of this patch was suggested here:
https://github.com/systemd/systemd/pull/19443#issuecomment-829566659

Fixes: #6519
2023-05-05 21:06:16 +01:00
Luca Boccassi 6ad7989ea0 Merge pull request #27536 from dtardon/checked-fd-parsing
Always check parsed fds for validity
2023-05-05 20:55:48 +01:00
Zbigniew Jędrzejewski-Szmek 46886f130d test_ukify: add test for combining config and cmdline 2023-05-05 18:43:20 +02:00
Zbigniew Jędrzejewski-Szmek 248be6ef37 man: describe all the changes to ukify
As in mkosi(1), let's describe the config file and commandline options
together. This is nice for us, because we don't need to duplicate descriptions
and we're less likely to forget to update one place or the other. This is also
nice for users, because they can easily figure out what can be configured
where.

The options are now ordered by config file section.

--summary was not described before.

More examples are added.
2023-05-05 18:43:20 +02:00
Zbigniew Jędrzejewski-Szmek bac18826e9 ci: install pytest-flakes
Some web searches say that it's packaged for those distros and not the others…

v2:
- drop arch. https://aur.archlinux.org/packages/python-pytest-flakes exists,
  but installation fails in CI.
2023-05-05 18:42:37 +02:00
Zbigniew Jędrzejewski-Szmek 55be961f48 test_ukify: rework how --flakes argument is appended
The usual approach is to put 'addopts = --flakes' in setup.cfg. Unfortunately
this fails badly when pytest-flakes is not installed:
  ERROR: usage: test_ukify.py [options] [file_or_dir] [file_or_dir] [...]
  test_ukify.py: error: unrecognized arguments: --flakes

pytest-flakes is not packaged everywhere, and this test is not very important,
so let's just do it only if pytest-flakes is available. We now detect if
pytest-flakes is available and only add '--flakes' conditionally. This
unfortunately means that when invoked via 'pytest' or directly as
'src/ukify/test/test_ukify.py', '--flakes' will not be appended automatically.
But I don't see a nice way to achieve previous automatic behaviour.

(I first considered making 'setup.cfg' templated. But then it is created
in the build directory, but we would need it in the source directory for
pytest to load it automatically. So to load the file, we'd need to give an
argument to pytest anyway, so we don't gain anything with this more complex
approach.)
2023-05-05 18:42:37 +02:00
Zbigniew Jędrzejewski-Szmek 041f536f9a test_ukify: propagate failure
Oops. This explains why the tests were "passing" in CI even
though a direct pytest invocation would fail.
2023-05-05 18:42:37 +02:00
Zbigniew Jędrzejewski-Szmek a758f95c33 ukify: appease mypy
Note to self: PEP 585 introduced using collection types as types,
and is available since 3.9. PEP 604 allows writing unions with "|",
but is only available since 3.10, so not yet here because we maintain
compat with 3.9.
2023-05-05 18:42:37 +02:00