From: dongshengyuan <545258830@qq.com> Date: Mon, 6 Jul 2026 05:40:26 +0000 (+0800) Subject: sysupdate: handle slashes after pattern fields X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=add910a838ea718abd7f70d221fd5a69408c7026;p=thirdparty%2Fsystemd.git sysupdate: handle slashes after pattern fields Patterns such as foo_@v/bar.efi are documented to match files in versioned subdirectories, but pattern_match() assumed that a field is always followed by a literal when another element exists. Handle a following slash as a delimiter too, and request another recursion step when the current path ends before that slash. Fixes #42895. Signed-off-by: dongshengyuan --- diff --git a/src/sysupdate/sysupdate-pattern.c b/src/sysupdate/sysupdate-pattern.c index f06265c698f..c859bd111cd 100644 --- a/src/sysupdate/sysupdate-pattern.c +++ b/src/sysupdate/sysupdate-pattern.c @@ -248,12 +248,14 @@ int pattern_match(const char *pattern, const char *s, InstanceMetadata *ret) { } if (e->elements_next) { - /* The next element must be literal, as we use it to determine where to split */ - assert(e->elements_next->type == PATTERN_LITERAL); - - n = strstr(p, e->elements_next->literal); - if (!n) - goto nope; + if (e->elements_next->type == PATTERN_LITERAL) { + n = strstr(p, e->elements_next->literal); + if (!n) + goto nope; + } else if (e->elements_next->type == PATTERN_SLASH) + n = strchrnul(p, '/'); + else + assert_not_reached(); } else /* End of the string */