grep: fix echo "aa" | busybox grep -F -w "a" (should not match)
No binary (build failed)
—
(log yok)
| @@ -352,7 +352,7 @@ static int grep_file(FILE *file) | |
| goto opt_f_not_found; | |
| } else | |
| if (option_mask32 & OPT_w) { | |
| - | char c = (match != str) ? match[-1] : ' '; |
| + | char c = (match != line) ? match[-1] : ' '; |
| if (!isalnum(c) && c != '_') { | |
| c = match[strlen(gl->pattern)]; | |
| if (!c || (!isalnum(c) && c != '_')) | |
| @@ -165,6 +165,12 @@ testing "grep -w word doesn't match wordword" \ | |
| "wordword\n" \ | |
| "" | |
| + | testing "grep -F -w w doesn't match ww" \ |
| + | "grep -F -w w input" \ |
| + | "" \ |
| + | "ww\n" \ |
| + | "" |
| + | |
| testing "grep -w word match second word" \ | |
| "grep -w word input" \ | |
| "bword,word\n""wordb,word\n""bwordb,word\n" \ | |