For implicit rules, 'ab%cd' can currently match 'example_dir/abcd' which is not really what a user would intend.
Extend the length check to include the case where pathlen=stemlen so that '%' must match at least 1 character in the base filename. Signed-off-by: Julian Braha <[email protected]> --- Since it's only a 1-character change, I haven't filled out the copyright stuff (I assume this is considered "trivial"?) But let me know if I should do so. Thanks! --- src/implicit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/implicit.c b/src/implicit.c index e2d2759f..6057f18f 100644 --- a/src/implicit.c +++ b/src/implicit.c @@ -351,7 +351,7 @@ pattern_search (struct file *file, int archive, if (check_lastslash) { /* If so, don't include the directory prefix in STEM here. */ - if (pathlen > stemlen) + if (pathlen >= stemlen) continue; stemlen -= pathlen; stem += pathlen; -- 2.56.0
