VirtualBox

source: kBuild/vendor/grep/2.12/ChangeLog@ 3627

Last change on this file since 3627 was 2595, checked in by bird, 13 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 160.3 KB
Line 
12012-04-23 Jim Meyering <meyering@redhat.com>
2
3 version 2.12
4 * NEWS: Record release date.
5
6 build: update gnulib submodule to latest
7
8 tests: skip annoyingly long gnulib lock tests
9 * bootstrap.conf (avoided_gnulib_modules): Define.
10 (gnulib_tool_option_extras): Use it.
11
122012-04-22 Jim Meyering <meyering@redhat.com>
13
14 tests: avoid spurious quote-mismatch failure on OS/X
15 * tests/in-eq-out-infloop: Simplify expected error output, eliminating
16 expected quotes altogether, thus avoiding spurious OS/X-specific
17 failure due to mismatch of multi-byte vs. single-byte quotes.
18
192012-04-17 Jim Meyering <meyering@redhat.com>
20
21 build: update gnulib submodule to latest
22 * bootstrap: Also update this file.
23
242012-04-17 Jim Meyering <meyering@redhat.com>
25
26 grep: fix --devices=ACTION (-D) so stdin is once again exempt
27 An oversight in the 2.11 changes made it so "echo x|grep x" would
28 fail for those who set GREP_OPTIONS=--devices=skip.
29
30 * src/main.c (grepdesc): Ignore skip-related options when reading
31 from standard input.
32 * tests/skip-device: New file. Test for the above.
33 * tests/Makefile.am (TESTS): Add it.
34 * doc/grep.texi (File and Directory Selection): Clarify this point,
35 documenting the stdin exemption.
36 * NEWS (Bug fixes): Mention it, and add a few "[fixed in ...] notes.
37 Reported by Tino Keitel in http://bugs.debian.org/669084,
38 and forwarded to bug-grep by Aníbal Monsalve Salazar.
39
402012-04-13 Jim Meyering <meyering@redhat.com>
41
42 maint: dfa: correct bogus formatting
43 * src/dfa.c (transit_state, dfaexec): s/++ * VAR/++*VAR/
44
45 maint: dfa: add/improve comments
46 * src/dfa.c (transit_state_consume_1char): Note always-ignored
47 return value.
48 Fix typos: s/equivalent class/equivalence class/.
49
50 maint: dfa: avoid unnecessary uses of strcpy/strncpy
51 * src/dfa.c (icatalloc): Use memcpy, not strcpy, given the length.
52 (dfamust): Combine MALLOC+strcpy into cleaner xmemdup.
53 (parse_bracket_exp): Likewise, but replace a use of strncpy.
54
55 grep: handle symlinked directory loops as usual
56 * src/main.c (grepfile): Treat EMLINK just like ELOOP, for
57 systems like FreeBSD 9.0 on which we would otherwise report
58 "Too many links" rather than ignoring that type of failure.
59 E.g., "mkdir d; cd d; ln -s . a; grep -r ^" would print
60 grep: a: Too many links and would exit with status 2.
61 Now, it prints nothing and exits with status 1, as before.
62 Reported by Nelson H. F. Beebe.
63
64 tests: avoid spurious failure of the symlink test
65 * tests/symlink: Ignore spurious "Binary file d matches" on
66 systems for which reading from a directory actually succeeds.
67 Reported by Bruno Haible and Nelson Beebe.
68
692012-04-09 Jim Meyering <meyering@redhat.com>
70
71 tests: avoid syntax-check failure: reverse compare arguments
72 * tests/repetition-overflow: Fix reversed compare arguments.
73
74 build: update gnulib submodule to latest
75
762012-03-19 Paul Eggert <eggert@cs.ucla.edu>
77
78 grep: report overflow for ERE a{1000000000}
79 * NEWS: Document this.
80 * src/dfa.c (MIN): New macro.
81 (lex): Lexically analyze the repeat-count operator once, not
82 twice; the double-scan complicated the code and made it harder to
83 understand and fix. Adjust the repeat-count parsing so that it
84 better matches the behavior of the regex code, in three ways:
85 1. Diagnose too-large repeat counts rather than treating them as
86 literal characters. 2. Use RE_INVALID_INTERVAL_ORD, not
87 RE_NO_BK_BRACES, to decide whether to treat invalid-syntax {...}s
88 as literals. 3. Use the same wording for {...}-related
89 diagnostics that the regex code uses.
90 * tests/bre.tests, tests/ere.tests, tests/repetition-overflow:
91 Adjust to match new behavior, and add a few tests.
92 * cfg.mk (exclude_file_name_regexp--sc_error_message_uppercase):
93 New macro, since the diagnostics start with uppercase letters.
94
952012-03-15 Paul Eggert <eggert@cs.ucla.edu>
96
97 grep: -r no longer follows symlinks; use fts
98 Change -r to follow only command-line symlinks, and by default to
99 read only devices named on the command line. This is a simple
100 way to get a more-useful behavior when searching random
101 directories; the idea is to use 'find' if you want something fancy.
102 -R acts as before and gets a new alias --dereference-recursive.
103 The code now uses fts internally, so it is more robust and
104 faster with large hierarchies.
105 * .gitignore: Remove lib/savedir.c, lib/savedir.h.
106 * tests/symlink: New file
107 * Makefile.boot (LIB_OBJS_core): Remove isdir.o, savedir.o.
108 Perhaps other changes are needed too, but I'm not sure what
109 this makefile is for.
110 * NEWS: Document changes.
111 * doc/grep.texi (File and Directory Selection): Likewise.
112 * bootstrap.conf (gnulib_modules): Remove dirent, dirname, isdir, open.
113 Add fstatat, fts, openat-safer.
114 * lib/Makefile.am (libgreputils_a_SOURCES): Remove savedir.c, savedir.h.
115 * lib/savedir.c, lib/savedir.h: Remove.
116 * po/POTFILES.in: Add lib/openat-die.c.
117 * src/main.c: Include fcntl-safer.h, fts_.h. Don't include
118 isdir.h, savedir.h.
119 (struct stats, stats_base): Remove.
120 (long_options, usage, main): Add --dereference-recursive and
121 implement -r vs -R.
122 (filename_prefix_len, fts_options): New static vars.
123 (basic_fts_options, READ_COMMAND_LINE_DEVICES): New constants.
124 (devices): Now defaults to READ_COMMAND_LINE_DEVICES.
125 (reset, grep): Now takes just struct stat rather than file name and
126 struct stats. All callers changed.
127 (fillbuf): Now takes struct stat reather than struct stats.
128 All callers changed.
129 (grep): Don't worry about recursing too deeply; fts and grepdesc
130 handle this now.
131 (is_device_mode, grepdirent, grepdesc, grep_command_line_args):
132 New functions.
133 (grepfile): New args DIRDESC, FOLLOW, COMMAND_LINE. Remove struct stats
134 arg. All callers changed. Use openat_safer rather than open.
135 Use desc == STDIN_FILENO to tell whether we're reading "-".
136 Don't worry about EINTR when closing -- not possible, since we're
137 not catching signals.
138 * tests/Makefile.am (TESTS): Add symlink.
139 * tests/symlink: New file.
140
1412012-03-12 Paul Eggert <eggert@cs.ucla.edu>
142
143 tests: port big-match to non-GNU dd
144 * tests/big-match: Don't assume GNU dd extension "bs=1M".
145
146 tests: test for bug with -r --exclude-dir and no file operand
147 * tests/include-exclude: Test for the bug and fix.
148
1492012-03-12 Allan McRae <allan@archlinux.org>
150
151 grep: fix segfault with -r --exclude-dir and no file operand
152 * src/main.c (grepdir): Don't invoke excluded_file_name on NULL.
153 * NEWS (Bug fixes): Mention it.
154
1552012-03-09 Jim Meyering <meyering@redhat.com>
156
157 tests: exercise two recently-fixed bugs
158 * tests/repetition-overflow: New test for bugs fixed by commit
159 v2.10-82-gcbbc1a4.
160 * tests/Makefile.am (TESTS): Add it.
161
1622012-03-03 Jim Meyering <meyering@redhat.com>
163
164 maint: use an optimal-for-grep xz compression setting
165 * cfg.mk (XZ_OPT): Use -6e (determined empirically, see comments).
166 This sacrifices a meager 60 bytes of compressed tarball size for a
167 55-MiB decrease in the memory required during decompression. I.e.,
168 using -9e would shave off only 60 bytes from the tar.xz file, yet
169 would force every decompression process to use 55 MiB more memory.
170
171 build: update gnulib submodule to latest
172
1732012-03-02 Jim Meyering <meyering@redhat.com>
174
175 maint: post-release administrivia
176 * NEWS: Add header line for next release.
177 * .prev-version: Record previous version.
178 * cfg.mk (old_NEWS_hash): Auto-update.
179
180 version 2.11
181 * NEWS: Record release date.
182
183 tests: avoid failure when using Solaris 10's sed
184 * tests/reversed-range-endpoints: Use a simpler sed expression to
185 sanitize actual output, so it also works with Solaris 10's /bin/sed.
186
187 maint: manually correct formatting in dfa.c's cpp definitions
188 * src/dfa.c: Adjust formatting in cpp definitions.
189
190 maint: indent dfa.c
191 * src/dfa.c: Filter through indent like this:
192 HOME=. indent -Tsize_t -l79 --leave-preprocessor-space \
193 --dont-format-comments --no-tabs < dfa.c > k && mv k dfa.c
194
195 doc: correct grep.1's descriptions of \w and \W (they omitted "_")
196 * doc/grep.in.1: Fix descriptions of \w and \W.
197 They did not mention "_".
198 * doc/grep.texi (The Backslash Character and Special Expressions):
199 [\w, \W]: List the "_" before the char class, not after: [_[:alnum:]],
200 for readability and to be consistent with the man page.
201
2022012-03-02 Paul Eggert <eggert@cs.ucla.edu>
203
204 maint: spelling fixes
205
2062012-03-01 Paul Eggert <eggert@cs.ucla.edu>
207
208 grep: fix integer-overflow issues in main program
209 * NEWS: Document this.
210 * bootstrap.conf (gnulib_modules): Add inttypes, xstrtoimax.
211 Remove xstrtoumax.
212 * src/main.c: Include <inttypes.h>, for INTMAX_MAX, PRIdMAX.
213 (context_length_arg, prtext, grepbuf, grep, grepfile)
214 (get_nondigit_option, main):
215 Use intmax_t, not int, for line counts.
216 (context_length_arg, main): Silently ceiling line counts
217 to maximum value, since there's no practical difference between
218 doing that and using infinite-precision arithmetic.
219 (out_before, out_after, pending): Now intmax_t, not int.
220 (max_count, outleft): Now intmax_t, not off_t.
221 (prepend_args, prepend_default_options, main):
222 Use size_t, not int, for sizes.
223 (prepend_default_options): Check for int and size_t overflow.
224
225 grep: avoid mishandling of long lines
226 * src/pcresearch.c (Pexecute): Do not pass a line longer than
227 INT_MAX to pcre_exec, since its API does not permit that.
228
229 grep: remove no-longer-used setrlimit code
230 This code has been unused and obsolescent ever since the regex
231 code stopped using the stack for large regular expressions.
232 * src/main.c [HAVE_SETRLIMIT]: Do not include <sys/time.h> or
233 or <sys/resource.h>; no longer needed.
234 (set_rlimits): Remove. All callers changed.
235
236 grep: fix some core dumps with long lines etc.
237 These problems mostly occur because the code attempts to stuff
238 sizes into int or into unsigned int; this doesn't work on most
239 64-bit hosts and the errors can lead to core dumps.
240 * NEWS: Document this.
241 * src/dfa.c (token): Typedef to ptrdiff_t, since the enum's
242 range could be as small as -128 .. 127 on practical hosts.
243 (position.index): Now size_t, not unsigned int.
244 (leaf_set.elems): Now size_t *, not unsigned int *.
245 (dfa_state.hash, struct mb_char_classes.nchars, .nch_classes)
246 (.nranges, .nequivs, .ncoll_elems, struct dfa.cindex, .calloc, .tindex)
247 (.talloc, .depth, .nleaves, .nregexps, .nmultibyte_prop, .nmbcsets):
248 (.mbcsets_alloc): Now size_t, not int.
249 (dfa_state.first_end): Now token, not int.
250 (state_num): New type.
251 (struct mb_char_classes.cset): Now ptrdiff_t, not int.
252 (struct dfa.utf8_anychar_classes): Now token[5], not int[5].
253 (struct dfa.sindex, .salloc, .tralloc): Now state_num, not int.
254 (struct dfa.trans, .realtrans, .fails): Now state_num **, not int **.
255 (struct dfa.newlines): Now state_num *, not int *.
256 (prtok): Don't assume 'token' is no wider than int.
257 (lexleft, parens, depth): Now size_t, not int.
258 (charclass_index, nsubtoks)
259 (parse_bracket_exp, addtok, copytoks, closure, insert, merge, delete)
260 (state_index, epsclosure, state_separate_contexts)
261 (dfaanalyze, dfastate, build_state, realloc_trans_if_necessary)
262 (transit_state_singlebyte, match_anychar, match_mb_charset)
263 (check_matching_with_multibyte_ops, transit_state_consume_1char)
264 (transit_state, dfaexec, free_mbdata, dfaoptimize, dfafree)
265 (freelist, enlist, addlists, inboth, dfamust):
266 Don't assume indexes fit in 'int'.
267 (lex): Avoid overflow in string-to-{hi,lo} conversions.
268 (dfaanalyze): Redo indexing so that it works with size_t values,
269 which cannot go negative.
270 * src/dfa.h (dfaexec): Count argument is now size_t *, not int *.
271 (dfastate): State numbers are now ptrdiff_t, not int.
272 * src/dfasearch.c: Include "intprops.h", for TYPE_MAXIMUM.
273 (kwset_exact_matches): Now size_t, not int.
274 (EGexecute): Don't assume indexes fit in 'int'.
275 Check for overflow before converting a ptrdiff_t to a regoff_t,
276 as regoff_t is narrower than ptrdiff_t in 64-bit glibc (contra POSIX).
277 Check for memory exhaustion in re_search rather than treating
278 it merely as failure to match; use xalloc_die () to report any error.
279 * src/kwset.c (struct trie.accepting): Now size_t, not unsigned int.
280 (struct kwset.words): Now ptrdiff_t, not int.
281 * src/kwset.h (struct kwsmatch.index): Now size_t, not int.
282
283 tests: test for problems with long matches
284 The new test is expensive, so add a category of expensive tests,
285 which are normally not run, and put the new test in this new
286 category. The idea of having expensive tests is taken from coreutils.
287 * HACKING: Mention RUN_EXPENSIVE_TESTS and similar env vars.
288 * Makefile.am (check-expensive): New rule.
289 * tests/Makefile.am (TESTS): Add big-match.
290 * tests/init.cfg (expensive_): New function, from coreutils.
291 * tests/big-match: New file.
292
2932012-02-29 Paul Eggert <eggert@cs.ucla.edu>
294
295 maint: use gnulib _Noreturn rather than __attribute__ ((noreturn))
296 * src/grep.h (__attribute__): Remove.
297 * src/dfa.h (__attribute__): Likewise.
298 (dfaerror): Use noreturn rather than __attribute__ ((noreturn)).
299 * src/main.c (usage): Likewise.
300
3012012-02-26 Jim Meyering <meyering@redhat.com>
302
303 build: update submodule, bootstrap, tests/init.sh from gnulib
304 * gl/lib/regcomp.c.diff: Adjust.
305 * bootstrap: Update from gnulib.
306 * tests/init.sh: Update from gnulib.
307
3082012-02-26 Paolo Bonzini <bonzini@gnu.org>
309
310 dfa: merge calls to SUCCEEDS_IN_CONTEXT
311 * src/dfa.c (state_index): use a single call to SUCCEEDS_IN_CONTEXT.
312
313 dfa: fix a subtle constraint encoding bug
314 * src/dfa.c (SUCCEEDS_IN_CONTEXT, PREV_NEWLINE_DEPENDENT,
315 PREV_LETTER_DEPENDENT): Rewrite to handle all 3*3=9 possible
316 combinations of previous and next character contexts.
317 (MATCHES_NEWLINE_CONTEXT, MATCHES_LETTER_CONTEXT): Remove.
318 (NO_CONSTRAINT, BEGLINE_CONSTRAINT, ENDLINE_CONSTRAINT,
319 BEGWORD_CONSTRAINT, ENDWORD_CONSTRAINT, LIMWORD_CONSTRAINT,
320 NOTLIMWORD_CONSTRAINT): Switch to new encoding.
321 * NEWS: Document resulting bugfix.
322 * tests/spencer1.tests: Add regression test.
323
324 dfa: do not use MATCHES_*_CONTEXT directly
325 * src/dfa.c (dfastate): Use SUCCEEDS_IN_CONTEXT.
326
327 dfa: change meaning of a state context
328 * src/dfa.c (MATCHES_NEWLINE_CONTEXT, MATCHES_LETTER_CONTEXT): New.
329 (state_separate_contexts): Remove second argument.
330 (state_index): Do not mask away CTX_NONE.
331 (dfaanalyze): Adjust call to state_index and state_separate_contexts.
332 (dfastate): Adjust calls to state_index and state_separate_contexts.
333
3342012-02-13 Paul Eggert <eggert@cs.ucla.edu>
335
336 tests: fix loop in epipe test
337 * tests/epipe: Don't loop forever if the bug is present.
338 Problem reported by Jaroslav Skarvada.
339
3402012-02-08 Paul Eggert <eggert@cs.ucla.edu>
341
342 tests: work portably even if SIGPIPE is ignored
343 * tests/epipe: Don't rely on "trap - PIPE"; that's not portable.
344 Problem reported by Eric Blake in
345 <http://lists.gnu.org/archive/html/bug-grep/2012-02/msg00017.html>.
346 Also, use "ls -al" rather than "echo", in case "echo" is done by a
347 buggy shell that ignores write errors. And close grep's fd 3, as
348 a sanity check.
349
350 tests: work even if SIGPIPE is ignored
351 * tests/epipe: Do not infinite-loop if SIGPIPE is already ignored.
352 It could be that the invoker of 'make check' ignores SIGPIPE,
353 for example.
354
3552012-02-05 Jim Meyering <meyering@redhat.com>
356
357 build: accommodate -Wshadow and -Werror=suggest-attribute=pure
358 * src/dfa.c (state_separate_contexts): Add _GL_ATTRIBUTE_PURE.
359 (dfaexec): Rename parameter, s/newline/allow_nl/, to avoid
360 shadowing the global.
361
3622012-02-05 Paolo Bonzini <bonzini@gnu.org>
363
364 dfa: refactor common context computations
365 * src/dfa.c (CTX_ANY, charclass_context, state_separate_contexts): New.
366 (dfaanalyze): Use state_separate_contexts.
367 (dfastate): Use charclass_context and state_separate_contexts. Rename
368 prev_context to separate_contexts.
369
370 dfa: change newline/letter to a single context value
371 * src/dfa.c (MATCHES_NEWLINE_CONTEXT, MATCHES_LETTER_CONTEXT,
372 SUCCEEDS_IN_CONTEXT, ACCEPTS_IN_CONTEXT): Take a single context value
373 for prev and curr.
374 (struct dfa_state): Replace newline and letter with context.
375 (wchar_context): New.
376 (state_index): Replace newline and letter with context. Compare
377 context values in the state struct. Adjust calls to pass contexts.
378 (wants_newline): Replace with wanted_context. Adjust calls to pass
379 contexts.
380 (dfastate): Replace wants_newline and wants_letter with wanted_context.
381 Adjust calls to pass contexts.
382 (build_state): Adjust calls to pass contexts.
383 (match_anychar, match_mb_charset, transit_state): Use wchar_context.
384 Adjust calls to pass contexts.
385
3862012-02-05 Paolo Bonzini <bonzini@gnu.org>
387
388 dfa: introduce contexts for the values in d->success
389 Also initialize all tables in a single place in dfasyntax.
390
391 * src/dfa.c (CTX_NONE, CTX_LETTER, CTX_NEWLINE, char_context): New.
392 (sbit, letters, newline): New.
393 (dfasyntax): Fill them.
394 (dfastate): Remove letters, newline, initialized.
395 (build_state): Use CTX_* constants.
396 (dfaexec): Remove sbit and sbit_init.
397
3982012-02-05 Paolo Bonzini <bonzini@gnu.org>
399
400 dfa: remove useless check
401 * src/dfa.c (state_index): There is nothing that is a newline *and*
402 a letter. Remove redundant call to SUCCEEDS_IN_CONTEXT.
403
4042012-01-22 Jim Meyering <meyering@redhat.com>
405
406 build: update bootstrap from gnulib and adapt
407 * bootstrap: Update from gnulib.
408 * tests/init.sh: Update from gnulib.
409 * bootstrap.conf (bootstrap_epilogue): Remove now-unnecessary,
410 snippet that edited gnulib-tests/gnulib.mk.
411 (gnulib_tool_option_extras): Add both --symlink and
412 --makefile-name=gnulib.mk. Remove use of $bt.
413 * lib/Makefile.am: Initialize numerous automake variables so that
414 generated code in gnulib.mk may use += to append to them.
415
416 maint: convert `this' to 'this' quoting style in diagnostics
417 Now that gnulib's quote and quotearg modules use 'this' style,
418 change the few explicit uses in diagnostics to conform.
419 * src/egrep.c (after_options): Use 'this' style of quotes.
420 * src/fgrep.c (after_options): Likewise.
421 * src/grep.c (after_options): Likewise.
422 * src/main.c (usage): Likewise.
423
424 build: update gnulib to latest; adjust quoting in tests
425 * gnulib: Update.
426 * tests/in-eq-out-infloop: Convert expected diagnostics to match
427 new quoting.
428
4292012-01-22 Paul Eggert <eggert@cs.ucla.edu>
430
431 doc: document recent diagnostics-related changes
432 * NEWS: Document changes re diagnostics related to GREP_COLORS,
433 directory loops, -s, "write error".
434
435 grep: be quiet about GREP_COLORS syntax
436 * src/main.c (struct color_cap): fct now returns void,
437 since there's no longer need to use what it returns.
438 (color_cap_mt_fct, color_cap_rv_fct, color_cap_ne_fct): Return void.
439 (parse_grep_colors): Do not output diagnostics and then exit with
440 status 0. Instead, ignore errors in GREP_COLORS. This is more
441 consistent with programs that (e.g.) ignore errors in termcap entries,
442 and it's more internally-consistent as some GREP_COLORS errors
443 were ignored but not others.
444
445 grep: exit with nonzero status if directory loop
446 * src/main.c (grepdir): Exit with status 2 if a directory loop is
447 found, since the output might not be "right" (i.e., infinite...).
448
449 grep: suppress read errors if -s
450 * src/main.c (reset, grep, grepfile): Do not report an input error
451 if -s is given.
452
453 grep: don't say "write error" over and over
454 Problem reported by Travis Gummels in
455 <https://bugzilla.redhat.com/show_bug.cgi?id=741452>.
456 * src/main.c (write_error_seen): New static var.
457 (clean_up_stdout): New function.
458 (prline): Do not output 'write error' more than once; exit
459 after the first one. Use the same wording for the diagnostic
460 that close_stdout uses.
461 (main): Clean up with clean_up_stdout, not close_stdout, so that
462 grep doesn't output multiple "write error" diagnostics.
463 * tests/Makefile.am (TESTS): Add epipe.
464 * tests/epipe: New file.
465
4662012-01-12 Paul Eggert <eggert@cs.ucla.edu>
467
468 dfa: non-glibc word-constituent unibyte fix
469 * src/dfa.c (is_valid_unibyte_character): Fix typo that caused
470 this to incorrectly return 0 on unibyte non-glibc systems.
471 Problem reported by Aharon Robbins in
472 <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00084.html>.
473
4742012-01-04 Paul Eggert <eggert@cs.ucla.edu>
475
476 doc: document empty pattern better
477 * doc/grep.texi (Top, Fundamental Structure, Usage):
478 Explain how grep deals with the empty pattern.
479 Problem spotted by Bernhard Voelker in
480 <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00050.html>.
481
482 grep: with no args, search "." only if command-line -r
483 * NEWS: Document this.
484 * doc/grep.texi (Environment Variables, grep Programs): Likewise.
485 * src/main.c (usage): Likewise.
486 (main): Implement this.
487 (prepend_default_options): Return a count of prepended options.
488 * tests/r-dot: Test the above.
489
4902012-01-03 Jim Meyering <meyering@redhat.com>
491
492 tests: adjust test to match code, now that --mmap writes to stderr
493 * tests/ignore-mmap: Separate stdout and stderr; test both.
494
495 deprecate the --mmap option
496 * src/main.c (main): Deprecate the --mmap option: issue a warning
497 when it is used.
498 (usage): Change description.
499 * doc/grep.texi (Other Options): Document the new behavior.
500 * NEWS (Changes in behavior): Mention it.
501
5022012-01-03 Paolo Bonzini <bonzini@gnu.org>
503
504 dfa: fix incorrect comment
505 * src/dfa.c (dfastate): Fix comment for newline.
506
507 dfa: fix rebase conflict
508 * src/dfa.c (dfaanalyze): Fix reference to nalloc.
509
510 dfa: automatically resize position_sets
511 * src/dfa.c (insert, copy, merge): Resize arrays here.
512 (dfaanalyze): Do not track number of allocated elements here.
513 (dfastate): Allocate mbps with only one element.
514
515 dfa: change position_set nelem to size_t
516 * src/dfa.c (REALLOC_IF_NECESSARY): Disable assertion, to avoid
517 warnings from -Wtype-limits.
518 (position_set): Change nelem to a size_t.
519
520 dfa: move nalloc to position_set structure
521 * src/dfa.c (position_set): Add alloc.
522 (alloc_position_set): Initialize it.
523 (dfaanalyze): Use it instead of the nalloc array or nelem.
524
525 dfa: remove dead assignment
526 * src/dfa.c (transit_state): transit_state_consume_1char will clear follows,
527 do not do this ourselves.
528
529 dfa: introduce alloc_position_set
530 * src/dfa.c (alloc_position_set): New function, use it throughout.
531
532 dfa: use a more compact data type for grps
533 * src/dfa.c (leaf_set): New.
534 (dfastate): Use the smaller type, leaf_set, for grps. Its prior type
535 contained an unused constraint field.
536
537 dfa: use MALLOC/REALLOC always
538 src/dfa.c (dfastate, enlist, dfamust): Use MALLOC and REALLOC.
539
540 dfa: remove unnecessary braces
541 * src/dfa.c (dfastate): Remove unnecessary braces.
542
543 dfa: x2nrealloc starting from a NULL pointer works
544 * src/dfa.c (parse_bracket_exp): Do not MALLOC mbcset parts the first time
545 they are encountered. Initialize chars_al correctly.
546
5472012-01-03 Jim Meyering <meyering@redhat.com>
548
549 build: avoid build failure with --enable-gcc-warnings and recent gcc
550 * lib/colorize-posix.c: Disable -Wsuggest-attribute=const, to avoid
551 warning about this empty init_colorize function.
552
5532012-01-03 Paolo Bonzini <bonzini@gnu.org>
554
555 remove lib/ms/
556 * configure.ac: Create lib/colorize.c as a symbolic link.
557 * lib/colorize-posix.c: New name of lib/colorize-impl.c.
558 * lib/colorize-w32.c: New name of lib/ms/colorize-impl.c.
559 * lib/colorize.c: Delete.
560 * lib/Makefile.am (EXTRA_DIST): Adjust.
561 * .gitignore: Adjust.
562 * cfg.mk: Adjust syntax-check exclusions.
563
564 unify colorize.h headers
565 * lib/Makefile.am (EXTRA_DIST): Adjust.
566 * lib/colorize.h: Remove inline functions.
567 * lib/colorize-impl.c: Move them here as functions.
568 * lib/ms/colorize.h: Remove.
569 * src/Makefile.am (DEFAULT_HEADERS): Remove.
570
571 colorize: use isatty module
572 * bootstrap.conf: Add isatty module.
573 * gnulib: Update to latest.
574 * lib/colorize.h: Remove argument from should_colorize.
575 * lib/ms/colorize.h: Likewise.
576 * lib/colorize-impl.c: Factor isatty call out of here...
577 * lib/ms/colorize-impl.c: ... and here...
578 * src/main.c: ... into here.
579
5802012-01-03 Jim Meyering <meyering@redhat.com>
581
582 tests: avoid minor "make check" failure
583 * tests/r-dot: Make executable, to avoid triggering a failed
584 consistency test in "make check".
585
5862012-01-02 Paul Eggert <eggert@cs.ucla.edu>
587
588 grep: -r with no args now searches "."
589 This is a patch I've been meaning to put in for years.
590 When I added support for "grep -r", I forgot to have "grep -r PAT"
591 search the working directory by default, instead of searching
592 standard input (which makes no sense, even if stdin is a directory).
593 This is not an upward compatible change, since "grep -r PAT <file"
594 will no longer search standard input, but that's OK; nobody should
595 be using "grep -r" that way anyway.
596 * NEWS: Document this.
597 * doc/grep.texi (File and Directory Selection, grep Programs, Usage):
598 Likewise.
599 * src/main.c (usage): Likewise.
600 (grepdir): If DIR is null, search the working directory, but do
601 not prepend "./" to the file names.
602 (main): If recursing and no operands are given, search ".".
603 * tests/Makefile.am (TESTS): Add r-dot.
604 * tests/r-dot: New file.
605
606 grep: prefer fgets to printf, _ to gettext
607 * lib/colorize.h (print_end_colorize):
608 * lib/ms/colorize-impl.c (print_end_colorize):
609 Use fputs instead of printf.
610 * src/main.c (usage): Likewise. Use _ instead of gettext.
611
6122012-01-01 Paul Eggert <eggert@cs.ucla.edu>
613
614 grep: check stdin like other files
615 * NEWS: Document this.
616 * src/main.c (grepfile): Revamp tests for input files so that
617 standard input is tested like other files. For example, report
618 an error if standard input equals standard output.
619 Prefer open+fstat to stat+open if possible, as open+fstat is
620 usually a bit faster and avoids a race condition.
621 * tests/in-eq-out-infloop: Add tests for cases like
622 'grep pat <file >>file'.
623
6242012-01-01 Jim Meyering <meyering@redhat.com>
625
626 maint: update all copyright year number ranges
627 Run "make update-copyright".
628
6292012-01-01 Paul Eggert <eggert@cs.ucla.edu>
630
631 grep: lower-case function names
632 These names used to be macros, but they're functions now.
633 All callers changed.
634 * src/main.c (pr_sgr_start): Rename from PR_SGR_START.
635 (pr_sgr_end): Rename from PR_SGR_END.
636 (pr_sgr_start_if): Rename from PR_SGR_START_IF.
637 (pr_sgr_end_if): Rename from PR_SGR_END_IF.
638
639 ms: move Microsoft-specific stuff to lib/ms
640 * cfg.mk (exclude_file_name_regexp--sc_prohibit_strcmp)
641 (exclude_file_name_regexp--sc_require_config_h)
642 (exclude_file_name_regexp--sc_require_config_h_first):
643 New rules.
644 * lib/colorize.c, lib/colorize.h, lib/colorize-impl.c:
645 * lib/ms/colorize.h, lib/ms/colorize-impl.c: New files.
646 * configure.ac (GREP_SRC_INCLUDES): New macro.
647 * lib/Makefile.am (libgreputils_a_SOURCES): Add colorize.[ch].
648 (EXTRA_DIST): New macro.
649 * src/Makefile.am (DEFAULT_INCLUDES): New macro.
650 * src/main.c: Include colorize.h.
651 (PR_SGR_START, PR_SGR_END, PR_SGR_START_IF, PR_SGR_END_IF):
652 Now static functions, not macros.
653 (hstdout, norm_attr, w32_console_init, w32_sgr2attr)
654 (w32_clreol) [__MINGW32__]: Move to lib/ms/colorize-impl.c.
655 (pr_sgr_start, pr_sgr_end): Remove; callers changed to use new
656 print_start_colorize, print_end_colorize from colorize.h.
657 (init_colorize): Rename from w32_console_init and move to
658 colorize module; caller changed.
659 (should_colorize): Move to colorize module.
660
661 grep: do input==output check more like dir loop check
662 * src/main.c (grepfile): Just use SAME_INODE; don't bother
663 with SAME_REGULAR_FILE. This works better on properly-working
664 POSIX hosts, since it handles the case where the file is changing
665 as we grep it. It works worse on hosts that don't support st_ino
666 properly, but in practice this isn't that much of a problem here.
667 * src/system.h (same_file_attributes, SAME_REGULAR_FILE):
668 Remove; no longer needed.
669
670 build: update gnulib submodule to latest
671
6722011-12-28 Paul Eggert <eggert@cs.ucla.edu>
673
674 maint: remove now-unused/obsolete files
675 * README.DOS: Remove file.
676 * m4/djgpp.m4: Likewise.
677 * .gitignore: Remove reference to m4/djgpp.m4.
678
6792011-12-28 Jim Meyering <meyering@redhat.com>
680
681 maint: distribute ChangeLog-2009
682 * Makefile.am (EXTRA_DIST): Add ChangeLog-2009.
683 Spotted by Eli Zaretskii.
684
6852011-12-28 Jim Meyering <meyering@redhat.com>
686
687 main.c: add some 'const' directives
688 * src/main.c (color_dict, fg_color, bg_color, cap): Declare const.
689
690 No semantic change.
691
6922011-12-28 Jim Meyering <meyering@redhat.com>
693
694 main.c: correct indentation and formatting style
695 * src/main.c: Correct many formatting inconsistencies.
696 No semantic change.
697
698 avoid new syntax-check failures
699 * cfg.mk (old_NEWS_hash): Update, to accommodate old NEWS modification.
700 * src/main.c: Indent solely with spaces, never with TABs.
701 (should_colorize): Remove useless parens in #if directive.
702
7032011-12-28 Eli Zaretskii <eliz@gnu.org>
704
705 Fix whitespace, indentation and documentation
706 * src/main.c (parse_grep_colors): Fix indentation.
707 (usage): Mention MS-Windows in help text for -U and -u options.
708
709 update NEWS for MS-Windows changes
710 * NEWS: Mention MS-Windows related bugfixes and enhancements.
711
712 Fix the test suite for MS-Windows.
713 * tests/include-exclude: Use --directories=skip, to avoid
714 gratuitous failures on systems that cannot grep directories.
715 * tests/reversed-range-endpoints: Don't reject program names with
716 leading directories and drive letters.
717 * tests/warn-char-classes: Likewise.
718
719 Support color highlighting on MS-Windows
720 * src/main.c (SGR_START, SGR_END, PR_SGR_FMT, PR_SGR_FMT_IF): Remove.
721 (PR_SGR_START, PR_SGR_START_IF): Replace with pr_sgr_start.
722 (PR_SGR_END, PR_SGR_END_IF): Replace with pr_sgr_end.
723 (pr_sgr_start, pr_sgr_end, should_colorize): New functions.
724 (w32_console_init, w32_sgr2attr, w32_clreol) [__MINGW32__]: New functions.
725 (main): Use should_colorize. Invoke w32_console_init.
726
7272011-12-24 Paul Eggert <eggert@cs.ucla.edu>
728
729 don't ignore errors when reading a directory
730 grep no longer silently suppresses errors when reading a directory
731 as if it were a text file. For example, "grep x ." now reports a
732 read error on most systems; formerly, it ignored the error.
733 Problem reported as an aside by Bob Proulx (Bug#10355).
734 * NEWS: Document this.
735 * src/main.c (grep, grepfile): Implement this. Simplify the code
736 considerably.
737 * src/system.h (is_EISDIR): Remove; no longer needed.
738
739 --include etc. now work on command-line args more consistently
740 --include and --exclude apply only to non-directories and
741 --exclude-dir applies only to directories. "-" (standard input)
742 is never excluded, since it is not a file name.
743 This bug was discovered while fixing a read-directory bug (Bug#10355).
744 * NEWS: Document this.
745 * src/main.c (main): Implement this.
746 * tests/include-exclude: Test for it.
747
7482011-12-24 Jim Meyering <meyering@redhat.com>
749
750 build: update gnulib submodule to latest
751
7522011-12-12 Arnold D. Robbins <arnold@skeeve.com>
753
754 doc: improve grep.texi
755 * doc/grep.texi: General editing for improved aesthetics.
756 Also fix a few problems.
757
7582011-12-12 Jim Meyering <meyering@redhat.com>
759
760 build: use gnulib's iswctype wcscoll
761 * bootstrap.conf (gnulib_modules): Add iswctype and wcscoll.
762 * configure.ac: Remove explicit checks for those functions.
763 * src/mbsupport.h (MBS_SUPPORT): Define to 1 if not already defined.
764 Remove the conditional, now that we're guaranteed by gnulib to have
765 wcscoll and iswctype.
766 Suggested by Alan Hourihane in http://savannah.gnu.org/bugs/?34930
767
768 disable the new input==output guard for additional options
769 * src/main.c (grepfile): Do not reject input == output also
770 when using a few other options.
771 * tests/in-eq-out-infloop: Test these new cases.
772 * NEWS (Bug fixes): Mention it
773
7742011-12-11 Nicolas Vigier <boklm@mars-attacks.org>
775
776 do not reject "grep -qr . > out"
777 The recent fix to avoid an infinite disk-filling loop, commit 5e20a38a,
778 introduced a minor regression. If you use grep with -q and -r, and
779 redirect output to a file that will be traversed, then grep would
780 reject the command, even though it will generate no output.
781 In that case, there is no risk of an infinite loop.
782 * src/main.c (grepfile): Do not reject input == output when
783 using --quiet/--silent (-q).
784 Reported by J H Wilson in http://bugs.mageia.org/show_bug.cgi?id=3501
785 forwarded by Nicolas Vigier to https://savannah.gnu.org/bugs/?34917
786
7872011-11-29 Arnold Robbins <arnold@skeeve.com>
788
789 dfa: do not call nl_langinfo in !MBS_SUPPORT mode
790 * src/dfa.c (using_utf8) [!MBS_SUPPORT]: Remove erroneous "defined"
791 in cpp test for MBS_SUPPORT. Since commit a163349d, MBS_SUPPORT is 0/1.
792 This error caused trouble only in the !MBS_SUPPORT case.
793
794 dfa: avoid warning from deficient compiler in !MBS_SUPPORT mode
795 * src/dfa.c (setbit_wc) [!MBS_SUPPORT]: Add explicit "return false;"
796 after "abort ();", to avoid a warning from deficient compilers.
797
7982011-11-29 Jim Meyering <meyering@redhat.com>
799
800 tests: use "compare exp out", not "compare out exp"
801 Likewise, when an empty file is expected, use "compare /dev/null out",
802 not "compare out /dev/null". I.e., specify the expected/desired contents
803 via the first file name. Prompted by a suggestion from Bruno Haible
804 in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154
805
806 Run these commands:
807
808 git grep -l -E 'compare [^ ]+ exp' \
809 |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/'
810 git grep -l -E 'compare [^ ]+ /dev/null' \
811 |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/'
812
8132011-11-29 Jim Meyering <meyering@redhat.com>
814
815 build: update gnulib submodule to latest
816
8172011-11-28 Jim Meyering <meyering@redhat.com>
818
819 build: accommodate -Werror=suggest-attribute=pure
820 Now that we're using the latest manywarnings module from gnulib,
821 accommodate gcc's -Werror=suggest-attribute=pure option by marking
822 suggested functions with gnulib-defined _GL_ATTRIBUTE_PURE.
823 * src/kwset.c (hasevery): Mark function with pure attribute.
824 (bmexec): Likewise.
825 * src/dfa.c (nsubtoks, istrstr, find_pred, dfamusts): Likewise.
826 * configure.ac: Disable (for lib/) options that seem not to be worth
827 the trouble: -Wunsuffixed-float-constants and -Wformat-nonliteral.
828
8292011-11-21 Bruno Haible <bruno@clisp.org>
830
831 build: fix "make check" error on OSF/1
832 * tests/Makefile.am (TESTS_ENVIRONMENT): Test the value of the variable
833 BASH_VERSION, not the literal ASH_VERSION.
834
8352011-11-21 Jim Meyering <meyering@redhat.com>
836
837 portability: work consistently on *BSD systems
838 * src/dfa.c (is_valid_unibyte_character): Define.
839 (IS_WORD_CONSTITUENT): Use it here, to make grep work consistently
840 even on *BSD systems, which use different tables for ctype macros
841 like isalpha. http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4022
842 With help from Bruno Haible.
843
8442011-11-20 Jim Meyering <meyering@redhat.com>
845
846 maint: consistently use NULL, not 0, when comparing pointers
847 * src/dfa.c (dfaanalyze): Compare trans[s] with NULL, not 0.
848
849 maint: remove an avoidable #ifdef/#endif pair
850 * src/dfa.c (dfaanalyze): Remove avoidable #ifdef around "{".
851
852 tests: fix typo in last change
853 * tests/word-delim-multibyte: Use double quotes around $e_acute,
854 not single quotes. Spotted by Bruno Haible.
855 This and the preceding change do not resolve the XPASS failure
856 on OpenBSD 4.9 after all. See the explanation at
857 http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4022
858
859 tests: avoid unwarranted test failure on *BSD-based systems
860 * tests/word-delim-multibyte (e_acute): Use a more portable
861 representation of e-acute. Reported by Bruno Haible.
862
8632011-11-19 Jim Meyering <meyering@redhat.com>
864
865 maint: accommodate -Wdeclaration-after-statement, but only in dfa.c,
866 and because doing so does not impact readability/maintainability.
867 This is solely to accommodate gawk users who are stuck with ancient gcc.
868 This is no excuse to change any other code in grep.
869 * src/dfa.c (dfaoptimize, parse_bracket_exp): Move declaration
870 to precede first statement in block.
871
8722011-11-16 Jim Meyering <meyering@redhat.com>
873
874 maint: post-release administrivia
875 * NEWS: Add header line for next release.
876 * .prev-version: Record previous version.
877 * cfg.mk (old_NEWS_hash): Auto-update.
878
879 version 2.10
880 * NEWS: Record release date.
881
882 build: update gnulib submodule to latest
883
8842011-11-13 Jim Meyering <meyering@redhat.com>
885
886 maint: update bootstrap and init.sh from gnulib
887 * tests/init.sh: Update from gnulib.
888 * bootstrap: Likewise.
889
8902011-11-12 Jim Meyering <meyering@redhat.com>
891
892 build: update gnulib for exclude-test fixes
893
894 tests: make our "export" replacement efficient with modern shells
895 * tests/Makefile.am (TESTS_ENVIRONMENT): Use a trivial and efficient
896 implementation with a shell that supports "export var=val".
897 Use the sed-invoking replacement only when necessary.
898 Improved by Stefano Lattarini.
899
900 tests: make the replacement export function more robust
901 * tests/Makefile.am (sed_quote_value): Also quote single quotes.
902 Remove sed's -e options. Not needed.
903
9042011-11-12 Bruno Haible <bruno@clisp.org>
905
906 tests: fix test suite execution failure on OSF/1 5.1
907 * tests/Makefile.am (TESTS_ENVIRONMENT): Use a shell function to
908 ensure that we use only the portable form of the 'export' shell
909 built-in.
910
911 tests: don't assume that /bin/bash exists
912 * tests/fedora: Run using /bin/sh, not /bin/bash.
913
914 tests: avoid unwarranted failures due to SATAN's timeout
915 * tests/init.cfg (require_timeout_): Also ensure that
916 timeout exits with its child's exit status.
917
918 build: fix compilation error on MSVC 9 to due Pexecute() declaration
919 * src/pcresearch.c (WITHOUT_PCRE_NORETURN): Remove macro.
920 (Pexecute): Replace abort() call with code that does not trigger GCC
921 warnings.
922
923 tests: fix high-bit-range test failure on OSF/1 5.1
924 * tests/high-bit-range: Use octal escape instead of hexadecimal escape
925 sequence.
926
9272011-11-11 Jim Meyering <meyering@redhat.com>
928
929 build: update gnulib for solaris test fix
930
9312011-11-10 Jim Meyering <meyering@redhat.com>
932
933 build: update gnulib submodule to latest
934
935 maint: adjust the URL that will appear in the generated announcement
936 * cfg.mk (url_dir_list): Use this http://ftp.gnu.org/gnu/$(PACKAGE)
937 for the first link listed in the generated announcement.
938 announce-gen now provides the faster mirror link automatically.
939
9402011-11-06 Jim Meyering <meyering@redhat.com>
941
942 build: stop distributing gzip'd releases; xz is enough
943 * configure.ac (AM_INIT_AUTOMAKE): Add no-dist-gzip.
944 * NEWS (Build-related): Mention that we're dropping .tar.gz.
945
946 build: update gnulib submodule to latest
947
9482011-10-14 Stefano Lattarini <stefano.lattarini@gmail.com>
949
950 distcheck: ensure dist-hook fails if syntax-check fails
951 * Makefile.am (run-syntax-check): Fix logic, to ensure that
952 the recipe of this target returns a non-zero exit status if
953 "make syntax-check" fails.
954
9552011-10-12 Jim Meyering <meyering@redhat.com>
956
957 build: update gnulib submodule to latest
958 This should fix a few portability problems, including one on HP-UX
959 and a test-float failure on PPC, reported by Andreas Metzler.
960
9612011-10-10 Stefano Lattarini <stefano.lattarini@gmail.com>
962
963 gitignore: merge top-level and tests/ .gitignore files
964 * tests/.gitignore: Remove; what little remained of its
965 contents has been moved ...
966 * .gitignore: ... here.
967
968 tests: tiny simplification in TESTS_ENVIRONMENT definition
969 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove redundant use of
970 `export'.
971
9722011-10-10 Stefano Lattarini <stefano.lattarini@gmail.com>
973
974 tests: support development version of automake too
975 This change implements a more correct and idiomatic use of the
976 features of the Automake-provided 'parallel-tests' harness.
977 Moreover, this change is required in order for the testsuite to
978 continue to work with the new testsuite harness that is planned
979 to be introduced in Automake 1.12 (which, as of the writing date,
980 is still under development and in late alpha state).
981
982 * tests/Makefile.am (TESTS_ENVIRONMENT): The development version of
983 automake dos not support setting the interpreter delegated to run
984 the tests scripts in this variable; instead, use ...
985 (LOG_COMPILER): ... this variable.
986 * .gitignore: Ignore `.trs' files in directory `tests/'.
987 * build-aux/.gitignore: Ignore `test-driver' script.
988
9892011-10-04 Eli Zaretskii <eliz@gnu.org>
990
991 dfa: don't mishandle high-bit bytes in a regexp with signed-char
992 This appears to arise only on systems for which "char" is signed.
993 * src/dfa.c (FETCH_WC, FETCH): Produce an unsigned value, rather
994 than a sign-extended one. Fixes a bug on MS-Windows with compiling
995 patterns that include characters with the 8-th bit set.
996 (to_uchar): Define. From coreutils.
997 Reported by David Millis <tvtronix@yahoo.com>.
998 See http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3893
999 * NEWS (Bug fixes): Mention it.
1000
10012011-09-16 Jim Meyering <meyering@redhat.com>
1002
1003 maint: dfa: simplify multi-byte-related conditionals
1004 * src/dfa.c (setbit_case_fold_c, parse_bracket_exp, lex):
1005 (addtok_mb, dfaparse): Change each "MBS_SUPPORT && MB_CUR_MAX > 1"
1006 test to just "MB_CUR_MAX > 1".
1007 * src/dfasearch.c (kwsincr_case, EGexecute): Likewise.
1008 * src/kwsearch.c (Fcompile, Fexecute): Likewise.
1009 * src/searchutils.c (kwsinit): Likewise.
1010 * src/dfa.c (parse_bracket_exp): Convert
1011 "if (!MBS_SUPPORT || MB_CUR_MAX == 1)" to
1012 "if (MB_CUR_MAX == 1)" and do this:
1013 - assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
1014 + assert(MB_CUR_MAX == 1);
1015
1016 maint: dfa: simplify several expressions
1017 * src/dfa.c (dfainit): Set d->mb_cur_max unconditionally, now
1018 that MB_CUR_MAX is always usable. With that, simplify all
1019 "MBS_SUPPORT && d->mb_cur_max > 1" to simply "d->mb_cur_max > 1".
1020 (dfastate, dfaexec, dfainit, dfafree): Simplify, removing each
1021 now-unnecessary "MBS_SUPPORT &&".
1022
1023 maint: dfa: avoid in-function "#if MBS_SUPPORT" tests
1024 * src/dfa.c (setbit_case_fold_c): Remove "#if MBS_SUPPORT" in favor
1025 of simple "if (MBS_SUPPORT ...".
1026 (dfaexec, addtok): Likewise.
1027
1028 maint: ensure that MB_CUR_MAX is defined even when !MBS_SUPPORT
1029 * src/mbsupport.h [!MBS_SUPPORT] (MB_CUR_MAX): Define to 1.
1030
1031 build: fix compilation failure when MBS_SUPPORT is 0
1032 * src/dfa.c (add_utf8_anychar): Always compile this function,
1033 but when MBS_SUPPORT is 0, give it an empty body.
1034 (prepare_wc_buf): Likewise.
1035 [! MBS_SUPPORT] (setbit_wc): Define to always abort.
1036
1037 maint: dfa: simplify dfaoptimize
1038 * src/dfa.c (dfaoptimize): Simplify.
1039 (dfacomp): Remove now-redundant "if (MBS_SUPPORT)" guard,
1040 since dfaoptimize does nothing if !MBS_SUPPORT.
1041
1042 maint: dfa: remove some #if MBS_SUPPORT guards
1043 * src/dfa.c: Replace a few "#if MBS_SUPPORT" directives with
1044 "if (MBS_SUPPORT)". Remove some altogether.
1045
1046 maint: dfa: convert #if-MBS_SUPPORT (dfastate)
1047 * src/dfa.c (dfastate): Use regular "if", not #if MBS_SUPPORT.
1048
1049 maint: dfa: convert #if-MBS_SUPPORT (dfastate)
1050 * src/dfa.c (dfastate): Use regular "if", not #if MBS_SUPPORT.
1051
1052 maint: dfa: convert #if-MBS_SUPPORT (state_index)
1053 * src/dfa.c (state_index): Use regular "if", not #if MBS_SUPPORT.
1054
1055 maint: dfa: convert #if-MBS_SUPPORT (dfaparse)
1056 * src/dfa.c (dfaparse): Use regular "if", not #if MBS_SUPPORT.'
1057
1058 maint: dfa: convert #if-MBS_SUPPORT (copytoks)
1059 * src/dfa.c (copytoks): Use regular "if", not #if MBS_SUPPORT.'
1060
1061 maint: dfa: convert #if-MBS_SUPPORT (lex)
1062 * src/dfa.c (lex): Use regular "if", not #if MBS_SUPPORT.'
1063
1064 maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp)
1065 * src/dfa.c (parse_bracket_exp): Use regular "if", not #if MBS_SUPPORT.
1066
1067 maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp)
1068 * src/dfa.c (parse_bracket_exp): Use regular "if", not #if MBS_SUPPORT.
1069
1070 maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp)
1071 * src/dfa.c (parse_bracket_exp): Use regular "if", not #if MBS_SUPPORT.
1072
1073 maint: dfa: convert #if-MBS_SUPPORT (dfaexec)
1074 * src/dfa.c (dfaexec): Use regular "if", not #if MBS_SUPPORT.
1075
1076 maint: dfa: convert #if-MBS_SUPPORT (dfaexec)
1077 * src/dfa.c (dfaexec): Use regular "if", not #if MBS_SUPPORT.
1078 Also add curly braces around multi-line if/else blocks.
1079
1080 maint: dfa: remove #if-MBS_SUPPORT (free_mbdata)
1081 * src/dfa.c (free_mbdata): Remove the #if guard altogether.
1082
1083 maint: dfa: convert #if-MBS_SUPPORT (dfaoptimize, dfacomp)
1084 * src/dfa.c (dfaoptimize, dfacomp): Use regular "if",
1085 not #if MBS_SUPPORT.
1086
1087 maint: dfa: convert #if-MBS_SUPPORT (dfafree)
1088 * src/dfa.c (dfafree): Use regular "if", not #if MBS_SUPPORT.
1089
1090 maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp, part1)
1091 * src/dfa.c (parse_bracket_exp): Remove in-function #if MBS_SUPPORT.
1092
1093 maint: remove #if-MBS_SUPPORT declaration guards
1094 * src/search.h: Don't bother to #if-out declarations.
1095
1096 maint: convert #if-MBS_SUPPORT (EGexecute)
1097 * src/dfasearch.c (EGexecute): Remove in-function #if MBS_SUPPORT.
1098
1099 maint: convert #if-MBS_SUPPORT (kwsincr_case)
1100 * src/dfasearch.c (kwsincr_case): Remove in-function #if MBS_SUPPORT.
1101 Move decl's down.
1102
1103 maint: convert #if-MBS_SUPPORT (Fcompile, etc.)
1104 * src/kwsearch.c (Fcompile, Fexecute): Remove in-function #if MBS_SUPPORT.
1105 (Fcompile): Rearrange some declarations. No semantic change.
1106
1107 maint: convert #if-MBS_SUPPORT (kwsinit)
1108 * src/searchutils.c (kwsinit): Remove in-function #if MBS_SUPPORT.
1109
1110 maint: dfa: remove case-guarding #if-MBS_SUPPORT
1111 * src/dfa.c [DEBUG] (prtok): Remove now-useless #if-MBS_SUPPORT.
1112
11132011-09-15 Jim Meyering <meyering@redhat.com>
1114
1115 maint: remove #if MBS_SUPPORT around member declaration
1116 * src/dfa.c (dfastate): Don't #ifdef-out "mbps" position_set member.
1117
1118 maint: dfa: remove #if MBS_SUPPORT around struct definition
1119 * src/dfa.c (struct mb_char_classes): Don't #ifdef-out declarations.
1120
1121 build: avoid compilation failure when building without PCRE support
1122 * src/pcresearch.c [!HAVE_LIBPCRE] (WITHOUT_PCRE_NORETURN): Define
1123 to _Noreturn, not obsoleted-by-gnulib _GL_ATTRIBUTE_NORETURN.
1124 Reported by Eric Blake.
1125
1126 tests: stop using skip_test_; use skip_ instead
1127 * tests/init.cfg (skip_test_): Remove definition. Use the improved
1128 skip_ function from init.sh, now that it has the same feature.
1129 * tests/euc-mb: s/skip_test_/skip_/
1130 * tests/sjis-mb: Likewise.
1131 * tests/fmbtest: Likewise.
1132
1133 tests: skip tests that require MBS support
1134 * tests/init.cfg (require_compiled_in_MB_support): New function.
1135 * tests/char-class-multibyte: Use it here, since this test cannot
1136 succeed without MBS support.
1137 * tests/equiv-classes: Likewise.
1138 * tests/euc-mb: Likewise.
1139 * tests/fgrep-infloop: Likewise.
1140 * tests/init.cfg: Likewise.
1141 * tests/prefix-of-multibyte: Likewise.
1142 * tests/turkish-I: Likewise.
1143 * tests/sjis-mb: Likewise.
1144
1145 tests: make fmbtest explain (to stderr, not log) why it is skipped
1146 * tests/fmbtest: Use skip_ and fail_ to give better diagnostics.
1147
1148 maint: dfa: improve comments
1149 * src/dfa.c (match_mb_charset, match_anychar): Improve comments.
1150
11512011-09-14 Jim Meyering <meyering@redhat.com>
1152
1153 build: update gnulib submodule to newer
1154
1155 maint: correct indentation
1156 * src/dfa.c (dfaexec): Reposition curly braces to match indentation style.
1157 Remove useless comment.
1158
1159 maint: move declaration "down" to inner scope where it is used
1160 * src/dfa.c (dfaexec): Move decl of local down into scope where used.
1161
11622011-09-07 Jim Meyering <meyering@redhat.com>
1163
1164 doc: use "file name" consistently in grep's --help output
1165 * src/main.c (usage): Use "file name", not "filename" in descriptions
1166 of --with-filename (-H), --no-filename (-h) and --label=LABEL.
1167 Suggested by Sequoia McDowell.
1168
1169 bug: requires ru_RU.KOI8-R". [bug introduced in grep-2.9]
1170
11712011-08-31 Matthew Burgess <matthew@linuxfromscratch.org>
1172
1173 tests: remove debug code that would cp to /t
1174 * tests/unibyte-bracket-expr: Remove debug artifact introduced
1175 by 2011-06-02 commit de5f7000, "tests: exercise a uni-byte [...]
1176 bug: requires ru_RU.KOI8-R". [bug introduced in grep-2.9]
1177
11782011-08-20 Jim Meyering <meyering@redhat.com>
1179
1180 build: use largefile module and update to latest gnulib
1181 * configure.ac: Remove AC_SYS_LARGEFILE, subsumed by ...
1182 * bootstrap.conf (gnulib_modules): ...this. Use largefile module.
1183 * gnulib: Update to latest.
1184
1185 maint: clean up and plug a leak-on-OOM
1186 * src/dfa.c (icatalloc): Clean up; use xrealloc in place of malloc
1187 and realloc; remove conditionals that are unnecessary, now that
1188 failed allocation results in exit.
1189 (enlist): Use xrealloc in place of realloc; remove conditional.
1190 (comsubs): Avoid leak upon failed enlist call.
1191 (dfamust): Use xmalloc in place of malloc.
1192 Remove conditionals, now that icpyalloc and icatalloc never return NULL.
1193
1194 maint: use x2nrealloc, not xrealloc
1195 * src/main.c (main): Use x2nrealloc, not xrealloc
1196
11972011-07-24 Jim Meyering <meyering@redhat.com>
1198
1199 tests: add a test to trigger the bug
1200 * tests/Makefile.am (TESTS): Add it.
1201 * tests/in-eq-out-infloop: Exercise the bug/fix.
1202
1203 exit 2 (rather than infloop) when an input file is also on stdout
1204 This avoids a potential "infinite" disk-filling loop.
1205 Reported in http://savannah.gnu.org/patch/?5316
1206 and http://savannah.gnu.org/bugs/?17457.
1207 * src/main.c: Include "quote.h".
1208 (out_stat): New global.
1209 (grepfile): Compare each regular file's dev/ino/etc.
1210 with those from the file on stdout (if it too is regular).
1211 (main): Set out_stat, if stdout is a regular file.
1212 * src/system.h: Include "same-inode.h".
1213 (same_file_attributes): Define. From diffutils.
1214 (SAME_REGULAR_FILE): Define.
1215 * bootstrap.conf (gnulib_modules): Use quote, not quotearg.
1216 Use same-inode.
1217 * NEWS (Bug fixes): Mention it.
1218
12192011-07-15 Reuben Thomas <rrt@sc3d.org>
1220
1221 doc: improve documentation of character classes in the man page
1222 * doc/grep.in.1: Reword documentation of character classes.
1223
12242011-07-12 Jim Meyering <meyering@redhat.com>
1225
1226 dfa: remove unnecessary inclusion of verify.h
1227 * src/dfa.c: Don't include "verify.h".
1228
1229 dfa: simplify use of *ALLOC macros
1230 * src/dfa.c (XNMALLOC, XCALLOC): Redefine without outer cast-to-(t *).
1231 (CALLOC, MALLOC, REALLOC): Remove type "t" parameter and adjust callers.
1232
1233 dfa: change semantics of REALLOC_IF_NECESSARY's 3rd parameter
1234 * src/dfa.c (REALLOC_IF_NECESSARY): Change meaning of 3rd param,
1235 from "maximum index" to 1 greater than that: the required number
1236 of *P-sized elements. Note that only some of the uses of
1237 REALLOC_IF_NECESSARY needed to be adjusted, the others had already
1238 required an extra element.
1239
1240 dfa: rename REALLOC_IF_NECESSARY param/local for clarity
1241 * src/dfa.c (REALLOC_IF_NECESSARY): Rename nalloc and new_nalloc
1242 to n_alloc and new_n_alloc.
1243
1244 dfa: prepare for a semantic change in REALLOC_IF_NECESSARY
1245 * src/dfa.c (REALLOC_IF_NECESSARY): Remove "t" (type) parameter.
1246 Use (*p) instead. Adjust all callers.
1247
1248 dfa: add braces to REALLOC_IF_NECESSARY definition
1249 * src/dfa.c (REALLOC_IF_NECESSARY): Add curly braces; use TABs
1250 to right-indent.
1251
12522011-06-29 Paolo Bonzini <bonzini@gnu.org>
1253
1254 doc: improve documentation of character classes
1255 * doc/grep.texi (Character classes): Mention explicitly when
1256 examples refer to the C locale, explain better the general
1257 meaning of character classes.
1258
12592011-06-28 Jim Meyering <meyering@redhat.com>
1260
1261 dfa: fix the root cause of the heap overrun
1262 dfa's "insert" function was supposed to be maintaining the position
1263 list sorted on *decreasing* index, but since the 2009-12-09 "Speed
1264 up insert" commit, 62458291, it was using code that assumed the data
1265 were sorted on *increasing* index. As such, sometimes it would no
1266 longer merge constraints (not finding a match) and would append
1267 entries that normally would have matched and been merged. Those
1268 erroneous append operations resulted in the heap overrun fixed by
1269 2011-06-17 commit 0b91d692 by doubling the array size.
1270 * src/dfa.c (insert): Fix the comparison.
1271 (dfaanalyze): Now that that's fixed, revert commit 0b91d692,
1272 allocating space for only d->nleaves entries, not double that.
1273 As far as I can tell, this change has no effect other than
1274 decreased memory usage, although it may improve performance
1275 slightly, since the resulting list of positions is half as long
1276 as it used to be.
1277
12782011-06-28 Paolo Bonzini <bonzini@gnu.org>
1279
1280 dfa: use memcpy to copy position_sets
1281 * src/dfa.c (copy): Use memcpy.
1282
1283 dfa: use copyset to copy charclasses
1284 * src/dfa.c (add_utf8_anychar): Change memcpy to copyset.
1285
1286 gnulib: Update
1287 Fixes mmap-anon.m4 conflict with fn_grep, reported by Rainer Orth.
1288
12892011-06-22 Jim Meyering <meyering@redhat.com>
1290
1291 maint: update bootstrap from gnulib
1292 * bootstrap: Update to latest, so it no longer inserts empty lines
1293 in .gitignore files.
1294 * .gitignore: Let bootstrap move "!..." lines to end of file.
1295
12962011-06-21 Jim Meyering <meyering@redhat.com>
1297
1298 post-release administrivia
1299 * NEWS: Add header line for next release.
1300 * .prev-version: Record previous version.
1301 * cfg.mk (old_NEWS_hash): Auto-update.
1302
1303 version 2.9
1304 * NEWS: Record release date.
1305
1306 build: avoid a warning when building with --disable-perl-regexp...
1307 and --enable-gcc-warnings.
1308 * src/pcresearch.c (WITHOUT_PCRE_NORETURN): Define.
1309 Remove the unreachable return statement.
1310 Reported by Eric Blake.
1311
1312 tests: ensure that each test script is executable
1313 This adds a rule run at "make check" time to ensure that
1314 test scripts are consistently executable.
1315 This change is not required for "make check", but makes it easier
1316 for people to run scripts manually, but that is discouraged because
1317 doing so makes it easy to omit important variable settings that
1318 are normally provided via TESTS_ENVIRONMENT.
1319 This change also makes each of the existing TESTS executable.
1320 * tests/Makefile.am (check_executable_TESTS): New rule.
1321 (check): Depend on it.
1322 * tests/{all_scripts}: chmod 755.
1323 Prompted by a report from Eric Blake.
1324
1325 maint: update bootstrap from gnulib
1326 * bootstrap: Update from gnulib.
1327
1328 maint: update po/POTFILES.in
1329 * po/POTFILES.in: Remove dfasearch.c, now that it no longer
1330 contains a translatable diagnostic.
1331
1332 tests: include-exclude: avoid false positive failure on FreeBSD
1333 * tests/include-exclude: Avoid false-positive failure due to
1334 matching "a" in a directory on FreeBSD, when searching a directory
1335 without "-r". Search for '^aaa$' rather than just 'a'.
1336 Adjust test inputs and expected output files accordingly.
1337
1338 dfa: remove some useless casts
1339 * src/dfa.c (icatalloc): Change type of "old" parameter
1340 from "char const *" to "char *".
1341 Don't cast-away const on realloc argument.
1342 Remove now-unnecessary const-discarding cast.
1343 Don't (void)-cast strcpy result.
1344 * src/dosbuf.c (undossify_input): Remove anachronistic
1345 cast-to-"char *" of realloc argument.
1346
1347 dfa: more heap-allocation-related overflow protection
1348 * src/dfa.c (enlist): Use xnrealloc, not realloc.
1349 Also, remove unnecessary cast-to-(char *).
1350 (dfamust): Use xnmalloc, not malloc. Before, this code would
1351 return upon malloc failure (xnmalloc exits upon failure), but
1352 later, via the *ALLOC macros, it could already exit, so this
1353 new potential exit point is nothing new. The same applies
1354 to enlist, since it is called only through dfamust.
1355
1356 tests: update init.sh; simplify TESTS_ENVIRONMENT
1357 * tests/init.sh: Update from coreutils.
1358 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove shell_or_perl_
1359 function. Instead, just use $(SHELL), since grep has no test
1360 that starts with #!/usr/bin/perl.
1361
1362 build: update gnulib submodule to latest
1363
1364 build: avoid configure/gnulib-related errors
1365 * bootstrap.conf: Remove now-unnecessary code to exclude
1366 gettext/intl-related m4 tests.
1367
13682011-06-19 Jim Meyering <meyering@redhat.com>
1369
1370 maint: tighten up superfluous code
1371 * src/main.c (parse_grep_colors): Use xstrdup in place of xmalloc,
1372 a useless test, strlen, and strcpy.
1373
13742011-06-19 Paul Eggert <eggert@cs.ucla.edu>
1375
1376 dfa: avoid possibility of overflow
1377 * src/dfa.c (REALLOC_IF_NECESSARY, CALLOC, MALLOC, REALLOC):
1378 Use functions from xalloc.h to avoid overflow.
1379 * src/dfasearch.c (GEAcompile): Use xnrealloc rather than realloc.
1380 * src/pcresearch.c (Pcompile): Use xnmalloc, not xmalloc.
1381
13822011-06-18 Jim Meyering <meyering@redhat.com>
1383
1384 build: update gnulib submodule to latest
1385
1386 dfa: correct two uses of btowc
1387 * src/dfa.c (setbit_c, setbit_case_fold_c): Compare the btowc
1388 return value against WEOF, not EOF. Suggested by Eli Zaretskii.
1389 On a system like MinGW with unsigned wint_t, comparing a btowc
1390 return value against EOF (-1) would always be false.
1391
13922011-06-17 Jim Meyering <meyering@redhat.com>
1393
1394 dfa: don't overrun a malloc'd buffer for certain regexps
1395 * src/dfa.c (dfaanalyze): Allocate space for twice as many
1396 positions as there are leaves. Before this change, for some
1397 regular expressions, DFA analysis would have inserted far more
1398 "positions" than dfa->nleaves (up to double).
1399 Reported by Raymond Russell in http://savannah.gnu.org/bugs/?33547
1400 * tests/dfa-heap-overrun: Trigger the overrun.
1401 * tests/Makefile.am (TESTS): Add it.
1402 * NEWS (Bug fixes): Mention it.
1403
14042011-06-08 Jim Meyering <meyering@redhat.com>
1405
1406 tests: don't ignore sjis-mb test failure
1407 I made changes that caused grep to segfault during "make check" --
1408 as seen in dmesg output -- yet no test failed(!), and there was no
1409 trace of the segfault in the logs.
1410 * tests/sjis-mb (test_grep_reject): Ensure that output is empty.
1411 Don't ignore test failure.
1412
14132011-06-07 Paolo Bonzini <bonzini@gnu.org>
1414
1415 dfa: optimize wide characters in a bracket expression
1416 * src/dfa.c (addtok): Compile characters to an alternation. Handle the
1417 case when nothing else remains in the MBCSET.
1418
1419 dfa: refactor to prepare for upcoming optimizations
1420 * src/dfa.c (parse_bracket_exp): Move optimization of MBCSET from here...
1421 (addtok): ... to here.
1422
14232011-06-07 Paolo Bonzini <bonzini@gnu.org>
1424
1425 dfa: correct handling of single-byte character ranges
1426 This provides a better fix for the unibyte-bracket-expr and high-bit-range
1427 testcases, and fixes the latent bug tested by bogus-wctob.
1428
1429 * src/dfa.c (setbit_case_fold): Remove, replace with...
1430 (setbit_wc, setbit_c, setbit_case_fold_c): ... these.
1431 (parse_bracket_exp): Use setbit_case_fold_c when iterating over
1432 single-byte sequences. Use setbit_wc for multi-byte character sets,
1433 and setbit_case_fold_c for single-byte character sets.
1434 (lex): Use setbit_case_fold_c for single-byte character sets.
1435
14362011-06-07 Paolo Bonzini <bonzini@gnu.org>
1437
1438 tests: exercise latent bug in character ranges
1439 * tests/bogus-wctob: New.
1440 * Makefile.am (TESTS): Add it.
1441
14422011-06-07 Jim Meyering <meyering@redhat.com>
1443
1444 tests: exercise a uni-byte [...] bug: requires ru_RU.KOI8-R
1445 * tests/unibyte-bracket-expr: New file.
1446 * tests/Makefile.am (TESTS): Add it.
1447 * init.cfg (require_ru_RU_koi8_r): New function.
1448
1449 fix the [...] bug also for relatively unusual uni-byte encodings
1450 * src/dfa.c (setbit_case_fold): Also handle uni-byte locales
1451 like the one mentioned in the original report: see 2011-05-07
1452 commit d98338eb. Re-reported by Santiago Ruano Rincón.
1453 Note that most uni-byte locales are not affected.
1454 * NEWS (Bug fixes): Mention it.
1455
1456 tests: use skip_test_, not skip_
1457 Use skip_test_, not skip_. The former prints its message both to
1458 the log file and to FD 9 (redirected to tty via tests/Makefile.am),
1459 while skip_ prints only to stderr, which goes to the log file.
1460 * tests/init.cfg (skip_test_): New function.
1461 Use skip_test_ in place of skip_ everywhere.
1462 * tests/fmbtest: s/skip_/skip_test_/
1463 * tests/sjis-mb: Likewise.
1464 * tests/euc-mb: Likewise.
1465
1466 tests: fmbtest: factor
1467 * tests/fmbtest: Factor out locale-name duplication.
1468
1469 tests: fix skip-inducing typo in fmbtest
1470 * tests/fmbtest: Fix locale name typo (s/cz_CZ/cs_CZ/)
1471 that would cause this test to be skipped every time.
1472
14732011-06-07 Paolo Bonzini <bonzini@gnu.org>
1474
1475 gnulib: adjust included modules
1476 * bootstrap.conf (gnulib_modules): Drop strtoul, rename wctype to
1477 wctype-h.
1478
14792011-05-21 Jim Meyering <meyering@redhat.com>
1480
1481 grep -P: don't abort upon exceeding PCRE's backtracking limit
1482 * src/pcresearch.c (Pexecute): Handle PCRE_ERROR_MATCHLIMIT.
1483 * tests/Makefile.am (XFAIL_TESTS): Remove pcre-abort.
1484 * tests/pcre-abort: Expect failure, no output, and increase
1485 the length of the input string, in case the backtracking limit
1486 is ever raised. Adjust comment.
1487 * NEWS (Bug fixes): Mention it.
1488
1489 tests: show how to make grep -P abort
1490 * tests/pcre-abort: New file.
1491 Minimal testcase by Paolo Bonzini, derived from a report
1492 by www.beaver@list.ru.
1493 * tests/Makefile.am (TESTS): Add it.
1494 (XFAIL_TESTS): Add it here, too, since this test always fails, for now.
1495
1496 tests: fix oddities in pcre-z
1497 * tests/pcre-z: Redirect stderr inside $(), not outside.
1498 Remove double quotes around $REGEX (which is just 'a') within
1499 double-quoted "$(...)". Split a long line.
1500
1501 tests: factor out a new require_pcre_ function
1502 * tests/init.cfg (require_pcre_): New function, factored out of...
1503 * tests/pcre-z: ...here. Use the function.
1504 * tests/pcre: Likewise.
1505
1506 tests: clean up pcre
1507 * tests/pcre: Skip (don't pass) the test when PCRE support is disabled.
1508 Don't redirect so much to /dev/null, now that all test output goes to
1509 pcre.log. Remove unnecessary braces and diagnostic about failing test.
1510
15112011-05-13 Jim Meyering <meyering@redhat.com>
1512
1513 post-release administrivia
1514 * NEWS: Add header line for next release.
1515 * .prev-version: Record previous version.
1516 * cfg.mk (old_NEWS_hash): Auto-update.
1517
1518 version 2.8
1519 * NEWS: Record release date.
1520
1521 build: update gnulib, for fixed getcwd test
1522
1523 build: update gnulib submodule to latest
1524
1525 maint: remove syntax-checking sc_tight_scope rule
1526 * src/Makefile.am (sc_tight_scope): Remove rule.
1527 Now it's provided via gnulib's maint.mk.
1528 * cfg.mk (sc_tight_scope): Likewise.
1529
15302011-05-08 Jim Meyering <meyering@redhat.com>
1531
1532 maint: use consistent declaration syntax
1533 * src/grep.h (matchers): Declare consistently, so the sc_tight_scope
1534 rule detects this as an extern-marked variable.
1535
15362011-05-07 Jim Meyering <meyering@redhat.com>
1537
1538 maint: use gnulib's new readme-release module
1539 * bootstrap.conf (gnulib_modules): Add readme-release.
1540 (bootstrap_epilogue): Add the recommended perl one-liner.
1541 * README-release: Remove file; it is now generated from gnulib.
1542 * .gitignore: Add it.
1543 * gnulib: Update submodule to latest.
1544
1545 tests: exercise bug with 0x80..0xff in [...]
1546 * tests/high-bit-range: New test, inspired by an example in the
1547 report by Igor O. Ladygin: http://bugs.debian.org/624387,
1548 via Santiago Ruano Rincón's http://savannah.gnu.org/bugs/?33198
1549 * tests/Makefile.am (TESTS): Add it.
1550
1551 fix a bug whereby echo c|grep '[c]' would fail for any c in 0x80..0xff
1552 * src/dfa.c (setbit_case_fold) [MBS_SUPPORT]: Set the bit also
1553 when wctob returns EOF.
1554 * NEWS (Bug fixes): Mention it.
1555
15562011-05-02 Reuben Thomas <rrt@sc3d.org>
1557
1558 doc: correct comment about mmap
1559 * doc/grep.texi (Other Options) [--mmap]: This option is now
1560 ignored, so using it can have no effect on performance.
1561
15622011-05-02 Arnold D. Robbins <arnold@skeeve.com>
1563
1564 build: move add_utf8_anychar into MBS ifdef
1565
1566 maint: remove GAWK ifndef; no longer needed
1567
15682011-05-01 Jim Meyering <meyering@redhat.com>
1569
1570 maint: remove now-unnecessary use of gnulib's strtol module
1571 * bootstrap.conf (gnulib_modules): Remove now-obsolete "strtol".
1572
15732011-04-29 Jim Meyering <meyering@redhat.com>
1574
1575 maint: tweak README-release
1576 * README-release: Add note to check the NixOS/Hydra autobuilder results.
1577
15782011-04-28 Jim Meyering <meyering@redhat.com>
1579
1580 build: update gnulib submodule to latest
1581
1582 maint: add the tight_scope syntax-checking rule
1583 This ensures that the only externally scoped symbols are ones
1584 that are explicitly marked as "extern" or white-listed like "main".
1585 * src/Makefile.am (sc_tight_scope): New rule, copied from coreutils.
1586 * cfg.mk (sc_tight_scope): Define, to hook to it from the top level.
1587
1588 maint: mark some function declarations as extern
1589 * src/search.h: Add "extern" keyword to each function declaration.
1590
15912011-04-23 Jim Meyering <meyering@redhat.com>
1592
1593 maint: fix doubled-word typos in comments
1594 * src/dfa.c (SUCCEEDS_IN_CONTEXT): Remove doubled "a".
1595 * src/dfa.c (BACKREF): s/it it/it is/
1596
15972011-04-09 Jim Meyering <meyering@redhat.com>
1598
1599 maint: fix typos in comments: s/can not/cannot/
1600 * src/dfa.c (check_matching_with_multibyte_ops, dfastate): As above.
1601
16022011-03-19 Jim Meyering <meyering@redhat.com>
1603
1604 maint: stop using .x-sc_* files to list syntax-check exemptions
1605 Instead, use the new mechanism with which you merely use a
1606 variable (derived from the rule name) defined in cfg.mk to an ERE
1607 matching the exempted file names.
1608 * gnulib: Update to latest, to get maint.mk that implements this.
1609 * .x-sc_bindtextdomain: Remove file.
1610 * .x-sc_prohibit_tab_based_indentation: Likewise.
1611 * .x-sc_prohibit_xalloc_without_use: Likewise.
1612 * .x-sc_space_tab: Likewise.
1613 * cfg.mk: Define variables to exempt the same files.
1614
1615 build: correct my change of 2011-01-28
1616 Do not override original dist-hook rule.
1617 * Makefile.am (run-syntax-check): Rename from overriding dist-hook.
1618 (dist-hook): Depend on run-syntax-check.
1619
16202011-02-28 Jim Meyering <meyering@redhat.com>
1621
1622 maint: update from gnulib
1623 * bootstrap: Update from gnulib.
1624 * tests/init.sh: Likewise.
1625 * gnulib: Update to latest.
1626
16272011-01-28 Jim Meyering <meyering@redhat.com>
1628
1629 build: update gnulib submodule to latest
1630
1631 build: run syntax-check rules as part of "make dist"
1632 * Makefile.am (dist-hook): Depend on syntax-check.
1633 Suggested by Reuben Thomas.
1634
16352011-01-26 Jim Meyering <meyering@redhat.com>
1636
1637 maint: remove unneeded #include directives
1638 * lib/savedir.c: Don't include <stddef.h>. Not needed.
1639 * src/dfa.c: Likewise.
1640
16412011-01-22 Jim Meyering <meyering@redhat.com>
1642
1643 build: avoid new syntax-check failures
1644 * .x-sc_bindtextdomain: New file, used to avoid a spurious
1645 failure from the new syntax-check rule.
1646 * NEWS: Remove a trailing space.
1647
16482011-01-19 Jim Meyering <meyering@redhat.com>
1649
1650 tests: add a known-to-fail test
1651 * tests/turkish-I: New test.
1652 * tests/Makefile.am (TESTS): Add it.
1653 (XFAIL_TESTS): Add here, too.
1654 Reported by Ilya Basin.
1655
1656 maint: sort test names in Makefile.am
1657 * tests/Makefile.am (TESTS): Sort test names.
1658
16592011-01-05 Jim Meyering <meyering@redhat.com>
1660
1661 doc: remove erroneous "{,m}" item from grep man page
1662 * doc/grep.in.1: Remove item describing bogus {,m} regex notation.
1663 Reported by Fernando Basso.
1664
16652011-01-03 Jim Meyering <meyering@redhat.com>
1666
1667 maint: update copyright year ranges to include 2011
1668 Run "make update-copyright", so "make syntax-check" works in 2011.
1669
1670 build: update gnulib submodule to latest
1671
16722010-12-20 Paolo Bonzini <bonzini@gnu.org>
1673
1674 main: fix exit status on xmalloc failures
1675 * NEWS: Update.
1676 * src/main.c (main): Set exit_failure. Reported by Guy Shaw.
1677
1678 add comment above fn_grep
1679 * configure.ac (fn_grep): Add comment suggested by Bruno Haible.
1680
16812010-11-14 Paolo Bonzini <bonzini@gnu.org>
1682
1683 grep: add include guards
1684 * src/system.h: Add multiple inclusion guards.
1685 * src/grep.h: Likewise.
1686
1687 configure: fix M4 quotation
1688 * configure.ac: Add extra brackets around [...] patterns.
1689
1690 configure: remove dependency on grep that supports long lines and -e
1691 * configure.ac (fn_grep): New. Set GREP and EGREP to it, replace
1692 with newly-built grep before AC_OUTPUT. Reported by Florin Iucha
1693 <http://savannah.gnu.org/bugs/?31646>.
1694
16952010-11-04 Jim Meyering <meyering@redhat.com>
1696
1697 build: update gnulib to latest
1698
1699 tests: don't hard-code a 5-second timeout; that's not always enough
1700 Instead, time the command in the C locale and use 10 times that
1701 duration -- rounded up to whole seconds -- as the timeout when running
1702 it in the UTF-8 locale.
1703 * tests/backref-multibyte-slow: Compute a performance-relative timeout.
1704 Reported by Gilles Espinasse, regarding an imac 400. For more details,
1705 see http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3360
1706
17072010-10-09 Jim Meyering <meyering@redhat.com>
1708
1709 maint: describe policy on copyright year number ranges
1710 * README: Mention coreutils' long-standing policy on use of M-N
1711 ranges in copyright year lists. Requested by Richard Stallman.
1712
17132010-10-04 Dmitry V. Levin <ldv@altlinux.org>
1714
1715 build: compile gnulib without -Wcast-align to avoid warnings on ARM
1716 * configure.ac (GNULIB_WARN_CFLAGS): Remove -Wcast-align.
1717
17182010-09-30 Jim Meyering <meyering@redhat.com>
1719
1720 maint: don't define a gpg_key_ID. now it's obtained automatically
1721 * cfg.mk (gpg_key_ID): Remove definition. No longer needed.
1722
17232010-09-23 Paolo Bonzini <bonzini@gnu.org>
1724
1725 tests: add testcase for previous fix
1726 * tests/inconsistent-ranges: New.
1727 * tests/Makefile.am (TESTS): Add it.
1728
17292010-09-23 Paolo Bonzini <bonzini@gnu.org>
1730
1731 dfa: process range expressions consistently with system regex
1732 The actual meaning of range expressions in glibc is not exactly strcoll,
1733 which makes the behavior of grep hard to predict when compiled with the
1734 system regex. Leave to the system regex matcher the decision of which
1735 single-byte characters are matched by a range expression.
1736
1737 This partially reverts a change made in commit 0d38a8bb (which made
1738 sense at the time, but not now that src/dfa.c is not doing multibyte
1739 character set matching anymore).
1740
1741 * src/dfa.c (in_coll_range): Remove.
1742 (parse_bracket_exp): Use system regex to find which single-char
1743 bytes match a range expression.
1744
17452010-09-23 Bruno Haible <bruno@clisp.org>
1746
1747 build: fix link error on systems that have libiconv but not libintl
1748 * src/Makefile.am (LDADD): Add $(LIBICONV).
1749
17502010-09-21 Jim Meyering <meyering@redhat.com>
1751
1752 build: avoid compilation failure on the Hurd
1753 * src/dfasearch.c (dfawarn): Rename enum symbols to use DW_ prefix,
1754 so as not to collide with "GNU", which is defined by the Hurd.
1755 Reported by Matthias Lanzinger in http://savannah.gnu.org/bugs/?31096
1756
1757 maint: avoid obsolete gnulib modules
1758 * bootstrap.conf (gnulib_modules): Don't use obsolete atexit module.
1759 Use malloc-gnu and realloc-gnu -- malloc and realloc are obsolete.
1760
17612010-09-20 Jim Meyering <meyering@redhat.com>
1762
1763 maint: update README-release
1764 * README-release: Reflect changes in coreutils' version of this file.
1765
17662010-09-20 Aharon Robbins <arnold@skeeve.com>
1767
1768 dfa: fix compilation when not using MBS
1769 * src/dfa.c (prepare_wc_buf) [!MBS_SUPPORT]: Do not compile this
1770 function.
1771
17722010-09-16 Jim Meyering <meyering@redhat.com>
1773
1774 post-release administrivia
1775 * NEWS: Add header line for next release.
1776 * .prev-version: Record previous version.
1777 * cfg.mk (old_NEWS_hash): Auto-update.
1778
1779 version 2.7
1780 * NEWS: Record release date.
1781
17822010-09-14 Paolo Bonzini <bonzini@gnu.org>
1783
1784 tests: add equiv-classes
1785 * configure.ac (USE_INCLUDED_REGEX): Add Automake conditional.
1786 * tests/equiv-classes: New test.
1787 * tests/Makefile.am (TESTS): Add it.
1788 (XFAIL_TESTS) [USE_INCLUDED_REGEX]: Mark it as expected failure.
1789
17902010-09-14 Paolo Bonzini <bonzini@gnu.org>
1791
1792 dfa: fall back to glibc matcher if a MBCSET is found
1793 This patch enables full support of equivalence classes and multicharacter
1794 collation symbols. It can also improve performance problems in some
1795 cases for multibyte grep. Both of these changes however depend on the
1796 glibc version installed in the system.
1797
1798 For UTF-8 it will trigger only in the presence of MBCSET, e.g. [a-z].
1799 For other character sets all brackets and `.` as well will trigger it.
1800
1801 * NEWS: Document this.
1802 * src/dfa.c (dfaexec): Fall back to glibc for multibyte matches,
1803 if possible.
1804
18052010-09-14 Paolo Bonzini <bonzini@gnu.org>
1806
1807 build: update gnulib submodule to latest
1808 This is done to include commit "regex: Pass the system regex if its only
1809 problem is 32-bit regoff_t".
1810
1811 * gnulib: Update to e2b0e1a.
1812
18132010-09-12 Jim Meyering <meyering@redhat.com>
1814
1815 build: update gnulib submodule to latest
1816
1817 tests: update init.sh from gnulib
1818 * tests/init.sh: Update from gnulib.
1819
18202010-09-08 Patrick Boyd <pboyd04@gmail.com>
1821
1822 dfa: reduce stack usage
1823 * src/dfa.c (dfaanalyze): Allocate GRPS and LABELS arrays from heap,
1824 not on the stack. With this change, grep can now run in these UEFI
1825 simulators:
1826 http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK
1827 http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK2
1828
18292010-09-08 Jim Meyering <meyering@redhat.com>
1830
1831 tests/portability: avoid spurious failure with OpenBSD's /bin/sh
1832 * tests/warn-char-classes: Don't use "set -x" here. It causes
1833 a spurious test failure on openbsd 4.7 when using its /bin/sh,
1834 since the command, /bin/sh -xc 'P=1 : 2> err' emits "P=1" into err.
1835 To enable set -x, run the test with "VERBOSE=yes", e.g.,
1836 make check -C tests TESTS=warn-char-classes VERBOSE=yes
1837
1838 build: update gnulib submodule to latest
1839
18402010-09-03 Jim Meyering <meyering@redhat.com>
1841
1842 tests: remove .sh suffix from remaining test scripts.
1843 * tests/backref: Rename from backref.sh.
1844 * tests/bre: Rename from bre.sh.
1845 * tests/ere: Rename from ere.sh.
1846 * tests/file: Rename from file.sh.
1847 * tests/khadafy: Rename from khadafy.sh.
1848 * tests/options: Rename from options.sh.
1849 * tests/pcre: Rename from pcre.sh.
1850 * tests/spencer1: Rename from spencer1.sh.
1851 * tests/spencer2: Rename from spencer2.sh.
1852 * tests/status: Rename from status.sh.
1853 * tests/yesno: Rename from yesno.sh.
1854 * tests/Makefile.am: Reflect renamings.
1855
1856 tests: convert remaining tests to use init.sh
1857 * tests/file.sh: Use init.sh. Use Exit, not exit. Use grep, not ${GREP}.
1858 * tests/khadafy.sh: Likewise.
1859 * tests/options.sh: Likewise.
1860 * tests/spencer1.sh: Likewise.
1861 * tests/spencer2.sh: Likewise.
1862 * tests/status.sh: Likewise.
1863 * tests/spencer1.awk: Use grep, not ${GREP}.
1864 Don't ignore failure to generate intermediate shell script.
1865 * tests/Makefile.am (CLEANFILES): Remove altogether, now that
1866 all tests use init.sh.
1867 (TESTS_ENVIRONMENT): Don't set GREP. It's no longer used.
1868
1869 tests: remove warning.sh
1870 * tests/warning.sh: Remove file. All it did was print a warning.
1871 * tests/Makefile.am (TESTS): Remove warning.sh.
1872
1873 tests: convert pcre.sh to use init.sh
1874 * tests/pcre.sh: Use init.sh. Use Exit, not exit. Use grep, not ${GREP}.
1875
1876 tests: convert bre.sh to use init.sh
1877 * tests/bre.sh: Use init.sh.
1878 Use Exit, not exit.
1879 Use "$abs_top_srcdir/tests/", not "$srcdir/" to specify inputs.
1880 Source generated bre.script, rather than invoking $SHELL.
1881 * tests/ere.sh: Likewise.
1882 * tests/bre.awk: Use grep, not ${GREP}.
1883 * tests/ere.awk: Likewise.
1884 * tests/Makefile.am (CLEANFILES): Remove bre.script and ere.script.
1885
1886 tests: convert to use init.sh
1887 * tests/yesno.sh: Use init.sh.
1888 Use Exit, not exit.
1889 Use grep, not $GREP.
1890 * tests/backref.sh: Likewise.
1891 * tests/Makefile.am (CLEANFILES): Remove yesno.txt.
1892
1893 build: update gnulib submodule to latest
1894
1895 build: update build/test tools from gnulib
1896 * bootstrap: Update from gnulib.
1897 * tests/init.sh: Likewise.
1898
18992010-09-01 Jim Meyering <meyering@redhat.com>
1900
1901 maint: add lib/version-etc.c to the list in POTFILES.in
1902 * po/POTFILES.in: Add lib/version-etc.c.
1903
19042010-09-01 Jim Meyering <meyering@redhat.com>
1905
1906 grep: diagnose and exit-2 for bogus REs like [:space:], [:digit:], etc.
1907 When I make a mistake like this:
1908 grep '[:lower:]' ...
1909 be it in a script or on the command line, I want to know about
1910 it as soon as possible. I don't want grep to print a mere warning
1911 that it is interpreting this suspicious and almost guaranteed-wrong
1912 regular expression as a set of just 6 bytes. And I certainly don't
1913 want grep to silently do the wrong thing, even if that would be
1914 officially standards-conforming. It's obvious that I intended
1915 [[:lower:]], and I want my error to be diagnosed in a way that is
1916 most likely to get my attention. Thus, with this change, grep now
1917 prints a diagnostic and exits with status 2 the moment it
1918 encounters an offending [:char_class:] construct.
1919
1920 This changes the way grep works by default, rather than
1921 putting this new behavior on an option. A new option
1922 would seldom be used in scripts (not portable), and would
1923 probably be used only rarely by those who need it the most.
1924 This new functionality provides a valuable safety measure
1925 and incurs truly negligible risk.
1926
1927 For strict POSIX compliance, set POSIXLY_CORRECT in
1928 your environment. That disables this new feature.
1929
1930 Revert the changes from commit 2cd3bcea, "grep: add
1931 --warnings={always,never,auto}.", and then do the following:
1932
1933 * src/dfasearch.c (dfawarn): Call getenv("POSIXLY_CORRECT") here;
1934 Remove "warning: " from the diagnostic, now that it's more than
1935 a warning, and exit with status 2.
1936 * NEWS (New features): Describe the new semantics.
1937 * tests/warn-char-classes: Adjust one test to accommodate this change.
1938 * doc/grep.texi (Character Classes and Bracket Expressions): Document.
1939 (Environment Variables): Cross-reference it.
1940 Remove reference to obsolete getopt illegal vs. invalid difference.
1941 Thanks to Paul Eggert for suggestions and an initial prod.
1942
19432010-08-30 Jim Meyering <meyering@redhat.com>
1944
1945 maint: use gnulib's standard --version-printing code
1946 This includes author names and keeps the copyright year up to date.
1947 * bootstrap.conf (gnulib_modules): Add propername and version-etc-fsf.
1948 * src/main.c (AUTHORS): Define.
1949 (main): Use version_etc, rather than hard-coding the copyright text.
1950 Prompted by a patch from Paolo Bonzini.
1951
19522010-08-27 Paolo Bonzini <bonzini@gnu.org>
1953
1954 dfa: warn on [:space:] and similar
1955 * src/dfa.c (parse_bracket_exp): Warn on regular expressions such as
1956 [:space:].
1957 * src/dfa.h (dfawarn): New prototype.
1958 * src/dfasearch.c (dfawarn): New.
1959 * NEWS: Document.
1960
1961 tests: add test for warnings
1962 * tests/Makefile.am (TESTS): Add warn-char-class.
1963 * tests/warn-char-class: New.
1964
1965 grep: add --warnings={always,never,auto}.
1966 * src/grep.h (no_warnings): New declaration.
1967 * src/main.c (no_warnings): New.
1968 (WARNINGS_OPTION): Add to enum.
1969 (main): Add --warnings. Handle color_option == 2 together with it.
1970
1971 tests: add failing test for grep from a directory
1972 * tests/Makefile.am (TESTS, XFAIL_TESTS): Add grep-dir.
1973 * tests/grep-dir: New.
1974
1975 tests: add test for previous commit
1976 * tests/Makefile.am (TESTS): Add grep-dev-null.
1977 * tests/grep-dev-null: New.
1978
1979 search: fix "grep -Fif /dev/null"
1980 * bootstrap.conf: Include gnulib module minmax.
1981 * src/searchutils.c (mbtolower): Handle *N == 0 case.
1982 * src/system.h: Include minmax.h from gnulib.
1983
19842010-08-27 Adam Katz <savannah@kopis.com>
1985
1986 Remove declaration after statement in dfa.c
1987 * dfa.c (dfaexec): Declare saved_end at the beginning of the function.
1988
19892010-08-14 Jim Meyering <meyering@redhat.com>
1990
1991 make --include=FILE work once again
1992 The semantics of excluded_file_name changed (when operating on
1993 an "included" file name list).
1994 * src/main.c (main): Adjust for changed semantics of excluded_file_name
1995 simply by removing a negation.
1996 * NEWS (Bug fixes): Mention this fix.
1997 * tests/include-exclude: Add a test for this.
1998 Reported by Joe Perches in http://savannah.gnu.org/bugs/?29876.
1999
20002010-07-16 Paolo Bonzini <bonzini@gnu.org>
2001
2002 doc: document \s and \S
2003 * doc/grep.texi (The Backslash Character and Special Expressions):
2004 Document \s and \S escapes.
2005
20062010-05-29 Karl Berry <karl@gnu.org>
2007
2008 doc: discuss matches that span two or more lines
2009 * doc/grep.texi (Usage): Discuss matching across lines.
2010 (Character Classes and Bracket Expressions) <[:space:]>: refer to it.
2011
20122010-05-26 Jim Meyering <meyering@redhat.com>
2013
2014 build: use latest gettext: 0.18
2015 * configure.ac: Use gettext-0.18.
2016 * bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
2017 since the latter drags in a depedency on gettext 0.18.
2018 Suggested by Bruno Haible.
2019
2020 maint: update helper scripts from gnulib
2021 * tests/init.sh: Update from gnulib.
2022 * bootstrap: Likewise.
2023
2024 build: update gnulib submodule to latest
2025
2026 maint: don't emit an extra newline in each of two diagnostics
2027 * src/main.c (context_length_arg, grepdir): Remove a stray \n in
2028 each of two diagnostics.
2029
20302010-05-24 Bruno Haible <bruno@clisp.org>
2031
2032 search: Avoid out-of-bounds access.
2033 * src/dfasearch.c (EGexecute): Avoid access beyond end of buffer
2034 that could happen if start != beg - buf.
2035
20362010-05-23 Aharon Robbins <arnold@skeeve.com>
2037
2038 dfa: fix signedness warnings
2039 * src/dfa.c (dfaexec): Cast p when passing it to prepare_wc_buf.
2040
20412010-05-09 Jim Meyering <meyering@redhat.com>
2042
2043 tests: update init.sh
2044 * tests/init.sh: Update from gnulib.
2045
2046 tests: normalize init.sh-sourcing code
2047 * tests/backref-multibyte-slow: Use one-line idiom.
2048 * tests/backref-word: Likewise.
2049 * tests/case-fold-backref: Likewise.
2050 * tests/case-fold-backslash-w: Likewise.
2051 * tests/case-fold-char-class: Likewise.
2052 * tests/case-fold-char-range: Likewise.
2053 * tests/case-fold-char-type: Likewise.
2054 * tests/char-class-multibyte: Likewise.
2055 * tests/dfaexec-multibyte: Likewise.
2056 * tests/empty: Likewise.
2057 * tests/euc-mb: Likewise.
2058 * tests/fedora: Likewise.
2059 * tests/fgrep-infloop: Likewise.
2060 * tests/fmbtest: Likewise.
2061 * tests/foad1: Likewise.
2062 * tests/ignore-mmap: Likewise.
2063 * tests/include-exclude: Likewise.
2064 * tests/max-count-vs-context: Likewise.
2065 * tests/pcre-z: Likewise.
2066 * tests/prefix-of-multibyte: Likewise.
2067 * tests/reversed-range-endpoints: Likewise.
2068 * tests/sjis-mb: Likewise.
2069 * tests/spencer1-locale: Likewise.
2070 * tests/word-delim-multibyte: Likewise.
2071 * tests/word-multi-file: Likewise.
2072
2073 tests: update help-version
2074 * tests/help-version: Update from coreutils.
2075
20762010-05-06 Jim Meyering <meyering@redhat.com>
2077
2078 tests: enable glibc's malloc-perturbing option
2079 * tests/Makefile.am (MALLOC_PERTURB_): Define, in case it's not already
2080 set in your environment.
2081 (TESTS_ENVIRONMENT): Propagate MALLOC_PERTURB_ setting to test scripts.
2082
20832010-05-06 Paolo Bonzini <bonzini@gnu.org>
2084
2085 dfa: speed up [[:digit:]] and [[:xdigit:]]
2086 There's no "multibyte pain" in these two classes, since POSIX
2087 and ISO C99 mandate their contents.
2088
2089 Time for "./grep -x '[[:digit:]]' /usr/share/dict/linux.words"
2090 Before: 1.5s, after: 0.07s. (sed manages only 0.5s).
2091
2092 * src/dfa.c (predicates): Declare struct dfa_ctype separately
2093 from definition. Add sb_only.
2094 (find_pred): Return const struct dfa_ctype *.
2095 (parse_bracket_exp): Return const struct dfa_ctype *. Do
2096 not fill MBCSET for sb_only character types.
2097
20982010-05-05 Jim Meyering <meyering@redhat.com>
2099
2100 tests: readability: use awk rather than obfuscated sed
2101 * tests/backref-multibyte-slow: Generate input using an awk for-loop
2102 rather than expensive and harder-to-read sed pipes.
2103 Remove stray "set -x" and "wc -l in".
2104
2105 dfa: avoid segfault when processing an invalid multi-byte sequence
2106 * src/dfa.c (dfaexec): Handle the cases in which mbrtowc returns
2107 (size_t)-1 or (size_t)-2, rather than setting mblen_buf[i] to an
2108 outrageously large value.
2109
21102010-05-05 Paolo Bonzini <bonzini@gnu.org>
2111
2112 grep: remove redundant syntax bit
2113 * grep.c (Gcompile): Remove RE_HAT_LISTS_NOT_NEWLINE.
2114
2115 tests: add test for newly-fixed performance problem
2116 * tests/backref-multibyte-slow: New.
2117 * tests/Makefile.am: Add it.
2118
21192010-05-05 Paolo Bonzini <bonzini@gnu.org>
2120
2121 dfa: convert to wide character line-by-line
2122 This provides a nice speedup for -m in general, but especially
2123 it avoids quadratic complexity in case we have to go to glibc.
2124
2125 * NEWS: Document change.
2126 * src/dfa.c (prepare_wc_buf): Extract out of dfaexec. Convert
2127 only up to the next newline.
2128 (dfaexec): Exit multibyte processing loop if past buf_end.
2129 Call prepare_wc_buf again after processing a newline.
2130
21312010-05-01 Jim Meyering <meyering@redhat.com>
2132
2133 maint: remove useless #if HAVE_STDLIB_H
2134 * src/mbsupport.h: Don't test HAVE_STDLIB_H.
2135
21362010-04-20 Jim Meyering <meyering@redhat.com>
2137
2138 dfa: don't #ifdef-out member declarations
2139 * src/dfa.c (struct dfa): Remove "#if MBS_SUPPORT" guard that made
2140 several member declarations conditional on this cpp definition.
2141 (token): Likewise.
2142 Reported by Anders Wallin.
2143
2144 tests: ensure that the --mmap option is ignored
2145 * tests/ignore-mmap: New file.
2146 * tests/Makefile.am (TESTS): Add it.
2147 Reported by Jaroslav Škarvada in <http://savannah.gnu.org/bugs/?29614>
2148
21492010-04-20 Paolo Bonzini <bonzini@gnu.org>
2150
2151 dfa: honor RE_DOT_NEWLINE and RE_DOT_NOT_NULL in UTF-8 period optimization
2152 * src/dfa.c (add_utf8_anychar): Check for RE_DOT_NEWLINE and
2153 RE_DOT_NOT_NULL.
2154
2155 grep: fix --mmap not being ignored
2156 * NEWS: Document bugfix.
2157 * main.c (main): Ignore MMAP_OPTION.
2158
21592010-04-19 Jim Meyering <meyering@redhat.com>
2160
2161 maint: avoid syntax-check failure due to indentation via TABs
2162 * src/dfa.c (atom): Expand TABs in indentation.
2163
2164 build: update gnulib submodule to latest
2165
2166 maint: restrict scope of two globals to dfasearch.c
2167 * src/dfasearch.c (patterns, pcount): Declare these file-scoped
2168 globals to be static.
2169
21702010-04-19 Paolo Bonzini <bonzini@gnu.org>
2171
2172 dfa: optimize UTF-8 period
2173 * NEWS: Document improvement.
2174 * src/dfa.c (struct dfa): Add utf8_anychar_classes.
2175 (add_utf8_anychar): New.
2176 (atom): Simplify if/else nesting. Call add_utf8_anychar for ANYCHAR
2177 in UTF-8 locales.
2178 (dfaoptimize): Abort on ANYCHAR.
2179
2180 dfa: drop ORTOP
2181 * src/dfa.c (token, prtok, addtok_mb, nsubtoks, dfaanalyze, dfamust):
2182 Remove ORTOP.
2183 (regexp): Remove parameter, always add OR at the end, adjust callers.
2184 (atom): Adjust caller.
2185 (dfaparse): Adjust caller. Always add OR at the end.
2186
2187 dfa: fix {0,0}
2188 * NEWS: Document change.
2189 * src/dfa.c (struct dfa): Remove "broken" field.
2190 (lex): Do not set it.
2191 (closure): On {0,0}, backup and lex another closure without
2192 adding a CAT.
2193 (dfabroken): Remove.
2194 * src/dfa.h (dfabroken): Remove.
2195 * tests/spencer1.tests: Add testcases for {m,n}.
2196
2197 dfa: simplify dfainit
2198 * src/dfa.c (dfainit): Use memset.
2199
22002010-04-17 Jim Meyering <meyering@redhat.com>
2201
2202 doc: fix a nit in HACKING
2203 * HACKING: Correct size of .git/ dir: 9MB, not 30MB.
2204
2205 tests: add an expected-to-fail test using \< in a multi-byte locale
2206 * tests/word-delim-multibyte: New test. Currently failing.
2207 * tests/Makefile.am (TESTS): Add it.
2208 (XFAIL_TESTS): Define, temporarily.
2209 Reported by Jaroslav Škarvada in http://savannah.gnu.org/bugs/?29537.
2210
22112010-04-17 Paolo Bonzini <bonzini@gnu.org>
2212
2213 test: cover just-fixed bug
2214 * tests/empty: Test -Fw too.
2215
2216 grep: fix matching the empty string with grep -Fw
2217 * NEWS: Document fix.
2218 * src/kwsearch.c (Fexecute): The empty string is a valid match if it is
2219 a whole word.
2220
22212010-04-16 Jim Meyering <meyering@redhat.com>
2222
2223 maint: update init.sh and HACKING
2224 * HACKING: Sync from coreutils.
2225 * tests/init.sh: Update from gnulib.
2226
22272010-04-13 Jim Meyering <meyering@redhat.com>
2228
2229 build: update gnulib submodule to latest; adapt
2230 * COPYING: Remove empty line.
2231 * README: Likewise.
2232 * doc/fdl.texi: Likewise.
2233 * tests/backref-word: Likewise.
2234
22352010-04-12 Stefano Lattarini <stefano.lattarini@gmail.com>
2236
2237 tests: accept the Debian timeout program
2238 * tests/init.cfg: test timeout with `timeout 10s true'
2239
22402010-04-08 Jim Meyering <meyering@redhat.com>
2241
2242 dfa: convert "cannot happen" code/comment to use assert
2243 * src/dfa.c (dfamust): There were numerous "cannot happen" comments,
2244 some associated with "if (expr) goto done;". Replace each with an
2245 equivalent "assert (!expr);".
2246
2247 build: use gnulib's isblank module
2248 * bootstrap.conf (gnulib_modules): Use gnulib's isblank module,
2249 now that we rely on the function by that name.
2250
2251 maint: undo TAB-conversion change to gl/lib/*.c.diff
2252 This fixes a bootstrap failure due to the patches not applying.
2253 * .x-sc_prohibit_tab_based_indentation: Add ^gl/lib/.*\.c\.diff$
2254 * gl/lib/regcomp.c.diff: Revert today's TAB->space change.
2255 * gl/lib/regex_internal.c.diff: Likewise.
2256 * gl/lib/regexec.c.diff: Likewise.
2257
22582010-04-08 Arnold D. Robbins <arnold@skeeve.com>
2259
2260 dfa: fix declaration of dfabroken in dfa.h
2261 * dfa.h (dfabroken) [GAWK]: Fix declaration to match that in dfa.c.
2262
22632010-04-08 Jim Meyering <meyering@redhat.com>
2264
2265 maint: add syntax-check rule to enforce the new no-leading-TABs policy
2266 * cfg.mk (sc_prohibit_tab_based_indentation): New rule, from coreutils.
2267 (sc_prohibit_emacs__indent_tabs_mode__setting): Likewise.
2268 (old_NEWS_hash): Update.
2269 * .x-sc_prohibit_tab_based_indentation: List exempt files.
2270
22712010-04-08 Jim Meyering <meyering@redhat.com>
2272
2273 convert all TABs to equivalent spaces in indentation
2274 Using this file,
2275
2276 cat > leading-blank.exempt <<\EOF
2277 (?:^|\/)ChangeLog[^/]*$
2278 (?:^|\/)(?:GNU)?[Mm]akefile[^/]*$
2279 \.(?:am|mk)$
2280 EOF
2281
2282 run this command to convert all non-conforming leading white
2283 space to be all spaces:
2284
2285 git ls-files \
2286 | pcregrep -vf leading-blank.exempt \
2287 | xargs pcregrep -l '^ *\t' \
2288 | xargs perl -MText::Tabs -ni -le \
2289 '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2290
22912010-04-08 Jim Meyering <meyering@redhat.com>
2292
2293 build: include cfg.mk in the distribution tarball
2294 * Makefile.am (EXTRA_DIST): Add cfg.mk.
2295
22962010-04-08 Jim Meyering <meyering@redhat.com>
2297
2298 maint: Makefile.am tweak (no semantic change)
2299 * Makefile.am (EXTRA_DIST): List one per line. Sort.
2300
2301 build: include cfg.mk in the distribution tarball
2302 * Makefile.am (EXTRA_DIST): Add cfg.mk.
2303
23042010-04-08 Jim Meyering <meyering@redhat.com>
2305
2306 dfa: move definition of __attribute__ back into dfa.h
2307 * src/dfa.c (__attribute__): Move definition back to...
2308 * src/dfa.h: ... this file. It is essential for non-gcc compilers.
2309 Reported by Arnold Robbins.
2310
23112010-04-07 Arnold D. Robbins <arnold@skeeve.com>
2312
2313 dfa: move internals from dfa.h to dfa.c
2314 * src/dfa.h: Move internals into dfa.c.
2315 * src/dfa.c: The dfa internals are now totally local to this file.
2316 (dfaalloc, dfamusts, dfabroken): New functions to access features.
2317 * src/dfasearch.c (dfa): Change this global variable from struct to pointer.
2318 Adapt to that change, and use new functions, dfamusts and dfaalloc.
2319
23202010-04-07 Jim Meyering <meyering@redhat.com>
2321
2322 mbtolower: avoid potential NULL-dereference
2323 * src/searchutils.c: Include <assert.h>.
2324 (mbtolower): Assert that 0 < *n, to avoid possibility of NULL-deref.
2325 Remove dead increment.
2326
2327 maint: tell git to ignore more build products
2328 * .gitignore: Also ignore results of "make ID" and "make tags".
2329
2330 build: update gnulib submodule to latest
2331
2332 tests: use init.sh consistently
2333 * tests/euc-mb: Call "path_prepend_ ." on a line by itself,
2334 and with a comment. This makes it so all of the srcdir/init.sh
2335 lines are consistent, project-wide, and so that the addition of "."
2336 to PATH for this test is properly documented.
2337 * tests/sjis-mb: Likewise.
2338
2339 maint: avoid new syntax-check failure, ...
2340 ...now that the sole use of xmalloc no longer matches the
2341 regular expression used by the syntax-check rule.
2342 * .x-sc_prohibit_xalloc_without_use: Exempt src/kwset.c.
2343
2344 grep: make kwset's obstack use xmalloc, not malloc
2345 This insidious bug could make grep fail to diagnose a failed malloc,
2346 and then proceed to dereference the resulting NULL pointer.
2347 Note that this bug was unlikely ever to cause real trouble; without
2348 the fix, grep would segfault upon OOM, now it exits with a diagnostic.
2349 * src/kwset.c (malloc) [GREP]: Define without the "(s)" macro
2350 parameter, so that unadorned uses of malloc are also mapped to xmalloc.
2351 One such use is in the expansion of obstack_init.
2352 Report and patch by Nelson H. F. Beebe, in
2353 http://thread.gmane.org/gmane.comp.gnu.grep.bugs/2995
2354
2355 tests: improve help-version (sync from gzip's version)
2356 * tests/help-version: Cross-check $VERSION and --version output.
2357 * tests/Makefile.am (TESTS_ENVIRONMENT): Export VERSION=$(VERSION).
2358
23592010-04-06 Jim Meyering <meyering@redhat.com>
2360
2361 doc: update THANKS
2362 * THANKS: Update.
2363
23642010-04-06 Aharon Robbins <arnold@skeeve.com>
2365
2366 build: avoid conflict with WCHAR definition from Cygwin's <windows.h>
2367 * src/dfa.h (enum token): Remove the definition from this file.
2368 Replace with a declaration and typedef. Moved to ...
2369 * src/dfa.c (enum token): ... here.
2370 Reported by Corinna Vinschen.
2371
23722010-04-06 Jim Meyering <meyering@redhat.com>
2373
2374 doc: add HACKING
2375 * HACKING: New file. Copied from coreutils, with s/coreutils/grep/
2376 and a few minor edits.
2377
23782010-04-05 Jim Meyering <meyering@redhat.com>
2379
2380 tests: pull fixed init.sh from gnulib
2381 * tests/init.sh: Update from gnulib.
2382
2383 maint: fix new argmatch-related syntax-check failures
2384 * configure.ac (ARGMATCH_DIE): Use usage(EXIT_FAILURE), not exit(1).
2385 * po/POTFILES.in: Add lib/argmatch.c.
2386
2387 maint: update cfg.mk to work with gnulib's newer "make syntax-check"
2388 * cfg.mk: Update to use new _sc_search_regexp interface. Run this:
2389 perl -pi -e 's/\b_prohibit_regexp\b/_sc_search_regexp/;'
2390 -e 's/\bmsg=/halt=/; s/\bre=/prohibit=/;' cfg.mk
2391 and then adjust backslashes so they still line up.
2392
2393 maint: update tests/init.sh from gnulib
2394 This ensures that the explanation for any skipped or failed test
2395 is printed on stderr, not buried in each .log file.
2396 * tests/init.sh: Update from gnulib.
2397 * tests/init.cfg (stderr_fileno_): Define to 9, to match the
2398 literal 2>&9 in tests/Makefile.am
2399
2400 build: update gnulib submodule to latest
2401
24022010-04-04 Jim Meyering <meyering@redhat.com>
2403
2404 maint: use argmatch, for better --directories=INVAL diagnostics
2405 Before, you'd see this:
2406 grep: unknown directories method
2407
2408 Now, you'll see this:
2409 grep: invalid argument `INVAL' for `--directories'
2410 Valid arguments are:
2411 - `read'
2412 - `recurse'
2413 - `skip'
2414 Usage: src/grep [OPTION]... PATTERN [FILE]...
2415 Try `src/grep --help' for more information.
2416
2417 * bootstrap.conf: Add argmatch.
2418 * configure.ac: Define ARGMATCH_DIE and ARGMATCH_DIE_DECL.
2419 * src/main.c (directories_type): Define.
2420 (directories_args, directories_types) Define.
2421 All of the above so we can...
2422 (main): Use XARGMATCH.
2423 (usage): Declare extern, now that argmatch calls it via ARGMATCH_DIE.
2424
24252010-04-04 Jim Meyering <meyering@redhat.com>
2426
2427 dfa.c: const correctness; and remove useless casts of realloc and malloc
2428 * src/dfa.c (icatalloc, icpyalloc, istrstr, enlist): As above.
2429 (inboth, dfamust, comsubs): Likewise.
2430
2431 dfa.c: use a better (unsigned) type for an index: int->unsigned int
2432 * src/dfa.c (dfaexec): Use "unsigned int" for a logically unsigned index.
2433
2434 maint: style: use sizeof VAR, rather than sizeof TYPE, where possible
2435 * src/dfa.c (copyset, zeroset): Prefer sizeof EXPR, over sizeof TYPE,
2436 for improved readability/maintainability.
2437 (equal, parse_bracket_exp, addtok_wc, dfaparse, dfaexec): Likewise.
2438
24392010-04-02 Jim Meyering <meyering@redhat.com>
2440
2441 dfa.c: use a better (unsigned) type for an index: int->size_t
2442 * src/dfa.c (parse_bracket_exp): Use size_t as type of index, not int.
2443
2444 maint: const-correctness
2445 * src/dfa.c (tstbit, copyset, equal, charclass_index): Declare read-only
2446 "charclass" parameters to be "const". No semantic change.
2447
2448 maint: include <wchar.h> and <wctype.h> unconditionally
2449 * src/main.c: Include <wchar.h> and <wctype.h> unconditionally.
2450 Their presence/usefulness are assured by gnulib.
2451 * src/dfa.c: Likewise.
2452 * src/search.h: Likewise.
2453
2454 maint: MBS_SUPPORT: define to 0/1, not undef/1
2455 Prepare to remove many of these #ifdefs.
2456 * src/mbsupport.h (MBS_SUPPORT): Define to 0/1, not undef/1.
2457 Change each "#ifdef MBS_SUPPORT" to "#if MBS_SUPPORT". Use this:
2458 perl -pi -e 's/ifdef (MBS_SUPPORT)/if $1/' $(g grep -l ifdef.MBS_SUPPO)
2459 * src/dfa.c: s/#ifdef MBS_SUPPORT/#if MBS_SUPPORT/
2460 * src/dfa.h: Likewise.
2461 * src/dfasearch.c: Likewise.
2462 * src/kwsearch.c: Likewise.
2463 * src/main.c: Likewise.
2464 * src/search.h: Likewise.
2465 * src/searchutils.c: Likewise.
2466
24672010-04-02 Jim Meyering <meyering@redhat.com>
2468
2469 maint: use STREQ in place of strcmp
2470 perl -pi -e 's/\bstrcmp *\((.*?)\) == 0/STREQ ($1)/' src/main.c
2471 perl -pi -e 's/\bstrcmp *\((.*?)\) != 0/!STREQ ($1)/' src/main.c
2472
2473 * src/dfa.c (STREQ): Define.
2474 Use it instead of strcmp.
2475 * src/main.c (STREQ): Likewise.
2476 * cfg.mk (local-checks-to-skip): Remove sc_prohibit_strcmp,
2477 to enable the strcmp-prohibition.
2478
24792010-04-02 Jim Meyering <meyering@redhat.com>
2480
2481 maint: enable the useless_cpp_parens syntax check
2482 * cfg.mk (local-checks-to-skip): Remove sc_useless_cpp_parens.
2483 * src/main.c (devices, fillbuf, exit_on_match): Remove useless parens.
2484 (print_line_head, grepfile, set_limits, main): Likewise.
2485 * src/vms_fab.h: Likewise.
2486 * vms/config_vms.h: Likewise.
2487 * src/mbsupport.h: Likewise.
2488
2489 cleanup and improvement: parse command line arguments consistently
2490 * src/main.c: Include c-ctype.h, for this:
2491 (prepend_args): Use c_isspace, not ISSPACE.
2492 This is important so that we parse arguments consistently,
2493 and independently of the current locale.
2494 * bootstrap.conf (gnulib_modules): Add c-ctype.
2495 * src/system.h: Remove IS* definitions here, too.
2496 * src/dfasearch.c (WCHAR): Use isalnum, not ISALNUM.
2497 * src/kwsearch.c (WCHAR): Likewise.
2498 * src/searchutils.c (kwsinit): Use tolower, not TOLOWER.
2499
2500 cleanup: rely on gnulib's ctype.h functions; remove IS* macros and is_*
2501 * src/dfa.c (setbit_case_fold, prednames): Use official names.
2502 (IS_WORD_CONSTITUENT, lex): Likewise.
2503 (ISALNUM, ISALPHA, ISCNTRL, ISDIGIT, ISGRAPH): Remove definitions.
2504 (ISLOWER, ISPRINT, ISPUNCT, ISSPACE, ISUPPER, ISXDIGIT): Likewise.
2505 (is_alnum, is_alpha, is_blank, is_cntrl, is_digit, is_graph): Likewise.
2506 (is_lower, is_print, is_punct, is_space, is_upper, is_xdigit): Likewise.
2507 (isgraph): Likewise.
2508
2509 build: update gnulib submodule to latest, and adjust
2510 * src/main.c (parse_grep_colors): Adjust diagnostics not to trigger
2511 the sc_error_message_period and sc_error_message_uppercase
2512 syntax-check rules.
2513
2514 maint: remove all VMS-related code
2515 * configure.ac (AC_CONFIG_FILES): Remove vms/Makefile
2516 * Makefile.am (SUBDIRS): Remove vms.
2517 * src/Makefile.am (EXTRA_DIST): Remove vms_fab.c and vms_fab.h.
2518 * src/vms_fab.c, src/vms_fab.h, vms/make.com: Remove files.
2519 * vms/Makefile.am, vms/README, vms/config_vms.h: Likewise.
2520
2521 post-release administrivia
2522 * NEWS: Add header line for next release.
2523 * .prev-version: Record previous version.
2524 * cfg.mk (old_NEWS_hash): Auto-update.
2525
2526 version 2.6.3
2527 * NEWS: Record release date.
2528
25292010-04-02 Jim Meyering <meyering@redhat.com>
2530
2531 grep: avoid used-undefined error with truncated multibyte input
2532 * src/dfa.c (addtok_wc): Don't use buf[0] (it's undefined) when
2533 wcrtomb returns <= 0.
2534
2535 MBS_SUPPORT-removal: * src/dfa.c (dfastate):
2536
25372010-04-01 Jim Meyering <meyering@redhat.com>
2538
2539 maint: avoid unnecessary 2nd getenv("TERM")
2540 * src/main.c (main): Don't call getenv("TERM") twice -- in the same
2541 expression, even.
2542
2543 tests: remove all unportable uses of echo
2544 * src/main.c: Use printf rather than echo -ne in a comment.
2545 * tests/fedora: Use printf (not echo) also in ok/fail functions.
2546 * cfg.mk (sc_prohibit_echo_minus_en): New rule, to prohibit
2547 any future introduction.
2548
2549 tests: add explicit requirement for en_US.UTF-8
2550 * tests/char-class-multibyte: Use require_en_utf8_locale_,
2551 rather than open-coding it.
2552 * tests/prefix-of-multibyte: Require the locale explicitly.
2553 * tests/fgrep-infloop: Likewise.
2554 This fixes test failures that would arise on systems without
2555 that particular locale. Reported by Ludovic Courtès.
2556
2557 tests: new function, to require an en_US UTF8 locale
2558 * tests/init.cfg (require_en_utf8_locale_): New function.
2559
2560 tests: use printf, not echo -n, echo -e, or any combination
2561 * tests/fedora: Using printf is more portable.
2562
2563 grep: remove unnecessary code
2564 * src/main.c (print_line_middle): Now that we use RE_ICASE
2565 (enabled in commit 70e23616, "dfa: rewrite handling of multibyte
2566 case_fold lexing"), this case-conversion code is useless and wasteful.
2567 Remove it.
2568
2569 doc: fix typo: s/AM_V_AT/AM_V_at/
2570 * doc/Makefile.am (egrep.1 fgrep.1): The former has case consistent
2571 with its sister variable, AM_V_GEN, but the latter is the one that
2572 actually works.
2573
2574 doc: generated files are best made read-only, ...
2575 ...to minimize risk of accidentally modifying the generated file
2576 rather than its template. These are tiny, so no risk, but it's
2577 a good to be consistent, so generated files are easier to spot.
2578 * doc/Makefile.am (egrep.1 fgrep.1): When generating these files,
2579 ensure that they too are created read-only.
2580
2581 doc: generate grep.1 from template
2582 * doc/Makefile.am (grep.1): New rule.
2583 (CLEANFILES): Add grep.1 to the list.
2584 * .gitignore: Add /doc/grep.1
2585 * doc/grep.in.1: Replace hard-coded "2.5.1-cvs" with @VERSION@.
2586 Update copyright year list.
2587 Omit the line-splitting \(co directive so that update-copyright
2588 will perform future updates automatically.
2589 Egmont Koblinger reported the outdated version string
2590 and copyright year list in the man page:
2591 http://savannah.gnu.org/bugs/?29390
2592
2593 doc: prepare to generate grep.1
2594 * doc/grep.1: Rename to...
2595 * doc/grep.in.1: ...this.
2596
25972010-03-31 Eric Blake <eblake@redhat.com>
2598
2599 build: avoid another warning
2600 Noticed on cygwin:
2601 get-mb-cur-max.c: In function 'main':
2602 get-mb-cur-max.c:27: error: unused parameter 'argc' [-Wunused-parameter]
2603
2604 * tests/get-mb-cur-max.c (main): Use argc.
2605
26062010-03-31 Paolo Bonzini <bonzini@gnu.org>
2607
2608 tests: fix on systems with broken sh
2609 * tests/Makefile.am (TESTS_ENVIRONMENT): Adjust coreutils remnants.
2610 * tests/bre.sh: Invoke script with $SHELL if defined.
2611 * tests/ere.sh: Likewise.
2612 * tests/spencer1-locale: Likewise.
2613 * tests/spencer1.sh: Likewise.
2614
2615 tests: improve empty test
2616 * tests/empty: Add more tests, note expected failure.
2617
2618 tests: improve empty test with respect to locales
2619 * tests/empty: Add tests for multiple locales.
2620
2621 grep: fix grep -F against empty string
2622 * src/searchutils.c (is_mb_middle): Do not return true for empty matches
2623 when p == buf.
2624
2625 tests: rename empty.sh to empty
2626 * tests/empty.sh: Rename to...
2627 * tests/empty: ... this.
2628 * tests/Makefile.am (TESTS): Adjust.
2629
2630 tests: convert empty.sh to new style
2631 * tests/empty.sh: Convert to init.sh, add 10-second timeout.
2632
2633 tests: use get-mb-cur-max in char-class-multibyte
2634 * tests/char-class-multibyte: Use get-mb-cur-max to detect UTF-8 support.
2635 Rewrite previous locale detection code as a grep test.
2636
2637 tests: fix -Wformat failure
2638 * tests/get-mb-cur-max (main): Cast MB_CUR_MAX to int.
2639
26402010-03-31 Jim Meyering <meyering@redhat.com>
2641
2642 doc: add a "Reply-To" to the suggested announcement mail header
2643 * README-release: Add "Reply-To" with the list address,
2644 to minimize risk of replies to the other announcement recipients.
2645 Suggestion from Eric Blake.
2646
26472010-03-30 Jim Meyering <meyering@redhat.com>
2648
2649 build: avoid compiler warning when building test program
2650 * tests/Makefile.am (AM_CPPFLAGS, AM_CFLAGS, AM_LDFLAGS): Define,
2651 so that all the usual C compile-and-link machinery comes into play.
2652 * tests/get-mb-cur-max.c: Include "progname.h".
2653 Remove unnecessary inclusion of <ctype.h>.
2654 Mike Frysinger reported the "implicit decl of set_program_name" warning.
2655
2656 build: detect PCRE support also when <pcre/pcre.h> is the header
2657 * m4/pcre.m4: Also check for <pcre/pcre.h>.
2658 * src/pcresearch.c: Include <pcre/pcre.h>, if needed.
2659 Guard inclusions with HAVE_PCRE_H and HAVE_PCRE_PCRE_H, not HAVE_LIBPCRE.
2660 * NEWS (Bug fixes): Mention it.
2661 Dmitry V. Levin reported that PCRE support was not detected
2662 on systems with <pcre.h> not in the default include path.
2663
26642010-03-29 Jim Meyering <meyering@redhat.com>
2665
2666 post-release administrivia
2667 * NEWS: Add header line for next release.
2668 * .prev-version: Record previous version.
2669 * cfg.mk (old_NEWS_hash): Auto-update.
2670
2671 version 2.6.2
2672 * NEWS: Record release date.
2673
26742010-03-29 Eric Blake <eblake@redhat.com>
2675
2676 build: avoid warnings on cygwin
2677 * lib/savedir.c (isdir): Avoid shadowing a declaration.
2678 * src/main.c (get_nondigit_option): Cast away const to avoid
2679 compiler warning.
2680
2681 maint: ignore new test executable
2682 * .gitignore: Enhance.
2683
26842010-03-29 Jim Meyering <meyering@redhat.com>
2685
2686 doc: consolidate redundant-looking entries
2687 * NEWS: Consolidate the two --include/exclude-related entries.
2688 Suggested by Eric Blake.
2689
26902010-03-29 Paolo Bonzini <bonzini@gnu.org>
2691
2692 tests: use $(...) consistently
2693 * tests/backref.sh: Use `...' instead of ``...'' in comments.
2694 * tests/bre.awk: Use $(...) instead of `...`.
2695 * tests/ere.awk: Use $(...) instead of `...`.
2696 * tests/euc-mb: Use $(...) instead of `...`.
2697 * tests/fmbtest: Use $(...) instead of `...`.
2698 * tests/foad1: Use $(...) instead of `...`.
2699 * tests/pcre-z: Use $(...) instead of `...`. Quote output of grep.
2700 * tests/spencer1-locale.awk: Use $(...) instead of `...`.
2701 * tests/spencer1.awk: Use $(...) instead of `...`.
2702 * tests/yesno.sh: Use $(...) instead of `...`.
2703
27042010-03-29 Jim Meyering <meyering@redhat.com>
2705
2706 build: make doc/Makefile.am cleaner and more robust
2707 * doc/Makefile.am (egrep.1 fgrep.1): Generate robustly, i.e.,
2708 do not redirect directly to $@.
2709 Use $(AM_V_GEN).
2710 Do not distribute intermediate files like fgrep.man and egrep.man.
2711 Likewise, do not use them to generate their %.1 images.
2712 Instead, generate the .1 files directly.
2713
27142010-03-29 Paolo Bonzini <bonzini@gnu.org>
2715
2716 tests: add program to detect locales
2717 * tests/Makefile.am (check_PROGRAMS): Add get-mb-cur-max.
2718 * tests/get-mb-cur-max.c: New.
2719 * tests/euc-mb: Use it. Fail if the former detection test fails.
2720 * tests/sjis-mb: Use it. Fail if the former detection test fails. Expand
2721 comments.
2722
27232010-03-29 Paolo Bonzini <bonzini@gnu.org>
2724
2725 tests: add tests for SJIS character sets
2726 The attached test will be skipped unless (on a glibc system) you run
2727 something like
2728
2729 mkdir /usr/lib/locale/ja_JP.SHIFT_JIS
2730 zcat /usr/share/i18n/charmaps/SHIFT_JIS.gz | \
2731 localedef \
2732 -f - \
2733 -i /usr/share/i18n/locales/ja_JP \
2734 /usr/lib/locale/ja_JP.SHIFT_JIS
2735
2736 * tests/Makefile.am: Add sjis-mb.
2737 * tests/sjis-mb: New.
2738
27392010-03-29 Paolo Bonzini <bonzini@gnu.org>
2740
2741 grep -F: fix a bug with SJIS character sets
2742 Commit db9d6 would erroneously skip matches in SJIS character sets. In
2743 this character set low bytes (i.e. ASCII bytes) are also valid second
2744 bytes in a double-byte character, so you have to continue looking for
2745 a match, even if you match in the middle of a double-byte character.
2746
2747 * src/kwsearch.c: Ensure that beg is advanced by at least one byte,
2748 but do not fail immediately after matching in the middle of a double-byte
2749 character.
2750
27512010-03-29 Bruno Haible <bruno@clisp.org>
2752
2753 build: update after change in gnulib's lib-ignore module
2754 * src/Makefile.am (AM_LDFLAGS): Define. Use gnulib's new
2755 $(IGNORE_UNUSED_LIBRARIES_CFLAGS).
2756
27572010-03-29 Jim Meyering <meyering@redhat.com>
2758
2759 tests: disable new texinfo-acronym syntax-check from gnulib
2760 * cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.
2761
27622010-03-28 Norihiro Tanaka <noritnk@kcn.ne.jp>
2763
2764 tests: exercise fix for improper match of incomplete MB char prefix
2765 * tests/prefix-of-multibyte: New file.
2766 * tests/Makefile.am (TESTS): Add it.
2767
27682010-03-28 Jim Meyering <meyering@redhat.com>
2769
2770 grep -F: fix a multi-byte erroneous-match-in-middle bug
2771 Just as Perl prints nothing in this case,
2772 printf '\357\274\241\n' | perl -CIO -lne '/\357/ and print'
2773
2774 grep should also print nothing when used as follows.
2775 However, these would mistakenly match with grep prior to 2.6.2:
2776 printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\357'
2777 printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\357\274'
2778
2779 * src/searchutils.c (is_mb_middle): New parameter: the length of the
2780 match, in bytes, as determined by kwsexec. Use this to detect when
2781 the nominal match found by kwsexec must be skipped because it is for
2782 an incomplete multi-byte character that is a prefix of a character
2783 in the input.
2784 * src/dfasearch.c (EGexecute): Update caller.
2785 * src/kwsearch.c (Fexecute): Likewise.
2786 * src/search.h: Update prototype.
2787 * NEWS (Bug fixes): Mention it.
2788 Report and analysis by Norihiro Tanaka.
2789
27902010-03-28 Norihiro Tanaka <noritnk@kcn.ne.jp>
2791
2792 tests: add tests for the fgrep-infloop bug
2793 * tests/init.cfg (require_timeout_): New function.
2794 * tests/fgrep-infloop: New file. Test for the above fix.
2795 * tests/Makefile.am (TESTS): Add it.
2796
27972010-03-28 Jim Meyering <meyering@redhat.com>
2798
2799 grep -F: avoid infinite loop when searching for incomplete MB character
2800 Searching for an incomplete non-prefix of a multi-byte character
2801 should find no match.
2802
2803 Just as these print nothing,
2804 printf '\357\274\241\357\274\241\n' \
2805 | perl -CIO -ne '/\241\357/ and print'
2806 printf '\357\274\241\n' | perl -CIO -ne '/\274\241/ and print'
2807 printf '\357\274\241\n' | perl -CIO -ne '/\241/ and print'
2808 printf '\357\274\241\n' | perl -CIO -ne '/\274/ and print'
2809
2810 These should also print nothing, but with grep-2.6 and grep-2.6.1,
2811 they would infloop:
2812 printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\241'
2813 printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\274'
2814 printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\274\241'
2815
2816 * src/kwsearch.c (Fexecute): Don't infloop when searching for
2817 an incomplete non-prefix part of a multi-byte character.
2818 * NEWS (Bug fixes): Mention it.
2819 Reported and diagnosed by Norihiro Tanaka.
2820
28212010-03-28 Jim Meyering <meyering@redhat.com>
2822
2823 tests: rename: fmbtest.sh -> fmbtest
2824 * tests/fmbtest.sh: Rename to ...
2825 * tests/fmbtest: ...this, dropping the .sh suffix.
2826 * tests/Makefile.am (TESTS): Reflect renaming.
2827
2828 tests: convert fmbtest.sh to use init.sh
2829 * tests/fmbtest.sh: Use init.sh and adapt accordingly:
2830 Use "grep", not ${GREP}. Use Exit, not exit.
2831
2832 tests: also exercise the --include + glob path
2833 * tests/include-exclude: Exercise Javier's fix.
2834
28352010-03-28 Javier Villavicencio <the_paya@gentoo.org>
2836
2837 grep -r: fix --include with globs, too
2838 The previous fix addressed only the non-glob case.
2839 * src/main.c (main): Use add_exclude's EXCLUDE_WILDCARDS option,
2840 to enable the use of fnmatch with --include=GLOB.
2841 gnulib: Update to latest, for the fixed exclude.c.
2842
28432010-03-28 Jim Meyering <meyering@redhat.com>
2844
2845 grep -r: fix --include with non-globs
2846 * lib/savedir.c (savedir): Fix logic error. Introduced by commit
2847 bf3bd92c, "build: adapt to the newer exclude API we now get from gnulib"
2848 * tests/include-exclude: Test for this bug by exercising --include, too.
2849 * NEWS (Bug fixes): Mention it.
2850 Reported by Philipp Kohlbecher in http://savannah.gnu.org/bugs/?29358
2851
28522010-03-27 Jim Meyering <meyering@redhat.com>
2853
2854 kwset: correct comments; require non-NULL kwsmatch argument
2855 * src/kwset.c (kwsexec): Correct comments. This function has been
2856 returning an offset, not a pointer, for 9 years.
2857 Do not test for kwsmatch == NULL. All callers pass non-NULL.
2858 (cwexec): Likewise.
2859 * src/kwset.h (kwsexec): Mark the 4th parameter, kwsmatch, as non-NULL.
2860 Include "arg-nonnull.h".
2861
2862 build: add -I$(top_builddir)/lib so we also find generated .h files
2863 * src/Makefile.am (AM_CPPFLAGS): Rename from INCLUDES to avoid
2864 warning from automake -Wall.
2865 Add -I$(top_builddir)/lib, so we find generated .h files like
2866 getopt.h in a non-srcdir build.
2867
2868 build: remove superfluous LOCALEDIR definition
2869 * src/Makefile.am (INCLUDES): Remove unnecessary definition of
2870 LOCALEDIR here. Now, it's defined via gnulib's configmake.h.
2871 * src/system.h: Include "configmake.h" for its LOCALEDIR definition.
2872
2873 grep: don't segfault upon use of --include or --exclude* options
2874 * lib/savedir.c (isdir1): Fix fatal typo: deref "dir" argument,
2875 not the global (initially-NULL) "path". Reported by Standish Parsley.
2876 * tests/include-exclude: New file.
2877 * tests/Makefile.am (TESTS): Add it.
2878 * NEWS (Bug fixes): Mention it.
2879
28802010-03-26 Jim Meyering <meyering@redhat.com>
2881
2882 tests: rename: foad1.sh -> foad1
2883 * tests/foad1.sh: Rename to ...
2884 * tests/foad1: ...this, dropping the .sh suffix.
2885 * tests/Makefile.am (TESTS): Reflect renaming.
2886
2887 tests: convert foad1.sh to use init.sh
2888 This fixes a spurious test failure when "make check" is run with
2889 certain envvars set, e.g., "make check GREP_COLOR=always"
2890 * tests/foad1.sh: Use init.sh and adapt accordingly:
2891 Use "grep", not ${GREP}. Test VERBOSE against "yes", not "1",
2892 to be consistent with init.sh.
2893 Use Exit, not exit.
2894 Reported by Nelson H. F. Beebe.
2895
2896 tests: insulate tests from envvar settings
2897 * tests/init.cfg (vars_): Unset each envvar that can affect how
2898 grep works. This protects only those tests that have been
2899 converted to use init.sh.
2900
29012010-03-26 Eric Blake <eblake@redhat.com>
2902
2903 maint: ignore 'make dist pdf' droppings
2904 * .gitignore: Add more exemptions.
2905
29062010-03-26 Jim Meyering <meyering@redhat.com>
2907
2908 tests: avoid spurious test failure due to lack of a French UTF8 locale
2909 * tests/init.cfg: New file. If either $LOCALE_FR or $LOCALE_FR_UTF8
2910 is set to "none", reset it to the empty string.
2911 Reported by Mike Frysinger and Sven Joachim.
2912 * tests/Makefile.am (EXTRA_DIST): Add init.cfg.
2913
2914 build: do not use pkg-config to test for PCRE support
2915 * configure.ac: Do not use PKG_PROG_PKG_CONFIG or PKG_CHECK_MODULES.
2916 Do not modify CPPFLAGS; that belongs to those who invoke make.
2917 Instead, use autoconf's AC_CHECK_HEADERS and AC_SEARCH_LIBS via the
2918 new macro, gl_FUNC_PCRE, defined in...
2919 * m4/pcre.m4 (gl_FUNC_PCRE): New macro, to handle pcre-related
2920 configure-time tests.
2921 * src/Makefile.am (grep_LDADD): Use LIB_PCRE, not PCRE_LIBS.
2922 * src/pcresearch.c: Test HAVE_LIBPCRE via "#if", not "#ifdef".
2923 All other cpp tests of this symbol used "#if".
2924 Prompted by a suggestion from Bruno Haible.
2925 * NEWS (Build-related): Mention this.
2926
29272010-03-25 Jim Meyering <meyering@redhat.com>
2928
2929 doc: correct and amend NEWS entries for 2.6.1
2930 * NEWS (Bug fixes): Correct character ranges bug description.
2931 Add an example from Dmitry V. Levin.
2932 Add that the word-with-backref bug was introduced in 2.5.1.
2933 * cfg.mk (old_NEWS_hash): Update to match.
2934
2935 post-release administrivia
2936 * NEWS: Add header line for next release.
2937 * .prev-version: Record previous version.
2938 * cfg.mk (old_NEWS_hash): Auto-update.
2939
2940 version 2.6.1
2941 * NEWS: Record release date.
2942
29432010-03-25 Tony Abou-Assaleh <taa@acm.org>
2944
2945 tests: use awk's -v option more portably
2946 * tests/spencer1-locale: Add a space between awk's "-v" option and
2947 the following VAR=value string, to avoid test failure on Mac OS X.
2948
29492010-03-25 Norihirio Tanaka <noritnk@kcn.ne.jp>
2950
2951 dfa/grep: fix compilation with MBS_SUPPORT
2952 * src/dfa.c (cur_mb_len): Initialize to 1 and always make it available.
2953 (setbit_case_fold): Do not use wint_t in prototype if !MBS_SUPPORT.
2954 (parse_bracket_exp): Fix compilation with !MBS_SUPPORT.
2955 * src/kwsearch.c (kwsinit): Do not use mbtolower and MB_CUR_MAX
2956 if !MBS_SUPPORT.
2957 * src/searchutils.c (kwsinit): Do not refer to MB_CUR_MAX if !MBS_SUPPORT.
2958
2959 * tests/char-class-multibyte: Skip if UTF-8 matching does not work.
2960 * tests/fmbtest.sh: Likewise.
2961
29622010-03-25 Jim Meyering <meyering@redhat.com>
2963
2964 build: avoid warnings about unnecessary use of "return"
2965 * src/grep.c (Gcompile, Ecompile, Acompile): Do not "return X"
2966 from a function returning void, not even when X itself is a
2967 function returning void. This avoids warnings from Sun Studio 11
2968 reported by Dagobert Michelsen.
2969 * src/egrep.c (Ecompile): Likewise.
2970
29712010-03-25 Norihirio Tanaka <noritnk@kcn.ne.jp>
2972
2973 grep: fix printing when -w is used and regex is needed for matching
2974 * NEWS: Document bugfix.
2975 * src/dfasearch.c (EGexecute): After assess_pattern_match len, is either
2976 invalid or end-beg; jump to success.
2977 * tests/Makefile.am (TESTS): Add new test.
2978 * tests/backref-word: New.
2979
29802010-03-25 Paolo Bonzini <bonzini@gnu.org>
2981
2982 dfa: fix single byte character ranges
2983 * src/dfa.c (in_coll_range): Fix ordering for second strcoll. Reported
2984 by Dmitry V. Levin.
2985 * tests/spencer1-locale.awk: Also test single-byte character sets.
2986 * NEWS: Add a note about this bugfix.
2987 * THANKS: Add Dmitry.
2988
29892010-03-25 Norihirio Tanaka <noritnk@kcn.ne.jp>
2990
2991 grep: reset state after truncated or invalid multibyte sequences
2992 * src/searchutils.c (is_mb_middle): When treating an invalid sequence
2993 or a truncated multibyte character as a single byte character, reset
2994 mbstate
2995
2996 grep: do lowercase conversion in print_line_middle only for single-byte case
2997 * src/main.c (print_line_middle): Restrict match_icase code
2998 to MB_CUR_MAX == 1. Adjust comments.
2999
30002010-03-25 Jim Meyering <meyering@redhat.com>
3001
3002 tests: provide framework_failure_ function
3003 The shell function "framework_failure" was called in the unusual
3004 event that some fundamental test set-up operation would fail.
3005 However it was not defined. Define it, but with a trailing underscore
3006 to impinge less on the test writer's name space. Adjust all uses.
3007 * tests/init.sh (framework_failure_): New function.
3008 * tests/case-fold-backref: s/framework_failure/framework_failure_/
3009 * tests/case-fold-char-class: Likewise.
3010 * tests/case-fold-char-range: Likewise.
3011 * tests/case-fold-char-type: Likewise.
3012 * tests/char-class-multibyte: Likewise.
3013 * tests/dfaexec-multibyte: Likewise.
3014 * tests/max-count-vs-context: Likewise.
3015 * tests/word-multi-file: Likewise.
3016
3017 doc: tweak THANKS
3018 * THANKS: Update Arnold's name and address, per request.
3019
30202010-03-24 Jim Meyering <meyering@redhat.com>
3021
3022 portability: use gnulib's lseek wrapper
3023 * bootstrap.conf (gnulib_modules): Use gnulib's lseek wrapper,
3024 for improved portability. lseek does not fail with ESPIPE on
3025 pipes on some systems.
3026
3027 build: avoid link failure on Solaris 8
3028 * bootstrap.conf (gnulib_modules): Add wctob.
3029 * NEWS (Portability): Mention this.
3030 Reported by Dagobert Michelsen in <http://sv.gnu.org/bugs/?29325>.
3031
30322010-03-24 Petr Písař <petr.pisar@atlas.cz>
3033
3034 doc: translate new --help message
3035 * src/main.c: Translate "after_options".
3036
30372010-03-24 Jim Meyering <meyering@redhat.com>
3038
3039 doc: NEWS make it clear that the bug was introduced in 2.6
3040 * NEWS: Clarify.
3041
30422010-03-24 Paolo Bonzini <bonzini@gnu.org>
3043
3044 tests: fix char-class-multibyte
3045 * tests/char-class-multibyte: Make it pass.
3046
30472010-03-23 Jim Meyering <meyering@redhat.com>
3048
3049 build: avoid compilation failure when MBS_SUPPORT not defined
3050 * src/dfa.c (setbit_case_fold) [!MBS_SUPPORT]: Fix curly brace mismatch.
3051
30522010-03-23 Paolo Bonzini <bonzini@gnu.org>
3053
3054 dfa: fix sigsegv on multibyte character classes
3055 Reported by Jaroslav Škarvada <jskarvad@redhat.com>. This is
3056 unfortunate. grep needs an automatic testcase generator.
3057
3058 * NEWS: Document bug.
3059 * THANKS: Mention reporter.
3060 * src/dfa.c (set_bit_casefold): Change type of first argument for
3061 self-documentation.
3062 (parse_bracket_exp): Fix call.
3063 * tests/Makefile.am: Add new testcase.
3064 * tests/char-class-multibyte: New testcase.
3065
30662010-03-23 Jim Meyering <meyering@redhat.com>
3067
3068 post-release administrivia
3069 * NEWS: Add header line for next release.
3070 * .prev-version: Record previous version.
3071 * cfg.mk (old_NEWS_hash): Auto-update.
3072
3073 version 2.6
3074 * NEWS: Record release date.
3075
3076 build: avoid warnings: tell gcc and clang that dfaerror never returns
3077 * src/dfa.h (__attribute__): Define.
3078 (dfaerror): Declare with the "noreturn" attribute.
3079 * src/dfasearch.c (dfaerror): Add an unreachable use of abort.
3080
30812010-03-22 Eric Blake <eblake@redhat.com>
3082
3083 build: fix cygwin build
3084 Portions of gnulib depend on -lintl, and cygwin does not allow
3085 lazy linking.
3086
3087 * src/Makefile.am (LDADD): Include libraries in correct order.
3088
30892010-03-22 Paolo Bonzini <bonzini@gnu.org>
3090
3091 grep: remove --mmap
3092 mmap is a bad idea for sequentially accessed file because it will cause
3093 a page fault for every read page. Just consider it a failed experiment,
3094 and ignore --mmap while accepting it for backwards compatibility.
3095
3096 * configure.ac (AC_FUNC_MMAP): Remove.
3097 * doc/grep.texi (Other options): Say --mmap is ignored.
3098 * src/grep.c (mmap_option): Remove.
3099 (long_options): Do not reference it.
3100 (bufmapped, initial_bufoffset): Remove.
3101 (reset, fillbuf): Remove HAVE_MMAP code.
3102 (grepfile): Remove bufmapped reference.
3103 (usage): Say --mmap is ignored.
3104
31052010-03-22 Paolo Bonzini <bonzini@gnu.org>
3106
3107 grep: rename files for intuitiveness
3108 * Makefile.am (libgrep_a_SOURCES, grep_SOURCES, egrep_SOURCES,
3109 fgrep_SOURCES): Adjust.
3110 * grep.c: Rename to main.c.
3111 * esearch.c: Rename to egrep.c.
3112 * fsearch.c: Rename to fgrep.c.
3113 * gsearch.c: Rename to grep.c.
3114
3115 grep: kill GREP_PROGRAM/EGREP_PROGRAM/FGREP_PROGRAM
3116 * NEWS: Document slight semantic change.
3117 * TODO: #ifdefs are gone.
3118 * po/POTFILES.in: Update.
3119 * src/Makefile.am (grep_SOURCES, egrep_SOURCES, fgrep_SOURCES): Remove
3120 grep.c/egrep.c/fgrep.c.
3121 (noinst_LIBRARIES): Change libsearch.a to libgrep.a.
3122 (libsearch_a_SOURCES): Rename to libgrep_a_SOURCES, add grep.c
3123 (LDADD): Change libsearch.a to libgrep.a.
3124 * src/esearch.c: Add before_options and after_options.
3125 * src/fsearch.c: Likewise.
3126 * src/gsearch.c: Likewise.
3127 * src/grep.c (short_options, long_options): Remove GREP_PROGRAM
3128 special-casing.
3129 (usage): Use before_options and after_options, look at matchers.
3130 (setmatcher): Merge with install_matcher.
3131 (main): Call setmatcher (NULL) instead of install_matcher.
3132 * src/grep.h (GREP_PROGRAM): Remove.
3133 (before_options, after_options): Add.
3134
3135 thank Eric Blake
3136 * THANKS: Add Eric Blake, who reported the warning fixed by 774d0ee.
3137
3138 grep: libify *search.c
3139 * src/Makefile.am (libsearch_a_SOURCES): Add dfasearch.c, kwsearch.c,
3140 pcresearch.c.
3141 * src/esearch.c, src/fsearch.c, * src/gsearch.c: Only include search.h.
3142 * src/dfasearch.c (GEAcompile, EGexecute): Export.
3143 * src/kwsearch.c (Fcompile, Fexecute): Export.
3144 * src/pcresearch.c (Pcompile, Pexecute): Export.
3145 * src/search.h: Add new exported functions.
3146
3147 grep: prepare for libification of *search.c
3148 * src/dfasearch.c (Ecompile): Remove.
3149 * src/esearch.c: Place it here...
3150 * src/gsearch.c: ... and here.
3151
3152 grep: split search.c
3153 * po/POTFILES.in: Update.
3154 * src/Makefile.am (grep_SOURCES, egrep_SOURCES, fgrep_SOURCES): Move
3155 kwset.c and dfa.c to libsearch.a. Add searchutils.c there too.
3156 * src/search.h, src/dfasearch.c, src/pcresearch.c, src/kwsearch.c,
3157 src/searchutils.c: New files, split out of src/search.c.
3158 * src/esearch.c, src/fsearch.c: Include the new files instead of search.c.
3159 * src/gsearch.c: Likewise, plus move Gcompile/Acompile here.
3160
3161 grep: remove one #ifdef
3162 * search.c (GEAcompile) [EGREP_PROGRAM]: Use common code. Inline IF_BK.
3163
31642010-03-22 Paolo Bonzini <bonzini@gnu.org>
3165
3166 grep: eliminate {COMPILE,EXECUTE}_{RET,ARGS,FCT}
3167 Modern compilers warn about type mismatches.
3168
3169 * src/grep.c (do_execute): Write full declaration.
3170 * src/grep.h (COMPILE_RET, COMPILE_ARGS, COMPILE_FCT, EXECUTE_RET,
3171 EXECUTE_ARGS, EXECUTE_FCT): Remove.
3172 (compile_fp_t, execute_fp_t): Write full declaration.
3173 * src/search.c (GEAcompile, Gcompile, Acompile, Ecompile, EGexecute,
3174 Fcompile, Fexecute, Pcompile, Pexecute): Write full declaration.
3175
31762010-03-22 Paolo Bonzini <bonzini@gnu.org>
3177
3178 grep: make egrep/fgrep use struct matcher
3179 * Makefile.am (grep_SOURCES): Add gsearch.c.
3180 (EXTRA_DIST): Add search.c.
3181 * esearch.c (matchers): New.
3182 * fsearch.c (matchers): New.
3183 * gsearch.c: New.
3184 * search.c (matchers): Remove.
3185 * grep.c: Always compile most !GREP_PROGRAM sections.
3186 (main): Use first matcher if none is explicitly provided. Remove
3187 "default" matcher.
3188 * grep.h (struct matcher): Adjust comments.
3189
3190 grep: change struct matcher termination
3191 * src/grep.c (setmatcher): Look for NULL matchers[i].name.
3192 * src/grep.h (struct matcher): Change name to pointer. Adjust comments.
3193 * src/search.c (matchers): Terminate with three NULLs.
3194
3195 grep: remove one #ifdef
3196 * search.c (Ecompile): Always go through GEAcompile to use same code path
3197 for both grep and egrep.
3198
3199 grep: remove getpagesize.h
3200 * src/getpagesize.h: Remove.
3201 * src/Makefile.am (noinst_HEADERS): Remove getpagesize.h.
3202
32032010-03-21 Jim Meyering <meyering@redhat.com>
3204
3205 build: use the fcntl-h module, not "fcntl"
3206 * bootstrap.conf (gnulib_modules): We might need fcntl.h somewhere,
3207 but don't use the fcntl function. Reported by Bruno Haible.
3208
3209 build: avoid link failure on systems using gnulib's fcntl but not open
3210 * bootstrap.conf (gnulib_modules): Using gnulib's fcntl module
3211 and including <fcntl.h>, but not also using gnulib's "open" module
3212 would result in link failure due to references to rpl_open
3213 on systems requiring the replacement (e.g., Cygwin and Darwin).
3214
3215 build: avoid compilation failure on systems using rpl_open
3216 This new build failure has arisen as a result of using gnulib's
3217 "fcntl" module. Now that an inadequate "open" syscall is replace
3218 by gnulib's wrapper, it is essential to include <fcntl.h>.
3219 * src/grep.c: Include <fcntl.h>.
3220 This is required, for grepfile's use of open, at least on
3221 Cygwin and Darwin.
3222
3223 maint: use gnulib's fcntl module, just in case
3224 * bootstrap.conf (gnulib_modules): Add fcntl.
3225 Grep uses at least O_BINARY, which may be defined therein.
3226
3227 maint: remove TYPE_* definitions from src/system.h
3228 * src/system.h (TYPE_MAXIMUM, TYPE_MINIMUM, TYPE_SIGNED): Remove
3229 definitions. They are provided by intprops.h.
3230 * src/grep.c: Include "intprops.h"
3231 * bootstrap.conf (gnulib_modules): Add intprops.
3232
3233 maint: alphabetize #include directives
3234 * src/grep.c: Alphabetize #include directives.
3235
32362010-03-20 Jim Meyering <meyering@redhat.com>
3237
3238 build: stop using gnulib's memmove module
3239 * bootstrap.conf (gnulib_modules): Remove obsolete module: memmove
3240
3241 build: reinstate gnulib's fcntl-h-tests
3242 * bootstrap.conf (gnulib_tool_option_extras): Do not avoid
3243 the fcntl-h-tests. I cannot reproduce the failure.
3244
32452010-03-20 Eric Blake <eblake@redhat.com>
3246
3247 build: allow compilation on cygwin
3248 Gnulib is incompatible with -Wunused-macros. Addtionally,
3249 cygwin 1.7.1 coupled with --enable-gcc-warnings tripped on:
3250
3251 grep.c: In function 'print_line_middle':
3252 grep.c:805: error: array subscript has type 'char' [-Wchar-subscripts]
3253 grep.c: In function 'main':
3254 grep.c:1833: error: 'optarg' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
3255 grep.c:1834: error: 'optind' redeclared without dllimport attribute after being referenced with dll linkage
3256
3257 * configure.ac (GNULIB_WARN_FLAGS): Disable -Wunused-macros.
3258 * src/grep.c (print_line_middle): Use correct type to tolower.
3259 (main): Drop useless redeclarations.
3260 * .gitignore: Ignore more built files.
3261
32622010-03-20 Jim Meyering <meyering@redhat.com>
3263
3264 tests: ensure that all programs handle [b-a] consistently
3265 * tests/reversed-range-endpoints: New test.
3266 * tests/Makefile.am (TESTS): Add it.
3267
32682010-03-20 Jim Meyering <meyering@redhat.com>
3269
3270 build: update gnulib submodule to latest
3271 This pulls in the latest regex module from gnulib, including a fix
3272 to make it honor the RE_NO_EMPTY_RANGES syntax bit.
3273
3274 tests: temporarily disable irrelevant-to-grep failing C++ fcntl-h-tests
3275 * bootstrap.conf (gnulib_tool_option_extras): Temporarily add
3276 --avoid=fcntl-h-tests, until the C++ part of that test is fixed.
3277
32782010-03-20 Jim Meyering <meyering@redhat.com>
3279
3280 reject reversed-endpoint ranges, with all regex variants
3281 * src/search.c: Add RE_NO_EMPTY_RANGES to the syntax bits
3282 in three places, so that all of grep, egrep, and grep -E reject
3283 a range with reversed endpoints like '[b-a]'. This is required,
3284 when using the latest version of gnulib's regex module, since it
3285 now honors the RE_NO_EMPTY_RANGES flag, rather than acting as if
3286 it were always set.
3287 Based on a change by Matthew Burgess.
3288
32892010-03-19 Jim Meyering <meyering@redhat.com>
3290
3291 maint: correct macro parameter parentheses
3292 * src/dfa.c (FETCH_WC, FETCH): Parenthesize macro parameters.
3293
32942010-03-19 Paolo Bonzini <bonzini@gnu.org>
3295
3296 tests: change help-version to per-program functions
3297 * help-version: Change each *_args variable to a *_setup function.
3298
3299 dfa: fix wchar_t/wint_t type mismatch
3300 * src/dfa.c (FETCH_WC): Pass a local wchar_t variable to mbrtowc.
3301 (FETCH): Rename temporary second argument to FETCH_WC.
3302 (parse_bracket_exp): Always use FETCH_WC.
3303
33042010-03-19 Jim Meyering <meyering@redhat.com>
3305
3306 doc: add README-prereq, referenced from README-hacking
3307 * README-prereq: New file. Cloned from coreutils, s/coreutils/grep/
3308 Reported by Tony Abou-Assaleh.
3309
33102010-03-19 Arnold Robbins <arnold@skeeve.com>
3311
3312 maint: sync dfa comments from gawk
3313 * src/dfa.h (struct dfa) [newlines]: Amend comment.
3314 * src/dfa.c: Update copyright year list to include gawk's.
3315
33162010-03-17 Jim Meyering <meyering@redhat.com>
3317
3318 maint: remove obsolete "cvs-clean" make target
3319 * Makefile.am (cvs-clean): Remove obsolete target.
3320
33212010-03-17 Paolo Bonzini <bonzini@gnu.org>
3322
3323 dfa: initialize struct mbcset using memset
3324 * src/dfa.c (parse_bracket_exp): Use memset to initialize workmbc.
3325
3326 dfa: spell out "unsigned int"
3327 * dfa.c (setbit, tstbit, clrbit, setbit_case_fold, lex, dfaoptimize,
3328 free_mbdata): Put "int" after unsigned.
3329 * dfa.h (struct position, struct dfa): Likewise.
3330
33312010-03-17 Paolo Bonzini <bonzini@gnu.org>
3332
3333 dfa: optimize simple character sets under UTF-8 charsets
3334 Only use a bitset when possible without involving MBCSET. Testcase:
3335 yes 'the quick brown fox jumps over the lazy dog' | sed 100000q | \
3336 time grep -c [ABCDEFGHIJKLMNOPQRSTUVWXYZ,]
3337
3338 Before: 51ms (best of three runs); after: 16ms(best of three runs).
3339
3340 * src/dfa.c (parse_bracket_exp): For simple bracket expressions
3341 under UTF-8, use a CSET.
3342
33432010-03-17 Paolo Bonzini <bonzini@gnu.org>
3344
3345 dfa: speed up handling of brackets
3346 This patch has two sides. One is to fold the parsing of brackets in the
3347 single- and multi-byte cases. The second is to leverage this change,
3348 and use a bitset to test for single-byte characters in the charset.
3349 Splitting the two would be very hard.
3350
3351 Testcase:
3352 yes 'the quick brown fox jumps over the lazy dog' | sed 100000q | \
3353 time grep -c [ABCDEFGHIJKLMNOPQRSTUVWXYZ,]
3354
3355 Before: 59ms (best of three runs); after: 51ms (best of three runs).
3356 Nice, but mostly providing infrastructure for the next patch.
3357
3358 * src/dfa.c (setbit_case_fold): Try applying towlower/towupper.
3359 (looking_at): Remove.
3360 (FETCH_WC): New.
3361 (fetch_wc): Merge into FETCH_WC [MBS_SUPPORT].
3362 (FETCH) [MBS_SUPPORT]: Call FETCH_WC.
3363 (prednames, find_pred, is_blank and other predicates): Move above,
3364 remove K&R syntax support.
3365 (parse_bracket_exp): New name of parse_bracket_exp_mb, rewritten to
3366 include single-byte character set parsing of brackets.
3367 (lex): Adjust for fetch_wc->FETCH_WC change, remove single-byte
3368 character set parsing of brackets.
3369 (match_mb_charset): Test against work_mbc->cset.
3370 * src/dfa.h (struct mb_char_classes): Add cset.
3371
33722010-03-17 Paolo Bonzini <bonzini@gnu.org>
3373
3374 syntax-check: remove space-tab exception
3375 * .x-sc_space_tab: Remove.
3376 * src/dfa.c: Fix space-tab occurrence.
3377
3378 THANKS: fix Jim Meyering's email address
3379 * THANKS: Jim is now with Red Hat.
3380
3381 dfa: add missing function
3382 * src/dfa.c (using_utf8): New.
3383 (addtok_wc, free_mbdata, dfaoptimize) [!MBS_SUPPORT]: Do not define.
3384 (dfacomp) [!MBS_SUPPORT]: Do not call dfaoptimize.
3385
3386 tests: fix typo
3387 * fedora: Fix typo.
3388
3389 tests: use Exit
3390 * euc-mb: exit with "Exit 0".
3391
3392 grep: remove more register keywords
3393 * dosbuf.c: Remove register keywords.
3394 * grep.c: Remove register keywords.
3395 * kwset.c: Remove register keywords.
3396 * search.c: Remove register keywords.
3397
33982010-03-17 Paolo Bonzini <bonzini@gnu.org>
3399
3400 dfa: run simple UTF-8 regexps as a single-byte character set
3401 This provides a speedup whenever fgrep is "almost" sufficient but
3402 not quite (e.g. grep ^abc). This affects test cases such as
3403 https://savannah.gnu.org/bugs/?29117, which are already worked around
3404 by the line-by-line matching patch c32c04; without that patch the
3405 speedup can reach 1000x even on non-contrived testcases.
3406
3407 * src/dfa.c (dfaoptimize): New.
3408 (dfacomp): Call it.
3409
34102010-03-17 Paolo Bonzini <bonzini@gnu.org>
3411
3412 tests: fix syntax-check failures
3413 * tests/case-fold-backref: Use "foo" instead of "the".
3414 * tests/dfaexec-multibyte: Remove trailing blanks.
3415
34162010-03-17 Paolo Bonzini <bonzini@gnu.org>
3417
3418 grep: remove check_multibyte_string, fix non-UTF8 missed match
3419 Avoid computing ahead something that can be computed lazily as efficiently
3420 (or more efficiently in the case of UTF-8, though this is left as TODO).
3421 At the same time, "soften" the rejection condition for matching in the
3422 middle of a multibyte sequence to fix bug 23814.
3423
3424 Multibyte "grep -i" would still be very slow if it wasn't for the workaround
3425 patch c32c042 (grep: match multibyte charsets line-by-line when using -i,
3426 2010-03-08).
3427
3428 * NEWS: Document bugfix.
3429 * src/search.c (check_multibyte_string): Rewrite as...
3430 (is_mb_middle): ... this.
3431 (EGexecute, Fexecute): Adjust.
3432 * tests/Makefile.am (TESTS): Add euc-mb.
3433 * tests/euc-mb: New testcase.
3434
34352010-03-17 Paolo Bonzini <bonzini@gnu.org>
3436
3437 dfa: cache MB_CUR_MAX for dfaexec
3438 * src/dfa.c (state_index, dfaexec): Use d->mb_cur_max.
3439 (dfainit): Initialize it.
3440 (free_mbdata): New, extracted out of dfafree.
3441 (dfafree): Use it.
3442
3443 dfa: improve documentation of struct dfa
3444 * src/dfa.h (struct dfa): Reword some comments.
3445
3446 tests: factor name of output files into a variable
3447 * tests/case-fold-backref, tests/case-fold-char-class,
3448 tests/case-fold-char-range, tests/case-fold-char-type,
3449 tests/dfaexec-multibyte: Use a variable for the output filename,
3450 as it is common to the grep and compare invocations.
3451
3452 tests: use different output files to simplify reading failed .log files
3453 * tests/case-fold-backref, tests/case-fold-char-class,
3454 tests/case-fold-char-range, tests/case-fold-char-type: Use a different
3455 name for each output file from grep.
3456 * tests/dfaexec-multibyte: Likewise, and merge some grep invocations.
3457
3458 tests: add another grep -i testcase, from bug 16179
3459 * tests/case-fold-backref: New.
3460 * tests/Makefile.am (TESTS): Add it.
3461
34622010-03-17 Paolo Bonzini <bonzini@gnu.org>
3463
3464 dfa: rewrite handling of multibyte case_fold lexing
3465 Let dfacomp do the folding to lowercase of multibyte input strings,
3466 and remove it from grep.c. Input strings to kwset.c are still folded
3467 outside kwset.c, so we still need to do mbtolower in search.c.
3468
3469 * NEWS: Document bugfixes.
3470 * .x-sc_cast_of_argument_to_free: Remove.
3471 * src/dfa.c (wctok, addtok_wc): New.
3472 (cur_mb_index, update_mb_len_index): Remove.
3473 (FETCH): Do not call it.
3474 (parse_bracket_exp_mb) [GREP]: Disable case-folding of ranges and
3475 characters.
3476 (addtok): Extract part to...
3477 (addtok_mb): ... this new function.
3478 (lex): Call fetch_wc in the main loop for MB_CUR_MAX > 1. Return WCHAR
3479 for normal characters if MB_CUR_MAX > 1.
3480 (atom): Handle WCHAR instead of treating multibyte characters specially.
3481 Do case folding of multibyte characters here.
3482 (dfacomp): Remove case_fold special casing.
3483 * src/dfa.h (WCHAR): New.
3484 * src/grep.c (mb_icase_keys): Remove.
3485 (main): Do not call it.
3486 * src/search.c (kwsinit): Init transition table only for MB_CUR_MAX == 1.
3487 (mbtolower): New.
3488 (kwsincr_case): New.
3489 (kwsmusts): Call it instead of kwsincr.
3490 (check_multibyte_string): Remove.
3491 (check_multibyte_string_no_icase): Rename to check_multibyte_string.
3492 (GEAcompile, EGexecute, Fcompile): Use mbtolower instead of the old
3493 check_multibyte_string.
3494 * tests/Makefile.am (TESTS): Add case-fold-backslash-w.
3495 * tests/foad1.sh: Enable fixed tests.
3496 * tests/case-fold-backslash-w: New.
3497
34982010-03-16 Paolo Bonzini <bonzini@gnu.org>
3499
3500 grep: match multibyte charsets line-by-line when using -i
3501 The turtle combination -i + MB_CUR_MAX>1 requires case conversion ahead
3502 of time. Avoid doing this repeatedly when many matches succeed. Together
3503 with the previous changes, this fixes https://savannah.gnu.org/bugs/?29117
3504 and https://savannah.gnu.org/bugs/?14472.
3505
3506 * NEWS: Document new speedup.
3507 * src/grep.c (do_execute): New.
3508 (grepbuf): Use it.
3509
35102010-03-15 Paolo Bonzini <bonzini@gnu.org>
3511
3512 dfa: fix handling of ranges in multibyte character sets
3513 * src/dfa.c (parse_bracket_exp_mb): Add separate ranges for
3514 lowercase and uppercase endpoints if folding case.
3515 * tests/Makefile.am (TESTS): Add case-fold-char-range.
3516 * tests/case-fold-char-range: New.
3517
3518 tests: add more UTF-8 test cases
3519 * tests/Makefile.am (TESTS): Add spencer1-locale.
3520 (EXTRA_DIST): Add spencer1-locale.awk.
3521 * tests/spencer1-locale.awk: New.
3522 * tests/spencer1-locale: New.
3523
35242010-03-15 Jim Meyering <meyering@redhat.com>
3525
3526 tests: complete the renaming fedora.sh -> fedora
3527 * tests/Makefile.am (TESTS): Rename fedora.sh -> fedora here, too.
3528
35292010-03-15 Jim Meyering <meyering@redhat.com>
3530
3531 * tests/fedora.sh: Rename to...
3532 * tests/fedora: ...this, to reflect new convention:
3533 Use the lack of a suffix to indicate we've converted to the new
3534 init.sh-using test framework.
3535
3536 tests: adjust fedora.sh to handle traps more portably
3537
35382010-03-15 Jim Meyering <meyering@redhat.com>
3539
3540 tests: adjust fedora.sh to handle traps more portably
3541 * tests/fedora.sh: Use "Exit", not "exit".
3542
3543 tests: for each test, set an envvar to its name
3544 * tests/Makefile.am (TESTS_ENVIRONMENT): Set GREP_TEST_NAME for
3545 each test. This is used to help make the output of hundreds of
3546 independent, often-parallel valgrind runs more manageable.
3547
35482010-03-14 Jim Meyering <meyering@redhat.com>
3549
3550 tests: clean up fedora.sh
3551 * tests/fedora.sh: Use "grep", not ${GREP}.
3552 Use init.sh.
3553 Use timeout 10, not sleep 1 (three times).
3554 The latter would always sleep for 3 seconds, and the test would
3555 fail with a false positive on a slow system or with a heavily
3556 instrumented (valgrind) executable.
3557
35582010-03-12 Jim Meyering <meyering@redhat.com>
3559
3560 build: avoid build failure with --enable-gcc-warnings
3561 * src/dfa.c: Don't include <assert.h>, now that it is not used.
3562 [DEBUG]: Remove #ifdef block.
3563
35642010-03-12 Paolo Bonzini <bonzini@gnu.org>
3565
3566 syntax-check: enable space-tab
3567 * cfg.mk (local-checks-to-skip): Enable space-tab.
3568 * .x-sc_space_tab: Add exceptions.
3569 * tests/status.sh: Fix occurrence.
3570
3571 syntax-check: enable m4-quote-check
3572 * cfg.mk (local-checks-to-skip): Enable m4-quote-check.
3573 * configure.ac: Fix occurrence.
3574
3575 syntax-check: enable makefile-TAB-only-indentation
3576 * cfg.mk (local-checks-to-skip): Enable makefile-TAB-only-indentation.
3577 * Makefile.am: Fix only occurrence.
3578
3579 grep: fix error-message-uppercase
3580 * cfg.mk (local-checks-to-skip): Enable error-message-uppercase.
3581 * src/dfa.c (parse_bracket_exp_mb, lex, dfaparse): Fix occurrences.
3582 * src/search.c (Pcompile, Pexecute): Fix occurrences.
3583
3584 dfa, grep: cleanup if-before-free and cast-of-argument-to-free
3585 * .x-sc_avoid_if_before_free: Remove.
3586 * .x-sc_cast_of_alloca_return_value: Remove.
3587 * .x-sc_cast_of_x_alloc_return_value: Remove.
3588 * .x-sc_cast_of_argument_to_free: Temporarily add src/search.c.
3589 * cfg.mk (local-checks-to-skip): Remove sc_cast_of_argument_to_free.
3590 * src/dfa.c (ifree): Remove.
3591 (dfamust, build_state, transit_state, dfafree): Do not do if-before-free,
3592 do not cast free argument to ptr_t or char *.
3593 (freelist): Call free instead of ifree.
3594 * src/dfa.h (ptr_t): Remove.
3595
35962010-03-12 Paolo Bonzini <bonzini@gnu.org>
3597
3598 dfa: remove CRANGE dead code
3599 The only use of CRANGE was removed by commit 193830d. In theory it is
3600 more correct to do what CRANGE did, but in practice it seems like it did
3601 not work.
3602
3603 * src/dfa.h (token): Remove CRANGE.
3604 * src/dfa.c (atom): Do not handle CRANGE.
3605 (prtok): Likewise.
3606
36072010-03-12 Paolo Bonzini <bonzini@gnu.org>
3608
3609 dfa: get rid of x*alloc
3610 * src/dfa.c: Include xalloc.h.
3611 (xmalloc, xrealloc, xcalloc): Remove.
3612
3613 grep: cleanup one const cast
3614 * src/search.c (GEAcompile): Do not reuse motif when operating on the
3615 (const) pattern, so we can make it non-const. Remove cast from free.
3616
3617 kwset/system: remove ptr_t
3618 * src/kwset.h: Declare kwset using an incomplete struct type.
3619 * src/system.h (ptr_t): Remove.
3620
36212010-03-12 Jim Meyering <meyering@redhat.com>
3622
3623 tests: add test cases for dfaexec bug
3624 * tests/dfaexec-multibyte: New test.
3625 * tests/Makefile.am (TESTS): Add it.
3626 Reported by Paolo Bonzini in http://bugzilla.redhat.com/544407
3627 and http://bugzilla.redhat.com/544406 .
3628
36292010-03-12 Jim Meyering <meyering@redhat.com>
3630
3631 dfa: manually merge gawk's dfaexec
3632 * src/dfa.c (dfaexec): Adjust API: return pointer, not offset, and
3633 take an "end" pointer parameter, rather than integral "size".
3634 Adjust comment accordingly.
3635 (build_state): Maintain d->newlines.
3636 (copytoks): Update multibyte_prop indices.
3637 (SKIP_REMAINS_MB_IF_INITIAL_STATE): Update a cast.
3638 Return NULL, rather than (size_t) -1.
3639 (realloc_trans_if_necessary): Realloc d->newlines.
3640 * src/dfa.h (struct dfa): New member, "newlines".
3641 (struct dfa) [GAWK]: New member, "broken".
3642 (dfaexec): Update prototype and copy the new comment from dfa.c.
3643
3644 dfa: make search.c use the new dfaexec API
3645
3646 * src/search.c: Adjust to new dfaexec API.
3647 Now, dfaexec returns a pointer, not an integer,
3648 and the third parameter is END, not buffer size.
3649 * src/dfa.c (dfaexec): Rewrite the function's comment.
3650 Don't just clobber *END. While doing that happens to be
3651 fine for gawk's usage, in grep, *END usually points to the
3652 first byte of the next buffer. Save the initial value,
3653 and restore it just before returning.
3654 * src/dfa.h (dfaexec): Update comment; include parameter names.
3655
36562010-03-12 Jim Meyering <meyering@redhat.com>
3657
3658 dfa: appease static analyzers
3659 * src/dfa.c (transit_state_singlebyte): Call abort rather
3660 than returning in a "can't happen" scenario.
3661 This stops clang from emitting a false-positive report (I think it
3662 was used-uninitialized) about a caller.
3663
36642010-03-11 Jim Meyering <meyering@redhat.com>
3665
3666 dfa: do not accept [[:UPPER:]] or [[:LOWER:]] internally
3667 * src/dfa.c (parse_bracket_exp_mb): Those class names are not
3668 valid, and rejected elsewhere, so there is no point in allowing
3669 upper or mixed-case versions here.
3670
36712010-03-11 Jim Meyering <meyering@redhat.com>
3672
3673 maint: remove a trailing space
3674 * src/search.c (EXECUTE_FCT): Remove trailing space.
3675
3676 maint: remove all uses of PARAMS
3677 Remove most with this:
3678 git grep -lw PARAMS |xargs perl -pi -e 's/\bPARAMS *\((.*)\);/$1;/'
3679 Remove the remainder manually.
3680
36812010-03-11 Jim Meyering <meyering@redhat.com>
3682
3683 maint: remove all uses of PARAMS
3684 * lib/savedir.h (PARAMS): Remove definitions manually.
3685 Remove the remaining ones via this command:
3686 git grep -l define.PARAMS |xargs perl -ni -e '/define PARAMS/ or print'
3687 * src/dfa.h (PARAMS): Remove definitions.
3688 * src/system.h (PARAMS): Likewise.
3689 Remove most uses with this:
3690 git grep -lw PARAMS |xargs perl -pi -e 's/\bPARAMS *\((.*)\);/$1;/'
3691 Remove the remainder manually.
3692
3693 maint: remove now-useless prototypes
3694 * src/dfa.c: Remove the prototype of each static, non-recursive
3695 function whose definition precedes first use.
3696
3697 grep: plug an inconsequential leak
3698 * src/grep.c (main): Plug a leak: free "keys".
3699
3700 grep: avoid useless allocations for empty GREP_OPTIONS
3701 * src/grep.c (prepend_default_options): Ignore GREP_OPTIONS
3702 when it's empty, not just when it's undefined.
3703 There are still relatively harmless leaks when GREP_OPTIONS
3704 is set and non-empty. We'll address those, eventually.
3705
37062010-03-09 Jim Meyering <meyering@redhat.com>
3707
3708 build: record build-from-clone tool requirements
3709 * bootstrap.conf (buildreq): This makes bootstrap fail with
3710 a clear explanation of the problem. Otherwise, you'd get into
3711 the build process and fail with something far more cryptic.
3712
3713 dfa: remove a trailing blank
3714 * src/dfa.c (dfaexec): No trailing blanks allowed.
3715
3716 dfa: sync a tiny change from gawk
3717 * src/dfa.c (state_index) [MBS_SUPPORT]: Initialize .mpbs.nelem member
3718 unconditionally. Also initialize .mbps.elems.
3719
3720 dfa: avoid a leak (work_mbc->chars)
3721 * src/dfa.c (parse_bracket_exp_mb): Remove useless (and leaked MALLOC).
3722
3723 doc+bootstrap: document build-from-git-clone process
3724 * bootstrap: Update from coreutils/gnulib.
3725 * README-hacking: New file, nearly identical to the one in coreutils.
3726
37272010-03-08 Paolo Bonzini <bonzini@gnu.org>
3728
3729 more work on TODO
3730 * TODO: More work on the first section. Use clearer section headers.
3731
37322010-03-08 Reuben Thomas <rrt@sc3d.org>
3733
3734 bring TODO up-to-date
3735 * TODO: merge with TODO section of http://www.gnu.org/software/grep/devel.html
3736 and remove done items. Some small bits of tidying also.
3737
37382010-03-07 Paolo Bonzini <bonzini@gnu.org>
3739
3740 simplify parsing of [a-z]
3741 * src/dfa.c (in_coll_range): New.
3742 (lex): Use it instead of regcomp/regexec.
3743
3744 Small refactoring in src/dfa.c
3745 * src/dfa.c (parse_bracket_exp_mb): Return MBCSET.
3746 (lex): Assign return value of parse_bracket_exp_mb to lasttok, return it.
3747
3748 use do...while(0) idiom
3749 * dfa.c (FETCH): Wrap with do...while(0).
3750
37512010-03-06 Paolo Bonzini <bonzini@gnu.org>
3752
3753 extract common code from if/else
3754 * dfa.c (dfaexec): Simplify logic for MB_CUR_MAX > 1 case.
3755
3756 remove register variable hacks
3757 * dfa.c (dfaexec): We can extract the address of a variable without fearing
3758 performance problems, modern compilers know better.
3759
3760 remove register keywords
3761 * dfa.c (dfaexec): Modern compilers just ignore it.
3762
3763 allow grep -Pz
3764 * NEWS: Document grep -P improvements.
3765 * src/search.c (Pcompile): Remove restriction on grep -Pz.
3766 * tests/pcre-z: New.
3767 * tests/Makefile.am (TESTS): Add pcre-z.
3768
3769 fix cross-line matching in PCRE backend
3770 * search.c (Pexecute): Split the buffer in lines and match each line
3771 separately.
3772 * tests/fedora.sh: Add regression testsuite.
3773
3774 fix formatting of NEWS
3775 * NEWS: fix formatting of 2.6 entries.
3776
3777 fix a bug in handling of -i and character type
3778 * dfa.c (parse_bracket_exp_mb): Convert [[:lower:]] and [[:upper]] to
3779 [[:alpha:]] when folding case.
3780 * tests/case-fold-char-type: New file. Test for the bug.
3781 * tests/Makefile.am (TESTS): Add it.
3782 * NEWS (Bug fixes): Mention it.
3783
3784 fix previous test case change
3785 * tests/case-fold-char-class: Do not reset fail to 0 after first test.
3786
37872010-03-06 Mike Frysinger <vapier@gentoo.org>
3788
3789 grep(1) man page: touchup --label option
3790 * doc/grep.1 (--label): Don't italicize ending period. Point to -H
3791 option.
3792
37932010-03-06 Paolo Bonzini <bonzini@gnu.org>
3794
3795 augment case-fold-char-class test case
3796 * tests/case-fold-char-class: Test matching lowercase against uppercase
3797 as well as vice versa.
3798
37992010-03-06 Reuben Thomas <rrt@sc3d.org>
3800
3801 doc: improve the discussion of PCRE
3802 * doc/grep.1: Add a sentence about Perl regular expressions,
3803 and point to pcresyntax(3) and pcrepattern(3).
3804 * doc/grep.texi: Likewise.
3805
38062010-03-05 Jim Meyering <meyering@redhat.com>
3807
3808 maint: dfa-sync: comment and dead-to-grep code: no semantic change
3809 * src/dfa.c: Sync a comment and some #ifdef GAWK code.
3810
3811 maint: dfa-sync: don't malloc zero
3812 * src/dfa.c (dfacomp): Skip case_fold logic when length is zero.
3813 This probably "no semantic change", but does improve efficiency in
3814 a degenerate case.
3815
3816 maint: dfa-sync: use CALLOC rather than equiv. MALLOC+initialize-loop
3817 * src/dfa.c (dfaanalyze): Sync from gawk. No semantic change.
3818
3819 dfa.c: add support for \s and \S
3820 * src/dfa.c (lex): Sync from gawk's dfa.c.
3821
3822 maint: dfa-sync: add omitted array initializer
3823 * src/dfa.c (prednames): Add a "0" to final initializer.
3824 No semantic change.
3825
3826 fix a bug in handling of -i and character classes
3827 * dfa.c (parse_bracket_exp_mb): Sync one part of this function
3828 from gawk's dfa.c, which was patched by Arnold D. Robbins.
3829 * tests/case-fold-char-class: New file. Test for the bug.
3830 * tests/Makefile.am (TESTS): Add it.
3831 (TESTS_ENVIRONMENT): Propagate LOCALE_FR and LOCALE_FR_UTF8
3832 definitions into tests.
3833 * NEWS (Bug fixes): Mention it.
3834
38352010-03-05 Paolo Bonzini <pbonzini@redhat.com>
3836
3837 Fedora Grep regression test suite
3838 * tests/Makefile.am (TESTS): Add fedora.sh.
3839 (CLEANFILES): Add several new files.
3840 * tests/fedora.sh: New file, originally by Lubomir Rintel but somewhat
3841 rewritten to avoid bashisms.
3842
38432010-03-05 Paolo Bonzini <bonzini@gnu.org>
3844
3845 convert AUTHORS file to UTF-8
3846 * AUTHORS: Convert to UTF-8.
3847
3848 eliminate invalid "ptr += (ptr2 - ptr1)"
3849 * lib/savedir.c (savedir): new_name_space and name_space do not point into
3850 the same object, so computing their difference is invalid. Similarly,
3851 summing the difference to namep is invalid because namep and the result
3852 point into different objects. Avoid this.
3853
3854 fix for bug 21276
3855 * lib/savedir.c (isdir1): Use realloc instead of calloc. Remove
3856 dead code.
3857 (savedir): Do not leak name_space if allocation of new_name_space fails.
3858
38592010-03-04 Jim Meyering <meyering@redhat.com>
3860
3861 tests: add a test based on an example from Paolo Bonzini
3862 * tests/word-multi-file: New test.
3863 * tests/Makefile.am (TESTS): Add it.
3864
3865 doc: document release procedure
3866 * README-release: New file.
3867
3868 build: update gnulib submodule to latest
3869
38702010-02-22 Paolo Bonzini <bonzini@gnu.org>
3871
3872 add --group-separator=FOO and --no-group-separator
3873 * src/grep.c (group_separator): New.
3874 (long_options): Add --group-separator=FOO and --no-group-separator.
3875 (prtext): Print group_separator instead of SEP_STR_GROUP. Optionally
3876 suppress the separator altogether.
3877 (main) Handle GROUP_SEPARATOR_OPTION.
3878 * doc/grep.texi (Context control): Document it.
3879 * NEWS: Mention it.
3880 * tests/yesno.sh: Add testcases.
3881
38822010-02-21 Jim Meyering <meyering@redhat.com>
3883
3884 tests: don't use "echo -n"
3885 * tests/foad1.sh: Use printf, not echo -n. The latter is not portable.
3886 Reported by Daniel Richman.
3887
38882010-02-08 Jim Meyering <meyering@redhat.com>
3889
3890 remove useless DJGPP-specific code
3891 * src/grep.c (grepfile): Remove now-useless DJGPP-specific code.
3892 Now, all S_IS* macros are guaranteed to be defined via gnulib.
3893
38942010-02-07 Jim Meyering <meyering@redhat.com>
3895
3896 tests: add help-version sanity tests from coreutils
3897 * tests/help-version: New test, from coreutils.
3898 * tests/Makefile.am (TESTS): Add it.
3899 (TESTS_ENVIRONMENT) [built_programs]: Define it.
3900
3901 tests: correct TESTS_ENVIRONMENT's PATH setting
3902 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH to start with
3903 $(abs_top_builddir)/src, so that we test the programs we've just built.
3904
3905 grep: use the correct exit status (2) upon write failure, not 1
3906 * src/grep.c (main): Initialize exit_failure to EXIT_TROUBLE.
3907 * NEWS (Bug fixes): Mention this fix.
3908
3909 maint: enable the prohibit_magic_number_exit syntax check
3910 * cfg.mk (local-checks-to-skip): Remove sc_prohibit_magic_number_exit,
3911 to enable that check.
3912 * src/system.h (EXIT_TROUBLE): Define.
3913 * src/grep.c: Use symbolic names, EXIT_SUCCESS, EXIT_FAILURE, and
3914 EXIT_TROUBLE, not 0, 1, 2.
3915 * src/search.c: Likewise.
3916 * src/vms_fab.c (string): Likewise.
3917
39182010-02-05 Jim Meyering <meyering@redhat.com>
3919
3920 doc: adjust NEWS item
3921 * NEWS: Correct a description.
3922
39232010-02-04 Jim Meyering <meyering@redhat.com>
3924
3925 tests: exercise surprising -m1 vs. --context behavior
3926 * tests/max-count-vs-context: New test. Exercise the surprising,
3927 but documented, behavior reported by Markus Jochim in
3928 http://savannah.gnu.org/bugs/?28588.
3929 * tests/Makefile.am (TESTS): Add it.
3930
39312010-02-03 Jim Meyering <meyering@redhat.com>
3932
3933 tests: use init.sh from gnulib
3934 * tests/init.sh: New file, from gnulib.
3935 * tests/Makefile.am (EXTRA_DIST): Add it.
3936 (TESTS_ENVIRONMENT): Add variables and features.
3937 (VERBOSE): Define.
3938
3939 maint: remove unused Makefile rule
3940 * tests/Makefile.am (dist-hook): Remove rule. No longer needed.
3941
3942 maint: adjust formatting in tests/Makefile.am
3943 * tests/Makefile.am (TESTS, CLEANFILES): Align and sort.
3944
3945 build: avoid warnings in gnulib-supplied regex files
3946 Now that we enable more warnings in lib/, we choose
3947 to avoid some via patches applied by bootstrap, using
3948 files in the gl/ hierarchy. Other, less-important
3949 warnings are avoided simply by turning off the
3950 -Wold-style-definition option and using a slightly
3951 relaxed set of warnings $(GNULIB_WARN_CFLAGS) in lib/.
3952 * gl/lib/regcomp.c.diff: Avoid warnings.
3953 * gl/lib/regex_internal.c.diff: Likewise.
3954 * gl/lib/regex_internal.h.diff: Likewise.
3955 * gl/lib/regexec.c.diff: Likewise.
3956 * configure.ac (GNULIB_PORTCHECK): Disable only -Wold-style-definition.
3957 * lib/Makefile.am (AM_CFLAGS): Use $(GNULIB_WARN_CFLAGS) rather
3958 than the slightly more strict $(WARN_CFLAGS).
3959
3960 tests: adjust spencer #37 to pass with gnulib's regex code
3961 * tests/spencer1.tests: Change #37 to expect an exit status of 2, not 1.
3962 grep 'a[b-a]' reports "Invalid range end".
3963
3964 maint: use regex from gnulib, rather than our bit-rotting one
3965 * bootstrap.conf (gnulib_modules): Add regex.
3966 * configure.ac: Don't use jm_INCLUDED_REGEX.
3967 Update use of cache variable.
3968 * lib/regex.c: Remove file.
3969 * lib/regex.h: Likewise.
3970 * m4/regex.m4: Likewise.
3971 * POTFILES.in: Update to match.
3972
3973 build: update gnulib submodule to latest
3974
39752010-01-28 Jim Meyering <meyering@redhat.com>
3976
3977 maint: update to latest gnulib; adjust cfg.mk
3978 * gnulib: Update submodule to latest.
3979 * cfg.mk (old_NEWS_hash): Update to reflect NEWS Copyright line change.
3980
39812010-01-06 Jim Meyering <meyering@redhat.com>
3982
3983 maint: avoid old jm_* macros
3984 There were jm_* macros here, until very recently.
3985 * cfg.mk (sc_prohibit_jm_in_m4): New rule, from coreutils.
3986
3987 maint: remove decl.m4
3988 * m4/decl.m4: Remove unused file.
3989
3990 maint: rely on gnulib's new isdir.h
3991 * src/grep.c: Include "isdir.h".
3992 * src/system.h: Remove declaration of isdir.
3993
3994 build: rename local to avoid shadowing global, dfa
3995 * src/dfa.c (dfamust): Rename parameter: s/dfa/d/.
3996
3997 build: avoid warning from -Wmissing-prototypes
3998 * src/dfa.c (match_mb_charset): Declare to be static.
3999
4000 build: avoid shadowing warning for "link"
4001 * src/kwset.c (link): Define to kwset_link, to avoid shadowing
4002 the function.
4003
4004 build: avoid shadowing warning for unused "rs"
4005 * src/dfa.c (transit_state): Remove dead stores;
4006 move a declaration "down".
4007 Ignore transit_state_consume_1char return value.
4008
4009 build: avoid shadowing warnings
4010 * src/dfa.c (match_mb_charset): Rename parameter: s/index/idx/.
4011 (check_matching_with_multibyte_ops, match_anychar): Likewise.
4012
4013 build: avoid warning about unused definition of N_
4014 * src/dfa.c (N_): Remove unused definition.
4015
4016 build: avoid format-string warnings
4017 * src/search.c (dfaerror): Use literal "%s" as format string.
4018 (kwsmusts, GEAcompile): Likewise.
4019 (Pcompile): Likewise.
4020
4021 build: add configure-time --enable-gcc-warnings option; avoid warnings
4022 * bootstrap.conf (gnulib_modules): Add "manywarnings" module.
4023 * configure.ac: Add --enable-gcc-warnings, derived from code in bison.
4024 * src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) $(WERROR_CFLAGS)
4025 * lib/Makefile.am (AM_CFLAGS): Likewise, but append.
4026
4027 build: remove now-useless -I../intl option
4028 * src/Makefile.am (INCLUDES): Remove -I../intl, now that intl is gone.
4029
4030 maint: avoid more warnings
4031 * src/grep.c (MAX): Remove definition of unused macro.
4032 (usage): Declare with __attribute__ ((noreturn)).
4033 Split long strings into chunks of length < 509.
4034
4035 fix a possible bug: remove errant semicolon
4036 * src/grep.c (prline): Remove erroneous semicolon-after-if-expr.
4037
4038 maint: avoid compilation warnings
4039 * bootstrap.conf (gnulib_modules): Add ignore-value.
4040 * src/search.c (check_multibyte_string_no_icase): A variant of
4041 check_multibyte_string that does *not* convert case, and hence
4042 does not modify its BUF parameter.
4043 (check_multibyte_string): Use xcalloc in place of xmalloc+memset.
4044 Use ignore_value to ignore the return value from wcrtomb. This is
4045 ok, since we know the input is a valid upper case wide character.
4046 (Fexecute, EGexecute): Update callers of check_multibyte_string
4047 to use both it and check_multibyte_string_no_icase.
4048
4049 maint: avoid warnings about unused fwrite return value
4050 * bootstrap.conf (gnulib_modules): Add unlocked-io.
4051 * src/system.h: Include "unlocked-io.h".
4052
4053 maint: remove {m4,lib}/.gitignore; they were undergoing too much churn
4054 * .gitignore: Ignore all of m4/* except m4/djgpp.m4
4055 and all of lib/* except Makefile.am, savedir.c and savedir.h.
4056 * m4/.gitignore: Remove file.
4057 * lib/.gitignore: Remove file.
4058
40592010-01-05 Jim Meyering <meyering@redhat.com>
4060
4061 build: run gnulib's tests, too
4062 * Makefile.am (SUBDIRS): Add gnulib-tests.
4063 * gnulib-tests/Makefile.am: New file.
4064 * bootstrap.conf (bootstrap_epilogue): New function, from coreutils.
4065 (gnulib_tool_option_extras): Define.
4066 * configure.ac: Add gnulib-tests/Makefile.
4067
40682010-01-03 Jim Meyering <meyering@redhat.com>
4069
4070 maint: record update-copyright options for this package
4071 * cfg.mk: Next time, just run "make update-copyright".
4072
40732010-01-01 Jim Meyering <meyering@redhat.com>
4074
4075 maint: update all FSF copyright year lists to include 2010
4076 Use this command:
4077 git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \
4078 env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
4079
40802009-12-23 Jim Meyering <meyering@redhat.com>
4081
4082 fix multi-byte-locale read-beyond-end-of-buffer error
4083 Avoid read-beyond-end-of-buffer errors, evoked by running this:
4084 LC_ALL=en_US.UTF-8 valgrind src/grep -f <(printf 'a\nb\n') <(echo c)
4085
4086 Conditional jump or move depends on uninitialised value(s)
4087 at 0x78136D: __gconv_transform_utf8_internal (in /lib/libc-2.11.so)
4088 by 0x7E7232: mbrtowc (in /lib/libc-2.11.so)
4089 by 0x8055773: dfaexec (dfa.c:2816)
4090 by 0x804D7B0: EGexecute (search.c:353)
4091 by 0x804ACD8: grepbuf (grep.c:1036)
4092 by 0x804B023: grep (grep.c:1156)
4093 by 0x804B460: grepfile (grep.c:1287)
4094 by 0x804CF0D: main (grep.c:2282)
4095
4096 Conditional jump or move depends on uninitialised value(s)
4097 at 0x7E7248: mbrtowc (in /lib/libc-2.11.so)
4098 by 0x8055773: dfaexec (dfa.c:2816)
4099 by 0x804D7B0: EGexecute (search.c:353)
4100 by 0x804ACD8: grepbuf (grep.c:1036)
4101 by 0x804B023: grep (grep.c:1156)
4102 by 0x804B460: grepfile (grep.c:1287)
4103 by 0x804CF0D: main (grep.c:2282)
4104
4105 * src/dfa.c (dfaexec) [MBS_SUPPORT]: Do not access one byte beyond
4106 end of buffer.
4107
41082009-12-23 Jim Meyering <meyering@redhat.com>
4109
4110 build: update gnulib submodule to latest
4111
41122009-12-23 Paolo Bonzini <bonzini@gnu.org>
4113
4114 Speed up insert.
4115 Suggested by Johan Walles <johan.walles@gmail.com> (bug 23354).
4116
4117 * src/dfa.c (insert): Use binary search.
4118
41192009-12-23 Johan Walles <johan.walles@gmail.com>
4120
4121 Decrease epsclosure memory usage
4122 Fixes bug 23321.
4123
4124 * src/dfa.c (epsclosure): Make visited an array of char.
4125
41262009-12-22 Paolo Bonzini <bonzini@gnu.org>
4127
4128 Make 'grep -1 -2' and 'grep -1v2' equivalent to grep -2
4129 Fixes bug 12128.
4130
4131 * src/grep.c (get_nondigit_option): Reset the buffer every time
4132 a non-digit option is found or a new argument is started.
4133
41342009-12-22 Paolo Bonzini <bonzini@gnu.org>
4135
4136 Improve description of --label
4137 Fixes bug 22681.
4138
4139 * doc/grep.1 (--label): Use -H in the example, improve wording.
4140 * doc/grep.texi (Output Line Prefix Control): Likewise.
4141
41422009-12-22 Paolo Bonzini <bonzini@gnu.org>
4143
4144 Avoid using an invalid memchr result.
4145 Related to bug 13161. I cannot find a testcase, but it is better to be
4146 defensive considering that these bug were found in the past.
4147
4148 * src/search.c (EGexecute, Fexecute): Check for memchr return values.
4149
41502009-12-11 Jim Meyering <meyering@redhat.com>
4151
4152 build: update gnulib submodule to latest
4153
41542009-12-04 Jim Meyering <meyering@redhat.com>
4155
4156 maint: enable prohibit_have_config_h check
4157 * cfg.mk (local-checks-to-skip): Enable sc_prohibit_have_config_h
4158 * lib/regex.c: Remove useless cpp test of HAVE_CONFIG_H.
4159 * lib/savedir.c: Likewise.
4160 * src/grep.c: Likewise.
4161 * src/kwset.c: Likewise.
4162 * src/search.c: Likewise.
4163
4164 maint: enable cast_of_x_alloc_return_value check
4165 * cfg.mk (local-checks-to-skip): Enable sc_cast_of_x_alloc_return_value.
4166 * .x-sc_cast_of_x_alloc_return_value:
4167 * src/dfa.c (CALLOC, MALLOC, REALLOC): Remove casts.
4168 * src/dosbuf.c (undossify_input): Likewise.
4169 * src/grep.c (print_line_middle, prepend_default_options): Likewise.
4170
4171 maint: enable cast_of_alloca_return_value check
4172 * cfg.mk (local-checks-to-skip): Enable sc_cast_of_alloca_return_value.
4173 * .x-sc_cast_of_alloca_return_value: New file.
4174
41752009-12-04 Paolo Bonzini <bonzini@gnu.org>
4176
4177 fix "grep -Ff" on CRLF-terminated files
4178 * src/search.c (Fcompile) [HAVE_DOS_FILE_CONTENTS]: Recognize \r\n as
4179 a line terminator.
4180
4181 fix compilation with included regex
4182 * Makefile.am (libgreputils_a_DEPENDENCIES): New.
4183
4184 switch to pkg-config for PCRE detection
4185 * configure.ac: use pkg-config to detect PCRE
4186 * src/Makefile.am (grep_LDADD): link grep with PCRE_LIBS
4187
41882009-12-04 Jim Meyering <meyering@redhat.com>
4189
4190 maint: remove "missing" script
4191 * missing: Remove now-unused file.
4192
4193 maint: make .gitignore ignore more
4194 * .gitignore: Ignore more.
4195
4196 maint: enable useless-if-before-free check
4197 * cfg.mk (local-checks-to-skip): Enable sc_avoid_if_before_free.
4198 * .x-sc_avoid_if_before_free: New file. Exempt regex.c and dfa.c,
4199 in case anyone ever tries to merge their contents with other versions.
4200 * src/grep.c (print_line_middle, grepdir): Remove useless if-before-free.
4201 * src/search.c (IF_BK, EXECUTE_FCT): Likewise.
4202
4203 maint: enable po-check
4204 * cfg.mk (local-checks-to-skip): Enable sc_po_check.
4205 * po/POTFILES.in: Sort and update.
4206
42072009-12-03 Paolo Bonzini <bonzini@gnu.org>
4208
4209 update gnulib, fixing missing inclusion of stdbool.h
4210 * gnulib: Update.
4211
42122009-11-30 Jim Meyering <meyering@redhat.com>
4213
4214 maint: enable two checks
4215 * cfg.mk (local-checks-to-skip): Enable two:
4216 sc_prohibit_xalloc_without_use sc_two_space_separator_in_usage
4217 * src/grep.c (usage): Conform: use two spaces, not 1.
4218 * src/kwset.c (malloc): Define as a function-macro so that the
4219 syntax-check rule sees that we are indeed using xmalloc here.
4220
4221 maint: enable makefile_path_separator check
4222 * cfg.mk (local-checks-to-skip): Enable sc_makefile_path_separator_check,
4223 now that the sole offender, an old po/Makefile.in.in, is gone.
4224
4225 maint: remove now-generated file: po/Makefile.in.in
4226 * po/Makefile.in.in: Remove file, now generated via bootstrap.
4227
4228 maint: enable makefile @...@ check
4229 * cfg.mk (local-checks-to-skip): Enable sc_makefile_check.
4230 * lib/Makefile.am (libgreputils_a_LIBADD): Use $(...), rather than
4231 anachronistic @...@ notation.
4232 * src/Makefile.am (LDADD): Likewise.
4233 * tests/Makefile.am (AWK): Remove definition.
4234
4235 maint: enable trailing_blank check
4236 * cfg.mk (local-checks-to-skip): Enable sc_trailing_blank.
4237 * AUTHORS: Remove trailing blanks.
4238 * COPYING: Likewise.
4239 * README: Likewise.
4240 * README-alpha: Likewise.
4241 * README-boot: Likewise.
4242 * THANKS: Likewise.
4243 * TODO: Likewise.
4244 * src/dfa.c: Likewise.
4245 * src/mbsupport.h: Likewise.
4246 * tests/backref.sh: Likewise.
4247 * tests/file.sh: Likewise.
4248 * tests/options.sh: Likewise.
4249 * tests/tests: Likewise.
4250 * vms/README: Likewise.
4251 * vms/make.com: Likewise.
4252
4253 maint: enable unmarked_diagnostics check
4254 * cfg.mk (local-checks-to-skip): Enable sc_unmarked_diagnostics
4255 * src/grep.c (fillbuf): Mark a diagnostic for translation.
4256 (reset): Likewise.
4257
4258 maint: enable require_config_h checks
4259 * cfg.mk (local-checks-to-skip): Enable sc_require_config_h
4260 and sc_require_config_h_first.
4261 * src/dosbuf.c: Include <config.h>.
4262 * src/vms_fab.c: Likewise.
4263 * .x-sc_require_config_h: New file: list the exceptions.
4264 * .x-sc_require_config_h_first: Likewise.
4265
4266 maint: use gnulib's progname module; enable set_program_name check
4267 * bootstrap.conf (gnulib_modules): Add progname.
4268 * src/grep.c: Include "progname.h".
4269 (program_name): Remove declaration.
4270 (main): Call set_program_name.
4271 * cfg.mk (local-checks-to-skip): Add sc_program_name.
4272
4273 maint: enable "file system" check
4274 * cfg.mk (local-checks-to-skip): Enable sc_file_system.
4275 * lib/savedir.c (savedir): Tweak spelling. Remove trailing blanks.
4276
4277 maint: enable immutable_NEWS check
4278 * NEWS: Move copyright to the bottom.
4279 Use the format required by release-related tools.
4280 * .prev-version: New file.
4281 * cfg.mk (old_NEWS_hash): Define.
4282 (local-checks-to-skip): Enable check: sc_immutable_NEWS.
4283
4284 maint: disable the many failing syntax-checks
4285 * cfg.mk: New file.
4286 (local-checks-to-skip): Define to the list of disabled rules.
4287 Subsequent change-sets will enable them, one by one.
4288
4289 build: require automake-1.11, enable silent-rules, parallel tests, xz
4290 * configure.ac (AM_INIT_AUTOMAKE): Create xz-compressed tarballs,
4291 not bzip2-compressed ones. Enable automake's silent-rules,
4292 parallel tests, and test PASS/FAIL coloring options.
4293 Use AC_CONFIG_HEADERS, not AM_CONFIG_HEADER. Quote the argument.
4294
4295 build: use git-version-gen for inter-release version strings
4296 * configure.ac (AC_INIT): Use git-version-gen.
4297
4298 build: add several build- and release-related gnulib modules
4299 * bootstrap.conf (gnulib_modules): Add announce-gen update-copyright
4300 do-release-commit-and-tag git-version-gen gnu-web-doc-update
4301 gnupload maintainer-makefile useless-if-before-free
4302
4303 build: adapt to the newer closeout module from gnulib
4304 * src/grep.c: Include "exitfail.h".
4305 (main) [-q]: Set the global variable, exit_failure, rather than
4306 calling the now-removed close_stdout_set_file_name function.
4307
4308 build: adapt to the newer exclude API we now get from gnulib
4309 * src/grep.c (main): Adapt to newer exclude.c: add EXCLUDE_WILDCARDS as
4310 the new "option" argument in calls to add_exclude and add_exclude_file.
4311
4312 build: get more lib/* files from gnulib, adjust savedir
4313 * bootstrap.conf (gnulib_modules): Add the following:
4314 closeout exclude hard-locale isdir strtoumax.
4315 * lib/.gitignore, m4/.gitignore: Update.
4316 * lib/closeout.c, lib/closeout.h: Remove.
4317 * lib/exclude.c, lib/exclude.h: Remove.
4318 * lib/hard-locale.c, lib/hard-locale.h: Remove.
4319 * lib/strtoumax.c: Remove.
4320 * lib/isdir.c: Remove.
4321 * lib/Makefile.am: Remove here, too.
4322 * lib/savedir.c: Adapt to new exclude module:
4323 s/excluded_filename/excluded_file_name/ and remove 3rd argument.
4324
4325 build: update gnulib submodule to latest
4326
4327 maint: generate ChangeLog from git logs
4328 * Makefile.am (dist-hook, gen-ChangeLog): New rules.
4329 * bootstrap.conf (gnulib_modules): Add gitlog-to-changelog.
4330 Ensure that ChangeLog exists.
4331 * ChangeLog-2009: Rename from ChangeLog
4332 * ChangeLog: Remove file.
4333 * .gitignore: Add ChangeLog.
4334
4335 maint: list gnulib modules one per line
4336 * bootstrap.conf (gnulib_modules): List them one per line.
4337
43382009-11-30 Tony Abou-Assaleh <taa@acm.org>
4339
4340 Acknowledge new maintainers, update README-alpha
4341 * AUTHORS: new maintainers added
4342 * THANKS: same
4343 * README-alpha: change CVS references to Git
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette