Commit Graph
63111 Commits
Author SHA1 Message Date
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
Luca Boccassi 560900be67 Merge pull request #26772 from yuwata/time-util-adjust-formattable-timestamp-max
time-util: adjust formattable timestamp max
2023-03-12 23:06:39 +00:00
OMOJOLA JOSHUA cde4322b3a added a unit test for a function in "argv-utils.c" (#26760)
* added a unit test for argv-utils.c
2023-03-12 23:03:52 +00: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
Mike Yuan 78e3200354 edit-util: include the correct header 2023-03-13 01:44:51 +08:00
Mike Yuan 978e222f72 edit-util: rename trim_edit_marker to strip_edit_temp_file
with some minor cleanups
2023-03-13 00:44:34 +08:00
Mike Yuan 52073ba247 edit-util: always create temp file
even if neither original_path nor comment_paths is specified.
2023-03-13 00:41:11 +08:00
Mike Yuan 8992667fef edit-util: minor cleanups
Reuse unlink_and_free() and avoid unnecessary
call to rmdir()
2023-03-13 00:40:15 +08:00
Daan De Meyer 49f2e129f8 mkfs-util: Redirect mkfs.vfat stdout to /dev/null
mkfs.vfat does not have a --quiet option so let's redirect its
stdout to /dev/null instead.
2023-03-12 16:20:38 +01:00
Daan De Meyer 2417fa8ef5 mkfs-util: Don't explicitly enable has_journal for ext3/ext4
It's enabled by default anyway and removing it allows merging the ext
conditionals into one.
2023-03-12 15:36:08 +01:00
Daan De Meyer 59c3c195f4 mkfs-util: Always use "default" usage type for ext filesystems
If no usage type is explicitly specified, ext will choose one based
on the filesystem size. Let's override this and always use the
"default" usage type so that we can create filesystems that are
initially small but might grow later without opting in to the "small"
usage type.
2023-03-12 15:15:35 +01:00
Mike Yuan 7d28e496e8 Merge pull request #26756 from yuwata/edit-util-cleanups
edit-util: several cleanups
2023-03-12 19:23:19 +08: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
Daan De Meyer 9c34405241 mkosi: Update to latest 2023-03-11 13:55:41 +01: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
Morten Linderud 9e60dc0daf man: Fix pcrphase.service manvolnum from 1 to 8 2023-03-10 20:29:56 +01:00
Morten Linderud 6dadf31d61 src: Fixup copy-paste error for terminal_urlify_man
Signed-off-by: Morten Linderud <morten@linderud.pw>
2023-03-10 20:21:30 +01:00
Yu Watanabe c3600c380a generator: fix comment 2023-03-11 03:32:23 +09:00
Mike Yuan f8970df54b edit-util: several cleanups for run_editor
run_editor is now switched to heap allocation
for simplicity. The code for child is made into
an individual function for simpler error handling.
2023-03-11 02:02:51 +08:00
Mike Yuan 90c462bdd1 systemctl: edit: several cleanups 2023-03-11 02:02:44 +08:00
Mike Yuan 9a11b4f953 edit-util: introduce EditFileContext
This is a rather large change which moves
the add and install logic into edit-util.

We store an EditFile array and the number of
elements, along with the edit markers used in
temporary files and whether to remove the parent
directories of the target files if they're empty
in an EditFileContext object.

Call edit_files_add() to add an file to edit,
and do_edit_files_and_install() to do the actual
editing (through create_edit_temp_file(),
run_editor() and trim_edit_markers()).
After that, edit_file_context_done() can be used
to destroy the object.
2023-03-11 02:01:00 +08:00
Mike Yuan fa2413dd57 edit-util: several cleanups to create_edit_temp_file
original_path and comment_paths can now be used
together.

Removes reference to "unit"
2023-03-11 01:38:52 +08:00
Mike Yuan a01c4bc9af shared: extract edit-util from systemctl-edit 2023-03-11 01:38:52 +08:00
Dmitry V. Levin b2f7bb760a udev_rules_parse_file: issue diagnostics about duplicate LABEL tokens
When a rules contains several LABEL tokens, the parser used to silently
discard all of them besides the last one without any diagnostics at all.
It's time to break the vow of silence and let the parser issue a warning.
2023-03-10 17:10:41 +00:00
Will Fancher 6e017b19a8 mount: Include After=local-fs-pre.target by default in initrd
Although it may be true that /sysroot and its children don't belong in
local-fs.target, that doesn't mean they shouldn't come after
local-fs-pre.target. For instance, systemd-hibernate-resume@.service needs to
come before /sysroot and its children, but currently that only happens
coincidentally because of the ordering between systemd-fsck@.service and
local-fs-pre.target. As a result, mount units can be mistakenly started
simultaneously with systemd-hibernate-resume@.service, which can cause
corruption and data loss in the worst of cases.
2023-03-11 02:10:41 +09:00
Dmitry V. Levin c8f39ddcf6 testsuite-17.11.sh: check udevadm verify --root 2023-03-10 17:10:41 +00:00
Dmitry V. Levin 0a7eda348c udevadm verify: introduce --root option
When udevadm verify is invoked without positional arguments and loads
all rules files from the system like the udev daemon does, this option
can be used to operate on files underneath the specified root path.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin e8c53080c4 udevadm verify: load all rules from the system if no rules were given
When udevadm verify is invoked without positional arguments, that is,
when no udev rules files are specified, load all rules files from the system
like the udev daemon does, and verify them.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin 197f695a75 testsuite-17.11.sh: prepare to test udevadm verify --root 2023-03-10 17:10:41 +00:00
Dmitry V. Levin 99f2445171 testsuite-17.11.sh: create all files in a temporary directory
Make sure the test would not collide with anything else by moving
all files it created into a temporary directory.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin 0b1ee3e311 testsuite-17.11.sh: robustify unknown user/group checks
Use certainly invalid user/group names in the tests that check
unknown user/group diagnostics.
2023-03-10 17:10:41 +00:00
Daan De Meyer aa41079175 Merge pull request #26726 from DaanDeMeyer/cleanups
Various small cleanups
2023-03-10 14:22:53 +01:00