diff options
| author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2026-04-14 03:11:44 +0300 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2026-04-16 10:42:13 +0100 |
| commit | feca895aa0e76d1ec89fa11ce673746aefc29d64 (patch) | |
| tree | 96208812b4db22a5dced9481d4eca54657f40ea9 /scripts/embedded_scripts | |
| parent | 35f5b03d2fa2d1884c25b9e4854ec293ea534d4d (diff) | |
| download | busybox-w32-feca895aa0e76d1ec89fa11ce673746aefc29d64.tar.gz busybox-w32-feca895aa0e76d1ec89fa11ce673746aefc29d64.tar.bz2 busybox-w32-feca895aa0e76d1ec89fa11ce673746aefc29d64.zip | |
win32: switch to new fnmatch2.c
win32/fnmatch.c has several issues:
- *[* doesn't match foo[bar - but it should (non-special '[').
- FMN_CASEFOLD is not handled corrrectly. It does tolower on pattern
and string, which doesn't always work, e.g. *[@-[]* correctly
matches '@', A-Z, and '[', but as case-insensitive it only matches
'@' and '[' (tolower on the string breaks all the alpha matches):
set -o nocaseglob; echo *[@-[]*
set +o nocaseglob; echo *[@-[]*
- According to posix, negative bracket range, like [z-a], should be
either invalid or empty, but instead it matches only 'z'.
- There could be more issues hiding - the code is not easy to follow.
- It's exponential time in the number of '*' in pattern.
This commit adds win32/fnmatch2.c and disables win32/fnmatch.c
(currently using "#if 0"), but still keeps it in the tree.
The new implementation is written from scratch, non-recursive and
linear time, improves POSIX compliance, and hopefully more readable
and fixable if needed. Also, it's about half the size at the binary
(saves 908 bytes in x64).
See implementation details and choices as comment at fnmatch2.c .
Diffstat (limited to 'scripts/embedded_scripts')
0 files changed, 0 insertions, 0 deletions
