git: grep(1): Upgrade version 2.20 => 2.22

John Marino marino at
Wed Nov 4 04:39:11 PST 2015

commit cf51209a419dfffa3cb40ed1fcbcf3a592df4368
Author: John Marino <draco at>
Date:   Wed Nov 4 12:55:13 2015 +0100

    grep(1): Upgrade version 2.20 => 2.22
    release 2.21 (2014-11-23) [stable]
    ** Improvements
      Performance has been greatly improved for searching files containing
        holes, on platforms where lseek's SEEK_DATA flag works efficiently.
      Performance has improved for rejecting data that cannot match even
        the first part of a nontrivial pattern.
      Performance has improved for very long strings in patterns.
      If a file contains data improperly encoded for the current locale,
        and this is discovered before any of the file's contents are output,
        grep now treats the file as binary.
      grep -P no longer reports an error and exits when given invalid UTF-8
        data. Instead, it considers the data to be non-matching.
    ** Bug fixes
      grep no longer mishandles patterns that contain \w or \W in multibyte
      grep would fail to count newlines internally when operating in non-UTF8
        multibyte locales, leading it to print potentially many lines that did
        not match.  E.g., the command, "seq 10 | env LC_ALL=zh_CN src/grep -n
        .." would print this:
         implying that the match, "10" was on line 1.
         [bug introduced in grep-2.19]
      grep -F -x -o no longer prints an extra newline for each match.
        [bug introduced in grep-2.19]
      grep in a non-UTF8 multibyte locale could mistakenly match in the middle
        of a multibyte character when using a '^'-anchored alternate in a
        pattern, leading it to print non-matching lines.  [bug present since
        "the beginning"]
      grep -F Y no longer fails to match in non-UTF8 multibyte locales like
        Shift-JIS, when the input contains a 2-byte character, XY, followed by
        the single-byte search pattern, Y.  grep would find the first, middle-
        of-multibyte matching "Y", and then mistakenly advance an internal
        pointer one byte too far, skipping over the target "Y" just after
        that. [bug introduced in grep-2.19]
      grep -E rejected unmatched ')', instead of treating it like '\)'.
        [bug present since "the beginning"]
      On NetBSD, grep -r no longer reports "Inappropriate file type or format"
        when refusing to follow a symbolic link.
        [bug introduced in grep-2.12]
    ** Changes in behavior
      The GREP_OPTIONS environment variable is now obsolescent, and grep
        now warns if it is used.  Please use an alias or script instead.
      In locales with multibyte character encodings other than UTF-8,
        grep -P now reports an error and exits instead of misbehaving.
      When searching binary data, grep now may treat non-text bytes as
        line terminators.  This can boost performance significantly.
      grep -z no longer automatically treats the byte '\200' as binary data.
    release 2.22 (2015-11-01) [stable]
    ** Improvements
      Performance has improved for patterns containing very long strings,
        reducing preprocessing time for an N-byte regexp from O(N^2) to
        only slightly superlinear for most patterns.  Before, a command like
        the following would take over a minute, but now, it takes less than
        a second:
        : | grep -f <(seq -s '' 99999)
      When building grep, 'configure' now uses PCRE's pkg-config module for
        configuration information, rather than attempting to guess it by hand.
    ** Bug fixes
      A DFA matcher bug made this command mistakenly print its input line:
          echo axb | grep -E '^x|x$'
        Likewise for this equivalent command:
          echo axb | grep -e '^x' -e 'x$'
        [bug introduced in grep-2.19 ]
      grep no longer reads from uninitialized memory or from beyond the end
        of the heap-allocated input buffer.  This fix addressed CVE-2015-1345.
        [bug introduced in grep-2.19 ]
      With -z, '.' and '[^x]' in a pattern now consistently match newline.
        Previously, they sometimes matched newline, and sometimes did not.
        [bug introduced in grep-2.4]
      When the JIT stack is exhausted, grep -P now grows the stack rather
        than reporting an internal PCRE error.
      'grep -D skip PATTERN FILE' no longer hangs if FILE is a fifo.
        [bug introduced in grep-2.12]
      --exclude and related options are now matched against entire
        command-line arguments, not against command-line components.
        [bug introduced in grep-2.6]
      Fix performance degradation of grep -Fw in unibyte locales.
        [bug introduced in grep-2.19]

Summary of changes:
 contrib/grep/README.DELETED                |   5 +-
 contrib/grep/README.DRAGONFLY              |   8 +-
 gnu/usr.bin/grep/              |   2 +
 gnu/usr.bin/grep/grep/grep.1               | 213 ++++++++---------------------
 gnu/usr.bin/grep/libgreputils/Makefile     |   6 +-
 gnu/usr.bin/grep/libgreputils/alloca.h     |   2 +-
 gnu/usr.bin/grep/libgreputils/config.h     | 127 +++++++++++------
 gnu/usr.bin/grep/libgreputils/configmake.h |   2 +-
 gnu/usr.bin/grep/libgreputils/ctype.h      |   2 +-
 gnu/usr.bin/grep/libgreputils/dirent.h     |   4 +-
 gnu/usr.bin/grep/libgreputils/fcntl.h      |  24 +++-
 gnu/usr.bin/grep/libgreputils/getopt.h     |   2 +-
 gnu/usr.bin/grep/libgreputils/iconv.h      |  10 +-
 gnu/usr.bin/grep/libgreputils/inttypes.h   |   6 +-
 gnu/usr.bin/grep/libgreputils/langinfo.h   |  20 ++-
 gnu/usr.bin/grep/libgreputils/locale.h     |   2 +-
 gnu/usr.bin/grep/libgreputils/stdio.h      |  12 +-
 gnu/usr.bin/grep/libgreputils/stdlib.h     |  29 +++-
 gnu/usr.bin/grep/libgreputils/string.h     |  27 +++-
 gnu/usr.bin/grep/libgreputils/unistd.h     |  41 +++++-
 gnu/usr.bin/grep/libgreputils/unistr.h     |   2 +-
 gnu/usr.bin/grep/libgreputils/unitypes.h   |   2 +-
 gnu/usr.bin/grep/libgreputils/uniwidth.h   |   2 +-
 gnu/usr.bin/grep/libgreputils/wchar.h      |  13 +-
 gnu/usr.bin/grep/libgreputils/wctype.h     |   2 +-
 25 files changed, 315 insertions(+), 250 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list