diff --git a/CHECKSUMS b/CHECKSUMS index af413991..0b88783e 100644 --- a/CHECKSUMS +++ b/CHECKSUMS @@ -161,11 +161,4 @@ e2f44b06d2065226e6d2b184f9bf046bb0ce5144a585eadb14f83e19c349cc86 snapraid-13.0- 59b8b09e20a5937e0cd2798b1256eefa1cd27bd3f1c24b5e4dee32e6b25c1553 snapraid-14.0-windows-x64.zip b6a144161e7240c754947d5ea4f637f59006cbdaed68c2f285f440c257e7590e snapraid-14.0-windows-x86.zip b67183342cc4160891dfdf10452f1c79e71bb7887c54fcfb81cd2ded68b3bd37 snapraid-14.0-x86_64-1_am.txz -b33e19558ad0f29f1c8d3907a772377f1125f19b44003db8b8df05cec46cd7c6 snapraid-14.1.tar.gz -d0cb38415284e88cb6f7253ef8389aa207c3689e0276196808773bd37aeb6552 snapraid-14.1-1-x86_64.pkg.tar.zst -a754c6acd9c0efd8de89b698ff7bf422299f30de222c99db42a597b21f272429 snapraid-14.1-1.x86_64.rpm -0bb740d84b446aafc87fb8f188cb87d1429a7c3243b9339633f8a237dfc2b987 snapraid-14.1-windows-x64.zip -f796fc232bc578e9b3007e50dc543dcb9a8a9ab721eaf0b805a0e25c53e573e5 snapraid-14.1-windows-x86.zip -a15c366093e7184b72e51797fcf6429858374810c35694a0c7fb9cb044c5f7ff snapraid-14.1-x86_64-1_am.txz 128b5b0f80a6a0911e77ed3b5d9d81529f5ea1d8fffbb5112e3af3467d80464a snapraid_14.0-1_amd64.deb -b9c41ae2e8edbc413abd3172b7ed2da2cba7fa0e631d0f47fc1dafccf7c6e92c snapraid_14.1-1_amd64.deb diff --git a/HISTORY b/HISTORY index ce16a53d..634a490d 100644 --- a/HISTORY +++ b/HISTORY @@ -1,12 +1,6 @@ SnapRAID HISTORY ================ -14.1 2026/03 -============ - * Fix include/exclude specification of directories. - * Fix a build issue in Alpine distribution. - * Fix abort condition if the Windows volume name cannot be converted to UTF-8. - 14.0 2026/03 ============ * More log tags for all commands in preparation for the upcoming SnapRAID diff --git a/cmdline/elem.c b/cmdline/elem.c index 3a4be8d1..4b18fed1 100644 --- a/cmdline/elem.c +++ b/cmdline/elem.c @@ -186,35 +186,27 @@ static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter** path += strlen(filter->root); } - /* if the filter is for files, it doesn't applies to directories */ + /* match dirs with dirs and files with files */ + if (filter->is_dir && !is_dir) + return 0; if (!filter->is_dir && is_dir) return 0; - /* - * If the filter is for directories, it should be applied to all files inside - * that directory. - * - * This is done allowing a partial matching as far it ends at a directory separator - */ - int match_sub = 0; - if (filter->is_dir && !is_dir) - match_sub = 1; - int ret = 0; if (filter->is_abs) { /* skip initial slash, as always missing in the path */ - if (wnmatch_sub(filter->pattern + 1, path, match_sub) == 0) + if (wnmatch(filter->pattern + 1, path) == 0) ret = filter->direction; } else { /* the path is relative, first try to match from the root */ - if (wnmatch_sub(filter->pattern, path, match_sub) == 0) { + if (wnmatch(filter->pattern, path) == 0) { ret = filter->direction; } else { /* then try to match after all the / presents */ char* slash = strchr(path, '/'); while (slash) { - if (wnmatch_sub(filter->pattern, slash + 1, match_sub) == 0) { + if (wnmatch(filter->pattern, slash + 1) == 0) { ret = filter->direction; break; } diff --git a/cmdline/support.c b/cmdline/support.c index e30b4cb4..94a6cc1c 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -2541,7 +2541,7 @@ static const char* match_class(const char* p, char t) return p; } -int wnmatch_sub(const char* p, const char* t, int match_sub) +int wnmatch(const char* p, const char* t) { char p1 = 0; /* previous char */ while (*p) { @@ -2582,20 +2582,20 @@ int wnmatch_sub(const char* p, const char* t, int match_sub) */ if (*p == '/' && (p1 == 0 || p1 == '/')) { /* try reducing to nothing */ - if (wnmatch_sub(p + 1, t, match_sub) == 0) + if (wnmatch(p + 1, t) == 0) return 0; /* otherwise / should match in the text */ } /* try matching with 0 or more characters */ while (*t) { - if (wnmatch_sub(p, t, match_sub) == 0) + if (wnmatch(p, t) == 0) return 0; ++t; } /* try matching at the end */ - return wnmatch_sub(p, t, match_sub); + return wnmatch(p, t); } } else { /* skip the * */ @@ -2611,13 +2611,13 @@ int wnmatch_sub(const char* p, const char* t, int match_sub) /* try matching with 0 or more characters */ while (*t && *t != '/') { - if (wnmatch_sub(p, t, match_sub) == 0) + if (wnmatch(p, t) == 0) return 0; ++t; } /* try matching at the end */ - return wnmatch_sub(p, t, match_sub); + return wnmatch(p, t); case '[' : /* character class */ if (*t == 0 || *t == '/') @@ -2640,13 +2640,7 @@ int wnmatch_sub(const char* p, const char* t, int match_sub) p1 = p0; } - /* if we match sub directory */ - if (match_sub) { - /* match successfully only if we are at a directory border */ - return *t != '/'; - } else { - /* match successfully if we've consumed all text */ - return *t != 0; - } + /* match successful if we've consumed all text */ + return *t != 0; } diff --git a/cmdline/support.h b/cmdline/support.h index 67cc2da1..69fb90bd 100644 --- a/cmdline/support.h +++ b/cmdline/support.h @@ -523,24 +523,14 @@ void thread_yield(void); /* * Wild match function. * - * If match_sub is !=0, it matches sub directory. Specifically it matches if the - * string "t" is not fully consumed and the next character to consume is a /. - * * - ? matches any single character except / * - * matches any sequence of characters except / * - ** (nearby a /) matches everything including / * - ** (not near a /) like * - * - ##/ reduces to nothing in addition to the normal matching of ** (using # instead of * to not mess the C comment) + * - ##/ reduces to nothing in addition to the normal matching of ** (using # instead of * to mess the C comment) * - [...] matches character classes with support for ranges and negation lile [!...] or [^...], except / - * - * \return 0 if it matches */ -int wnmatch_sub(const char* p, const char* t, int match_sub); - -static inline int wnmatch(const char* p, const char* t) -{ - return wnmatch_sub(p, t, 0); -} +int wnmatch(const char* p, const char* t); #endif