aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-04-02 11:00:18 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2018-04-02 11:15:44 +0200
commit215c53d3b9617c10abb624b9331c2bdc9e4ddf3a (patch)
tree2b67126bb223f7759edbef61a0c56a8aab1ae6bb /main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch
parentf28c895d95932926ef41fe1c508814dcd6166c14 (diff)
downloadaports-215c53d3b9617c10abb624b9331c2bdc9e4ddf3a.tar.bz2
aports-215c53d3b9617c10abb624b9331c2bdc9e4ddf3a.tar.xz
main/busybox: backport fixes for grep and sed
Diffstat (limited to 'main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch')
-rw-r--r--main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch b/main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch
new file mode 100644
index 0000000000..4e04ba9224
--- /dev/null
+++ b/main/busybox/0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch
@@ -0,0 +1,48 @@
+From 03fd7e06f854d385070a6fc9714f445727c359cd Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Thu, 29 Mar 2018 18:03:50 +0200
+Subject: [PATCH] grep: fix echo "aa" | busybox grep -F -w "a" (should not
+ match)
+
+function old new delta
+grep_file 1461 1470 +9
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ findutils/grep.c | 2 +-
+ testsuite/grep.tests | 6 ++++++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/findutils/grep.c b/findutils/grep.c
+index fc6de4b69..88de0d4ef 100644
+--- a/findutils/grep.c
++++ b/findutils/grep.c
+@@ -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 != '_'))
+diff --git a/testsuite/grep.tests b/testsuite/grep.tests
+index ed4ba455e..d0b0d2767 100755
+--- a/testsuite/grep.tests
++++ b/testsuite/grep.tests
+@@ -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" \
+--
+2.16.3
+