Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe 206760a4bc Merge pull request #26928 from jamacku/update-shellcheck
ci: trigger `differential-shellcheck` workflow on push
2023-03-22 15:13:38 +09:00
Yu Watanabe 2415a0c7aa Merge pull request #26893 from yuwata/uki-util-update-log
util: rename uki-util.[ch] -> kernel-image.[ch]
2023-03-21 19:06:18 +09:00
Yu Watanabe 5689e161cf util: rename uki-util.[ch] -> kernel-image.[ch]
As the file contains functions not only for UKI.
2023-03-21 16:49:26 +09:00
Yu Watanabe fe3198df66 uki-util: rename KernelType -> KernelImageType
The name KernelType is slightly ambiguous. The type is about kernel
image. Let's rename the enum to clarify that.
2023-03-21 16:44:52 +09:00
Yu Watanabe fc56666cc2 uki-util: rename uki -> f
As the function is not only for UKI.
2023-03-21 16:40:39 +09:00
Yu Watanabe b3e26aa2d9 uki-util: update log messages 2023-03-21 16:38:40 +09:00
Yu Watanabe 719bbb365b Merge pull request #26875 from yuwata/core-transaction
core/transaction: several fixes for merge_unit_ids()
2023-03-21 00:42:30 +09:00
Yu Watanabe 00546c18fd strv: introduce strv_print_full() 2023-03-20 09:32:09 +01:00
Yu Watanabe de2c62e847 bootctl: fix wrong type comparison 2023-03-20 13:58:20 +09:00
Yu Watanabe a9b402e4d2 Merge pull request #26886 from ldv-alt/udevadm-verify
udev-rules: fix matching of token types that support alternative patterns
2023-03-20 13:58:08 +09:00
Yu Watanabe 432f1fa8c7 loop-util: add more debugging logs in loop_configure() 2023-03-19 20:32:09 +09:00
Yu Watanabe 55882f648e Merge pull request #26884 from YHNdnzj/tmpfiles-unit-name-update
Update references to obsolete systemd-tmpfiles.service
2023-03-19 12:18:10 +09:00
Yu Watanabe 3867264c78 Merge pull request #26880 from yuwata/test-tmpfiles
tmpfiles: cleanups
2023-03-19 02:49:11 +09:00
Yu Watanabe 9edf5752e5 Merge pull request #26879 from mrc0mmand/cocci
tree-wide: simplify x ? x : y to x ?: y where applicable
2023-03-19 02:48:39 +09:00
Yu Watanabe 458e8d6dd0 test-systemd-tmpfiles.py: create global temporary directory
For some unknown reasons, the temporary directory created by the test
below is not removed:
```
 # Test the case that a valid symlink is in the path.
 label = 'valid_symlink-deep'
 test_content('f= {} - - - - ' + label, label, user=user, subpath='/deep/1/2', path_cb=valid_symlink)
```
To keep /tmp clean, let's create the global temprary directory.
2023-03-18 22:27:41 +09:00
Yu Watanabe 015ddd4bf0 test-systemd-tmpfiles.py: use test_content() at one more place 2023-03-18 22:27:41 +09:00
Yu Watanabe 056ff0b455 tmpfiles: show file type in octal, instead of hex 2023-03-18 22:27:41 +09:00
Yu Watanabe f5c0edd166 man: explicitly list three command syntax at the beginning 2023-03-18 20:22:08 +08:00
Yu Watanabe 0bc2bcf4fe Merge pull request #26759 from medhefgo/boot-stack-protector
boot: Add support for stack protector/trapping math/ubsan
2023-03-18 15:07:45 +09:00
Yu Watanabe a9938fb3cb Merge pull request #26862 from yuwata/uki-util
uki-util: export functions of inspecting kernel
2023-03-18 15:04:54 +09:00
Yu Watanabe aa5ef80130 Merge pull request #26861 from yuwata/exec-util
exec-util: introduce execute_strv() and EXEC_DIR_SKIP_REMAINING
2023-03-18 15:04:16 +09:00
Yu Watanabe 1f3792bfca Merge pull request #26855 from DaanDeMeyer/repart-fixes
Repart fixes
2023-03-18 15:03:38 +09:00
Yu Watanabe 5803c24da5 core/transaction: do not log "(null)"
As we ignores the failure in merge_unit_ids(), so unit_ids may be NULL.
2023-03-18 12:19:44 +09:00
Yu Watanabe 999f165143 core/transaction: make merge_unit_ids() return non-NULL on success 2023-03-18 12:19:44 +09:00
Yu Watanabe 366eced4c8 core/transaction: make merge_unit_ids() always return NUL-terminated string
Follow-up for 924775e8ce.

The loop run with `STRV_FOREACH_PAIR()`, hence `if (*(unit_id+1))` is
not a good way to detect if there exist a next entry.

Fixes #26872.
2023-03-18 12:12:05 +09:00
Yu Watanabe b0e339547f kernel-install: check all entry candidates first, then check existence of $pref/loader/entries only once
If we have multiple entries in $ENTRY_TOKEN_SEARCH, and $pref/loader/entries
exists, then previously we would always exit after the first candidate and
ignore the second and later candidates.

Follow-up for 1b43f86893.
2023-03-17 20:41:17 +09:00
Yu Watanabe 561d801370 Revert "kernel-install: also try to find $BOOT by partition GUID"
This reverts commit 41f39e2144.

From the post merge comment in #26648:

> Hmm, this is highly problematic, no? if I boot from my ssd and then
> plug in a fedora live usb stick, then there will be two ESPs around,
> the one from my ssd and the one from the live usb one, and this code
> might find the wrong one and bad things will happen
2023-03-17 20:41:17 +09:00
Yu Watanabe 16af02cd97 uki-util: move functions for inspecting kernel to uki-util.[ch] 2023-03-17 20:40:34 +09:00
Yu Watanabe c8eced395b bootctl: introduce inspect_kernel()
Then, now verb_kernel_identify() and verb_kernel_inspect() can share
most of the code.
2023-03-17 20:40:34 +09:00
Yu Watanabe 8102ff2e3d bootctl: introduce uki_read_pretty_name()
No functional change, just prepration for later commits.
2023-03-17 20:40:34 +09:00
Yu Watanabe 748b15c277 bootctl: find matching section in read_pe_section()
No functional change, just refactoring.
2023-03-17 20:40:34 +09:00
Yu Watanabe 03221e746d bootctl: return 0 instead of EXIT_SUCCESS 2023-03-17 20:40:34 +09:00
Yu Watanabe ab94d98b29 bootctl: move verb_kernel_identity()
No functional change, just for making beautify later diffs.
2023-03-17 20:40:34 +09:00
Yu Watanabe 58f5f60f1a os-util: add missing headers
For 'bool' and 'usec_t'.
2023-03-17 20:40:34 +09:00
Yu Watanabe 6ad9af0b13 exec-util: introduce EXEC_DIR_SKIP_REMAINING flag
Will be used in later commits.
2023-03-17 20:38:15 +09:00
Yu Watanabe f691157b87 exec-util: extract the core logic of execute_directories() as execute_strv()
Then, we can use it with a custom enumerator of executables.

No functional change, preparation for later commits.
2023-03-17 20:38:15 +09:00
Yu Watanabe 753e38d984 exec-util: enumerate executables earlier
Then, return earlier if no executable found.
2023-03-17 20:38:15 +09:00
Yu Watanabe fb0e5f12c6 exec-util: drop meaningless casts 2023-03-17 20:38:15 +09:00
Yu Watanabe 8e8df8292a exec-util: tighten variable scope a bit 2023-03-17 20:38:15 +09:00
Yu Watanabe 58dfcc57f2 test: add a testcase that dir_fd_is_root() is not confused by bind mount
See the comment in dir_fd_is_root() and
https://github.com/systemd/systemd/pull/26820#issuecomment-1469554966.
2023-03-17 09:49:21 +01:00
Yu Watanabe 77c6bb895a Merge pull request #26803 from yuwata/udevadm-verify-summary
udevadm-verify: print a short summary
2023-03-17 12:14:04 +09:00
Yu Watanabe 7b4cae904b test: add tests for summary output of udevadm verify 2023-03-16 14:54:46 +09:00
Yu Watanabe f99deb1e94 test: reindent testsuite-17.11.sh 2023-03-16 14:54:46 +09:00
Yu Watanabe 7ec4e184ba udevadm-verify: add a short summary 2023-03-16 14:54:46 +09:00
Yu Watanabe 3b1b0f1aeb sd-journal: fix segfault
Unfortunately, journal_file_next_entry() returns 0 when the next entry
not found. The commit cc938e4a0a adds
FIXME comment about that. We should really fix that, but the function and
its return value are used in many place, hence checking all usecases is not
easy. So, let's workaround that here, and handle the 0 return value by
the caller.

Follow-up for 34af74946e.

Fixes #26822.
2023-03-16 00:26:22 +00:00
Yu Watanabe b2b5a95227 github: update default and example in template 2023-03-15 20:31:34 +01:00
Yu Watanabe cb6ff2a42c Merge pull request #26771 from YHNdnzj/machinectl-edit
machinectl: add verb edit and cat to operate on .nspawn files
2023-03-16 04:02:11 +09:00
Yu Watanabe 0e5b4d767a Merge pull request #26831 from YHNdnzj/edit-util-followup
edit-util: follow-ups
2023-03-16 03:51:55 +09:00
Yu Watanabe 91ea97356c test-50-dissect: add test for long reference name 2023-03-14 18:53:55 +09:00
Yu Watanabe e551954def udev: mention that the kernel silently truncates lo_file_name if too long
Resolves the confusion in https://github.com/systemd/systemd/pull/26693#discussion_r1131151335.
2023-03-14 18:50:01 +09:00
Yu Watanabe 4b2e1a27cc Merge pull request #26767 from yuwata/udev-rule-rework-logging
udev-rule: rework logging about udev rules
2023-03-14 13:14:49 +09:00
Yu Watanabe a6ca54ed94 man: add missing tags in udevadm(8) 2023-03-13 19:29:58 +00:00
Yu Watanabe cbcdc582f3 Merge pull request #26749 from DaanDeMeyer/more-cleanups
execute: Some modernizations
2023-03-14 03:34:37 +09:00
Yu Watanabe 4fed028ae4 Merge pull request #26781 from mrc0mmand/tests-again
test: add a couple of tests for systemd-path
2023-03-14 03:27:45 +09:00
Yu Watanabe 4bc70180c0 udevadm-verify: fix indentation of help message 2023-03-13 21:30:44 +09:00
Yu Watanabe ef7d152c01 udevadm: enable colorized logging 2023-03-13 21:25:57 +09:00
Yu Watanabe e7f5d708d3 udev-rules: inline rule_line_append_token() 2023-03-13 21:25:57 +09:00
Yu Watanabe a0244c5de4 udev-rules: modernize free functions 2023-03-13 21:25:57 +09:00
Yu Watanabe 2aa5fe5e32 udev-rules: do not set 'issues' tag when applying rules to event device
The tagging is used by `udevadm verify` and the command only parses
udev rules but not apply them.
2023-03-13 21:25:57 +09:00
Yu Watanabe e5a3494844 udev-rules: introduce log_event_truncated() helper function 2023-03-13 21:25:57 +09:00
Yu Watanabe c06ab041c7 udev-rule: rework logging about udev rules
This makes the loggers take the most relevant object, i.e. when
applying udev rules to a device, the loggers take sd_device and
UdevRuleToken object, and when parsing udev rules, they take
UdevRuleLine or UdevRuleFile object.

To achieve that, this drops 'iterators' in UdevRules or friends named
`current_file` or so. Instead of that, each object now has its
parent object, e.g. UdevRuleToken.rule_line that references the
UdevRuleLine object the token belonging to. And each function previously
took UdevRules object now takes the most relevant object, e.g. UdevRuleToken.

Solves the discussion in https://github.com/systemd/systemd/pull/26698#discussion_r1129261193.
2023-03-13 21:25:45 +09:00
Yu Watanabe d77d42ed3a systemctl: refuse to acquire dbus connection with --global
Maybe, better to check the runtime scope each verb for better log
message, but this is a good start point to not trigger assertion.

Fixes oss-fuzz#56915 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56915).

Fixes #26402 and #26754.
2023-03-13 12:27:34 +01:00
Yu Watanabe cfacd245e7 test-time-util: do not fail on DST change 2023-03-13 04:43:51 +09:00
Yu Watanabe 37c6a3dc1a time-util: add note about on DST change 2023-03-13 04:43:51 +09:00
Yu Watanabe 6bed374280 test: add more testcases for formatting/parsing timestamp 2023-03-13 04:43:51 +09:00
Yu Watanabe bd5770da76 time-util: make USEC_TIMESTAMP_FORMATTABLE_MAX for 32bit system off by one day
As the same reason why we take one day off for 64bit case.

This also makes both upper bounds always defined for testing.
2023-03-13 04:43:19 +09:00
Yu Watanabe af339540ec Merge pull request #26775 from DaanDeMeyer/ext-default
mkfs-util: Always use "default" usage type for ext filesystems
2023-03-13 04:04:09 +09:00
Yu Watanabe a23561293b Merge pull request #26776 from YHNdnzj/edit-util-more-cleanup
edit-util: some more cleanups
2023-03-13 04:01:02 +09:00
Yu Watanabe 5654a4f9c5 sd-boot: fix incompatible type
Fixes the following build error:
```
../src/boot/efi/vmm.c: In function ‘get_smbios_table’:
../src/boot/efi/vmm.c:217:24: error: incompatible types when returning type ‘_Bool’ but ‘const SmbiosHeader *’ was expected
  217 |                 return false;
      |                        ^~~~~
```
2023-03-12 19:49:16 +09:00
Yu Watanabe 0a742f3622 edit-util: unlink temporary file on failure
Addresses the suggestion
https://github.com/systemd/systemd/pull/26756#discussion_r1133078705.
2023-03-11 22:20:54 +09:00
Yu Watanabe aec8200b12 edit-util: fix potentical crash when no edit markers
This also makes trim_edit_markers() take EditFile as the argument.
2023-03-11 22:19:22 +09:00
Yu Watanabe c629a5bc44 edit-util: make create_edit_temp_file() take EditFile as the argument
No functional changes, just refactoring.
2023-03-11 22:19:22 +09:00
Yu Watanabe 043db3400c edit-util: make EditFile take reference of EditFileContext
No functional change, just preparation for later commits.
2023-03-11 22:19:22 +09:00
Yu Watanabe 321291d82b systemctl-edit: invert one error check 2023-03-11 22:19:22 +09:00
Yu Watanabe 7a2a7f2c00 systemctl-edit: shorten code a bit 2023-03-11 22:19:22 +09:00
Yu Watanabe c9501b03cd Merge pull request #26641 from medhefgo/boot-elf2efi
boot: Drop gnu-efi / Add elf2efi.py
2023-03-11 17:15:01 +09:00
Yu Watanabe 91e07dd476 Merge pull request #26303 from YHNdnzj/edit-util
shared: add edit-util (part of which extracted from systemctl-edit)
2023-03-11 17:13:27 +09:00
Yu Watanabe 5b23987eaf Merge pull request #26739 from ldv-alt/udevadm-verify
udevadm verify: introduce --root option
2023-03-11 17:12:57 +09:00
Yu Watanabe dcbe37ca2f Merge pull request #26752 from Foxboron/morten/fix-manpage
src: Fixup copy-paste error for terminal_urlify_man
2023-03-11 17:12:47 +09:00
Yu Watanabe c3600c380a generator: fix comment 2023-03-11 03:32:23 +09:00
Yu Watanabe 367de0a9b7 system.conf: add default for memory pressure settings
Follow-up for #26393.
2023-03-09 23:43:17 +09:00
Yu Watanabe 054749e413 core: add missing MemoryPressureWatch= and MemoryPressureThresholdSec= setting
Follow-up for #26393.

Addresses https://github.com/systemd/systemd/pull/26393#issuecomment-1458655798.
2023-03-09 23:43:04 +09:00
Yu Watanabe b9872fe1dd macro: support the case that the number of elements has const qualifier
Follow-up for 5716c27e1f.

Addresses https://github.com/systemd/systemd/pull/26303#issuecomment-1460712007.
2023-03-09 08:41:43 +01:00
Yu Watanabe 00aba43fe6 Merge pull request #26698 from ldv-alt/udevadm-verify
Implement a udev rules syntax checker in the form of
`udevadm verify [OPTIONS] FILE...` command that is based on
`udev_rules_parse_file` interface and would apply further checks
on top of it in the future.

Resolves: #26606
2023-03-09 13:05:57 +09:00
Yu Watanabe 0744ed0f26 Merge pull request #26713 from keszybz/man-getenv
Add note to docs that setenv() cannot be called in parallel with getenv()
2023-03-09 00:16:30 +09:00
Yu Watanabe 9d0d39ee53 conf-files: fix potential memleak in conf_files_list_strv_internal() on failure
This also changes the used hash_ops from path_hash_ops to
string_hash_ops, as the key is not a path, but a filename.
2023-03-07 18:43:34 +09:00
Yu Watanabe 9ecacf1eae systemctl: port FOREACH_ARRAY() to systemctl-list-units.c 2023-03-07 13:27:18 +09:00
Yu Watanabe 5716c27e1f macro: introduce FOREACH_ARRAY() macro
The pattern that runs all array element is quite common.
But, sometimes, the number of element may be in a signed integer, or the
array may be NULL.
2023-03-07 13:27:16 +09:00
Yu Watanabe 9200e520ad Merge pull request #26669 from YHNdnzj/journalctl-lines-since-until
journalctl: fix output when --lines is used with --since or --until
2023-03-07 12:02:47 +09:00
Yu Watanabe 84d0dc53ac time-util: drop redundant call of tzset()
It is also called at the beginning of `parse_timestamp_maybe_with_tz()`.
2023-03-06 20:39:37 +00:00
Yu Watanabe 25e12db5e4 Merge pull request #26650 from yuwata/udev-trigger
test: generate debugging logs for udevd after restart
2023-03-06 16:36:34 +09:00
Yu Watanabe a6d46fe64b test: add header build tests for newer C and C++ standards 2023-03-06 10:21:47 +09:00
Yu Watanabe ce16d177dd tree-wide: replace IOVEC_INIT with IOVEC_MAKE
We use gnu11 to build, hence we can use structured initializer with
casting, and it is not necessary to use different patterns on
initialization and assignment.

Addresses https://github.com/systemd/systemd/pull/26560#discussion_r1118875447.
2023-03-06 09:30:28 +09:00
Yu Watanabe a0229fb14d sd-journal: wrap long line
Addresses https://github.com/systemd/systemd/pull/26560#discussion_r1118875967.
2023-03-06 09:16:13 +09:00
Yu Watanabe 61ccf030ae man: mention systemd-growfs-root.service 2023-03-06 07:15:29 +09:00
Yu Watanabe 5e97505335 man: mention systemd-fsck-usr.service 2023-03-06 07:15:12 +09:00
Yu Watanabe ae9f36397f Revert "hwdb: fix swapped buttons for Logitech Lift left"
This reverts commit 81cfea95e5.

The modalias seems to match a generic Logitech USB receiver even the
connected mouce is not for left hand.

Fixes #26671 and #26676.
2023-03-05 14:21:22 +01:00
Yu Watanabe 561f17a1e4 Merge pull request #26668 from yuwata/man-link-rename
man: add/update example in systemd.link
2023-03-04 22:14:22 +09:00
Yu Watanabe 181d719542 man: add an example to (re-)apply new settings to a network interface
Closes #26601.
2023-03-04 20:07:56 +09:00
Yu Watanabe 9b7f499ff1 man: sync the default .link file in example 2023-03-04 14:35:01 +09:00