[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] grep: fix --mmap not being ignored
From: |
Jim Meyering |
Subject: |
Re: [PATCH] grep: fix --mmap not being ignored |
Date: |
Tue, 20 Apr 2010 15:07:38 +0200 |
Paolo Bonzini wrote:
> * NEWS: Document bugfix.
> * main.c (main): Ignore MMAP_OPTION.
> ---
> NEWS | 3 +++
> src/main.c | 1 +
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index 1bf9011..1f3d00a 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -16,6 +16,9 @@ GNU grep NEWS -*-
> outline -*-
> slow in other multibyte locales. [bug present since multi-byte
> character set support was introduced in 2.5.2]
>
> + --mmap was meant to be ignored in 2.6.x, but it was instead
> + removed by mistake. [bug introduced in 2.6]
> +
> * Noteworthy changes in release 2.6.3 (2010-04-02) [stable]
>
> ** Bug fixes
> diff --git a/src/main.c b/src/main.c
> index aa3819c..4c7c0e3 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -2069,6 +2069,7 @@ main (int argc, char **argv)
> label = optarg;
> break;
>
> + case MMAP_OPTION:
Please attribute the bug reporter in the future.
I wrote a nearly identical patch, but also added a tiny test.
Here's what's left:
>From 734dcaf837d7ccf675b599c21dfca3d5056b4950 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 20 Apr 2010 12:34:26 +0200
Subject: [PATC] tests: ensure that the --mmap option is ignored
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* tests/ignore-mmap: New file.
* tests/Makefile.am (TESTS): Add it.
Reported by Jaroslav Škarvada in <http://savannah.gnu.org/bugs/?29614>
---
tests/Makefile.am | 1 +
tests/ignore-mmap | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
create mode 100644 tests/ignore-mmap
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fae2c85..c2cc82c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -46,6 +46,7 @@ TESTS = \
fmbtest \
foad1 \
help-version \
+ ignore-mmap \
include-exclude \
khadafy.sh \
max-count-vs-context \
diff --git a/tests/ignore-mmap b/tests/ignore-mmap
new file mode 100644
index 0000000..9fdbf0c
--- /dev/null
+++ b/tests/ignore-mmap
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Ensure that --mmap is ignored
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+echo a > in || framework_failure_
+fail=0
+
+grep --mmap a in > out 2>&1 || fail=1
+compare out in || fail=1
+
+grep --mmap b in > out 2>&1
+# Expect no match and no output.
+test $? = 1 || fail=1
+compare out /dev/null || fail=1
+
+Exit $fail
--
1.7.1.rc1.248.gcefbb