source: patches/grep-2.6.3-fixes-1.patch@ b369f3c

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since b369f3c was 4cc665a, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Drop the Grep i18n patch and introduce a fixes patch.

  • Property mode set to 100644
File size: 9.1 KB
  • grep-2.6.3

    Submitted By: Joe Ciccone
    Date: 2010-08-03
    Initial Package Version: 2.6.3
    Upstream Status: Unknown
    Origin: http://ftp.de.debian.org/debian/pool/main/g/grep/grep_2.6.3-3.debian.tar.bz2
    Description: Various fixes from debian for Grep
    
    diff -Naur grep-2.6.3.orig/NEWS grep-2.6.3/NEWS
    old new  
    11GNU grep NEWS                                    -*- outline -*-
    22
     3  --mmap was meant to be ignored in 2.6.x, but it was instead
     4  removed by mistake.  [bug introduced in 2.6]
     5
    36* Noteworthy changes in release 2.6.3 (2010-04-02) [stable]
    47
    58** Bug fixes
  • configure

    diff -Naur grep-2.6.3.orig/configure grep-2.6.3/configure
    old new  
    2437224372if test "$ac_res" != no; then :
    2437324373  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
    2437424374  test "$ac_cv_search_pcre_compile" = "none required" ||
    24375          LIB_PCRE=$ac_cv_search_pcre_compile
     24375         LIB="-ldl $LIBS"
    2437624376fi
    2437724377
    2437824378      for ac_func in pcre_compile
    2437924379do :
    2438024380  ac_fn_c_check_func "$LINENO" "pcre_compile" "ac_cv_func_pcre_compile"
    2438124381if test "x$ac_cv_func_pcre_compile" = x""yes; then :
     24382  CPPFLAGS="$CPPFLAGS -DHAVE_DYNAMIC_LIBPCRE"
    2438224383  cat >>confdefs.h <<_ACEOF
    2438324384#define HAVE_PCRE_COMPILE 1
    2438424385_ACEOF
  • doc/grep.in.1

    diff -Naur grep-2.6.3.orig/doc/grep.in.1 grep-2.6.3/doc/grep.in.1
    old new  
    2525.hy 0
    2626.
    2727.SH NAME
    28 grep, egrep, fgrep \- print lines matching a pattern
     28grep, egrep, fgrep, rgrep \- print lines matching a pattern
    2929.
    3030.SH SYNOPSIS
    3131.B grep
     
    5656.B grep
    5757prints the matching lines.
    5858.PP
    59 In addition, two variant programs
    60 .B egrep
    61 and
     59In addition, three variant programs
     60.B egrep,
    6261.B fgrep
     62and
     63.B rgrep
    6364are available.
    6465.B egrep
    6566is the same as
     
    6768.B fgrep
    6869is the same as
    6970.BR "grep\ \-F" .
     71.B rgrep
     72is the same as
     73.BR "grep\ \-r" .
    7074Direct invocation as either
    7175.B egrep
    7276or
     
    825829is not special if it would be the start of an invalid interval
    826830specification.
    827831For example, the command
    828 .B "grep\ \-E\ '{1'"
     832.B "grep\ \-E\ \(aq{1\(aq"
    829833searches for the two-character string
    830834.B {1
    831835instead of reporting a syntax error in the regular expression.
     
    865869For example, if
    866870.B GREP_OPTIONS
    867871is
    868 .BR "'\-\^\-binary-files=without-match \-\^\-directories=skip'" ,
     872.BR "\(aq\-\^\-binary-files=without-match \-\^\-directories=skip\(aq" ,
    869873.B grep
    870874behaves as if the two options
    871875.B \-\^\-binary\-files=without-match
     
    11601164is not set.
    11611165.
    11621166.SH "EXIT STATUS"
    1163 Normally, the exit status is 0 if selected lines are found and 1 otherwise.
    1164 But the exit status is 2 if an error occurred, unless the
    1165 .B \-q
    1166 or
    1167 .B \-\^\-quiet
    1168 or
    1169 .B \-\^\-silent
    1170 option is used and a selected line is found.
    1171 Note, however, that \s-1POSIX\s0 only mandates, for programs such as
    1172 .BR grep ,
    1173 .BR cmp ,
    1174 and
    1175 .BR diff ,
    1176 that the exit status in case of error be greater than 1;
    1177 it is therefore advisable, for the sake of portability,
    1178 to use logic that tests for this general condition
    1179 instead of strict equality with\ 2.
     1167The exit status is 0 if selected lines are found, and 1 if not found.         
     1168If an error occurred the exit status is 2.  (Note: POSIX error
     1169handling code should check for '2' or greater.)
    11801170.
    11811171.SH COPYRIGHT
    11821172Copyright 1998-2000, 2002, 2005-2010 Free Software Foundation, Inc.
  • grep-2.6.3

    diff -Naur grep-2.6.3.orig/po/ca.po grep-2.6.3/po/ca.po
    old new  
    278278#: src/main.c:1165
    279279#, c-format
    280280msgid "Binary file %s matches\n"
    281 msgstr "Concidència en el fitxer binari %s\n"
     281msgstr "Coincidència en el fitxer binari %s\n"
    282282
    283283#: src/main.c:1179
    284284msgid "(standard input)"
  • src/kwset.c

    diff -Naur grep-2.6.3.orig/src/kwset.c grep-2.6.3/src/kwset.c
    old new  
    4040#ifdef GREP
    4141# include "xalloc.h"
    4242# undef malloc
    43 # define malloc(s) xmalloc(s)
     43# define malloc xmalloc
    4444#endif
    4545
    4646#define NCHAR (UCHAR_MAX + 1)
  • src/main.c

    diff -Naur grep-2.6.3.orig/src/main.c grep-2.6.3/src/main.c
    old new  
    266266static char const short_options[] =
    267267"0123456789A:B:C:D:EFGHIPTUVX:abcd:e:f:hiKLlm:noqRrsuvwxyZz";
    268268
     269/* Default for `file_list' if no files are given on the command line. */
     270static char *stdin_argv[] =
     271{
     272  "-", NULL
     273};
     274
    269275/* Non-boolean long options that have no corresponding short equivalents.  */
    270276enum
    271277{
     
    511517         for byte sentinels fore and aft.  */
    512518      newalloc = newsize + pagesize + 1;
    513519
    514       newbuf = bufalloc < newalloc ? xmalloc (bufalloc = newalloc) : buffer;
     520      newbuf = bufalloc < newalloc ? malloc (bufalloc = newalloc) : buffer;
     521      if (newbuf == NULL)
     522        {
     523          int saved_errno = errno;
     524          free (buffer);
     525          bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1;
     526          buffer = xmalloc (bufalloc);
     527          errno = saved_errno;
     528          return 0;
     529        }
    515530      readbuf = ALIGN_TO (newbuf + 1 + save, pagesize);
    516531      bufbeg = readbuf - save;
    517532      memmove (bufbeg, buffer + saved_offset, save);
     
    17391754  int opt, cc, status;
    17401755  int default_context;
    17411756  FILE *fp;
     1757  char **file_list;
    17421758
    17431759  initialize_main (&argc, &argv);
    17441760  set_program_name (argv[0]);
     
    20612077        label = optarg;
    20622078        break;
    20632079
     2080      case MMAP_OPTION:
    20642081      case 0:
    20652082        /* long options */
    20662083        break;
     
    21542171  if (max_count == 0)
    21552172    exit (EXIT_FAILURE);
    21562173
    2157   if (optind < argc)
     2174  file_list = (optind == argc ? stdin_argv : &argv[optind]);
     2175
     2176  status = 1;
     2177  while (1)
    21582178    {
    2159         status = 1;
    2160         do
    2161         {
    2162           char *file = argv[optind];
    2163           if ((included_patterns || excluded_patterns)
    2164               && !isdir (file))
    2165             {
    2166               if (included_patterns &&
    2167                   ! excluded_file_name (included_patterns, file))
    2168                 continue;
    2169               if (excluded_patterns &&
    2170                   excluded_file_name (excluded_patterns, file))
    2171                 continue;
    2172             }
    2173           status &= grepfile (strcmp (file, "-") == 0 ? (char *) NULL : file,
    2174                               &stats_base);
    2175         }
    2176         while ( ++optind < argc);
     2179        char *file = *file_list++;
     2180
     2181        if (file == NULL)
     2182          break;
     2183
     2184        if ((included_patterns || excluded_patterns)
     2185           && !isdir (file))
     2186          {
     2187            if (included_patterns &&
     2188                ! excluded_file_name (included_patterns, file))
     2189              continue;
     2190            if (excluded_patterns &&
     2191                excluded_file_name (excluded_patterns, file))
     2192              continue;
     2193          }
     2194        status &= grepfile (strcmp (file, "-") == 0
     2195                           ? (char *) NULL : file, &stats_base);
    21772196    }
    2178   else
    2179     status = grepfile ((char *) NULL, &stats_base);
    21802197
    21812198  /* We register via atexit() to test stdout.  */
    21822199  exit (errseen ? EXIT_TROUBLE : status);
  • src/pcresearch.c

    diff -Naur grep-2.6.3.orig/src/pcresearch.c grep-2.6.3/src/pcresearch.c
    old new  
    2222#include "search.h"
    2323#if HAVE_PCRE_H
    2424# include <pcre.h>
     25# ifdef HAVE_DYNAMIC_LIBPCRE
     26#  include <dlfcn.h>
     27# endif
    2528#elif HAVE_PCRE_PCRE_H
    2629# include <pcre/pcre.h>
     30# ifdef HAVE_DYNAMIC_LIBPCRE
     31#  include <dlfcn.h>
     32# endif
    2733#endif
    2834
    2935#if HAVE_LIBPCRE
     
    3440static pcre_extra *extra;
    3541#endif
    3642
     43#ifdef HAVE_DYNAMIC_LIBPCRE
     44
     45# define pcre_compile dl_pcre_compile
     46# define pcre_study dl_pcre_study
     47# define pcre_exec dl_pcre_exec
     48# define pcre_maketables dl_pcre_maketables
     49
     50static pcre *(*pcre_compile)(const char *pattern, int options,
     51const char **errptr, int *erroffset,
     52                               const unsigned char *tableptr);
     53static pcre_extra *(*pcre_study)(const pcre *code, int options,
     54                                   const char **errptr);
     55static int (*pcre_exec)(const pcre *code, const pcre_extra *extra,
     56                          const char *subject, int length, int startoffset,
     57                          int options, int *ovector, int ovecsize);
     58static const unsigned char *(*pcre_maketables)(void);
     59
     60static int
     61map_pcre(void)
     62{
     63  void *library;
     64
     65  if (pcre_maketables)
     66    return 1;
     67
     68  if (!(library = dlopen("libpcre.so.3", RTLD_NOW)))
     69    return 0;
     70
     71  if (!(pcre_compile = dlsym(library, "pcre_compile")))
     72    return 0;
     73  if (!(pcre_study = dlsym(library, "pcre_study")))
     74    return 0;
     75  if (!(pcre_exec = dlsym(library, "pcre_exec")))
     76    return 0;
     77  if (!(pcre_maketables = dlsym(library, "pcre_maketables")))
     78    return 0;
     79
     80  return 1;
     81}
     82
     83#else
     84#define map_pcre() (1)
     85#endif /* HAVE_DYNAMIC_LIBPCRE */
     86
    3787void
    3888Pcompile (char const *pattern, size_t size)
    3989{
     
    51101  char const *p;
    52102  char const *pnul;
    53103
     104  if (!map_pcre ())
     105    error (EXIT_TROUBLE, 0, "%s",
     106           _("The -P option is not supported: libpcre.so.3 is not available"));
     107
    54108  /* FIXME: Remove these restrictions.  */
    55109  if (memchr(pattern, '\n', size))
    56110    error (EXIT_TROUBLE, 0, _("the -P option only supports a single pattern"));
Note: See TracBrowser for help on using the repository browser.