summaryrefslogtreecommitdiff
path: root/tests/filename-lineno.pl
Commit message (Collapse)AuthorAgeFilesLines
* maint: update copyright datesJim Meyering2023-01-011-1/+1
|
* maint: make update-copyrightJim Meyering2022-01-011-1/+1
|
* grep: migrate to pcre2Carlo Marcelo Arenas Belón2021-11-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | Mostly a bug by bug translation of the original code to the PCRE2 API. Code still could do with some optimizations but should be good as a starting point. The API changes the sign of some types and therefore some ugly casts were needed, some of the changes are just to make sure all variables fit into the newer types better. Includes backward compatibility and could be made to build all the way to 10.00, but assumes a recent enough version and has been tested with 10.23 (from CentOS 7, the oldest). Performance seems equivalent, and it also seems functionally complete. * m4/pcre.m4 (gl_FUNC_PCRE): Check for PCRE2, not the original PCRE. * src/pcresearch.c (struct pcre_comp, jit_exec) (Pcompile, Pexecute): Use PCRE2, not the original PCRE. * tests/filename-lineno.pl: Adjust to match PCRE2 diagnostics.
* maint: run "make update-copyright"Paul Eggert2021-01-011-1/+1
|
* grep: -P: report input filename upon PCRE execution failureJim Meyering2020-10-111-2/+13
| | | | | | | | | | | | Without this, it could be tedious to determine which input file evokes a PCRE-execution-time failure. * src/pcresearch.c (Pexecute): When failing, include the error-provoking file name in the diagnostic. * src/grep.c (input_filename): Make extern, since used above. * src/search.h (input_filename): Declare. * tests/filename-lineno.pl: Test for this. ($no_pcre): Factor out. * NEWS (Bug fixes): Mention this.
* tests: correct filename-lineno.plJim Meyering2020-10-051-1/+1
| | | | | * tests/filename-lineno.pl: Remove a stray envvar that somehow slipped into expected output string.
* tests: fix tests when PCRE is not usedPaul Eggert2020-10-051-3/+3
| | | | | | | | | * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH before setting PCRE_WORKS, so that the latter test uses the just-built grep. * tests/filename-lineno.pl (invalid-re-P-paren) (invalid-re-P-star-paren): Adjust non-PCRE case to match recently-changed behavior.
* tests: restore deleted -P testsJim Meyering2020-09-281-0/+13
| | | | | | | | | | | v3.4-almost-45-g8577dda deleted these two -P-using tests because a grep built without PCRE support would fail those tests. This sets an envvar with the equivalent of the result from the require_pcre_ function and restores the now-guarded tests. Tested by running this: ./configure --disable-perl-regexp && make check * tests/Makefile.am (PCRE_WORKS): Set this envvar. * tests/filename-lineno.pl: Restore invalid-re-P-paren and invalid-re-P-star-paren, now each with a guard.
* grep: don't assume PCRE in testsPaul Eggert2020-09-231-6/+0
| | | | | | | * tests/filename-lineno.pl: Remove invalid-re-P-paren and invalid-re-P-star-paren as they assume PCRE support, which causes a false alarm "grep: Perl matching not supported in a --disable-perl-regexp build" on platforms without PCRE.
* grep: "grep '\)'" reports an error againPaul Eggert2020-09-181-0/+16
| | | | | | | * src/grep.c (try_fgrep_pattern): With -G, pass \) through to GEAcompile so that it can complain. This fixes an unexpected change in behavior from grep 3.4 and earlier. * tests/filename-lineno.pl: Add tests for this sort of thing.
* Omit duplicate regexpsPaul Eggert2020-09-071-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not pass two copies of the same regexp to the regular-expression engine. Although the engines should perform nearly as well even with the copies, in practice they do not. Problem reported by Luca Borzacchiello (Bug#43040). * bootstrap.conf (gnulib_modules): Add hash. * src/grep.c: Include stdint.h, for SIZE_WIDTH. Include hash.h. (struct patloc, patloc, patlocs_allocated, patlocs_used): Rename from struct FL_pair, fl_pair, n_fl_pair_slots, n_pattern_files, respectively, since the data type is no longer a pair. All uses changed. (struct patloc): New member FILELINE. The lineno member is now ptrdiff_t since nowadays we prefer signed types. (pattern_array, patterns_table): New static vars. (count_nl_bytes, fl_add): Remove; no longer used. (hash_pattern, compare_patterns, update_patterns): New functions. update_patterns does what fl_add used to do, plus remove dups. (pattern_file_name): Adjust to change from fl_pair to patloc. (main): Move some variables to inner blocks for clarity. Maintain the pattern_table hash of all patterns. Update pattern_array to match keys, and use update_patterns instead of fl_add to remove duplicate keys. * tests/filename-lineno.pl (invalid-re-2-files) (invalid-re-2-files2, invalid-re-2e): Ensure regexps are unique in tests so that dups aren’t removed in diagnostics. (invalid-re-line-numbers): New test.
* maint: update all copyright year number rangesJim Meyering2020-01-011-1/+1
| | | | | | | | Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * doc/grep.in.1: Use "-" in copyright year ranges, not \en.
* maint: update all copyright dates via "make update-copyright"Jim Meyering2019-01-011-1/+1
| | | | * gnulib: Also update submodule for its copyright updates.
* maint: update URLsPaul Eggert2018-04-211-1/+1
| | | | | Mostly this is just changing http: to https:. In one or two places it removes no-longer-useful URLs.
* maint: update gnulib and copyright dates for 2018Jim Meyering2018-01-061-1/+1
| | | | | | * gnulib: Update to latest. * all files: Run "make update-copyright". * bootstrap: Update from gnulib.
* tests: avoid false failures when run in qemu user modeJim Meyering2017-07-011-0/+3
| | | | | | | | | | * tests/filename-lineno.pl: Derive the program name that grep will use in diagnostics, based on a suggestion from Assaf Gordon. * tests/in-eq-out-infloop: Similar: accept an arbitrary "command_name: " prefix on checked diagnostics, rather than requiring "grep: ". * tests/reversed-range-endpoints: Likewise. * tests/write-error-msg: Likewise. Reported by Bruno Haible in http://bugs.gnu.org/27532
* maint: update gnulib and copyright dates for 2017Jim Meyering2017-01-011-1/+1
| | | | | * gnulib: Update to latest. * all files: Run "make update-copyright".
* grep: print "filename:lineno:" in invalid-regex diagnosticJim Meyering2016-07-251-0/+80
Determining the file name and line number is a little tricky because of the way the regular expressions are all concatenated onto a newline- separated list. By the time grep would compile regular expressions, the <filename,lineno> origin of each regexp was no longer available. This patch adds a list of filename,first_lineno pairs, one per input source, by which we can then map the ordinal regexp number to a filename,lineno pair for the diagnostic. * src/dfasearch.c (GEAcompile): When diagnosing an invalid regexp specified via -f FILE, include the "FILENAME:LINENO: " prefix. Also, when there are two or more lines with compilation failures, diagnose all of them, rather than stopping after the first. * src/grep.h (pattern_file_name): Declare it. * src/grep.c: (struct FL_pair): Define type. (fl_pair, n_fl_pair_slots, n_pattern_files, patfile_lineno): Define globals. (fl_add, pattern_file_name): Define functions. (main): Call fl_add for each type of the following: -e argument, -f argument, command-line-specified (without -e) regexp. * tests/filename-lineno.pl: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Improvements): Mention this. Initially reported by Gunnar Wolf in https://bugs.debian.org/525214 Forwarded to grep's bug list by Santiago Ruano Rincón as http://debbugs.gnu.org/23965