The glob_match() function in src/shared/utils.c supports basic wildcard patterns (* matches within a single path component, ? matches a single character), but does NOT support ** (double-star) for recursive directory matching. rsync and most modern file sync tools support ** for matching across directory boundaries.
For example, the pattern src/**/*.c should match src/main.c, src/sub/file.c, src/a/b/c/file.c, etc., but glob_match() currently treats ** the same as * because it processes each * character individually.
Location
src/shared/utils.c:59-82
Suggested Fix
Add support for ** by detecting two consecutive * characters and treating them as a recursive wildcard that matches across / boundaries:
if(*pattern=='*'&&*(pattern+1)=='*'){// Treat ** as matching across directories
// Skip any trailing /
while(*pattern=='*'||*pattern=='/')pattern++;// Try matching at every position in str
while(*str){if(glob_match(pattern,str))returntrue;str++;}returnglob_match(pattern,str);}
Severity
Low
Category
Enhancement
## Description
The `glob_match()` function in `src/shared/utils.c` supports basic wildcard patterns (`*` matches within a single path component, `?` matches a single character), but does NOT support `**` (double-star) for recursive directory matching. rsync and most modern file sync tools support `**` for matching across directory boundaries.
For example, the pattern `src/**/*.c` should match `src/main.c`, `src/sub/file.c`, `src/a/b/c/file.c`, etc., but `glob_match()` currently treats `**` the same as `*` because it processes each `*` character individually.
## Location
`src/shared/utils.c:59-82`
## Suggested Fix
Add support for `**` by detecting two consecutive `*` characters and treating them as a recursive wildcard that matches across `/` boundaries:
```c
if (*pattern == '*' && *(pattern+1) == '*') {
// Treat ** as matching across directories
// Skip any trailing /
while (*pattern == '*' || *pattern == '/')
pattern++;
// Try matching at every position in str
while (*str) {
if (glob_match(pattern, str))
return true;
str++;
}
return glob_match(pattern, str);
}
```
## Severity
Low
## Category
Enhancement
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
The
glob_match()function insrc/shared/utils.csupports basic wildcard patterns (*matches within a single path component,?matches a single character), but does NOT support**(double-star) for recursive directory matching. rsync and most modern file sync tools support**for matching across directory boundaries.For example, the pattern
src/**/*.cshould matchsrc/main.c,src/sub/file.c,src/a/b/c/file.c, etc., butglob_match()currently treats**the same as*because it processes each*character individually.Location
src/shared/utils.c:59-82Suggested Fix
Add support for
**by detecting two consecutive*characters and treating them as a recursive wildcard that matches across/boundaries:Severity
Low
Category
Enhancement