]> git.ipfire.org Git - thirdparty/systemd.git/commit
sysupdate: Evaluate all patterns before descending into a subdir
authorKai Lüke <kai@amutable.com>
Fri, 3 Jul 2026 13:39:22 +0000 (22:39 +0900)
committerKai Lüke <pothos@users.noreply.github.com>
Fri, 10 Jul 2026 12:25:38 +0000 (14:25 +0200)
commitc8a2e035ce0e8b22bedc6727559101808ce456b3
tree3b0add9cff610077ced35b5ca19cab907e7d2b22
parent761c6641103c1a5e7fc6548cbcd69ad63cc3541e
sysupdate: Evaluate all patterns before descending into a subdir

When we have two match patterns, e.g., because the repository layout
changed and we look for old and new style files, we can have the case
that one pattern suggests a descend into a subdir but the other pattern
would be a direct match. This was missed and only the descent was done.
Yet the other way round also has to be covered: We can't just use the
direct match because it might be that it's rejected if the type doesn't
fit (directory vs. regular file). In this case we should still descent.

Remember that we want to descend but continue checking the other
pattern first to maybe get a direct match. Introduce a new combined
return code YES_AND_RETRY to give the full information to the caller
which now can decide to fallback to a descent. While at it, use the
stat info for the directory check. Also add tests to ensure that the
order of patterns doesn't matter and we handle the above corner cases.
src/sysupdate/sysupdate-cleanup.c
src/sysupdate/sysupdate-pattern.c
src/sysupdate/sysupdate-pattern.h
src/sysupdate/sysupdate-resource.c
test/units/TEST-72-SYSUPDATE.sh