]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-rules: accept cvm CONST matches
authordongshengyuan <545258830@qq.com>
Fri, 10 Jul 2026 08:04:31 +0000 (16:04 +0800)
committerdongshengyuan <545258830@qq.com>
Fri, 10 Jul 2026 08:04:31 +0000 (16:04 +0800)
CONST{cvm} is documented and already handled when udev rules are
executed, but the parser rejected it before the rule could be used.

Include cvm in the supported CONST key list.

Follow-up for 6e2e83b48734e86992cbdbb329c48cc066cf7c96.

Reproducer:

$ printf 'CONST{cvm}=="none", NAME="x"\n' > /tmp/codex-cvm.rules
$ udevadm verify /tmp/codex-cvm.rules
/tmp/codex-cvm.rules:1 Invalid attribute for CONST.
/tmp/codex-cvm.rules: udev rules check failed.

1 udev rules files have been checked.
  Success: 0
  Fail:    1

src/udev/udev-rules.c

index b96ba0fe33532ffe51b6f54b9a644ae1aea20e8a..42f6fde8a089b92fcbf8e2a49fa8eb29957d038c 100644 (file)
@@ -849,7 +849,7 @@ static int parse_token(
                 } else
                         r = rule_line_add_token(rule_line, TK_M_ENV, op, value, attr, is_case_insensitive, token_str);
         } else if (streq(key, "CONST")) {
-                if (isempty(attr) || !STR_IN_SET(attr, "arch", "virt"))
+                if (isempty(attr) || !STR_IN_SET(attr, "arch", "virt", "cvm"))
                         return log_line_invalid_attr(rule_line, key);
                 if (!is_match)
                         return log_line_invalid_op(rule_line, key);