Commit Graph
63118 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 42fff80cb8 udev/v4l_id: use O_CLOEXEC|O_NOCTTY
This is the usual set of flags. O_CLOEXEC doesn't matter because we don't spawn
anything, but O_NOCTTY could possibly make a difference if the helper is called
on a wrong device type.
2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek 8a4c11e0e2 meson: add udev builtins to dist-check
They now pass, and we might as well test them to avoid unexpected
regressions.
2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek 5356761da6 udev: implement --version in all builtins
Those are separate binaries, and occasionally people will get a misplaced
binary that doesn't match the rest of the installed system and be confused, so
it good to be able to check the version. It is also nice to have the same
interface in all binaries.

Note that we usually use a separate 'enum ARG_VERSION = 0x100' for an option
without a short name. We can use a less verbose approach of simply taking any
unused letter, which works just as well and even the compiler would warn us
if we tried to use the letter in another place. This way we avoid a few lines
of boilerplate.

The help texts are adjusted to have an empty line between the synopsis and
option list, and no empty lines after the option list.
2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek bd36d0281a udev/cdrom_id: do not abort on unknown options
Copy-pasta is good, but you have to pick a reliable source.
2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek 32c2d046c6 udev/mtd_probe: convert to run() 2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek 8b89b9d7c3 udev/mtd_probe: implement --help 2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek 4b0f967484 udev/fido_id: implement --help 2023-03-16 16:46:44 +01:00
Zbigniew Jędrzejewski-Szmek 66026fca95 udev/ata_id: stop using errno, fix logic
The code was setting errno, which we don't do, and which is hard to get right…
Rework the code to use the usual negative-errno convention and add some
debug logging.

disk_scsi_inquiry_command() was working partially by accident: the v3 fallback
would enter the v4 check path, and pass it because the v4 data would still be
initialized to 0.
2023-03-16 16:46:43 +01:00
Zbigniew Jędrzejewski-Szmek 4dfe41e234 udev/ata_id: drop unused output parameter 2023-03-16 16:45:11 +01:00
Zbigniew Jędrzejewski-Szmek c6f85c3c40 udev/ata_id: convert to run() 2023-03-15 09:36:26 +01:00
Zbigniew Jędrzejewski-Szmek 61da49cfd6 udev/ata_id: split out parse_argv()
Beef up syntax and error messages a bit.
2023-03-15 09:36:26 +01:00
Zbigniew Jędrzejewski-Szmek 6fecd78ca9 udev/v4l_id: convert to run() and add error messages
Also split out parse_argv(), use "ARG" instead of "<arg>".
Make the syntax help a bit more precise.
2023-03-13 18:14:55 +01: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