summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* build: avoid compilation failure when building without PCRE supportJim Meyering2011-09-151-1/+1
| | | | | | * src/pcresearch.c [!HAVE_LIBPCRE] (WITHOUT_PCRE_NORETURN): Define to _Noreturn, not obsoleted-by-gnulib _GL_ATTRIBUTE_NORETURN. Reported by Eric Blake.
* tests: stop using skip_test_; use skip_ insteadJim Meyering2011-09-154-18/+8
| | | | | | | | * tests/init.cfg (skip_test_): Remove definition. Use the improved skip_ function from init.sh, now that it has the same feature. * tests/euc-mb: s/skip_test_/skip_/ * tests/sjis-mb: Likewise. * tests/fmbtest: Likewise.
* tests: skip tests that require MBS supportJim Meyering2011-09-158-0/+15
| | | | | | | | | | | | | * tests/init.cfg (require_compiled_in_MB_support): New function. * tests/char-class-multibyte: Use it here, since this test cannot succeed without MBS support. * tests/equiv-classes: Likewise. * tests/euc-mb: Likewise. * tests/fgrep-infloop: Likewise. * tests/init.cfg: Likewise. * tests/prefix-of-multibyte: Likewise. * tests/turkish-I: Likewise. * tests/sjis-mb: Likewise.
* tests: make fmbtest explain (to stderr, not log) why it is skippedJim Meyering2011-09-151-2/+2
| | | | * tests/fmbtest: Use skip_ and fail_ to give better diagnostics.
* maint: dfa: improve commentsJim Meyering2011-09-151-10/+7
| | | | * src/dfa.c (match_mb_charset, match_anychar): Improve comments.
* build: update gnulib submodule to newerJim Meyering2011-09-141-0/+0
|
* maint: correct indentationJim Meyering2011-09-141-7/+9
| | | | | * src/dfa.c (dfaexec): Reposition curly braces to match indentation style. Remove useless comment.
* maint: move declaration "down" to inner scope where it is usedJim Meyering2011-09-141-2/+2
| | | | * src/dfa.c (dfaexec): Move decl of local down into scope where used.
* doc: use "file name" consistently in grep's --help outputJim Meyering2011-09-071-3/+3
| | | | | | | | * src/main.c (usage): Use "file name", not "filename" in descriptions of --with-filename (-H), --no-filename (-h) and --label=LABEL. Suggested by Sequoia McDowell. bug: requires ru_RU.KOI8-R". [bug introduced in grep-2.9]
* tests: remove debug code that would cp to /tMatthew Burgess2011-08-311-1/+0
| | | | | | * tests/unibyte-bracket-expr: Remove debug artifact introduced by 2011-06-02 commit de5f7000, "tests: exercise a uni-byte [...] bug: requires ru_RU.KOI8-R". [bug introduced in grep-2.9]
* build: use largefile module and update to latest gnulibJim Meyering2011-08-204-1/+2
| | | | | | * configure.ac: Remove AC_SYS_LARGEFILE, subsumed by ... * bootstrap.conf (gnulib_modules): ...this. Use largefile module. * gnulib: Update to latest.
* maint: clean up and plug a leak-on-OOMJim Meyering2011-08-201-28/+20
| | | | | | | | | | * src/dfa.c (icatalloc): Clean up; use xrealloc in place of malloc and realloc; remove conditionals that are unnecessary, now that failed allocation results in exit. (enlist): Use xrealloc in place of realloc; remove conditional. (comsubs): Avoid leak upon failed enlist call. (dfamust): Use xmalloc in place of malloc. Remove conditionals, now that icpyalloc and icatalloc never return NULL.
* maint: use x2nrealloc, not xreallocJim Meyering2011-08-201-1/+1
| | | | * src/main.c (main): Use x2nrealloc, not xrealloc
* tests: add a test to trigger the bugJim Meyering2011-07-242-0/+27
| | | | | * tests/Makefile.am (TESTS): Add it. * tests/in-eq-out-infloop: Exercise the bug/fix.
* exit 2 (rather than infloop) when an input file is also on stdoutJim Meyering2011-07-244-2/+74
| | | | | | | | | | | | | | | | | This avoids a potential "infinite" disk-filling loop. Reported in http://savannah.gnu.org/patch/?5316 and http://savannah.gnu.org/bugs/?17457. * src/main.c: Include "quote.h". (out_stat): New global. (grepfile): Compare each regular file's dev/ino/etc. with those from the file on stdout (if it too is regular). (main): Set out_stat, if stdout is a regular file. * src/system.h: Include "same-inode.h". (same_file_attributes): Define. From diffutils. (SAME_REGULAR_FILE): Define. * bootstrap.conf (gnulib_modules): Use quote, not quotearg. Use same-inode. * NEWS (Bug fixes): Mention it.
* doc: improve documentation of character classes in the man pageReuben Thomas2011-07-151-5/+4
| | | | * doc/grep.in.1: Reword documentation of character classes.
* dfa: remove unnecessary inclusion of verify.hJim Meyering2011-07-121-1/+0
| | | | * src/dfa.c: Don't include "verify.h".
* dfa: simplify use of *ALLOC macrosJim Meyering2011-07-121-51/+68
| | | | | * src/dfa.c (XNMALLOC, XCALLOC): Redefine without outer cast-to-(t *). (CALLOC, MALLOC, REALLOC): Remove type "t" parameter and adjust callers.
* dfa: change semantics of REALLOC_IF_NECESSARY's 3rd parameterJim Meyering2011-07-121-9/+10
| | | | | | | | * src/dfa.c (REALLOC_IF_NECESSARY): Change meaning of 3rd param, from "maximum index" to 1 greater than that: the required number of *P-sized elements. Note that only some of the uses of REALLOC_IF_NECESSARY needed to be adjusted, the others had already required an extra element.
* dfa: rename REALLOC_IF_NECESSARY param/local for clarityJim Meyering2011-07-121-5/+5
| | | | | * src/dfa.c (REALLOC_IF_NECESSARY): Rename nalloc and new_nalloc to n_alloc and new_n_alloc.
* dfa: prepare for a semantic change in REALLOC_IF_NECESSARYJim Meyering2011-07-121-20/+19
| | | | | * src/dfa.c (REALLOC_IF_NECESSARY): Remove "t" (type) parameter. Use (*p) instead. Adjust all callers.
* dfa: add braces to REALLOC_IF_NECESSARY definitionJim Meyering2011-07-121-8/+10
| | | | | * src/dfa.c (REALLOC_IF_NECESSARY): Add curly braces; use TABs to right-indent.
* doc: improve documentation of character classesPaolo Bonzini2011-06-291-13/+13
| | | | | | * doc/grep.texi (Character classes): Mention explicitly when examples refer to the C locale, explain better the general meaning of character classes.
* dfa: fix the root cause of the heap overrunJim Meyering2011-06-281-5/+5
| | | | | | | | | | | | | | | | | | dfa's "insert" function was supposed to be maintaining the position list sorted on *decreasing* index, but since the 2009-12-09 "Speed up insert" commit, 62458291, it was using code that assumed the data were sorted on *increasing* index. As such, sometimes it would no longer merge constraints (not finding a match) and would append entries that normally would have matched and been merged. Those erroneous append operations resulted in the heap overrun fixed by 2011-06-17 commit 0b91d692 by doubling the array size. * src/dfa.c (insert): Fix the comparison. (dfaanalyze): Now that that's fixed, revert commit 0b91d692, allocating space for only d->nleaves entries, not double that. As far as I can tell, this change has no effect other than decreased memory usage, although it may improve performance slightly, since the resulting list of positions is half as long as it used to be.
* dfa: use memcpy to copy position_setsPaolo Bonzini2011-06-281-4/+1
| | | | * src/dfa.c (copy): Use memcpy.
* dfa: use copyset to copy charclassesPaolo Bonzini2011-06-281-1/+1
| | | | * src/dfa.c (add_utf8_anychar): Change memcpy to copyset.
* gnulib: UpdatePaolo Bonzini2011-06-282-0/+1
| | | | Fixes mmap-anon.m4 conflict with fn_grep, reported by Rainer Orth.
* maint: update bootstrap from gnulibJim Meyering2011-06-222-7/+7
| | | | | | * bootstrap: Update to latest, so it no longer inserts empty lines in .gitignore files. * .gitignore: Let bootstrap move "!..." lines to end of file.
* post-release administriviaJim Meyering2011-06-213-2/+5
| | | | | | * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
* version 2.9v2.9Jim Meyering2011-06-211-1/+1
| | | | * NEWS: Record release date.
* build: avoid a warning when building with --disable-perl-regexp...Jim Meyering2011-06-211-2/+8
| | | | | | | and --enable-gcc-warnings. * src/pcresearch.c (WITHOUT_PCRE_NORETURN): Define. Remove the unreachable return statement. Reported by Eric Blake.
* tests: ensure that each test script is executableJim Meyering2011-06-2137-0/+11
| | | | | | | | | | | | | | This adds a rule run at "make check" time to ensure that test scripts are consistently executable. This change is not required for "make check", but makes it easier for people to run scripts manually, but that is discouraged because doing so makes it easy to omit important variable settings that are normally provided via TESTS_ENVIRONMENT. This change also makes each of the existing TESTS executable. * tests/Makefile.am (check_executable_TESTS): New rule. (check): Depend on it. * tests/{all_scripts}: chmod 755. Prompted by a report from Eric Blake.
* maint: update bootstrap from gnulibJim Meyering2011-06-211-28/+66
| | | | * bootstrap: Update from gnulib.
* maint: update po/POTFILES.inJim Meyering2011-06-211-1/+0
| | | | | * po/POTFILES.in: Remove dfasearch.c, now that it no longer contains a translatable diagnostic.
* tests: include-exclude: avoid false positive failure on FreeBSDJim Meyering2011-06-211-9/+9
| | | | | | | * tests/include-exclude: Avoid false-positive failure due to matching "a" in a directory on FreeBSD, when searching a directory without "-r". Search for '^aaa$' rather than just 'a'. Adjust test inputs and expected output files accordingly.
* dfa: remove some useless castsJim Meyering2011-06-212-5/+5
| | | | | | | | | | * src/dfa.c (icatalloc): Change type of "old" parameter from "char const *" to "char *". Don't cast-away const on realloc argument. Remove now-unnecessary const-discarding cast. Don't (void)-cast strcpy result. * src/dosbuf.c (undossify_input): Remove anachronistic cast-to-"char *" of realloc argument.
* dfa: more heap-allocation-related overflow protectionJim Meyering2011-06-211-6/+2
| | | | | | | | | | * src/dfa.c (enlist): Use xnrealloc, not realloc. Also, remove unnecessary cast-to-(char *). (dfamust): Use xnmalloc, not malloc. Before, this code would return upon malloc failure (xnmalloc exits upon failure), but later, via the *ALLOC macros, it could already exit, so this new potential exit point is nothing new. The same applies to enlist, since it is called only through dfamust.
* tests: update init.sh; simplify TESTS_ENVIRONMENTJim Meyering2011-06-212-21/+23
| | | | | | | * tests/init.sh: Update from coreutils. * tests/Makefile.am (TESTS_ENVIRONMENT): Remove shell_or_perl_ function. Instead, just use $(SHELL), since grep has no test that starts with #!/usr/bin/perl.
* build: update gnulib submodule to latestJim Meyering2011-06-211-0/+0
|
* build: avoid configure/gnulib-related errorsJim Meyering2011-06-211-32/+0
| | | | | * bootstrap.conf: Remove now-unnecessary code to exclude gettext/intl-related m4 tests.
* maint: tighten up superfluous codeJim Meyering2011-06-191-4/+1
| | | | | * src/main.c (parse_grep_colors): Use xstrdup in place of xmalloc, a useless test, strlen, and strcpy.
* dfa: avoid possibility of overflowPaul Eggert2011-06-193-15/+14
| | | | | | | * src/dfa.c (REALLOC_IF_NECESSARY, CALLOC, MALLOC, REALLOC): Use functions from xalloc.h to avoid overflow. * src/dfasearch.c (GEAcompile): Use xnrealloc rather than realloc. * src/pcresearch.c (Pcompile): Use xnmalloc, not xmalloc.
* build: update gnulib submodule to latestJim Meyering2011-06-182-0/+1
|
* dfa: correct two uses of btowcJim Meyering2011-06-181-2/+2
| | | | | | | * src/dfa.c (setbit_c, setbit_case_fold_c): Compare the btowc return value against WEOF, not EOF. Suggested by Eli Zaretskii. On a system like MinGW with unsigned wint_t, comparing a btowc return value against EOF (-1) would always be false.
* dfa: don't overrun a malloc'd buffer for certain regexpsJim Meyering2011-06-174-3/+32
| | | | | | | | | | | * src/dfa.c (dfaanalyze): Allocate space for twice as many positions as there are leaves. Before this change, for some regular expressions, DFA analysis would have inserted far more "positions" than dfa->nleaves (up to double). Reported by Raymond Russell in http://savannah.gnu.org/bugs/?33547 * tests/dfa-heap-overrun: Trigger the overrun. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.
* tests: don't ignore sjis-mb test failureJim Meyering2011-06-081-3/+3
| | | | | | | | I made changes that caused grep to segfault during "make check" -- as seen in dmesg output -- yet no test failed(!), and there was no trace of the segfault in the logs. * tests/sjis-mb (test_grep_reject): Ensure that output is empty. Don't ignore test failure.
* dfa: optimize wide characters in a bracket expressionPaolo Bonzini2011-06-072-5/+36
| | | | | * src/dfa.c (addtok): Compile characters to an alternation. Handle the case when nothing else remains in the MBCSET.
* dfa: refactor to prepare for upcoming optimizationsPaolo Bonzini2011-06-071-9/+21
| | | | | * src/dfa.c (parse_bracket_exp): Move optimization of MBCSET from here... (addtok): ... to here.
* dfa: correct handling of single-byte character rangesPaolo Bonzini2011-06-071-49/+55
| | | | | | | | | | | | This provides a better fix for the unibyte-bracket-expr and high-bit-range testcases, and fixes the latent bug tested by bogus-wctob. * src/dfa.c (setbit_case_fold): Remove, replace with... (setbit_wc, setbit_c, setbit_case_fold_c): ... these. (parse_bracket_exp): Use setbit_case_fold_c when iterating over single-byte sequences. Use setbit_wc for multi-byte character sets, and setbit_case_fold_c for single-byte character sets. (lex): Use setbit_case_fold_c for single-byte character sets.
* tests: exercise latent bug in character rangesPaolo Bonzini2011-06-072-0/+18
| | | | | * tests/bogus-wctob: New. * Makefile.am (TESTS): Add it.