Thread (11 messages) flat view 11 messages, 2 authors, 2016-06-15
DORMANTno replies

[PATCH 5/8] wildmatch: fix case-insensitive matching

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:54:58
Subsystem: the rest · Maintainer: Linus Torvalds

dowild() does case insensitive matching by lower-casing the text. That
means lower case letters in patterns imply case-insensitive matching,
but upper case means exact matching.

We do not want that subtlety. Lower case pattern too so iwildmatch()
always does what we expect it to do.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 wildmatch.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/wildmatch.c b/wildmatch.c
index 2382873..fdb8cb1 100644
--- a/wildmatch.c
+++ b/wildmatch.c
@@ -72,6 +72,8 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
 		return ABORT_ALL;
 	if (force_lower_case && ISUPPER(t_ch))
 	    t_ch = tolower(t_ch);
+	if (force_lower_case && ISUPPER(p_ch))
+	    p_ch = tolower(p_ch);
 	switch (p_ch) {
 	  case '\\':
 	    /* Literal match with following character.  Note that the test
-- 
1.8.0.rc0.29.g1fdd78f
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help