--- grep-2.5.3~dfsg.orig/grep-2.5.3.tar.gz.cdbs-config_list +++ grep-2.5.3~dfsg/grep-2.5.3.tar.gz.cdbs-config_list @@ -0,0 +1,4 @@ +grep-2.5.3/intl/config.charset +grep-2.5.3/config.guess +grep-2.5.3/config.hin +grep-2.5.3/config.sub --- grep-2.5.3~dfsg.orig/debian/install +++ grep-2.5.3~dfsg/debian/install @@ -0,0 +1 @@ +debian/rgrep usr/bin --- grep-2.5.3~dfsg.orig/debian/changelog +++ grep-2.5.3~dfsg/debian/changelog @@ -0,0 +1,497 @@ +grep (2.5.3~dfsg-5ubuntu2) intrepid; urgency=low + + * debian/rules: Configure with --without-included-regex, so that the + broken configure test does not erroneously think that our glibc doesn't + support regexes. (It fails to use _GNU_SOURCE in configure). The internal + one is broken and e. g. does not work with "grep -i". Thanks to + Jean-Baptiste Lallement for tracking this down! (LP: #241990) + + -- Martin Pitt Thu, 17 Jul 2008 10:43:28 +0100 + +grep (2.5.3~dfsg-5ubuntu1) intrepid; urgency=low + + * debian/rules, debian/control: Enable perl-regexp (-P) (LP: #15051, + Debian #238237) + + -- Daniel Hahler Wed, 18 Jun 2008 10:34:11 +0000 + +grep (2.5.3~dfsg-5) unstable; urgency=low + + * Removed 56-recursive-default.patch, refer to #414168. + Closes: #467625 + + -- Anibal Monsalve Salazar Fri, 29 Feb 2008 08:58:31 +1100 + +grep (2.5.3~dfsg-4) unstable; urgency=low + + * rgrep: Make . the default when no file or directory names given. + Thanks to Magnus Holmgren (Closes: 414168) + * grep.1: using \(aq instead of '. Thanks to Andrew Moise + . (Closes: #226881) + * egrep: using calloc() instead of malloc() + Thanks to Johan Walles (Closes: #450649) + * Updated watch file. + * Bump Standard-version to 3.7.3. (No changes needed) + + -- Santiago Ruano Rincón Sat, 16 Feb 2008 20:43:55 +0100 + +grep (2.5.3~dfsg-3) unstable; urgency=high + + * Acknowledge NMU. Closes: #181378, #442882, #439931, #368575, + #350206, #432636, #441006, #444164, #429435 + * debian/control: added homepage + + -- Anibal Monsalve Salazar Thu, 04 Oct 2007 21:01:16 +1000 + +grep (2.5.3~dfsg-2.1) unstable; urgency=high + + * Non-maintainer upload. + * Reinstate patches by Nicolas François + Closes: #181378, #442882 + + -- Thomas Viehmann Tue, 02 Oct 2007 23:02:35 +0200 + +grep (2.5.3~dfsg-2) unstable; urgency=low + + * Removed 65-dfa-optional.patch. (Closes: #439827, #440195, #440342) + + -- Santiago Ruano Rincón Thu, 06 Sep 2007 00:16:20 -0500 + +grep (2.5.3~dfsg-1) unstable; urgency=low + + * New upstream version (Closes: #433705). Fixes: + - grep --color '^a' colors too much (^a*) (Closes: #294367) + - { echo foo; echo bar; } |grep -o ^. matches every letter + (Closes: #406259) + - grep -A1 -m1 segfaults with multiple line matches (Closes: #411097) + - -o does not work correctly with quantifications (Closes: #293267) + - fgrep -w in 2.5.1 fails when wanted subset follows a superset string + (Closes: #195922) + * Updated copyright to GPLv3 + * Removed postinst and prerm. They register and deregister grep.info + which is not shipped (Closes: #336240). + * Removed debian/info (Closes: #362184, #407768). + + -- Santiago Ruano Rincón Sat, 25 Aug 2007 11:11:01 -0500 + +grep (2.5.1.ds2-6) unstable; urgency=low + + * Added watch file. (Closes: #248733) + * grep didn't work with FIFOs, thanks to Bastian Kleineidam + (Closes: #198846) + + -- Santiago Ruano Rincón Tue, 10 Oct 2006 00:41:50 -0500 + +grep (2.5.1.ds2-5) unstable; urgency=low + + * Fixed "fgrep : troubles with -w option", closes: #350775. + Patch thanks to Nicolas François . + * Set Standards-Version to 3.7.2. + * Changed co-maontainer's email address. + + -- Anibal Monsalve Salazar Thu, 18 May 2006 21:40:49 +1000 + +grep (2.5.1.ds2-4) unstable; urgency=low + + * Compiled with -O3 (Closes: #322416) + grep is 40 times slower on native amd64 than in a 32bit chroot + * Again, configure without-libpcre + + -- Santiago Ruano Rincon Wed, 9 Nov 2005 17:50:00 -0500 + +grep (2.5.1.ds2-3) unstable; urgency=low + + * Compiled with libpcre3 to enable perl regular expressions. + Closes: #203109: perl mode non-functional, should not be documented + Closes: #238237: -P option doesn't work. + * Closes: #190551: br0ken manpage: Uses 'Egrep' instead of 'egrep'. + Thanks to Marc Brockschmidt + + -- Santiago Ruano Rincon Mon, 7 Nov 2005 03:40:13 -0500 + +grep (2.5.1.ds2-2) unstable; urgency=low + + * Patched 64-egf-speedup.patch with patch from Nicolas François + . Put 64-egf-speedup.patch, + 65-dfa-optional.patch, 66-match_icase.patch and 67-w.patch back + in, closes: #181378, #206470, #224993. + * Fixed "minor documentation syntax error", closes: #240239, + #257900. Patches by Allard Hoeve and Derrick + 'dman' Hudson . + * Fixed "info page not in main info menu", closes: #284676, + #267718. Patches by Rui Tiago Cação Matos + and Paul Brook . + + -- Anibal Monsalve Salazar Wed, 26 Oct 2005 19:14:35 +1000 + +grep (2.5.1.ds2-1) unstable; urgency=low + + * Removed 64-egf-speedup.patch, 65-dfa-optional.patch, + 66-match_icase.patch and 67-w.patch from debian/patches, + closes: #329876. + * Removed grep.texi from upstream tarball, 50-rgrep-info.patch and + 51-dircategory-info.patch from debian/patches, the GNU Free + Documentation License from debian/copyright and debian/fdl.txt, + closes: #281647. + * Fixed FSF postal address in debian/copyright. + * Fixed override disparity found in suite unstable: + grep: override says utils-required, .deb says base-required. + + -- Anibal Monsalve Salazar Mon, 26 Sep 2005 22:17:50 +1000 + +grep (2.5.1.ds1-6) unstable; urgency=low + + * 64-egf-speedup.patch, 65-dfa-optional.patch, 66-match_icase.patch, + 67-w.patch speed up grep. Thanks to Nicolas François + (Closes: #181378, #206470, #224993) + * Deleted the CVS directories + + -- Santiago Ruano Rincon Sat, 10 Sep 2005 01:52:04 -0500 + +grep (2.5.1.ds1-5) unstable; urgency=low + + * New maintainer, closes: #316380. + * Updated standards version to 3.6.2. + + -- Anibal Monsalve Salazar Fri, 01 Jul 2005 08:29:42 +1000 + +grep (2.5.1.ds1-4) unstable; urgency=high + + * Add missing GFDL copyright statements (Closes: #274352) + * Acknowledge NMU (Closes #249245, #274352, #276209, #276202) + + -- Ryan M. Golbeck Sun, 21 Nov 2004 02:02:02 -0500 + +grep (2.5.1.ds1-3.2) unstable; urgency=low + + * NMU to fix RC bugs + * 61-dfa.c-case_fold-charclass.patch: new patch by Fumitoshi UKAI + to fix case_fold match with characters in bracket in multibyte + locales (UTF-8, CJK, ...) + closes: Bug#249245 + * 62-dfa.c-charclass-bracket.patch: new patch by Fumitoshi UKAI + to fix wrong match '[' against character class such as [[:space:]] + in multibyte locales (UTF-8, ...) + closes: Bug#274352 + * 63-dfa.c-case_fold-range.patch: new patch by Fumitoshi UKAI + to fix case_fold match on [a-z] or [A-Z] in multibyte locales (UTF-8,.) + closes: Bug#276209 + + -- Fumitoshi UKAI Wed, 20 Oct 2004 02:19:35 +0900 + +grep (2.5.1.ds1-3.1) unstable; urgency=low + + * NMU to fix RC bug + * 60-dfa.c-case_fold.patch: new patch by Fumitoshi UKAI + to fix case_fold match on [:upper:] and [:lower:] in + multibyte locales (UTF-8, CJK, ...) + closes: Bug#276202 + + -- Fumitoshi UKAI Tue, 19 Oct 2004 02:07:07 +0900 + +grep (2.5.1.ds1-3) unstable; urgency=high + + * configure without-libpcre (Closes: #237071) + + -- Ryan M. Golbeck Tue, 03 Aug 2004 21:51:44 -0400 + +grep (2.5.1.ds1-2) unstable; urgency=low + + * Fixed pre-depends (Closes: #222655) + + -- Ryan M. Golbeck Sun, 07 Dec 2003 18:09:00 -0400 + +grep (2.5.1.ds1-1) unstable; urgency=low + + * Fixed manpage typo (Closes: #207703) + + * Makefile.in info patch (Closes: #218969) + - Thanks Andreas Metzler + + * Fixed misspelled month in changelog. + + -- Ryan M. Golbeck Tue, 18 Nov 2003 01:02:03 -0400 + +grep (2.5.1-7) unstable; urgency=low + + * Jeff Bailey : + - Converted to cdbs + + -- Jeff Bailey Tue, 19 Aug 2003 01:07:31 -0400 + +grep (2.5.1-6) unstable; urgency=low + + * Consolidated manpage patches + + Fixed line-buffering typo (Closes: #198947) + + Re-ordered options, perl regexp note (Closes: #203109) + + * Applied patch for bigfiles w/o newlines (Closes: #185208) + - Thanks Jim Meyering + + -- Ryan M. Golbeck Sun, 17 Aug 2003 00:10:00 -0500 + +grep (2.5.1-5) unstable; urgency=low + + * applied i18n patch for LSB test suite (Closes: #184884) + * fixed misspelling in manpage (Closes: #187477) + + -- Ryan M. Golbeck Sat, 29 Mar 2003 00:10:00 -0500 + +grep (2.5.1-4) unstable; urgency=low + + * New Maintainer (thanks Robert and Clint) + * New uploader: Jeff Bailey + * Converted to CBS. + + * Added rgrep documentation to manpage and info doc. + * Cleaned up copyright file. + * Added #!/bin/sh to rgrep. + * Added dircategory to grep.texi + + -- Ryan M. Golbeck Mon, 17 Feb 2003 00:10:00 -0500 + +grep (2.5.1-3) unstable; urgency=medium + + * Document -z in the manpage. closes: #183277. + + -- Clint Adams Mon, 10 Mar 2003 02:10:32 -0500 + +grep (2.5.1-2) unstable; urgency=low + + * Call install with INSTALL_PROGRAM, not initial make. + + -- Clint Adams Sun, 16 Feb 2003 00:07:50 -0500 + +grep (2.5.1-1) unstable; urgency=low + + * Hijack. + * Update config.{guess,sub}. closes: #174898, #179702. + * New upstream version. closes: #152204. + * Update to Standards-Version 3.5.8. + * Support noopt and nostrip DEB_BUILD_OPTIONS. + * Add texinfo to Build-Depends. + + -- Clint Adams Thu, 13 Feb 2003 18:49:35 -0500 + +grep (2.4.2-3.1) unstable; urgency=low + + * NMU + * doc/grep.1: + - re-word description of exit codes. (Closes: #158134) + - apply rgrep patch--thanks, Martin Michlmayr! (Closes: #127438) + * doc/grep.info: + - fix missing colon in character class example (Closes: #173882) + * debian/rules: + - put only grep in /bin, fgrep and egrep in /usr/bin. (Closes: #93193) + - clean up po/*.gmo so that it is possible to rebuild without + dpkg-source aborting with "unrepresentable changes to binary files" + errors. (Closes: #142206) + - apply patch to remove bashisms (Closes: #172524) + * debian/control: add more descriptive paragraph to description + (Closes: #45943) + * debian/copyright: changed to reflect current maintainer. + (Closes: #156479) + * debian/postinst: no longer need to set /usr/doc link. + + -- Hwei Sheng Teoh Tue, 10 Dec 2002 08:46:16 -0500 + +grep (2.4.2-3) frozen unstable; urgency=low + + * Updated dutch translation (Closes: #111313) + * Fixed documentation (Closes: #69083, #71305) + * Fixed hurd build failure (Closes: #105435) + + -- Robert van der Meulen Wed, 28 Nov 2001 17:32:08 +0100 + +grep (2.4.2-2) frozen unstable; urgency=low + + * New maintainer + * Replaced config.sub and config.guess for newer ones. (Closes: #98034) + * Fixed french language bug. (Closes: #95349) + + -- Robert van der Meulen Mon, 25 Jun 2001 14:31:38 +0200 + +grep (2.4.2-1) frozen unstable; urgency=low + + * New upstream release. This is only a translation-update and bugfix + release, there is no new code (besides the bugfixes that is) + * Fix location of GPL (lintian) + * add -isp option to dpkg-gencontrol (lintian) + + -- Wichert Akkerman Sun, 2 Apr 2000 17:57:56 +0200 + +grep (2.4-2) frozen unstable; urgency=low + + * Fix grep-call in rgrep, Closes: Bug# 52751 + + -- Wichert Akkerman Sat, 22 Jan 2000 15:06:01 +0100 + +grep (2.4-1) unstable; urgency=low + + * New upstream version + + -- Wichert Akkerman Wed, 8 Dec 1999 02:05:48 +0100 + +grep (2.3-8) unstable; urgency=low + + * Add a rgrep-script and add Conflicts and Provides for it + * Bump standards-version to 3.1.0 + + -- Wichert Akkerman Tue, 23 Nov 1999 22:12:18 +0100 + +grep (2.3-7) unstable; urgency=low + + * Use different approach to get things in /usr/share + + -- Wichert Akkerman Tue, 5 Oct 1999 18:48:54 +0200 + +grep (2.3-6) unstable; urgency=low + + * Set datadir to /usr/share, Closes: Bug# 46632 + + -- Wichert Akkerman Tue, 5 Oct 1999 04:08:09 +0200 + +grep (2.3-5) unstable; urgency=low + + * Change "Debian/GNU Linux" to "Debian GNU/Linux" in copyright + * Change to FHS 2.1(pre2) + * No longer generate md5sums + + -- Wichert Akkerman Wed, 8 Sep 1999 02:16:55 +0200 + +grep (2.3-4) unstable; urgency=low + + * Remove debian/files and debian/substvars on clean (Bug# 38620) + + -- Wichert Akkerman Mon, 31 May 1999 13:31:59 +0200 + +grep (2.3-3) unstable; urgency=low + + * Don't clobber NEWS with ChangeLog (Bug# 33917) + * Register info-documentation with install-info (Bug# 33917) + * Generally try to preserve timestamps + * Upgrade standards-version to 2.5.1 + + -- Wichert Akkerman Wed, 26 May 1999 00:36:51 +0200 + +grep (2.3-2) unstable; urgency=low + + * Make egrep and grep seperate binaries again, since they don't check + argv[0] anymore + + -- Wichert Akkerman Thu, 25 Feb 1999 02:59:21 +0100 + +grep (2.3-1) unstable; urgency=low + + * New upstream version + + -- Wichert Akkerman Tue, 23 Feb 1999 02:16:01 +0100 + +grep (2.2-1) unstable; urgency=low + + * New upstream version + + -- Wichert Akkerman Mon, 27 Apr 1998 12:13:04 +0200 + +grep (2.1-7) frozen unstable; urgency=high + + * Fix wrong patch for Bug# 20284. Note to self: don't trust + received patches! (Bug# 20573, 20592, 20541) + + -- Wichert Akkerman Fri, 3 Apr 1998 12:05:42 +0200 + +grep (2.1-6) frozen unstable; urgency=low + + * Complain about non-existant files (Bug# 20283) + * Return with errorcode 2 when file cannot be opened (Bug# 20284) + * Fixed syntax error in manpage (Bug# 20509) + * Changed manpage: a pattern is a legal parameter (Bug# 20509) + + -- Wichert Akkerman Wed, 1 Apr 1998 14:07:00 +0200 + +grep (2.1-5) unstable; urgency=low + + * Fixed type in description (Bug# 18945) + * Now standards-version 2.4.0.0 + * Re-instate [ef]grep.1 since some man-programs seem to + need them BBug# 16445) + * GPL is not compressed (lintian) + + -- Wichert Akkerman Sun, 15 Mar 1998 23:19:37 +0100 + +grep (2.1-4) unstable; urgency=low + + * Hardlink [ef]grep to grep binary again + + -- Wichert Akkerman Mon, 29 Dec 1997 02:06:26 +0100 + +grep (2.1-3) unstable; urgency=low + + * Fixed incorrect md5sums + + -- Wichert Akkerman Tue, 16 Dec 1997 17:17:57 +0100 + +grep (2.1-2) unstable; urgency=low + + * Fix redundant manpages (Bug# 14570) + + -- Wichert Akkerman Fri, 7 Nov 1997 18:03:39 +0100 + +grep (2.1-1) unstable; urgency=low + + * New upstream version (Bug# 14219) + * Fixed spelling error in copyright + * Fixed compilation flags to comply with policy + * Pristine sources + + -- Wichert Akkerman Thu, 25 Sep 1997 12:19:59 +0200 + +grep (2.0-12) unstable; urgency=low + + * Rename upstream change to changelog + * Added md5sums to .deb file + + -- Wichert Akkerman Mon, 14 Jul 1997 01:17:15 +0200 + +grep (2.0-11) unstable; urgency=low + + * Removed symlinks for egrep.1 and fgrep.1 (Bug# 7814) + + -- Wichert Akkerman Tue, 11 Mar 1997 00:20:25 +0100 + +grep (2.0-10) unstable; urgency=low + + * Now conforms to policy manual version 2.1.2.2 + * Fixed typo in debian/rules (Bug# 7665) + + -- Wichert Akkerman Thu, 27 Feb 1997 02:01:53 +0100 + +grep (2.0-9) frozen unstable; urgency=low + + * Corrected priority in debian controlfile. + + -- Wichert Akkerman Tue, 12 Nov 1996 23:36:10 +0100 + +grep (2.0-8) stable; urgency=low + + * Made copyright a symlink to /usr/doc/copyright/GPL + * Compress man-pages + * Renamed debian changelog to changelog.Debian + + -- Wichert Akkerman Sat, 26 Oct 1996 18:43:57 +0200 + +grep (2.0-7) stable unstable; urgency=low + + * Moved to new packaging format + + -- Wichert Akkerman Sat, 21 Sep 1996 17:24:52 +0200 + +grep (2.0-6); priority=LOW + + * Revamped debian files + * Disable mmap-code since mmap does not work on files from the + proc-filesystem. (Temporary fix, still looking for a better + solution). + * new maintainer: Wichert Akkerman + + -- Wichert Akkerman ,Mon Jul 29 18:38:06 MET DST 1996 --- grep-2.5.3~dfsg.orig/debian/preinst +++ grep-2.5.3~dfsg/debian/preinst @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +dpkg --assert-support-predepends + +#DEBHELPER# --- grep-2.5.3~dfsg.orig/debian/compat +++ grep-2.5.3~dfsg/debian/compat @@ -0,0 +1 @@ +4 --- grep-2.5.3~dfsg.orig/debian/watch +++ grep-2.5.3~dfsg/debian/watch @@ -0,0 +1,3 @@ +version=2 +opts=dversionmangle=s/\~dfsg// \ + http://ftp.gnu.org/gnu/grep/grep-(.*)\.tar\.gz --- grep-2.5.3~dfsg.orig/debian/rules +++ grep-2.5.3~dfsg/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +DEB_TAR_SRCDIR=grep-2.5.3 +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/tarball.mk + +DEB_MAKE_CHECK_TARGET = +#DEB_MAKE_CHECK_TARGET = check + +DEB_CONFIGURE_EXTRA_FLAGS := CFLAGS=-O3 --exec-prefix=/ --without-included-regex --- grep-2.5.3~dfsg.orig/debian/links +++ grep-2.5.3~dfsg/debian/links @@ -0,0 +1 @@ +usr/share/man/man1/grep.1.gz usr/share/man/man1/rgrep.1.gz --- grep-2.5.3~dfsg.orig/debian/rgrep +++ grep-2.5.3~dfsg/debian/rgrep @@ -0,0 +1,4 @@ +#!/bin/sh + +exec grep -r "$@" + --- grep-2.5.3~dfsg.orig/debian/control +++ grep-2.5.3~dfsg/debian/control @@ -0,0 +1,29 @@ +Source: grep +Section: utils +Priority: required +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Anibal Monsalve Salazar +Uploaders: Santiago Ruano Rincón +Standards-Version: 3.7.3 +Build-Depends: gettext, cdbs (>= 0.4.5.3), debhelper (>= 4.1.0), libpcre3-dev (>= 7.6-2ubuntu1) +Homepage: http://www.gnu.org/software/grep/ + +Package: grep +Architecture: any +Essential: yes +Pre-Depends: ${shlibs:Depends} +Conflicts: rgrep +Provides: rgrep +Description: GNU grep, egrep and fgrep + 'grep' is a utility to search for text in files; it can be used from the + command line or in scripts. Even if you don't want to use it, other packages + on your system probably will. + . + The GNU family of grep utilities may be the "fastest grep in the west". + GNU grep is based on a fast lazy-state deterministic matcher (about + twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper + search for a fixed string that eliminates impossible text from being + considered by the full regexp matcher without necessarily having to + look at every character. The result is typically many times faster + than Unix grep or egrep. (Regular expressions containing backreferencing + will run more slowly, however.) --- grep-2.5.3~dfsg.orig/debian/copyright +++ grep-2.5.3~dfsg/debian/copyright @@ -0,0 +1,33 @@ +This is the Debian GNU/Linux prepackaged version of the grep program. +Currently Anibal Monsalve Salazar maintains the +Debian GNU/Linux version of grep. + +Robert van der Meulen and +Ryan M. Golbeck +were the previous maintainers. + +This package was created from the grep sources as found on the GNU +mirrors. grep.texi file was removed since it is not DFSG compliant + +Grep is copyrighted as described below: + + Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2004, + 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. + +On a Debian system you can find a copy of this license in +/usr/share/common-licenses/GPL. --- grep-2.5.3~dfsg.orig/debian/dirs +++ grep-2.5.3~dfsg/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share +bin --- grep-2.5.3~dfsg.orig/debian/patches/65-dfa-optional.patch +++ grep-2.5.3~dfsg/debian/patches/65-dfa-optional.patch @@ -0,0 +1,73 @@ +The DFA algorithm is slow with mutlibytes characters. +This patch disables the DFA algorithm, but it can be re-enabled by setting +the GREP_USE_DFA environment variable. + +This patch requires 64-egf-speedup.patch +--- src/search.c.orig 2005-09-06 22:22:17.000000000 +0200 ++++ src/search.c 2005-09-06 22:25:41.000000000 +0200 +@@ -326,6 +326,8 @@ + char eol = eolbyte; + int backref, start, len; + struct kwsmatch kwsm; ++ static int use_dfa; ++ static int use_dfa_checked = 0; + size_t i, ret_val; + #ifdef MBS_SUPPORT + int mb_cur_max = MB_CUR_MAX; +@@ -333,6 +335,26 @@ + memset (&mbs, '\0', sizeof (mbstate_t)); + #endif /* MBS_SUPPORT */ + ++ if (!use_dfa_checked) ++ { ++ char *grep_use_dfa = getenv ("GREP_USE_DFA"); ++ if (!grep_use_dfa) ++ { ++#ifdef MBS_SUPPORT ++ /* Turn off DFA when processing multibyte input. */ ++ use_dfa = (MB_CUR_MAX == 1); ++#else ++ use_dfa = 1; ++#endif /* MBS_SUPPORT */ ++ } ++ else ++ { ++ use_dfa = atoi (grep_use_dfa); ++ } ++ ++ use_dfa_checked = 1; ++ } ++ + buflim = buf + size; + + for (beg = end = buf; end < buflim; beg = end) +@@ -400,7 +422,8 @@ + #endif /* MBS_SUPPORT */ + (kwsm.index < kwset_exact_matches)) + goto success; +- if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) ++ if (use_dfa && ++ dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) + continue; + } + else +@@ -409,7 +432,9 @@ + #ifdef MBS_SUPPORT + size_t bytes_left = 0; + #endif /* MBS_SUPPORT */ +- size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref); ++ size_t offset = 0; ++ if (use_dfa) ++ offset = dfaexec (&dfa, beg, buflim - beg, &backref); + if (offset == (size_t) -1) + break; + /* Narrow down to the line we've found. */ +@@ -451,7 +476,7 @@ + --beg; + } + /* Successful, no backreferences encountered! */ +- if (!backref) ++ if (use_dfa && !backref) + goto success; + } + else --- grep-2.5.3~dfsg.orig/debian/patches/61-dfa.c-case_fold-charclass.patch +++ grep-2.5.3~dfsg/debian/patches/61-dfa.c-case_fold-charclass.patch @@ -0,0 +1,29 @@ +fix the following problem in multibyte locales. + % echo Y | egrep -i '[y]' + % + +derived from gawk's dfa.c. + +--- ./src/dfa.c.orig 2004-10-20 02:04:52.000000000 +0900 ++++ ./src/dfa.c 2004-10-20 02:07:01.000000000 +0900 +@@ -652,6 +652,20 @@ + REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, + work_mbc->nchars + 1); + work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc; ++ if (case_fold && (iswlower((wint_t) wc) || iswupper((wint_t) wc))) ++ { ++ wint_t altcase; ++ ++ altcase = wc; /* keeps compiler happy */ ++ if (iswlower((wint_t) wc)) ++ altcase = towupper((wint_t) wc); ++ else if (iswupper((wint_t) wc)) ++ altcase = towlower((wint_t) wc); ++ ++ REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, ++ work_mbc->nchars + 1); ++ work_mbc->chars[work_mbc->nchars++] = (wchar_t) altcase; ++ } + } + } + while ((wc = wc1) != L']'); --- grep-2.5.3~dfsg.orig/debian/patches/67-w.patch +++ grep-2.5.3~dfsg/debian/patches/67-w.patch @@ -0,0 +1,118 @@ +reverted: +--- src/search.c 2007-10-01 14:47:55.000000000 +0200 ++++ src/search.c 2007-09-30 23:38:45.000000000 +0200 +@@ -282,6 +284,7 @@ + static int use_dfa_checked = 0; + size_t i, ret_val; + #ifdef MBS_SUPPORT ++ const char *last_char = NULL; + int mb_cur_max = MB_CUR_MAX; + mbstate_t mbs; + memset (&mbs, '\0', sizeof (mbstate_t)); +@@ -338,6 +341,8 @@ + while (bytes_left) + { + size_t mlen = mbrlen (beg, bytes_left, &mbs); ++ ++ last_char = beg; + if (mlen == (size_t) -1 || mlen == 0) + { + /* Incomplete character: treat as single-byte. */ +@@ -398,6 +403,8 @@ + while (bytes_left) + { + size_t mlen = mbrlen (beg, bytes_left, &mbs); ++ ++ last_char = beg; + if (mlen == (size_t) -1 || mlen == 0) + { + /* Incomplete character: treat as single-byte. */ +@@ -475,10 +483,84 @@ + if (match_words) + while (match <= best_match) + { ++ int lword_match = 0; ++ if (match == buf) ++ lword_match = 1; ++ else ++ { ++ assert (start > 0); ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1) ++ { ++ const char *s; ++ int mr; ++ wchar_t pwc; ++ if (using_utf8) ++ { ++ s = match - 1; ++ while (s > buf ++ && (unsigned char) *s >= 0x80 ++ && (unsigned char) *s <= 0xbf) ++ --s; ++ } ++ else ++ s = last_char; ++ mr = mbtowc (&pwc, s, match - s); ++ if (mr <= 0) ++ { ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ lword_match = 1; ++ } ++ else if (!(iswalnum (pwc) || pwc == L'_') ++ && mr == (int) (match - s)) ++ lword_match = 1; ++ } ++ else ++#endif /* MBS_SUPPORT */ ++ if (!WCHAR ((unsigned char) match[-1])) ++ lword_match = 1; ++ } ++ ++ if (lword_match) ++ { ++ int rword_match = 0; ++ if (start + len == end - beg - 1) ++ rword_match = 1; ++ else ++ { ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1) ++ { ++ wchar_t nwc; ++ int mr; ++ ++ mr = mbtowc (&nwc, buf + start + len, ++ end - buf - start - len - 1); ++ if (mr <= 0) ++ { ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ rword_match = 1; ++ } ++ else if (!iswalnum (nwc) && nwc != L'_') ++ rword_match = 1; ++ } ++ else ++#endif /* MBS_SUPPORT */ ++ if (!WCHAR ((unsigned char) match[len])) ++ rword_match = 1; ++ } ++ ++ if (rword_match) ++ { ++ if (!start_ptr) ++ /* Returns the whole line. */ ++ goto success; ++ else ++ { ++ goto assess_pattern_match; ++ } ++ } ++ } +- if ((match == buf || !WCHAR ((unsigned char) match[-1])) +- && (len == end - beg - 1 +- || !WCHAR ((unsigned char) match[len]))) +- goto assess_pattern_match; + if (len > 0) + { + /* Try a shorter length anchored at the same place. */ --- grep-2.5.3~dfsg.orig/debian/patches/68-no-grep.texi.patch +++ grep-2.5.3~dfsg/debian/patches/68-no-grep.texi.patch @@ -0,0 +1,101 @@ +diff -urN doc.orig/grep.1 doc/grep.1 +--- doc.orig/grep.1 2007-08-25 12:59:52.000000000 -0500 ++++ doc/grep.1 2007-08-25 13:00:25.000000000 -0500 +@@ -1218,20 +1218,6 @@ + glob(7), regex(7). + .SS "\s-1POSIX\s0 Programmer's Manual Page" + grep(1p). +-.SS "\*(Txinfo Documentation" +-The full documentation for +-.B grep +-is maintained as a \*(Txinfo manual. +-If the +-.B info +-and +-.B grep +-programs are properly installed at your site, the command +-.IP +-.B info grep +-.PP +-should give you access to the complete manual. +-. + .SH NOTES + \s-1GNU\s0's not Unix, but Unix is a beast; + its plural form is Unixen. +diff -urN doc.orig/Makefile.in doc/Makefile.in +--- doc.orig/Makefile.in 2007-08-24 23:58:09.000000000 -0500 ++++ doc/Makefile.in 2007-08-25 00:09:13.000000000 -0500 +@@ -58,13 +58,13 @@ + am__depfiles_maybe = + SOURCES = + DIST_SOURCES = +-INFO_DEPS = $(srcdir)/grep.info ++#INFO_DEPS = $(srcdir)/grep.info + am__TEXINFO_TEX_DIR = $(srcdir) + DVIS = grep.dvi + PDFS = grep.pdf + PSS = grep.ps + HTMLS = grep.html +-TEXINFOS = grep.texi ++#TEXINFOS = grep.texi + TEXI2DVI = texi2dvi + TEXI2PDF = $(TEXI2DVI) --pdf --batch + MAKEINFOHTML = $(MAKEINFO) --html +@@ -200,14 +200,14 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = no-dependencies +-info_TEXINFOS = grep.texi ++#info_TEXINFOS = grep.texi + man_MANS = grep.1 fgrep.1 egrep.1 + EXTRA_DIST = grep.1 egrep.man fgrep.man + CLEANFILES = egrep.1 fgrep.1 + all: all-am + + .SUFFIXES: +-.SUFFIXES: .dvi .html .info .pdf .ps .texi ++.SUFFIXES: .dvi .html .info .pdf .ps + $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ +@@ -283,23 +283,23 @@ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +-$(srcdir)/grep.info: grep.texi $(srcdir)/version.texi +-grep.dvi: grep.texi $(srcdir)/version.texi +-grep.pdf: grep.texi $(srcdir)/version.texi +-grep.html: grep.texi $(srcdir)/version.texi +-$(srcdir)/version.texi: $(srcdir)/stamp-vti +-$(srcdir)/stamp-vti: grep.texi $(top_srcdir)/configure +- @(dir=.; test -f ./grep.texi || dir=$(srcdir); \ +- set `$(SHELL) $(srcdir)/mdate-sh $$dir/grep.texi`; \ +- echo "@set UPDATED $$1 $$2 $$3"; \ +- echo "@set UPDATED-MONTH $$2 $$3"; \ +- echo "@set EDITION $(VERSION)"; \ +- echo "@set VERSION $(VERSION)") > vti.tmp +- @cmp -s vti.tmp $(srcdir)/version.texi \ +- || (echo "Updating $(srcdir)/version.texi"; \ +- cp vti.tmp $(srcdir)/version.texi) +- -@rm -f vti.tmp +- @cp $(srcdir)/version.texi $@ ++#$(srcdir)/grep.info: grep.texi $(srcdir)/version.texi ++#grep.dvi: grep.texi $(srcdir)/version.texi ++#grep.pdf: grep.texi $(srcdir)/version.texi ++#grep.html: grep.texi $(srcdir)/version.texi ++#$(srcdir)/version.texi: $(srcdir)/stamp-vti ++#$(srcdir)/stamp-vti: grep.texi $(top_srcdir)/configure ++# @(dir=.; test -f ./grep.texi || dir=$(srcdir); \ ++# set `$(SHELL) $(srcdir)/mdate-sh $$dir/grep.texi`; \ ++# echo "@set UPDATED $$1 $$2 $$3"; \ ++# echo "@set UPDATED-MONTH $$2 $$3"; \ ++# echo "@set EDITION $(VERSION)"; \ ++# echo "@set VERSION $(VERSION)") > vti.tmp ++# @cmp -s vti.tmp $(srcdir)/version.texi \ ++# || (echo "Updating $(srcdir)/version.texi"; \ ++# cp vti.tmp $(srcdir)/version.texi) ++# -@rm -f vti.tmp ++# @cp $(srcdir)/version.texi $@ + + mostlyclean-vti: + -rm -f vti.tmp --- grep-2.5.3~dfsg.orig/debian/patches/64-egf-speedup.patch +++ grep-2.5.3~dfsg/debian/patches/64-egf-speedup.patch @@ -0,0 +1,792 @@ +--- src/search.c.orig ++++ src/search.c +@@ -18,10 +18,15 @@ + + /* Written August 1992 by Mike Haertel. */ + ++#ifndef _GNU_SOURCE ++# define _GNU_SOURCE 1 ++#endif + #ifdef HAVE_CONFIG_H + # include + #endif + ++#include ++ + #include + + #include "mbsupport.h" +@@ -43,6 +48,9 @@ + #ifdef HAVE_LIBPCRE + # include + #endif ++#ifdef HAVE_LANGINFO_CODESET ++# include ++#endif + + #define NCHAR (UCHAR_MAX + 1) + +@@ -68,6 +76,19 @@ + error (2, 0, _("memory exhausted")); + } + ++/* UTF-8 encoding allows some optimizations that we can't otherwise ++ assume in a multibyte encoding. */ ++static int using_utf8; ++ ++void ++check_utf8 (void) ++{ ++#ifdef HAVE_LANGINFO_CODESET ++ if (strcmp (nl_langinfo (CODESET), "UTF-8") == 0) ++ using_utf8 = 1; ++#endif ++} ++ + #ifndef FGREP_PROGRAM + /* DFA compiled regexp. */ + static struct dfa dfa; +@@ -134,49 +155,6 @@ + } + #endif /* !FGREP_PROGRAM */ + +-#ifdef MBS_SUPPORT +-/* This function allocate the array which correspond to "buf". +- Then this check multibyte string and mark on the positions which +- are not single byte character nor the first byte of a multibyte +- character. Caller must free the array. */ +-static char* +-check_multibyte_string(char const *buf, size_t size) +-{ +- char *mb_properties = xmalloc(size); +- mbstate_t cur_state; +- wchar_t wc; +- int i; +- +- memset(&cur_state, 0, sizeof(mbstate_t)); +- memset(mb_properties, 0, sizeof(char)*size); +- +- for (i = 0; i < size ;) +- { +- size_t mbclen; +- mbclen = mbrtowc(&wc, buf + i, size - i, &cur_state); +- +- if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0) +- { +- /* An invalid sequence, or a truncated multibyte character. +- We treat it as a single byte character. */ +- mbclen = 1; +- } +- else if (match_icase) +- { +- if (iswupper((wint_t)wc)) +- { +- wc = towlower((wint_t)wc); +- wcrtomb(buf + i, wc, &cur_state); +- } +- } +- mb_properties[i] = mbclen; +- i += mbclen; +- } +- +- return mb_properties; +-} +-#endif /* MBS_SUPPORT */ +- + #if defined(GREP_PROGRAM) || defined(EGREP_PROGRAM) + #ifdef EGREP_PROGRAM + COMPILE_FCT(Ecompile) +@@ -193,6 +171,7 @@ + size_t total = size; + char const *motif = pattern; + ++ check_utf8 (); + #if 0 + if (match_icase) + syntax_bits |= RE_ICASE; +#@@ -303,47 +282,78 @@ hunk6 +@@ -303,20 +282,9 @@ hunk6 + struct kwsmatch kwsm; + size_t i, ret_val; + #ifdef MBS_SUPPORT +- char *mb_properties = NULL; +- if (MB_CUR_MAX > 1) +- { +- if (match_icase) +- { +- char *case_buf = xmalloc(size); +- memcpy(case_buf, buf, size); +- if (start_ptr) +- start_ptr = case_buf + (start_ptr - buf); +- buf = case_buf; +- } +- if (kwset) +- mb_properties = check_multibyte_string(buf, size); +- } ++ int mb_cur_max = MB_CUR_MAX; ++ mbstate_t mbs; ++ memset (&mbs, '\0', sizeof (mbstate_t)); + #endif /* MBS_SUPPORT */ + + buflim = buf + size; +@@ -329,21 +282,63 @@ hunk6 + if (kwset) + { + /* Find a possible match using the KWset matcher. */ +- size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm); ++#ifdef MBS_SUPPORT ++ size_t bytes_left = 0; ++#endif /* MBS_SUPPORT */ ++ size_t offset; ++#ifdef MBS_SUPPORT ++ /* kwsexec doesn't work with match_icase and multibyte input. */ ++ if (match_icase && mb_cur_max > 1) ++ /* Avoid kwset */ ++ offset = 0; ++ else ++#endif /* MBS_SUPPORT */ ++ offset = kwsexec (kwset, beg, buflim - beg, &kwsm); + if (offset == (size_t) -1) +- goto failure; ++ return (size_t)-1; ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1 && !using_utf8) ++ { ++ bytes_left = offset; ++ while (bytes_left) ++ { ++ size_t mlen = mbrlen (beg, bytes_left, &mbs); ++ if (mlen == (size_t) -1 || mlen == 0) ++ { ++ /* Incomplete character: treat as single-byte. */ ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ beg++; ++ bytes_left--; ++ continue; ++ } ++ ++ if (mlen == (size_t) -2) ++ /* Offset points inside multibyte character: ++ * no good. */ ++ break; ++ ++ beg += mlen; ++ bytes_left -= mlen; ++ } ++ } ++ else ++#endif /* MBS_SUPPORT */ + beg += offset; + /* Narrow down to the line containing the candidate, and + run it through DFA. */ + end = memchr(beg, eol, buflim - beg); + end++; + #ifdef MBS_SUPPORT +- if (MB_CUR_MAX > 1 && mb_properties[beg - buf] == 0) ++ if (mb_cur_max > 1 && bytes_left) + continue; + #endif + while (beg > buf && beg[-1] != eol) + --beg; +- if (kwsm.index < kwset_exact_matches) ++ if ( ++#ifdef MBS_SUPPORT ++ !(match_icase && mb_cur_max > 1) && ++#endif /* MBS_SUPPORT */ ++ (kwsm.index < kwset_exact_matches)) + goto success; + if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) + continue; +@@ -351,13 +363,47 @@ + else + { + /* No good fixed strings; start with DFA. */ ++#ifdef MBS_SUPPORT ++ size_t bytes_left = 0; ++#endif /* MBS_SUPPORT */ + size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref); + if (offset == (size_t) -1) + break; + /* Narrow down to the line we've found. */ ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1 && !using_utf8) ++ { ++ bytes_left = offset; ++ while (bytes_left) ++ { ++ size_t mlen = mbrlen (beg, bytes_left, &mbs); ++ if (mlen == (size_t) -1 || mlen == 0) ++ { ++ /* Incomplete character: treat as single-byte. */ ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ beg++; ++ bytes_left--; ++ continue; ++ } ++ ++ if (mlen == (size_t) -2) ++ /* Offset points inside multibyte character: ++ * no good. */ ++ break; ++ ++ beg += mlen; ++ bytes_left -= mlen; ++ } ++ } ++ else ++#endif /* MBS_SUPPORT */ + beg += offset; + end = memchr (beg, eol, buflim - beg); + end++; ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1 && bytes_left) ++ continue; ++#endif /* MBS_SUPPORT */ + while (beg > buf && beg[-1] != eol) + --beg; + } +@@ -475,24 +521,144 @@ + *match_size = len; + ret_val = beg - buf; + out: +-#ifdef MBS_SUPPORT +- if (MB_CUR_MAX > 1) +- { +- if (match_icase) +- free((char*)buf); +- if (mb_properties) +- free(mb_properties); +- } +-#endif /* MBS_SUPPORT */ + return ret_val; + } + #endif /* defined(GREP_PROGRAM) || defined(EGREP_PROGRAM) */ + ++#ifdef MBS_SUPPORT ++static int f_i_multibyte; /* whether we're using the new -Fi MB method */ ++static struct ++{ ++ wchar_t **patterns; ++ size_t count, maxlen; ++ unsigned char *match; ++} Fimb; ++#endif ++ + #if defined(GREP_PROGRAM) || defined(FGREP_PROGRAM) + COMPILE_FCT(Fcompile) + { ++ int mb_cur_max = MB_CUR_MAX; + char const *beg, *lim, *err; + ++ check_utf8 (); ++#ifdef MBS_SUPPORT ++ /* Support -F -i for UTF-8 input. */ ++ if (match_icase && mb_cur_max > 1) ++ { ++ mbstate_t mbs; ++ wchar_t *wcpattern = xmalloc ((size + 1) * sizeof (wchar_t)); ++ const char *patternend = pattern; ++ size_t wcsize; ++ kwset_t fimb_kwset = NULL; ++ char *starts = NULL; ++ wchar_t *wcbeg, *wclim; ++ size_t allocated = 0; ++ ++ memset (&mbs, '\0', sizeof (mbs)); ++# ifdef __GNU_LIBRARY__ ++ wcsize = mbsnrtowcs (wcpattern, &patternend, size, size, &mbs); ++ if (patternend != pattern + size) ++ wcsize = (size_t) -1; ++# else ++ { ++ char *patterncopy = xmalloc (size + 1); ++ ++ memcpy (patterncopy, pattern, size); ++ patterncopy[size] = '\0'; ++ patternend = patterncopy; ++ wcsize = mbsrtowcs (wcpattern, &patternend, size, &mbs); ++ if (patternend != patterncopy + size) ++ wcsize = (size_t) -1; ++ free (patterncopy); ++ } ++# endif ++ if (wcsize + 2 <= 2) ++ { ++fimb_fail: ++ free (wcpattern); ++ free (starts); ++ if (fimb_kwset) ++ kwsfree (fimb_kwset); ++ free (Fimb.patterns); ++ Fimb.patterns = NULL; ++ } ++ else ++ { ++ if (!(fimb_kwset = kwsalloc (NULL))) ++ error (2, 0, _("memory exhausted")); ++ ++ starts = xmalloc (mb_cur_max * 3); ++ wcbeg = wcpattern; ++ do ++ { ++ int i; ++ size_t wclen; ++ ++ if (Fimb.count >= allocated) ++ { ++ if (allocated == 0) ++ allocated = 128; ++ else ++ allocated *= 2; ++ Fimb.patterns = xrealloc (Fimb.patterns, ++ sizeof (wchar_t *) * allocated); ++ } ++ Fimb.patterns[Fimb.count++] = wcbeg; ++ for (wclim = wcbeg; ++ wclim < wcpattern + wcsize && *wclim != L'\n'; ++wclim) ++ *wclim = towlower (*wclim); ++ *wclim = L'\0'; ++ wclen = wclim - wcbeg; ++ if (wclen > Fimb.maxlen) ++ Fimb.maxlen = wclen; ++ if (wclen > 3) ++ wclen = 3; ++ if (wclen == 0) ++ { ++ if ((err = kwsincr (fimb_kwset, "", 0)) != 0) ++ error (2, 0, err); ++ } ++ else ++ for (i = 0; i < (1 << wclen); i++) ++ { ++ char *p = starts; ++ int j, k; ++ ++ for (j = 0; j < wclen; ++j) ++ { ++ wchar_t wc = wcbeg[j]; ++ if (i & (1 << j)) ++ { ++ wc = towupper (wc); ++ if (wc == wcbeg[j]) ++ continue; ++ } ++ k = wctomb (p, wc); ++ if (k <= 0) ++ goto fimb_fail; ++ p += k; ++ } ++ if ((err = kwsincr (fimb_kwset, starts, p - starts)) != 0) ++ error (2, 0, err); ++ } ++ if (wclim < wcpattern + wcsize) ++ ++wclim; ++ wcbeg = wclim; ++ } ++ while (wcbeg < wcpattern + wcsize); ++ f_i_multibyte = 1; ++ kwset = fimb_kwset; ++ free (starts); ++ Fimb.match = xmalloc (Fimb.count); ++ if ((err = kwsprep (kwset)) != 0) ++ error (2, 0, err); ++ return; ++ } ++ } ++#endif /* MBS_SUPPORT */ ++ ++ + kwsinit (); + beg = pattern; + do +@@ -511,6 +677,76 @@ + error (2, 0, err); + } + ++#ifdef MBS_SUPPORT ++static int ++Fimbexec (const char *buf, size_t size, size_t *plen, int exact) ++{ ++ size_t len, letter, i; ++ int ret = -1; ++ mbstate_t mbs; ++ wchar_t wc; ++ int patterns_left; ++ ++ assert (match_icase && f_i_multibyte == 1); ++ assert (MB_CUR_MAX > 1); ++ ++ memset (&mbs, '\0', sizeof (mbs)); ++ memset (Fimb.match, '\1', Fimb.count); ++ letter = len = 0; ++ patterns_left = 1; ++ while (patterns_left && len <= size) ++ { ++ size_t c; ++ ++ patterns_left = 0; ++ if (len < size) ++ { ++ c = mbrtowc (&wc, buf + len, size - len, &mbs); ++ if (c + 2 <= 2) ++ return ret; ++ ++ wc = towlower (wc); ++ } ++ else ++ { ++ c = 1; ++ wc = L'\0'; ++ } ++ ++ for (i = 0; i < Fimb.count; i++) ++ { ++ if (Fimb.match[i]) ++ { ++ if (Fimb.patterns[i][letter] == L'\0') ++ { ++ /* Found a match. */ ++ *plen = len; ++ if (!exact && !match_words) ++ return 0; ++ else ++ { ++ /* For -w or exact look for longest match. */ ++ ret = 0; ++ Fimb.match[i] = '\0'; ++ continue; ++ } ++ } ++ ++ if (Fimb.patterns[i][letter] == wc) ++ patterns_left = 1; ++ else ++ Fimb.match[i] = '\0'; ++ } ++ } ++ ++ len += c; ++ letter++; ++ } ++ ++ return ret; ++} ++#endif /* MBS_SUPPORT */ ++ + EXECUTE_FCT(Fexecute) + { + register char const *beg, *try, *end; +@@ -519,69 +755,256 @@ + struct kwsmatch kwsmatch; + size_t ret_val; + #ifdef MBS_SUPPORT +- char *mb_properties = NULL; +- if (MB_CUR_MAX > 1) +- { +- if (match_icase) +- { +- char *case_buf = xmalloc(size); +- memcpy(case_buf, buf, size); +- if (start_ptr) +- start_ptr = case_buf + (start_ptr - buf); +- buf = case_buf; +- } +- mb_properties = check_multibyte_string(buf, size); +- } ++ int mb_cur_max = MB_CUR_MAX; ++ mbstate_t mbs; ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ const char *last_char = NULL; + #endif /* MBS_SUPPORT */ + + for (beg = start_ptr ? start_ptr : buf; beg <= buf + size; beg++) + { + size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch); + if (offset == (size_t) -1) +- goto failure; ++ return offset; + #ifdef MBS_SUPPORT +- if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0) +- continue; /* It is a part of multibyte character. */ ++ if (mb_cur_max > 1 && !using_utf8) ++ { ++ size_t bytes_left = offset; ++ while (bytes_left) ++ { ++ size_t mlen = mbrlen (beg, bytes_left, &mbs); ++ ++ last_char = beg; ++ if (mlen == (size_t) -1 || mlen == 0) ++ { ++ /* Incomplete character: treat as single-byte. */ ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ beg++; ++ bytes_left--; ++ continue; ++ } ++ ++ if (mlen == (size_t) -2) ++ /* Offset points inside multibyte character: no good. */ ++ break; ++ ++ beg += mlen; ++ bytes_left -= mlen; ++ } ++ ++ if (bytes_left) ++ continue; ++ } ++ else + #endif /* MBS_SUPPORT */ + beg += offset; ++#ifdef MBS_SUPPORT ++ /* For f_i_multibyte, the string at beg now matches first 3 chars of ++ one of the search strings (less if there are shorter search strings). ++ See if this is a real match. */ ++ if (f_i_multibyte ++ && Fimbexec (beg, buf + size - beg, &kwsmatch.size[0], start_ptr == NULL)) ++ goto next_char; ++#endif /* MBS_SUPPORT */ + len = kwsmatch.size[0]; + if (start_ptr && !match_words) + goto success_in_beg_and_len; + if (match_lines) + { + if (beg > buf && beg[-1] != eol) +- continue; ++ goto next_char; + if (beg + len < buf + size && beg[len] != eol) +- continue; ++ goto next_char; + goto success; + } + else if (match_words) +- for (try = beg; len; ) +- { +- if (try > buf && WCHAR((unsigned char) try[-1])) +- break; +- if (try + len < buf + size && WCHAR((unsigned char) try[len])) +- { +- offset = kwsexec (kwset, beg, --len, &kwsmatch); +- if (offset == (size_t) -1) +- break; +- try = beg + offset; +- len = kwsmatch.size[0]; +- } +- else if (!start_ptr) +- goto success; +- else +- goto success_in_beg_and_len; +- } /* for (try) */ +- else +- goto success; +- } /* for (beg in buf) */ ++ { ++ while (len) ++ { ++ int word_match = 0; ++ if (beg > buf) ++ { ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1) ++ { ++ const char *s; ++ int mr; ++ wchar_t pwc; ++ ++ if (using_utf8) ++ { ++ s = beg - 1; ++ while (s > buf ++ && (unsigned char) *s >= 0x80 ++ && (unsigned char) *s <= 0xbf) ++ --s; ++ } ++ else ++ s = last_char; ++ mr = mbtowc (&pwc, s, beg - s); ++ if (mr <= 0) ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ else if ((iswalnum (pwc) || pwc == L'_') ++ && mr == (int) (beg - s)) ++ goto next_char; ++ } ++ else ++#endif /* MBS_SUPPORT */ ++ if (WCHAR ((unsigned char) beg[-1])) ++ goto next_char; ++ } ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1) ++ { ++ wchar_t nwc; ++ int mr; + +- failure: +- ret_val = -1; +- goto out; ++ mr = mbtowc (&nwc, beg + len, buf + size - beg - len); ++ if (mr <= 0) ++ { ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ word_match = 1; ++ } ++ else if (!iswalnum (nwc) && nwc != L'_') ++ word_match = 1; ++ } ++ else ++#endif /* MBS_SUPPORT */ ++ if (beg + len >= buf + size || !WCHAR ((unsigned char) beg[len])) ++ word_match = 1; ++ if (word_match) ++ { ++ if (start_ptr == NULL) ++ /* Returns the whole line now we know there's a word match. */ ++ goto success; ++ else { ++ /* Returns just this word match. */ ++ *match_size = len; ++ return beg - buf; ++ } ++ } ++ if (len > 0) ++ { ++ /* Try a shorter length anchored at the same place. */ ++ --len; ++ offset = kwsexec (kwset, beg, len, &kwsmatch); ++ ++ if (offset == -1) ++ goto next_char; /* Try a different anchor. */ ++#ifdef MBS_SUPPORT ++ ++ if (mb_cur_max > 1 && !using_utf8) ++ { ++ size_t bytes_left = offset; ++ while (bytes_left) ++ { ++ size_t mlen = mbrlen (beg, bytes_left, &mbs); ++ ++ last_char = beg; ++ if (mlen == (size_t) -1 || mlen == 0) ++ { ++ /* Incomplete character: treat as single-byte. */ ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ beg++; ++ bytes_left--; ++ continue; ++ } ++ ++ if (mlen == (size_t) -2) ++ { ++ /* Offset points inside multibyte character: ++ * no good. */ ++ break; ++ } ++ ++ beg += mlen; ++ bytes_left -= mlen; ++ } ++ ++ if (bytes_left) ++ { ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ goto next_char; /* Try a different anchor. */ ++ } ++ } ++ else ++#endif /* MBS_SUPPORT */ ++ beg += offset; ++#ifdef MBS_SUPPORT ++ /* The string at beg now matches first 3 chars of one of ++ the search strings (less if there are shorter search ++ strings). See if this is a real match. */ ++ if (f_i_multibyte ++ && Fimbexec (beg, len - offset, &kwsmatch.size[0], ++ start_ptr == NULL)) ++ goto next_char; ++#endif /* MBS_SUPPORT */ ++ len = kwsmatch.size[0]; ++ } ++ } ++ } ++ else ++ goto success; ++next_char:; ++#ifdef MBS_SUPPORT ++ /* Advance to next character. For MB_CUR_MAX == 1 case this is handled ++ by ++beg above. */ ++ if (mb_cur_max > 1) ++ { ++ if (using_utf8) ++ { ++ unsigned char c = *beg; ++ if (c >= 0xc2) ++ { ++ if (c < 0xe0) ++ ++beg; ++ else if (c < 0xf0) ++ beg += 2; ++ else if (c < 0xf8) ++ beg += 3; ++ else if (c < 0xfc) ++ beg += 4; ++ else if (c < 0xfe) ++ beg += 5; ++ } ++ } ++ else ++ { ++ size_t l = mbrlen (beg, buf + size - beg, &mbs); ++ ++ last_char = beg; ++ if (l + 2 >= 2) ++ beg += l - 1; ++ else ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ } ++ } ++#endif /* MBS_SUPPORT */ ++ } ++ ++ return -1; + + success: ++#ifdef MBS_SUPPORT ++ if (mb_cur_max > 1 && !using_utf8) ++ { ++ end = beg + len; ++ while (end < buf + size) ++ { ++ size_t mlen = mbrlen (end, buf + size - end, &mbs); ++ if (mlen == (size_t) -1 || mlen == (size_t) -2 || mlen == 0) ++ { ++ memset (&mbs, '\0', sizeof (mbstate_t)); ++ mlen = 1; ++ } ++ if (mlen == 1 && *end == eol) ++ break; ++ ++ end += mlen; ++ } ++ } ++ else ++ #endif /* MBS_SUPPORT */ + end = memchr (beg + len, eol, (buf + size) - (beg + len)); + end++; + while (buf < beg && beg[-1] != eol) +@@ -591,15 +1016,6 @@ + *match_size = len; + ret_val = beg - buf; + out: +-#ifdef MBS_SUPPORT +- if (MB_CUR_MAX > 1) +- { +- if (match_icase) +- free((char*)buf); +- if (mb_properties) +- free(mb_properties); +- } +-#endif /* MBS_SUPPORT */ + return ret_val; + } + #endif /* defined(GREP_PROGRAM) || defined(FGREP_PROGRAM) */ --- grep-2.5.3~dfsg.orig/debian/patches/63-dfa.c-case_fold-range.patch +++ grep-2.5.3~dfsg/debian/patches/63-dfa.c-case_fold-range.patch @@ -0,0 +1,32 @@ +--- ./src/dfa.c.orig 2004-10-20 02:13:43.000000000 +0900 ++++ ./src/dfa.c 2004-10-20 02:14:14.000000000 +0900 +@@ -658,6 +658,29 @@ + REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t, + range_ends_al, work_mbc->nranges + 1); + work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2; ++ if (case_fold ++ && (iswlower((wint_t)wc) || iswupper((wint_t)wc)) ++ && (iswlower((wint_t)wc2) || iswupper((wint_t)wc2))) { ++ wint_t altcase; ++ altcase = wc; ++ if (iswlower((wint_t)wc)) ++ altcase = towupper((wint_t)wc); ++ else ++ altcase = towlower((wint_t)wc); ++ REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t, ++ range_sts_al, work_mbc->nranges + 1); ++ work_mbc->range_sts[work_mbc->nranges] = (wchar_t)altcase; ++ ++ altcase = wc2; ++ if (iswlower((wint_t)wc2)) ++ altcase = towupper((wint_t)wc2); ++ else ++ altcase = towlower((wint_t)wc2); ++ REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t, ++ range_ends_al, work_mbc->nranges + 1); ++ work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)altcase; ++ ++ } + } + else if (wc != WEOF) + /* build normal characters. */ --- grep-2.5.3~dfsg.orig/debian/patches/70-man_apostrophe.patch +++ grep-2.5.3~dfsg/debian/patches/70-man_apostrophe.patch @@ -0,0 +1,20 @@ +--- doc/grep.1.orig 2008-01-20 17:17:18.000000000 +0100 ++++ doc/grep.1 2008-01-20 17:19:10.000000000 +0100 +@@ -822,7 +822,7 @@ + is not special if it would be the start of an invalid interval + specification. + For example, the command +-.B "grep\ \-E\ '{1'" ++.B "grep\ \-E\ \(aq{1\(aq" + searches for the two-character string + .B {1 + instead of reporting a syntax error in the regular expression. +@@ -862,7 +862,7 @@ + For example, if + .B GREP_OPTIONS + is +-.BR "'\-\^\-binary-files=without-match \-\^\-directories=skip'" , ++.BR "\(aq\-\^\-binary-files=without-match \-\^\-directories=skip\(aq" , + .B grep + behaves as if the two options + .B \-\^\-binary\-files=without-match --- grep-2.5.3~dfsg.orig/debian/patches/55-bigfile.patch +++ grep-2.5.3~dfsg/debian/patches/55-bigfile.patch @@ -0,0 +1,90 @@ +--- src/grep.c.orig 2002-03-26 16:54:12.000000000 +0100 ++++ src/grep.c 2003-04-03 16:46:36.000000000 +0200 +@@ -82,6 +82,12 @@ static struct exclude *included_patterns + static char const short_options[] = + "0123456789A:B:C:D:EFGHIPUVX:abcd:e:f:hiKLlm:noqRrsuvwxyZz"; + ++/* Default for `file_list' if no files are given on the command line. */ ++static char *stdin_argv[] = ++{ ++ "-", NULL ++}; ++ + /* Non-boolean long options that have no corresponding short equivalents. */ + enum + { +@@ -348,7 +354,16 @@ fillbuf (size_t save, struct stats const + for byte sentinels fore and aft. */ + newalloc = newsize + pagesize + 1; + +- newbuf = bufalloc < newalloc ? xmalloc (bufalloc = newalloc) : buffer; ++ newbuf = bufalloc < newalloc ? malloc (bufalloc = newalloc) : buffer; ++ if (newbuf == NULL) ++ { ++ int saved_errno = errno; ++ free (buffer); ++ bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1; ++ buffer = xmalloc (bufalloc); ++ errno = saved_errno; ++ return 0; ++ } + readbuf = ALIGN_TO (newbuf + 1 + save, pagesize); + bufbeg = readbuf - save; + memmove (bufbeg, buffer + saved_offset, save); +@@ -1288,6 +1303,7 @@ main (int argc, char **argv) + FILE *fp; + extern char *optarg; + extern int optind; ++ char **file_list; + + initialize_main (&argc, &argv); + program_name = argv[0]; +@@ -1712,29 +1728,29 @@ warranty; not even for MERCHANTABILITY o + if (max_count == 0) + exit (1); + +- if (optind < argc) ++ file_list = (optind == argc ? stdin_argv : &argv[optind]); ++ ++ status = 1; ++ while (1) + { +- status = 1; +- do ++ char *file = *file_list++; ++ ++ if (file == NULL) ++ break; ++ ++ if ((included_patterns || excluded_patterns) ++ && !isdir (file)) + { +- char *file = argv[optind]; +- if ((included_patterns || excluded_patterns) +- && !isdir (file)) +- { +- if (included_patterns && +- ! excluded_filename (included_patterns, file, 0)) +- continue; +- if (excluded_patterns && +- excluded_filename (excluded_patterns, file, 0)) +- continue; +- } +- status &= grepfile (strcmp (file, "-") == 0 ? (char *) NULL : file, +- &stats_base); ++ if (included_patterns && ++ ! excluded_filename (included_patterns, file, 0)) ++ continue; ++ if (excluded_patterns && ++ excluded_filename (excluded_patterns, file, 0)) ++ continue; + } +- while ( ++optind < argc); ++ status &= grepfile (strcmp (file, "-") == 0 ++ ? (char *) NULL : file, &stats_base); + } +- else +- status = grepfile ((char *) NULL, &stats_base); + + /* We register via atexit() to test stdout. */ + exit (errseen ? 2 : status); --- grep-2.5.3~dfsg.orig/debian/patches/60-dfa.c-case_fold.patch +++ grep-2.5.3~dfsg/debian/patches/60-dfa.c-case_fold.patch @@ -0,0 +1,20 @@ +--- ./src/dfa.c.orig 2004-10-19 01:52:09.000000000 +0900 ++++ ./src/dfa.c 2004-10-19 01:59:43.000000000 +0900 +@@ -547,6 +547,17 @@ + /* build character class. */ + { + wctype_t wt; ++ /* NOTE: ++ * when case_fold, character class [:upper:] and [:lower:] ++ * should be treated as [:alpha:], this is the same way ++ * of glibc/posix/regcomp.c:build_charclass(). ++ * reported by Bug#276202 ++ * - fixed by Fumitoshi UKAI ++ */ ++ if (case_fold ++ && (strcmp (str, "upper") == 0 || strcmp (str, "lower") == 0)) ++ strcpy (str, "alpha"); ++ + /* Query the character class as wctype_t. */ + wt = wctype (str); + --- grep-2.5.3~dfsg.orig/debian/patches/2-man_rgrep.patch +++ grep-2.5.3~dfsg/debian/patches/2-man_rgrep.patch @@ -0,0 +1,36 @@ +--- doc/grep.1.orig 2007-08-25 10:20:03.000000000 -0500 ++++ doc/grep.1 2007-08-25 10:23:09.000000000 -0500 +@@ -26,7 +26,7 @@ + .hy 0 + . + .SH NAME +-grep, egrep, fgrep \- print lines matching a pattern ++grep, egrep, fgrep, rgrep \- print lines matching a pattern + . + .SH SYNOPSIS + .B grep +@@ -57,10 +57,11 @@ + .B grep + prints the matching lines. + .PP +-In addition, two variant programs +-.B egrep +-and ++In addition, three variant programs ++.B egrep, + .B fgrep ++and ++.B rgrep + are available. + .B egrep + is the same as +@@ -68,6 +69,9 @@ + .B fgrep + is the same as + .BR "grep\ \-F" . ++.B rgrep ++is the same as ++.BR "grep\ \-r" . + Direct invocation as either + .B egrep + or --- grep-2.5.3~dfsg.orig/debian/patches/75-dfa_calloc.patch +++ grep-2.5.3~dfsg/debian/patches/75-dfa_calloc.patch @@ -0,0 +1,14 @@ +diff -ur grep-2.5.3/src/dfa.c grep-2.5.3-johan/src/dfa.c +--- grep-2.5.3/src/dfa.c 2007-06-28 20:57:19.000000000 +0200 ++++ grep-2.5.3-johan/src/dfa.c 2008-01-05 09:46:54.000000000 +0100 +@@ -1605,9 +1605,7 @@ + int *visited; + position p, old; + +- MALLOC(visited, int, d->tindex); +- for (i = 0; i < d->tindex; ++i) +- visited[i] = 0; ++ CALLOC(visited, int, d->tindex); + + for (i = 0; i < s->nelem; ++i) + if (d->tokens[s->elems[i].index] >= NOTCHAR --- grep-2.5.3~dfsg.orig/debian/patches/66-match_icase.patch +++ grep-2.5.3~dfsg/debian/patches/66-match_icase.patch @@ -0,0 +1,39 @@ +This fixes + echo Y | LC_ALL=en_US.UTF-8 grep -i '[y]' +The expected output is: + Y + +Without this patch, it works on non UTF-8 environment, but fails on UTF-8 +environment. + +The definition of RE_ICASE comes from the glibc (/usr/include/regex.h) + +Maybe lib/posix/regex.h should be removed to enforce the usage of the +glibc's regex.h + +--- lib/posix/regex.h.orig 2004-01-05 12:09:12.984391131 +0000 ++++ lib/posix/regex.h 2004-01-05 12:09:24.717990622 +0000 +@@ -109,6 +109,10 @@ + treated as 'a\{1'. */ + #define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) + ++/* If this bit is set, then ignore case when matching. ++ If not set, then case is significant. */ ++#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) ++ + /* This global variable defines the particular regexp syntax to use (for + some interfaces). When a regexp is compiled, the syntax used is + stored in the pattern buffer, so changing this does not affect +--- src/search.c.orig 2005-09-06 23:50:40.000000000 +0200 ++++ src/search.c 2005-09-06 23:59:33.000000000 +0200 +@@ -172,10 +167,8 @@ + char const *motif = pattern; + + check_utf8 (); +-#if 0 + if (match_icase) + syntax_bits |= RE_ICASE; +-#endif + re_set_syntax (syntax_bits); + dfasyntax (syntax_bits, match_icase, eolbyte); +