Commit Graph
89045 Commits
Author SHA1 Message Date
Yu Watanabe 3c230737f5 sd-device: use macro to define device_get_sysattr_int() and friends 2026-05-18 02:55:56 +09:00
Yu Watanabe dbfe8b162b test: add test cases for device_get_sysattr_int() and friends 2026-05-18 02:55:56 +09:00
Yu Watanabe 532276524f sd-device: rename argument names for storing result
When a function takes only one argument for storing result, the argument
is not necessary to be named as ret_xyz, but ret should be enough.
2026-05-18 02:55:56 +09:00
Yu Watanabe 06d687ffac tree-wide: use device_get_sysattr_safe_string()
The obtained strings are passed to another function, e,g, handled as a
path and opened, printed to the terminal, written to a file, saved to
udev database as udev property, exposed through DBus, passed to logger,
and so on. Hence, these should not contain any malicious characters.
2026-05-18 02:55:56 +09:00
Yu Watanabe fdce4d4687 udev-builtin-net_id: quote strings in log messages 2026-05-18 02:55:56 +09:00
Yu Watanabe 35edd031b9 udev-builtin-net_id: use EINVAL when we get unexpected sysattr value
The results are completely ignored or only checked if it is negative or
not. Hence, this does not change anything.
2026-05-18 02:55:56 +09:00
Yu Watanabe c5a04f59d9 udev: drop redundant checks
This partially reverts 16325b35fa,
as bad characters are already filtered.
2026-05-18 02:55:56 +09:00
Yu Watanabe c6ea72e39a Revert "udev-builtin-net-id: print cescaped bad attributes"
This reverts commit 7c4047957e.

This is not necessary, as bad characters are already filtered.
2026-05-18 02:55:56 +09:00
Yu Watanabe d0e48e2601 udev: use device_get_sysattr_safe_string() in device_get_sysattr_value_filtered()
Then, renamed to device_get_sysattr_safe_string_filtered().
2026-05-18 02:55:56 +09:00
Yu Watanabe 13ce62caba sd-device: use device_get_sysattr_safe_string()
The read value are exposed by sd_device_get_subsystem() and friends.
Hence, it is better to filter invalid characters.
Of course, these should be always safe unless the kernel is buggy.
But, just for safety.

Note, even if uevent file contains invalid characters, then
device_read_uevent_file() should succeed without parsing the contents.
The caller should fail later with a proper error code if a necessary
field is unset. E.g. sd_device_get_ifindex() should still return -ENOENT
even when uevent file contains an invalid characters.
2026-05-18 02:55:56 +09:00
Yu Watanabe 0341058ee6 sd-device: introduce device_get_sysattr_safe_string()
This introduce a helper function that verifies read sysattr value.
Some sysattr value may come from firmware, and kernel may expose unsafe
string. The introduced function should be used when we use the result as
a string.
2026-05-18 02:55:56 +09:00
Yu Watanabe b74f016e59 string-util: introduce STRING_ALLOW_NEWLINES switch for string_is_safe()
This also make StringSafeFlags defined in basic-forward.h so other
headers can use the enum.
2026-05-18 02:55:34 +09:00
Jörg Behrmann 2cdf552762 emacs: add settings for Python modes
Both python-mode and python-ts-mode are shipped by Emacs nowadays, with the
latter being the more modern tree-sitter-based one. Even though they are
similar, the newer one doesn't automatically take the older ones settings.
2026-05-18 02:51:41 +09:00
Jörg Behrmann 24b79ff1d0 ci/linter: show diffs for ruff check when possible 2026-05-18 02:51:41 +09:00
Yu Watanabe e184315aee ci/linter: run ruff for all python scripts 2026-05-18 02:51:41 +09:00
Yu Watanabe 4c333638ad proxy-echo: apply "ruff check --fix" 2026-05-18 02:51:35 +09:00
Yu Watanabe 06961b7c5f fake-report-server: apply "ruff format" and "ruff check --fix" 2026-05-18 02:49:29 +09:00
Yu Watanabe 2a0eaff3a7 fake-imds: apply "ruff format" and "ruff check --fix" 2026-05-18 02:48:35 +09:00
Yu Watanabe 94f807be03 merge-bpf-compdb: apply "ruff format" 2026-05-18 02:47:09 +09:00
Yu Watanabe 9e15fad481 xml_helper: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 8fc2bde0db update-man-rules: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe c1e31e12b4 update-dbus-docs: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 09e34716fc sync-docs: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 3b690e2c7e meson-render-jinja2: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 1fbb5e0ff1 meson-extract-unit-files: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 3675924f5b make-man-index: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 8b24db05d4 make-directive-index: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe e0ac581a8b list-discoverable-partitions: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe cc1373700b generate-gperfs: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 86d3b07fba gdb-sd_dump_hashmaps: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 30c87278d4 find-unused-library-symbols: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 2ab056cb7e fetch-mkosi: apply "ruff format" and "ruff check --fix"
This also makes CONFIG is closed when not necessary.
2026-05-18 02:44:47 +09:00
Yu Watanabe 6c2bf5330b fetch-distro: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 0df17e665b elf2efi: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 7e62c9be6f dump-auxv: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 5aa172e263 dbus-exporter: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe a5d54f52d6 check-version-history: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 53172028c8 check-efi-alignment: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe 0965c5d719 catalog-report: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe ce9b618e46 analyze-dump-sort: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe b27bd1a399 TEST-69-SHUTDOWN: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe 81b1f3dd9f test-udev: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:46 +09:00
Yu Watanabe f8a3f9d135 test-tmpfiles: apply "ruff format" and "ruff check --fix"
This also dropped unnecessary existence check for subprocess.run.
2026-05-18 02:44:46 +09:00
Yu Watanabe 6e4c7f91f9 test-shutdown: apply "ruff format" 2026-05-18 02:44:46 +09:00
Yu Watanabe 1b94d7d7ec test-network: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:46 +09:00
Yu Watanabe 59199ec3bd test-network: drop old ip command support 2026-05-18 02:44:46 +09:00
Yu Watanabe 9c0c203db4 test-network: assume the test is running with newer udevd 2026-05-18 02:44:46 +09:00
Yu Watanabe cbc2990335 test-network: drop old kernel support and workaround for fixed kernel bug
- l3mdev in fib rules is supported since
https://github.com/torvalds/linux/commit/96c63fa7393d0a346acfe5a91e0c7d4c7782641b (v4.8).
- uid range in fib rules is supported since
https://github.com/torvalds/linux/commit/622ec2c9d52405973c9f1ca5116eb1c393adfc7d (v4.10).
- port range and ip proto in fib rules is supported since
https://github.com/torvalds/linux/commit/bfff4862653bb96001ab57c1edd6d03f48e5f035 (v4.17).
- interface alternative name is supported since
https://github.com/torvalds/linux/commit/36fbf1e52bd3ff8a5cb604955eedfc9350c2e6cc (v5.5).
- SRIOV on netdevsim is supported since
https://github.com/torvalds/linux/commit/79579220566cd33fe3b15ce8249c57e10251b258 (4.16).
- nexthop is supported since
https://github.com/torvalds/linux/commit/65ee00a9409f751188a8cdc0988167858eb4a536 (v5.3).
- bridge MDB entries on bridge master is supported since
https://github.com/torvalds/linux/commit/1bc844ee0faa1b92e3ede00bdd948021c78d7088 (v5.4).
2026-05-18 02:44:46 +09:00
Yu Watanabe 124bbf37de sys-script: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:46 +09:00
Yu Watanabe 87c0cf15fe sd-script: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:46 +09:00