| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
When invoked by udevadm verify, warn about rules that have PROGRAM
assignments specified after RESULT checks.
|
| |
|
|
|
|
|
|
| |
Make sure the ENOENT exception reintroduced by commit
9db7081d83d56cd2523b03f9eb9d67ef1c93c55f is not applied when the parser
is invoked by udevadm verify.
|
|
|
|
|
|
|
|
|
| |
This reverts commit 42a467b55219384c7c3b137ab3cc8b6a309a8a14.
We need to skip -ENOENT when loading udev rules because new files with rules
may be added or removed at any time, and the loading of rules is triggered
asynchronously. Even though the window is fairly narrow, udev shouldn't throw
an error if a rules file is removed.
|
|
|
|
| |
Fixes: 25de7aa7b90c ("udev: modernize udev-rules.c")
|
|
|
|
|
|
|
| |
Log an error when a rule line contains the following kind of conflicting
match expressions:
KEY=="foo*", KEY=="bar*"
|
|
|
|
|
|
|
|
|
|
|
|
| |
When udev_rules_parse_file() is called by udevadm verify, issue warnings
about the following conditions in udev rules:
* the first token in the rule is preceded with a comma
* the last token in the rule is followed by a comma
* there is no comma between tokens
* there is no whitespace between tokens
* there is more than a single comma between tokens
* there is whitespace between a token and a comma
* there is no whitespace after comma
|
|
|
|
|
|
|
|
|
| |
Move udev_check_rule_line() invocation from udev_rule_file_get_issues()
to udev_rules_parse_file(), invoke udev_check_rule_line() only when
udev_rules_parse_file() is called by udevadm verify.
Subsequent commits are going to perform more checks invoked from
udev_rules_parse_file().
|
|
|
|
|
| |
Move udev_rules_parse_file() after udev_check_rule_line() as
the former us going to use the latter.
|
|
|
|
|
|
|
|
|
| |
Chasing symlinks is a core function that's used in a lot of places
so it deservers a less verbose names so let's rename it to chase()
and chaseat().
We also slightly change the pattern used for the chaseat() helpers
so we get chase_and_openat() and similar.
|
|\
| |
| | |
Implement --help/--version in all udev builtins
|
| |
| |
| |
| |
| |
| | |
The array is a union, aligned as uint16_t, so we were accessing fields at
offsets of two, so we didn't do actually do unaligned access. But let's make
this explicit.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
They now pass, and we might as well test them to avoid unexpected
regressions.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
Copy-pasta is good, but you have to pick a reliable source.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Beef up syntax and error messages a bit.
|
| |
| |
| |
| |
| | |
Also split out parse_argv(), use "ARG" instead of "<arg>".
Make the syntax help a bit more precise.
|
| |
| |
| |
| |
| |
| |
| | |
Log an error when a rule line contains the following kind of conflicting
match expressions:
KEY=="foo", KEY=="bar"
|
| |
| |
| |
| |
| |
| |
| | |
Fix check for conflicting and duplicate expressions of types that
support alternative patterns.
Fixes: 3ec58d0cd8f6 ("udev-rules: check for conflicting and duplicate expressions")
|
| |
| |
| |
| |
| |
| | |
This reverts commit cd3c8a117ccf3505e49d34324473e2175ef0a9ce which was
papering over the bug instead of a proper fix made by the previous
commit.
|
|\ \
| | |
| | | |
udev: slightly extend comment and add more tests
|
| | |
| | |
| | |
| | | |
Resolves the confusion in https://github.com/systemd/systemd/pull/26693#discussion_r1131151335.
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
Log an error when a rule line contains conflicting match expressions, e.g.
NAME=="value", NAME!="value"
Log a warning when a rule line contains duplicate expressions, e.g.
NAME=="value", NAME=="value"
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
The tagging is used by `udevadm verify` and the command only parses
udev rules but not apply them.
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
boot: Drop gnu-efi / Add elf2efi.py
|
| |
| |
| |
| | |
This will help in a later commit to separate userspace from EFI builds.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds support for retrieving info about the inode backing a loopback
file to udev-builtin-blkid. It will pick up the inode number and device
of the backing inode, as well as the lo_file_name[] array that the
loopback device maintains.
A later patch uses this information to create block device symlinks in
/dev/ that allow refering block devices by their backing inodes. This is
useful when separate tools set up a loopback device from those which
ultimately shall mount them, and there shall be a stable reference be
passed along. For example, we can add a new kernel option setuploop= or
so which allows setting up a block device via a generator, and still
have a way to safely reference later.
And yes, this doesn't directly have anything to do with the probing
libblkid does, but it's close enough, and we have the device open anyway
here, so the additional ioctl() here should not hurt.
|
| |
|
|
|
|
|
|
|
| |
When udev rules file ends with a line continuation, the parser
used to silently ignore the line without any diagnostics at all.
It's time to break the vow of silence and let the parser issue some
error diagnostics.
|
|
|
|
|
|
| |
Check for unused labels in the specified udev rules files, report such
labels and exit with a non-zero exit code if any unused labels are
found.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We seem to have no tool to verify udev rule files. There is a simple
udev rules syntax checker in the tree, test/rule-syntax-check.py, but
it is too simple to detect less trivial issues not detected by udev,
e.g. redundant comparisons (#26593) or labels without references.
Such a tool would be beneficial not only for maintaining udev rules
distributed along with udev, but also and even more so for maintaining
third party udev rules that are more likely to have issues with syntax
and semantic correctness.
Implement a udev rules syntax and semantics 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 subsequent commits.
Resolves: #26606
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Traditionally, all issues found in udev rules by udev_rules_parse_file()
are logged and ignored, so there was no mechanism to propagate the
information about these issues back to the caller.
Introduce such a mechanism by adding a new member to UdevRuleFile.
This new member is a bitmask describing which log levels were used
in messages logged with regards to the rule file.
This mechanism is going to be used by udevadm verify in subsequent
commits.
|
|
|
|
|
|
|
|
|
|
|
| |
Tablets don't typically have relative coordinates (they are separated on
the kernel device layer). However, some Logitech mice report similar
supported events, so use the existence of EV_REL to determiner whether or
not the device is really a tablet.
Fixes bug introduced by 0855ce67726f87a5a67b4fb536d58e0e4428a248.
Fixes: #26600
|