Disabled in early 2010, elicited a warning starting in Jan 2012.
Now, I'm removing it altogether:
From 4de79eb6685c78ac1312bb527539a64dc93c0960 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sat, 11 Jan 2014 12:15:30 -0800
Subject: [PATCH] maint: remove vestiges of support for long-disabled --mmap
option
This option was disabled in March of 2010, and began to elicit a
warning in January of 2012. Its time has come.
* doc/grep.in.1: Remove mention.
* doc/grep.texi: Likewise.
* src/main.c (GROUP_SEPARATOR_OPTION, usage, MMAP_OPTION)
(long_options, main): Remove all traces.
* tests/Makefile.am (check_PROGRAMS): Remove mention of ignore-mmap.
* tests/ignore-mmap: Remove file.
* NEWS (Maintenance): Mention it.
---
NEWS | 5 +++++
doc/grep.in.1 | 19 +------------------
doc/grep.texi | 9 ---------
src/main.c | 12 ++----------
tests/Makefile.am | 1 -
tests/ignore-mmap | 20 --------------------
6 files changed, 8 insertions(+), 58 deletions(-)
delete mode 100755 tests/ignore-mmap
diff --git a/NEWS b/NEWS
index 6e46684..97ee31b 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,11 @@ GNU grep NEWS -*- outline
-*-
grep -i in a multibyte locale is now typically 10 times faster
for patterns that do not contain \ or [.
+** Maintenance
+
+ grep's --mmap option was disabled in March of 2010, and began to
+ elicit a warning in January of 2012. Now it is completely gone.
+
* Noteworthy changes in release 2.16 (2014-01-01) [stable]
diff --git a/doc/grep.in.1 b/doc/grep.in.1
index d91de8c..58a6c0e 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -544,23 +544,6 @@ Follow all symbolic links, unlike
Use line buffering on output.
This can cause a performance penalty.
.TP
-.B \-\^\-mmap
-If possible, use the
-.BR mmap (2)
-system call to read input, instead of
-the default
-.BR read (2)
-system call.
-In some situations,
-.B \-\^\-mmap
-yields better performance.
-However,
-.B \-\^\-mmap
-can cause undefined behavior (including core dumps)
-if an input file shrinks while
-.B grep
-is operating, or if an I/O error occurs.
-.TP
.BR \-U ", " \-\^\-binary
Treat the file(s) as binary.
By default, under \s-1MS-DOS\s0 and \s-1MS\s0-Windows,
@@ -1219,7 +1202,7 @@ Back-references are very slow, and may require
exponential time.
.SS "Regular Manual Pages"
awk(1), cmp(1), diff(1), find(1), gzip(1),
perl(1), sed(1), sort(1), xargs(1), zgrep(1),
-mmap(2), read(2),
+read(2),
pcre(3), pcresyntax(3), pcrepattern(3),
terminfo(5),
glob(7), regex(7).
diff --git a/doc/grep.texi b/doc/grep.texi
index 473a181..e32ab18 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -706,15 +706,6 @@ directory, recursively, following all symbolic links.
Use line buffering on output.
This can cause a performance penalty.
-@item --mmap
-@opindex --mmap
-@cindex memory mapped input
-This option is deprecated and now elicits a warning, but is otherwise a no-op.
-It used to make @command{grep} read
-input with the @code{mmap} system call, instead of the default @code{read}
-system call. On modern systems, @code{mmap} would rarely if ever yield
-better performance.
-
@item -U
@itemx --binary
@opindex -U
diff --git a/src/main.c b/src/main.c
index bfd0982..3f16061 100644
--- a/src/main.c
+++ b/src/main.c
@@ -288,8 +288,7 @@ enum
LINE_BUFFERED_OPTION,
LABEL_OPTION,
EXCLUDE_DIRECTORY_OPTION,
- GROUP_SEPARATOR_OPTION,
- MMAP_OPTION
+ GROUP_SEPARATOR_OPTION
};
/* Long options equivalences. */
@@ -327,8 +326,6 @@ static struct option const long_options[] =
{"line-regexp", no_argument, NULL, 'x'},
{"max-count", required_argument, NULL, 'm'},
- /* FIXME: disabled in Mar 2010; warn towards end of 2011; remove in 2013. */
- {"mmap", no_argument, NULL, MMAP_OPTION},
{"no-filename", no_argument, NULL, 'h'},
{"no-group-separator", no_argument, NULL, GROUP_SEPARATOR_OPTION},
{"no-messages", no_argument, NULL, 's'},
@@ -1572,8 +1569,7 @@ Miscellaneous:\n\
-s, --no-messages suppress error messages\n\
-v, --invert-match select non-matching lines\n\
-V, --version print version information and exit\n\
- --help display this help and exit\n\
- --mmap deprecated no-op; evokes a warning\n"));
+ --help display this help and exit\nn"));
printf (_("\
\n\
Output control:\n\
@@ -2263,10 +2259,6 @@ main (int argc, char **argv)
label = optarg;
break;
- case MMAP_OPTION:
- error (0, 0, _("the --mmap option has been a no-op since 2010"));
- break;
-
case 0:
/* long options */
break;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a37a814..e2967fa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,7 +65,6 @@ TESTS = \
grep-dev-null \
grep-dir \
help-version \
- ignore-mmap \
in-eq-out-infloop \
include-exclude \
inconsistent-range \
diff --git a/tests/ignore-mmap b/tests/ignore-mmap
deleted file mode 100755
index 8c40868..0000000
--- a/tests/ignore-mmap
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# Ensure that --mmap is ignored
-. "${srcdir=.}/init.sh"; path_prepend_ ../src
-
-echo a > in || framework_failure_
-fail=0
-
-echo grep: the --mmap option has been a no-op since 2010 > exp
-
-grep --mmap a in > out 2> err || fail=1
-compare out in || fail=1
-compare exp err || fail=1
-
-grep --mmap b in > out 2>err
-# Expect no match and no output.
-test $? = 1 || fail=1
-compare /dev/null out || fail=1
-compare exp err || fail=1
-
-Exit $fail
--
1.8.5.2.229.g4448466