[4cc665a] | 1 | Submitted By: Joe Ciccone
|
---|
| 2 | Date: 2010-08-03
|
---|
| 3 | Initial Package Version: 2.6.3
|
---|
| 4 | Upstream Status: Unknown
|
---|
| 5 | Origin: http://ftp.de.debian.org/debian/pool/main/g/grep/grep_2.6.3-3.debian.tar.bz2
|
---|
| 6 | Description: Various fixes from debian for Grep
|
---|
| 7 |
|
---|
| 8 | diff -Naur grep-2.6.3.orig/NEWS grep-2.6.3/NEWS
|
---|
| 9 | --- grep-2.6.3.orig/NEWS 2010-04-02 04:55:33.000000000 -0400
|
---|
| 10 | +++ grep-2.6.3/NEWS 2010-08-03 22:11:08.142326516 -0400
|
---|
| 11 | @@ -1,5 +1,8 @@
|
---|
| 12 | GNU grep NEWS -*- outline -*-
|
---|
| 13 |
|
---|
| 14 | + --mmap was meant to be ignored in 2.6.x, but it was instead
|
---|
| 15 | + removed by mistake. [bug introduced in 2.6]
|
---|
| 16 | +
|
---|
| 17 | * Noteworthy changes in release 2.6.3 (2010-04-02) [stable]
|
---|
| 18 |
|
---|
| 19 | ** Bug fixes
|
---|
| 20 | diff -Naur grep-2.6.3.orig/configure grep-2.6.3/configure
|
---|
| 21 | --- grep-2.6.3.orig/configure 2010-04-02 04:56:49.000000000 -0400
|
---|
| 22 | +++ grep-2.6.3/configure 2010-08-03 22:11:08.137850711 -0400
|
---|
| 23 | @@ -24372,13 +24372,14 @@
|
---|
| 24 | if test "$ac_res" != no; then :
|
---|
| 25 | test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
---|
| 26 | test "$ac_cv_search_pcre_compile" = "none required" ||
|
---|
| 27 | - LIB_PCRE=$ac_cv_search_pcre_compile
|
---|
| 28 | + LIB="-ldl $LIBS"
|
---|
| 29 | fi
|
---|
| 30 |
|
---|
| 31 | for ac_func in pcre_compile
|
---|
| 32 | do :
|
---|
| 33 | ac_fn_c_check_func "$LINENO" "pcre_compile" "ac_cv_func_pcre_compile"
|
---|
| 34 | if test "x$ac_cv_func_pcre_compile" = x""yes; then :
|
---|
| 35 | + CPPFLAGS="$CPPFLAGS -DHAVE_DYNAMIC_LIBPCRE"
|
---|
| 36 | cat >>confdefs.h <<_ACEOF
|
---|
| 37 | #define HAVE_PCRE_COMPILE 1
|
---|
| 38 | _ACEOF
|
---|
| 39 | diff -Naur grep-2.6.3.orig/doc/grep.in.1 grep-2.6.3/doc/grep.in.1
|
---|
| 40 | --- grep-2.6.3.orig/doc/grep.in.1 2010-04-01 04:15:35.000000000 -0400
|
---|
| 41 | +++ grep-2.6.3/doc/grep.in.1 2010-08-03 22:11:08.137850711 -0400
|
---|
| 42 | @@ -25,7 +25,7 @@
|
---|
| 43 | .hy 0
|
---|
| 44 | .
|
---|
| 45 | .SH NAME
|
---|
| 46 | -grep, egrep, fgrep \- print lines matching a pattern
|
---|
| 47 | +grep, egrep, fgrep, rgrep \- print lines matching a pattern
|
---|
| 48 | .
|
---|
| 49 | .SH SYNOPSIS
|
---|
| 50 | .B grep
|
---|
| 51 | @@ -56,10 +56,11 @@
|
---|
| 52 | .B grep
|
---|
| 53 | prints the matching lines.
|
---|
| 54 | .PP
|
---|
| 55 | -In addition, two variant programs
|
---|
| 56 | -.B egrep
|
---|
| 57 | -and
|
---|
| 58 | +In addition, three variant programs
|
---|
| 59 | +.B egrep,
|
---|
| 60 | .B fgrep
|
---|
| 61 | +and
|
---|
| 62 | +.B rgrep
|
---|
| 63 | are available.
|
---|
| 64 | .B egrep
|
---|
| 65 | is the same as
|
---|
| 66 | @@ -67,6 +68,9 @@
|
---|
| 67 | .B fgrep
|
---|
| 68 | is the same as
|
---|
| 69 | .BR "grep\ \-F" .
|
---|
| 70 | +.B rgrep
|
---|
| 71 | +is the same as
|
---|
| 72 | +.BR "grep\ \-r" .
|
---|
| 73 | Direct invocation as either
|
---|
| 74 | .B egrep
|
---|
| 75 | or
|
---|
| 76 | @@ -825,7 +829,7 @@
|
---|
| 77 | is not special if it would be the start of an invalid interval
|
---|
| 78 | specification.
|
---|
| 79 | For example, the command
|
---|
| 80 | -.B "grep\ \-E\ '{1'"
|
---|
| 81 | +.B "grep\ \-E\ \(aq{1\(aq"
|
---|
| 82 | searches for the two-character string
|
---|
| 83 | .B {1
|
---|
| 84 | instead of reporting a syntax error in the regular expression.
|
---|
| 85 | @@ -865,7 +869,7 @@
|
---|
| 86 | For example, if
|
---|
| 87 | .B GREP_OPTIONS
|
---|
| 88 | is
|
---|
| 89 | -.BR "'\-\^\-binary-files=without-match \-\^\-directories=skip'" ,
|
---|
| 90 | +.BR "\(aq\-\^\-binary-files=without-match \-\^\-directories=skip\(aq" ,
|
---|
| 91 | .B grep
|
---|
| 92 | behaves as if the two options
|
---|
| 93 | .B \-\^\-binary\-files=without-match
|
---|
| 94 | @@ -1160,23 +1164,9 @@
|
---|
| 95 | is not set.
|
---|
| 96 | .
|
---|
| 97 | .SH "EXIT STATUS"
|
---|
| 98 | -Normally, the exit status is 0 if selected lines are found and 1 otherwise.
|
---|
| 99 | -But the exit status is 2 if an error occurred, unless the
|
---|
| 100 | -.B \-q
|
---|
| 101 | -or
|
---|
| 102 | -.B \-\^\-quiet
|
---|
| 103 | -or
|
---|
| 104 | -.B \-\^\-silent
|
---|
| 105 | -option is used and a selected line is found.
|
---|
| 106 | -Note, however, that \s-1POSIX\s0 only mandates, for programs such as
|
---|
| 107 | -.BR grep ,
|
---|
| 108 | -.BR cmp ,
|
---|
| 109 | -and
|
---|
| 110 | -.BR diff ,
|
---|
| 111 | -that the exit status in case of error be greater than 1;
|
---|
| 112 | -it is therefore advisable, for the sake of portability,
|
---|
| 113 | -to use logic that tests for this general condition
|
---|
| 114 | -instead of strict equality with\ 2.
|
---|
| 115 | +The exit status is 0 if selected lines are found, and 1 if not found.
|
---|
| 116 | +If an error occurred the exit status is 2. (Note: POSIX error
|
---|
| 117 | +handling code should check for '2' or greater.)
|
---|
| 118 | .
|
---|
| 119 | .SH COPYRIGHT
|
---|
| 120 | Copyright 1998-2000, 2002, 2005-2010 Free Software Foundation, Inc.
|
---|
| 121 | diff -Naur grep-2.6.3.orig/po/ca.po grep-2.6.3/po/ca.po
|
---|
| 122 | --- grep-2.6.3.orig/po/ca.po 2010-04-02 04:57:08.000000000 -0400
|
---|
| 123 | +++ grep-2.6.3/po/ca.po 2010-08-03 22:11:08.137850711 -0400
|
---|
| 124 | @@ -278,7 +278,7 @@
|
---|
| 125 | #: src/main.c:1165
|
---|
| 126 | #, c-format
|
---|
| 127 | msgid "Binary file %s matches\n"
|
---|
| 128 | -msgstr "Concidència en el fitxer binari %s\n"
|
---|
| 129 | +msgstr "Coincidència en el fitxer binari %s\n"
|
---|
| 130 |
|
---|
| 131 | #: src/main.c:1179
|
---|
| 132 | msgid "(standard input)"
|
---|
| 133 | diff -Naur grep-2.6.3.orig/src/kwset.c grep-2.6.3/src/kwset.c
|
---|
| 134 | --- grep-2.6.3.orig/src/kwset.c 2010-04-01 04:15:35.000000000 -0400
|
---|
| 135 | +++ grep-2.6.3/src/kwset.c 2010-08-03 22:11:08.142326516 -0400
|
---|
| 136 | @@ -40,7 +40,7 @@
|
---|
| 137 | #ifdef GREP
|
---|
| 138 | # include "xalloc.h"
|
---|
| 139 | # undef malloc
|
---|
| 140 | -# define malloc(s) xmalloc(s)
|
---|
| 141 | +# define malloc xmalloc
|
---|
| 142 | #endif
|
---|
| 143 |
|
---|
| 144 | #define NCHAR (UCHAR_MAX + 1)
|
---|
| 145 | diff -Naur grep-2.6.3.orig/src/main.c grep-2.6.3/src/main.c
|
---|
| 146 | --- grep-2.6.3.orig/src/main.c 2010-04-01 12:52:10.000000000 -0400
|
---|
| 147 | +++ grep-2.6.3/src/main.c 2010-08-03 22:11:08.142326516 -0400
|
---|
| 148 | @@ -266,6 +266,12 @@
|
---|
| 149 | static char const short_options[] =
|
---|
| 150 | "0123456789A:B:C:D:EFGHIPTUVX:abcd:e:f:hiKLlm:noqRrsuvwxyZz";
|
---|
| 151 |
|
---|
| 152 | +/* Default for `file_list' if no files are given on the command line. */
|
---|
| 153 | +static char *stdin_argv[] =
|
---|
| 154 | +{
|
---|
| 155 | + "-", NULL
|
---|
| 156 | +};
|
---|
| 157 | +
|
---|
| 158 | /* Non-boolean long options that have no corresponding short equivalents. */
|
---|
| 159 | enum
|
---|
| 160 | {
|
---|
| 161 | @@ -511,7 +517,16 @@
|
---|
| 162 | for byte sentinels fore and aft. */
|
---|
| 163 | newalloc = newsize + pagesize + 1;
|
---|
| 164 |
|
---|
| 165 | - newbuf = bufalloc < newalloc ? xmalloc (bufalloc = newalloc) : buffer;
|
---|
| 166 | + newbuf = bufalloc < newalloc ? malloc (bufalloc = newalloc) : buffer;
|
---|
| 167 | + if (newbuf == NULL)
|
---|
| 168 | + {
|
---|
| 169 | + int saved_errno = errno;
|
---|
| 170 | + free (buffer);
|
---|
| 171 | + bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1;
|
---|
| 172 | + buffer = xmalloc (bufalloc);
|
---|
| 173 | + errno = saved_errno;
|
---|
| 174 | + return 0;
|
---|
| 175 | + }
|
---|
| 176 | readbuf = ALIGN_TO (newbuf + 1 + save, pagesize);
|
---|
| 177 | bufbeg = readbuf - save;
|
---|
| 178 | memmove (bufbeg, buffer + saved_offset, save);
|
---|
| 179 | @@ -1739,6 +1754,7 @@
|
---|
| 180 | int opt, cc, status;
|
---|
| 181 | int default_context;
|
---|
| 182 | FILE *fp;
|
---|
| 183 | + char **file_list;
|
---|
| 184 |
|
---|
| 185 | initialize_main (&argc, &argv);
|
---|
| 186 | set_program_name (argv[0]);
|
---|
| 187 | @@ -2061,6 +2077,7 @@
|
---|
| 188 | label = optarg;
|
---|
| 189 | break;
|
---|
| 190 |
|
---|
| 191 | + case MMAP_OPTION:
|
---|
| 192 | case 0:
|
---|
| 193 | /* long options */
|
---|
| 194 | break;
|
---|
| 195 | @@ -2154,29 +2171,29 @@
|
---|
| 196 | if (max_count == 0)
|
---|
| 197 | exit (EXIT_FAILURE);
|
---|
| 198 |
|
---|
| 199 | - if (optind < argc)
|
---|
| 200 | + file_list = (optind == argc ? stdin_argv : &argv[optind]);
|
---|
| 201 | +
|
---|
| 202 | + status = 1;
|
---|
| 203 | + while (1)
|
---|
| 204 | {
|
---|
| 205 | - status = 1;
|
---|
| 206 | - do
|
---|
| 207 | - {
|
---|
| 208 | - char *file = argv[optind];
|
---|
| 209 | - if ((included_patterns || excluded_patterns)
|
---|
| 210 | - && !isdir (file))
|
---|
| 211 | - {
|
---|
| 212 | - if (included_patterns &&
|
---|
| 213 | - ! excluded_file_name (included_patterns, file))
|
---|
| 214 | - continue;
|
---|
| 215 | - if (excluded_patterns &&
|
---|
| 216 | - excluded_file_name (excluded_patterns, file))
|
---|
| 217 | - continue;
|
---|
| 218 | - }
|
---|
| 219 | - status &= grepfile (strcmp (file, "-") == 0 ? (char *) NULL : file,
|
---|
| 220 | - &stats_base);
|
---|
| 221 | - }
|
---|
| 222 | - while ( ++optind < argc);
|
---|
| 223 | + char *file = *file_list++;
|
---|
| 224 | +
|
---|
| 225 | + if (file == NULL)
|
---|
| 226 | + break;
|
---|
| 227 | +
|
---|
| 228 | + if ((included_patterns || excluded_patterns)
|
---|
| 229 | + && !isdir (file))
|
---|
| 230 | + {
|
---|
| 231 | + if (included_patterns &&
|
---|
| 232 | + ! excluded_file_name (included_patterns, file))
|
---|
| 233 | + continue;
|
---|
| 234 | + if (excluded_patterns &&
|
---|
| 235 | + excluded_file_name (excluded_patterns, file))
|
---|
| 236 | + continue;
|
---|
| 237 | + }
|
---|
| 238 | + status &= grepfile (strcmp (file, "-") == 0
|
---|
| 239 | + ? (char *) NULL : file, &stats_base);
|
---|
| 240 | }
|
---|
| 241 | - else
|
---|
| 242 | - status = grepfile ((char *) NULL, &stats_base);
|
---|
| 243 |
|
---|
| 244 | /* We register via atexit() to test stdout. */
|
---|
| 245 | exit (errseen ? EXIT_TROUBLE : status);
|
---|
| 246 | diff -Naur grep-2.6.3.orig/src/pcresearch.c grep-2.6.3/src/pcresearch.c
|
---|
| 247 | --- grep-2.6.3.orig/src/pcresearch.c 2010-04-01 04:15:35.000000000 -0400
|
---|
| 248 | +++ grep-2.6.3/src/pcresearch.c 2010-08-03 22:11:08.137850711 -0400
|
---|
| 249 | @@ -22,8 +22,14 @@
|
---|
| 250 | #include "search.h"
|
---|
| 251 | #if HAVE_PCRE_H
|
---|
| 252 | # include <pcre.h>
|
---|
| 253 | +# ifdef HAVE_DYNAMIC_LIBPCRE
|
---|
| 254 | +# include <dlfcn.h>
|
---|
| 255 | +# endif
|
---|
| 256 | #elif HAVE_PCRE_PCRE_H
|
---|
| 257 | # include <pcre/pcre.h>
|
---|
| 258 | +# ifdef HAVE_DYNAMIC_LIBPCRE
|
---|
| 259 | +# include <dlfcn.h>
|
---|
| 260 | +# endif
|
---|
| 261 | #endif
|
---|
| 262 |
|
---|
| 263 | #if HAVE_LIBPCRE
|
---|
| 264 | @@ -34,6 +40,50 @@
|
---|
| 265 | static pcre_extra *extra;
|
---|
| 266 | #endif
|
---|
| 267 |
|
---|
| 268 | +#ifdef HAVE_DYNAMIC_LIBPCRE
|
---|
| 269 | +
|
---|
| 270 | +# define pcre_compile dl_pcre_compile
|
---|
| 271 | +# define pcre_study dl_pcre_study
|
---|
| 272 | +# define pcre_exec dl_pcre_exec
|
---|
| 273 | +# define pcre_maketables dl_pcre_maketables
|
---|
| 274 | +
|
---|
| 275 | +static pcre *(*pcre_compile)(const char *pattern, int options,
|
---|
| 276 | +const char **errptr, int *erroffset,
|
---|
| 277 | + const unsigned char *tableptr);
|
---|
| 278 | +static pcre_extra *(*pcre_study)(const pcre *code, int options,
|
---|
| 279 | + const char **errptr);
|
---|
| 280 | +static int (*pcre_exec)(const pcre *code, const pcre_extra *extra,
|
---|
| 281 | + const char *subject, int length, int startoffset,
|
---|
| 282 | + int options, int *ovector, int ovecsize);
|
---|
| 283 | +static const unsigned char *(*pcre_maketables)(void);
|
---|
| 284 | +
|
---|
| 285 | +static int
|
---|
| 286 | +map_pcre(void)
|
---|
| 287 | +{
|
---|
| 288 | + void *library;
|
---|
| 289 | +
|
---|
| 290 | + if (pcre_maketables)
|
---|
| 291 | + return 1;
|
---|
| 292 | +
|
---|
| 293 | + if (!(library = dlopen("libpcre.so.3", RTLD_NOW)))
|
---|
| 294 | + return 0;
|
---|
| 295 | +
|
---|
| 296 | + if (!(pcre_compile = dlsym(library, "pcre_compile")))
|
---|
| 297 | + return 0;
|
---|
| 298 | + if (!(pcre_study = dlsym(library, "pcre_study")))
|
---|
| 299 | + return 0;
|
---|
| 300 | + if (!(pcre_exec = dlsym(library, "pcre_exec")))
|
---|
| 301 | + return 0;
|
---|
| 302 | + if (!(pcre_maketables = dlsym(library, "pcre_maketables")))
|
---|
| 303 | + return 0;
|
---|
| 304 | +
|
---|
| 305 | + return 1;
|
---|
| 306 | +}
|
---|
| 307 | +
|
---|
| 308 | +#else
|
---|
| 309 | +#define map_pcre() (1)
|
---|
| 310 | +#endif /* HAVE_DYNAMIC_LIBPCRE */
|
---|
| 311 | +
|
---|
| 312 | void
|
---|
| 313 | Pcompile (char const *pattern, size_t size)
|
---|
| 314 | {
|
---|
| 315 | @@ -51,6 +101,10 @@
|
---|
| 316 | char const *p;
|
---|
| 317 | char const *pnul;
|
---|
| 318 |
|
---|
| 319 | + if (!map_pcre ())
|
---|
| 320 | + error (EXIT_TROUBLE, 0, "%s",
|
---|
| 321 | + _("The -P option is not supported: libpcre.so.3 is not available"));
|
---|
| 322 | +
|
---|
| 323 | /* FIXME: Remove these restrictions. */
|
---|
| 324 | if (memchr(pattern, '\n', size))
|
---|
| 325 | error (EXIT_TROUBLE, 0, _("the -P option only supports a single pattern"));
|
---|