Merge pull request #16435 from gaoyi1988/master

fix multi matches when use "||"
This commit is contained in:
Yu Watanabe 2020-07-12 21:46:22 +09:00 committed by GitHub
commit 5553041a62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -452,6 +452,11 @@ static int rule_line_add_token(UdevRuleLine *rule_line, UdevRuleTokenType type,
}
}
*b = '\0';
/* Make sure the value is end, so NULSTR_FOREACH can read correct match */
if (b < a)
b[1] = '\0';
if (bar)
empty = true;

View File

@ -1322,6 +1322,17 @@ EOF
KERNEL=="sda", TAG=""
TAGS=="foo|", SYMLINK+="found"
TAGS=="aaa|bbb", SYMLINK+="bad"
EOF
},
{
desc => "test multi matches 11",
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
exp_name => "found",
not_exp_name => "bad",
rules => <<EOF
KERNEL=="sda", TAG="c"
TAGS=="foo||bar||c", SYMLINK+="found"
TAGS=="aaa||bbb||ccc", SYMLINK+="bad"
EOF
},
{