git: grep: Upgrade from version 2.9 to 2.12

John Marino marino at
Tue May 8 14:57:08 PDT 2012

commit 073c18e488955d8e490953c2263bda1886147517
Author: John Marino <draco at>
Date:   Tue May 8 12:36:23 2012 +0200

    grep: Upgrade from version 2.9 to 2.12
    =====================   Version 2.10 (16 NOV 2011)   =====================
    It's been nearly five months and 80 commits since 2.9, yet few big
    changes in grep proper.  However, there have been many changes in gnulib,
    including a few portability fixes that affect grep.   We inherited 750+
    portability and robustness improvements by using gnulib.
    [Bug fixes]
    * grep no longer mishandles high-bit-set pattern bytes on systems
      where "char" is a signed type. [bug appears to affect only MS-Windows]
    * grep now rejects a command like "grep -r pattern . > out",
      in which the output file is also one of the inputs,
      because it can result in an "infinite" disk-filling loop.
      [bug present since "the beginning"]
      "make dist" no longer builds .tar.gz files.
      xz is portable enough and in wide-enough use that distributing
      only .tar.xz files is enough.
    =====================   Version 2.11 (02 MAR 2012)   =====================
    In just 2.5 months, we've seen more changes than in the five months
    leading up to 2.10, addressing a surprising number of old bugs.
    Special thanks to Paulo Bonzini and Paul Eggert for many fine patches.  We
    inherited 340+ portability and robustness improvements by using gnulib.
    [New features]
    * If no file operand is given, and a command-line -r or equivalent
      option is given, grep now searches the working directory.  Formerly
      grep ignored the -r and searched standard input nonrecursively.
      An -r found in GREP_OPTIONS does not have this new effect.
    * grep now supports color highlighting of matches on MS-Windows.
    [Bug fixes]
    * grep no longer dumps core on lines whose lengths do not fit in 'int'.
      (e.g., lines longer than 2 GiB on a typical 64-bit host).
      Instead, grep either works as expected, or reports an error.
      An error can occur if not enough main memory is available, or if the
      GNU C library's regular expression functions cannot handle such long
      lines. [bug present since "the beginning"]
    * The -m, -A, -B, and -C options no longer mishandle context line
      counts that do not fit in 'int'.  Also, grep -c's counts are now
      limited by the type 'intmax_t' (typically less than 2**63) rather
      than 'int' (typically less than 2**31).
    * grep no longer silently suppresses errors when reading a directory
      as if it were a text file.  For example, "grep x ." now reports a
      read error on most systems; formerly, it ignored the error.
      [bug introduced in grep-2.5]
    * grep now exits with status 2 if a directory loop is found,
      instead of possibly exiting with status 0 or 1.
      [bug introduced in grep-2.3]
    * The -s option now suppresses certain input error diagnostics that it
      formerly failed to suppress.  These include errors when closing the
      input, when lseeking the input, and when the input is also the output.
      [bug introduced in grep-2.4]
    * On POSIX systems, commands like "grep PAT < FILE >> FILE"
      now report an error instead of looping.
      [bug present since "the beginning"]
    * The --include, --exclude, and --exclude-dir options now handle
      command-line arguments more consistently.  --include and --exclude
      apply only to non-directories and --exclude-dir applies only to
      directories.  "-" (standard input) is never excluded, since it is
      not a file name.
      [bug introduced in grep-2.5]
    * grep no longer rejects "grep -qr . > out", i.e., when run with -q
      and an input file is the same as the output file, since with -q
      grep generates no output, so there is no risk of infinite loop or
      of an output-affecting race condition.  Thus, the use of the following
      options also disables the input-equals-output failure:
        --max-count=N (-m) (for N >= 2)
        --files-with-matches (-l)
        --files-without-match (-L)
      [bug introduced in grep-2.10]
    * grep no longer emits an error message and quits on MS-Windows when
      invoked with the -r option.
    * grep no longer misinterprets some alternations involving anchors
      (^, $, \<  \>  \B, \b).  For example, grep -E "(^|\B)a" no
      longer reports a match for the string "x a".
      [bug present since "the beginning"]
    [Changes in behavior]
    * Use of the --mmap option now elicits a warning.  It has been a no-op
      since March of 2010.
    * grep no longer diagnoses write errors repeatedly; it exits after
      diagnosing the first write error.  This is better behavior when
      writing to a dangling pipe.
    * Syntax errors in GREP_COLORS are now ignored, instead of sometimes
      eliciting warnings.  This is more consistent with programs that
      (e.g.) ignore errors in termcap entries.
    =====================   Version 2.12 (23 APR 2012)   =====================
    There have been 22 commits by 3 people in the 7 weeks since 2.11.
    In spite of the relatively small number of commits, this is a
    significant delta, with two regression fixes, Paul's conversion,
    from grep's crufty old dir-traversal code to the use of gnulib's fts
    and the change to how -r (--recursive) works.
    [Bug fixes]
    * "echo P|grep --devices=skip P" once again prints P, as it did in 2.10
      [bug introduced in grep-2.11]
    * grep no longer segfaults with -r --exclude-dir and no file operand.
      I.e., ":|grep -r --exclude-dir=D PAT" would segfault.
      [bug introduced in grep-2.11]
    * Recursive grep now uses fts for directory traversal, so it can
      handle much-larger directories without reporting things like "File
      name too long", and it can run much faster when dealing with large
      directory hierarchies. [bug present since the beginning]
    * grep -E 'a{1000000000}' now reports an overflow error rather than
      silently acting like grep -E 'a\{1000000000}'.
    [New features]
    * The -R option now has a long-option alias --dereference-recursive.
    [Changes in behavior]
    * The -r (--recursive) option now follows only command-line symlinks.
      Also, by default -r now reads a device only if it is named on the
      command line; this can be overridden with --devices.  -R acts as
      before, so use -R if you prefer the old behavior of following all
      symlinks and defaulting to reading all devices.

Summary of changes:
 contrib/grep/README.DELETED                        |    3 +
 contrib/grep/README.DRAGONFLY                      |   13 +-
 gnu/usr.bin/grep/grep/grep.1                       |   26 +-
 gnu/usr.bin/grep/libgreputils/Makefile             |   73 ++--
 gnu/usr.bin/grep/libgreputils/alloca.h             |   10 +-
 gnu/usr.bin/grep/libgreputils/config.h             |  520 +++++++++++++++++---
 .../libdiffutils => grep/libgreputils}/fcntl.h     |   18 +-
 gnu/usr.bin/grep/libgreputils/getopt.h             |   54 +-
 gnu/usr.bin/grep/libgreputils/unistr.h             |  178 +++++---
 gnu/usr.bin/grep/libgreputils/unitypes.h           |   26 +-
 gnu/usr.bin/grep/libgreputils/uniwidth.h           |   25 +-
 11 files changed, 698 insertions(+), 248 deletions(-)
 copy gnu/usr.bin/{diff/libdiffutils => grep/libgreputils}/fcntl.h (97%)

DragonFly BSD source repository

More information about the Commits mailing list