VirtualBox

source: kBuild/vendor/sed/current/ChangeLog@ 3627

Last change on this file since 3627 was 3611, checked in by bird, 7 months ago

vendor/sed/current: GNU sed 4.9 (sed-4.9.tar.xz sha256:6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181)

File size: 145.7 KB
Line 
12022-11-06 Jim Meyering <meyering@fb.com>
2
3 version 4.9
4 * NEWS: Record release date.
5
6 build: update gnulib to latest, and testsuite/init.sh
7
8 tests: do not rely on unportable "grep -q"
9 * testsuite/inplace-selinux.sh: Avoid unportable "grep -q".
10 Instead, just redirect to /dev/null.
11
122022-10-23 Jim Meyering <meyering@fb.com>
13
14 test: add a test case and mention the change in NEWS
15 * testsuite/misc.pl: Add a test to exercise the preceding change.
16 * NEWS (Changes in behavior): Mention it.
17
182022-10-23 Oğuz <oguzismailuysal@gmail.com>
19
20 sed: handle the unspecified "n as delimiter alias" case more sensibly
21 Print the less-surprising variant in a corner case of POSIX-unspecified
22 behavior. Before, this would print "n". Now, it prints "X":
23 printf n | sed 'sn\nnXn'; echo
24 * sed/compile.c (match_slash): Remove special handling of 'n'.
25 Reported in https://bugs.gnu.org/40242
26
272022-10-23 Jim Meyering <meyering@fb.com>
28
29 build: update gnulib to latest, for Solaris static_assert fix
30
312022-10-16 Jim Meyering <meyering@fb.com>
32
33 build: fix am_DISTCHECK_CONFIGURE_FLAGS typo
34 * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Correct typo
35 in recent change: s/am_/AM_/
36
37 build: update gnulib to latest, for getdelim vs macOS workaround
38
39 maint: avoid syntax-check failure
40 * Makefile.am (am_DISTCHECK_CONFIGURE_FLAGS): Change
41 DISTCHECK_CONFIGURE_FLAGS to
42 am_DISTCHECK_CONFIGURE_FLAGS.
43
44 maint: tell git to ignore new generated files in lib/
45 * lib/.gitignore: Add /assert.h and /stdckdint.h
46
47 build: work when perl is installed but not in /usr/bin/perl
48 Also support building on systems without perl and when cross-compiling.
49 * configure.ac (AC_ARG_ENABLE [bold-man-page-references]): New
50 configure-time option, using code copied from coreutils.
51 (BUILD_MAN_PAGE, BUILD_DUMMY_MAN_PAGE): Remove definitions.
52 (HAVE_PERL): Remove bogus conditional.
53 * doc/dummy-man: New file, from coreutils, with slight adapation.
54 * build-aux/help2man: Update from coreutils.
55 * doc/local.mk (EXTRA_DIST): Distribute dummy-man.
56 (run_help2man): New variable.
57 (doc/sed.1): Use it rather than simply invoking help2man.
58 Simplify to use only one copy of this rule, now that run_help2man
59 works both with and without perl and when cross-compiling.
60 Move the --name=... string argument into...
61 * doc/sed.x: ... here. Also make the "Synopsis" appear in generated file.
62 In https://lists.gnu.org/r/sed-devel/2022-10/msg00005.html,
63 Bruno Haible reported build failure with perl in a different
64 location and (in another report) another failure with no perl at all.
65
66 build: fix THANKS generation
67 * .mailmap: Building THANKS would fail due to thanks-gen finding
68 two different email addresses for Mike Frysinger. Map the older
69 one to the newer one.
70
71 build: update gnulib to latest
72
732022-09-15 Marvin Schmidt <marvin.schmidt1987@gmail.com>
74
75 tests: remove stray export-ending semicolon in test setup
76 * testsuite/local.mk (TESTS_ENVIRONMENT): Remove the erroneous ";"
77 that effectively elided all following var=val pairs from the test
78 environment. Report and patch from http://bugs.gnu.org/57831
79 Bug introduced via v4.2.2-100-gb250bd4.
80
812022-07-03 Paul Eggert <eggert@cs.ucla.edu>
82
83 maint: pacify ‘make syntax-check’
84 * THANKS.in: Put J.T. before Jakub again, as apparently
85 that’s how it’s done in Fedora 36 which is bleeding edge.
86 * cfg.mk (sc_THANKS_in_sorted): Update for Fedora 36 sort.
87 (sc_gitignore_missing): The lib files to ignore are now
88 in lib/.gitignore, not .gitignore.
89
90 sed: fix infloop with symlink cycles
91 * bootstrap.conf (gnulib_modules):
92 Add eloop-threshold, idx, minmax, readlink.
93 * configure.ac: Do not check for lstat; no longer needed.
94 (ENABLE_FOLLOW_SYMLINKS): Remove; all uses removed.
95 (TEST_SYMLINKS): Depend only on readlink.
96 * sed/utils.c: Include eloop-threshold.h, idx.h, minmax.h.
97 (SSIZE_IDX_MAX): New macro.
98 (follow_symlink): Rewrite to not loop when given a symlink cycle.
99 Do not use lstat, since readlink suffices. Use just one memory
100 buffer, not two; this simplifies memory management.
101 * testsuite/follow-symlinks.sh: Adjust diagnostics to
102 to match revised behavior. Test for symlink loops.
103
1042022-07-02 Paul Eggert <eggert@cs.ucla.edu>
105
106 build: update gnulib submodule to latest
107
1082022-07-02 Jim Meyering <meyering@fb.com>
109
110 maint: exempt doc/fdl.texi from long-line check
111 * cfg.mk (FILTER_LONG_LINES): Also exempt doc/fdl.texi.
112
1132022-07-02 Paul Eggert <eggert@cs.ucla.edu>
114
115 sed: fix temp file cleanup
116 Without this fix, the code would sometimes use FP after calling
117 fclose (FP), which has undefined behavior in C.
118 Problem found with --enable-gcc-warnings and GCC 12.
119 * sed/execute.c (open_next_file): Do not register here,
120 as it’s too late and this can cause the file to not
121 be cleaned up.
122 * sed/sed.c (G_file_to_unlink, register_cleanup_file, cancel_cleanup):
123 Move from here to utils.c.
124 (cleanup): Call remove_cleanup_file instead of doing it by hand.
125 * sed/utils.c (struct open_file): Remove member temp
126 (which was always false) and fclose_failed (which was
127 not enough to prevent calling fclose with a bad pointer).
128 All uses changed.
129 (register_open_file): Do not access p->fp after it’s fclosed,
130 as that has undefined behavior in C.
131 Use xmalloc instead of xcalloc, since we initialize all members.
132 (G_file_to_unlink, register_cleanup_file, cancel_cleanup):
133 Move from utils.c to here.
134 (remove_cleanup_file): New function.
135 (ck_mkstemp): Fix a screwup when mkostemp succeeded but
136 set_binary_mode or fdopen failed: we might misuse a null pointer,
137 or forget to clean up the newly-created temp file.
138 (ck_getdelim): Rename local to avoid confusion with global.
139 (mark_as_fclose_failed): Remove. All uses removed.
140 (ck_fclose): Remove entry from open_files before attempting
141 to fclose it, so that panicking doesn’t try to fclose it again.
142 (do_ck_fclose): New arg NAME so that there’s no need to
143 call mark_as_fclose_failed, which inspected FP after fclosing
144 it, which is undefined behavior.
145 (ck_rename): Omit arg UNLINK_IF_FAIL. All callers changed.
146 The cleanup handler removes this file now, as needed.
147
148 .gitconfig: add gt-bug* for some test cases
149
150 Remove unused BOOST.tests, PCRE.tests, SPENCER.tests
151
152 Remove unused files testcases.h, ptestcases.h
153
154 maint: stop using fdl module
155 This is as per current Gnulib recommendations.
156
157 Update COPYING, bootstrap from Gnulib
158
159 Update, simplify, and sort .gitignore files
160
161 Add NEWS item for dfa fix in Gnulib
162
1632022-02-13 Chris Marusich <cmmarusich@gmail.com>
164
165 tests: export CONFIG_HEADER to test scripts
166 Before this change, the testsuite/inplace-selinux test fails in some
167 cases when SELinux is available. The reason it fails is because the
168 require_selinux_ function in init.cfg expects the CONFIG_HEADER
169 environment variable to be defined, but in fact it is not defined.
170 Even though we do invoke AM_CONFIG_HEADER in configure.ac, and even
171 though the CONFIG_HEADER variable does get set in the resulting
172 Makefile, nothing actually exports the CONFIG_HEADER variable, so the
173 test is doomed to fail whenever it is not skipped. Fix this by
174 exporting the variable.
175
176 * testsuite/local.mk (TESTS_ENVIRONMENT): Add CONFIG_HEADER to the
177 list of variables to export to the environment of the test scripts.
178
179 Reported by Vineet Jain <vkjain@gmail.com> in
180 https://bugs.gnu.org/36150 . The fix was suggested by Timothy Sample
181 <samplet@ngyro.com> in the same bug report.
182
1832022-01-01 Jim Meyering <meyering@fb.com>
184
185 maint: make update-copyright
186
187 build: update gnulib to latest; also bootstrap and init.sh
188
1892021-12-24 Jim Meyering <meyering@fb.com>
190
191 maint: syntax-check: disable the indent check
192 * cfg.mk (local-checks-to-skip): Add sc_indent.
193 Otherwise, "make syntax-check" would fail for me on a
194 fedora 25 system.
195
1962021-12-17 Jim Meyering <meyering@fb.com>
197
198 build: non-recursive Automake in a less hacky way
199 * bootstrap.conf (gnulib_modules): Remove
200 non-recursive-gnulib-prefix-hack.
201 (gnulib_tool_option_extras): Add --automake-subdir.
202 (bootstrap_post_import_hook): No need to massage lib/gnulib.mk.
203 * configure.ac [AM_INIT_AUTOMAKE]: Move subdir-objects onto the same line
204 as the function name, so gnulib-tool sees it.
205
2062021-10-02 Jim Meyering <meyering@fb.com>
207
208 doc: fix more typos
209 * doc/sed.texi: Fix typos.
210
2112021-10-02 Antonio Diaz Diaz <antonio@gnu.org>
212
213 doc: fix a typo
214 * doc/sed.texi (sed regular expressions):
215 s/considrations/considerations/
216 This addresses https://bugs.gnu.org/50943
217
2182021-09-05 Jim Meyering <meyering@fb.com>
219
220 maint: avoid new syntax-check failure
221 * doc/sed.texi: Split lines longer than 80.
222
223 build: update gnulib to latest
224
225 build: update gnulib to latest
226
227 doc: tighten/clarify wording e.g., re "g" modifier
228 * doc/sed.texi: When declaring that an example replaces
229 all occurrences, use "g" and make the description more
230 precise. Prompted by http://bugs.gnu.org/50361
231 Stop using "the word" when describing a match, to avoid the
232 implication of a connection with "word"-delimited (\b) matching.
233 Prefer to match "on lines ...", not "in lines".
234
2352021-08-16 Assaf Gordon <assafgordon@gmail.com>
236
237 sed: allow '0rFILE' (insert FILE before the first line)
238 The 'r' command can be used with address zero, effectively prepending
239 a file to the beginning of the input file, e.g.:
240 sed '0rA.TXT' B.TXT > C.TXT
241 is equivalent to:
242 cat A.TXT B.TXT > C.TXT
243
244 With "sed -i", this allows safe in-place prepending of files.
245 A typical example would be adding a license header to multiple source
246 files:
247 sed -i '0rLICENSE' *.c *.h
248 find -iname '*.cpp' | xargs sed -i '0rLICENSE'
249
250 A current cumbersome alternative is:
251 sed -i -e 'x;${p;x};1rA.TXT' -e '1d' B.TXT
252
253 * NEWS: Mention new feature.
254 * sed/sed.h (struct readcmd): New struct. (struct sed_cmd): Use new
255 struct instead of a char* for the filename.
256 * sed/compile.c (compile_program): Expand conditional detecting invalid
257 usage of "0" address to allow "0r"; Adjust '0r' to '1r' with prepending
258 (instead of appending).
259 * sed/execute.c (execute_program): 'r' command: support prepending.
260 * sed/debug.c (debug_print_function): Use the new 'struct readcmd'.
261 * testsuite/cmd-0r.sh: New test.
262 * testsuite/local.mk (TESTS): Add new test.
263 * doc/sed.texi (Zero Address): New section. (Adding a header to multiple
264 files): New example section.
265
2662021-08-11 Assaf Gordon <assafgordon@gmail.com>
267
268 sed: extract print_file function
269 * sed/execute.c (dump_append_queue): Extract code to print a file to ...
270 (print_file): new function.
271
2722021-08-04 Renaud Pacalet <renaud.pacalet@telecom-paris.fr>
273
274 doc: fix wording in 'line length adj.' example
275 Reported in https://bugs.gnu.org/49680 .
276
277 * doc/sed.texi: Fix wording, typo.
278
2792021-08-01 Jim Meyering <meyering@fb.com>
280
281 sed: avoid potential double-fclose
282 Upon a failed temp file fclose, do_ck_fclose would call panic,
283 which would then attempt to fclose and unlink that same pointer.
284 Caught by gcc's new -Wanalyzer-double-fclose.
285 * sed/utils.c (struct open_file) [fclose_failed]: New member.
286 (panic): Don't double-close.
287 (register_open_file): Clear new member.
288 (mark_as_fclose_failed): Use new member to avoid double fclose.
289 (do_ck_fclose): Call mark_as_fclose_failed upon fclose failure.
290
291 maint: update obsolete constructs in configure.ac
292 * configure.ac: Avoid autoconf warnings:
293 Switch from obsolete AM_CONFIG_HEADER to AC_CONFIG_HEADERS, and quote.
294 Use AC_PROG_CC_STDC, not AC_PROG_CC.
295 Convert from obsolete AC_TRY_RUN to AC_RUN_IFELSE.
296
297 maint: avoid new warning about deprecated security_context_t
298 * sed/execute.c (open_next_file): Use char * in place of
299 deprecated security_context_t.
300
3012021-07-10 Jim Meyering <meyering@fb.com>
302
303 build: update gnulib to latest
304 * gnulib: update to latest
305 * .gitignore files: Reflect gnulib changes.
306 * bootstrap: update from gnulib
307
3082021-01-05 Assaf Gordon <assafgordon@gmail.com>
309
310 build: restore build rules for manual page
311 Reported by Kian Kasad in
312 https://lists.gnu.org/r/sed-devel/2020-12/msg00000.html ,
313 (continued in https://lists.gnu.org/r/sed-devel/2021-01/msg00000.html ).
314
315 * configure.ac: Enable buidling the manual page regardless of whether
316 building from git or from a tarball.
317
3182021-01-05 Assaf Gordon <assafgordon@gmail.com>
319
320 sed: silence -Wformat-nonoliteral warning
321 GCC compilation fails with:
322 sed/compile.c:206:3: error: format not a string literal, argument types
323 not checked [-Werror=format-nonliteral]
324 sprintf (unknown_cmd, msg, ch);
325 ^~~~~~~
326 While there is suppression of "-Wformat-nonliteral" in configure.ac,
327 it later '-Wformat=2' which turns "-Wformat-nonliteral" on.
328
329 * sed/compile.c (bad_command): Add explicit "#pragma GCC ... ignore".
330 The format string is fixed and known ahead of time.
331
3322021-01-05 Assaf Gordon <assafgordon@gmail.com>
333
334 maint: update all copyright year number ranges
335 Run "make update-copyright" and then...
336 * gnulib: Update to latest with copyright year adjusted.
337 * bootstrap.conf (gnulib_modules): Remove getopt module, depracated in
338 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=0abc38bd2a1398f0
339 * po/POTFILES.in: Remove getopt.c
340 * sed/utils.h (panic): Rename _GL_ATTRIBUTE_FORMAT_PRINTF to
341 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD following gnulib's change:
342 https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=387d654cabd7bc15
343 * tests/init.sh: Sync with gnulib to pick up copyright year.
344 * bootstrap: Likewise.
345
3462020-03-23 Jim Meyering <meyering@fb.com>
347
348 build: update to newer help2man
349 * build-aux/help2man: Update from coreutils.
350 This updates from 1.28 to 1.47.3
351 * cfg.mk (exclude_file_name_regexp--sc_long_lines):
352 Exempt help2man from the 80-column-max limit.
353 This addresses https://bugs.gnu.org/30471
354
3552020-01-18 Tobias Stoeckmann <tobias@stoeckmann.org>
356
357 sed: handle very long input lines with R (tiny change)
358 It is possible to trigger an out of bounds memory access when
359 using the sed command R with an input file containing very long
360 lines.
361
362 The problem is that the line length of parsed file is returned as
363 a size_t by ck_getdelim, but temporarily stored in an int and
364 then converted back into a size_t. On systems like amd64, on which
365 this problem can be triggered, size_t and int have different sizes.
366
367 If the input line is longer than 2 GB (which is parseable on amd64
368 or other 64 bit systems), this means that the temporarily stored
369 int turns negative. Converting the negative int back into a size_t
370 will lead to an excessively large size_t, as the conversion leads to
371 a lot of leading 1 bits.
372
373 Eventually ck_fwrite is called with this huge size_t which in turn
374 will lead to an out of bounds access on amd64 systems -- after all
375 the parsed text was just a bit above 2 GB, not near SIZE_MAX.
376
377 You can trigger this issue with GNU sed on OpenBSD like this:
378
379 $ dd if=/dev/zero bs=1M count=2049 | tr '\0' e > long.txt
380 $ sed Rlong.txt /etc/fstab
381 Segmentation fault (core dumped)
382
383 I was unable to trigger the bug on a Linux system with glibc due to
384 a bug in glibc's fwrite implementation -- it leads to a short write
385 and sed treats that correctly as an error.
386
387 * sed/execute.c (execute_program) [case 'R']: Declare result
388 to be of type size_t, not int.
389 * NEWS (Bug fixes): Mention it.
390 This addresses https://bugs.gnu.org/39166
391
3922020-01-18 Tobias Stoeckmann <tobias@stoeckmann.org>
393
394 sed: handle very long execution lines (tiny change)
395 If sed is called with an excessively long execution line, then it is
396 prone to an out of bounds memory access.
397
398 The problem is that the length of the execution line, which is a
399 size_t, is temporarily stored in an int. This means that on systems
400 which have a 64 bit size_t and a 32 bit int (e.g. linux amd64) an
401 execution line which exceeds 2 GB will overflow int. If it is just
402 slightly larger than 2 GB, the negative int value is used as an
403 array index to finish the execution line string with '\0' which
404 therefore triggers the out of bounds access.
405
406 This problem is probably never triggered in reality, but can be
407 provoked like this (given that 'e' support is compiled in):
408
409 $ dd if=/dev/zero bs=1M count=2049 | tr '\0' e > e-command.txt
410 $ sed -f e-command.txt /etc/fstab
411 Segmentation fault (core dumped)
412
413 Also adjust another int/size_t conversion, even though it is a
414 purely cosmetic change, because it can never be larger than 4096.
415
416 * sed/execute.c (execute_program) [case 'e']: Declare cmd_length
417 to be of type size_t, not int. Likewise for "n" just below.
418 * NEWS (Bug fixes): Mention it.
419 This addresses https://bugs.gnu.org/39165
420
4212020-01-14 Jim Meyering <meyering@fb.com>
422
423 maint: post-release administrivia
424 * NEWS: Add header line for next release.
425 * .prev-version: Record previous version.
426 * cfg.mk (old_NEWS_hash): Auto-update.
427
428 version 4.8
429 * NEWS: Record release date.
430
431 doc: mention changes inherited through gnulib
432 * NEWS (Improvements): Mention gnulib.
433
4342020-01-11 Jim Meyering <meyering@fb.com>
435
436 build: update gnulib to latest (for updated perl.m4)
437
438 tests: remove valgrind-added diagnostics from stderr
439 * testsuite/bug32271-2.sh: Filter out lines starting with "==".
440 This avoids unwarranted failures on e.g., windows systems that
441 would emit this to stderr:
442 +==16281== error calling PR_SET_PTRACER, vgdb might block
443 * testsuite/newline-dfa-bug.sh: Likewise.
444 Reported by Vagelis Prokopiou on Windows subsystem for Linux
445 (Debian 10) in https://lists.gnu.org/r/sed-devel/2020-01/msg00018.html
446 and by Bruno Haible for mingw in
447 https://lists.gnu.org/r/sed-devel/2020-01/msg00005.html
448
449 sed: avoid MSVC build failure
450 * sed/sed.c (usage): Remove unnecessary forward declaration.
451 Reported by Bruno Haible in
452 https://lists.gnu.org/r/sed-devel/2020-01/msg00007.html
453
454 tests: avoid hpux11 test failure
455 * testsuite/title-case.sh: Correct printf usage not to trigger
456 unspecified behavior for '\(\)'. Instead, just use sed with its -r
457 option so those parentheses don't need any backslash at all.
458 Reported by Bruno Haible in
459 https://lists.gnu.org/r/sed-devel/2020-01/msg00008.html
460
4612020-01-09 Jim Meyering <meyering@fb.com>
462
463 tests: handle missing perl
464 Before this change, the two perl-requiring tests would fail
465 on systems without perl. Now, they are skipped, as intended.
466 * bootstrap.conf (gnulib_modules): Add perl.
467 * testsuite/no-perl: New file. From coreutils.
468 * testsuite/local.mk (EXTRA_DIST): Add it.
469 (TESTSUITE_PERL): Include testsuite/ prefix.
470
4712020-01-06 Jim Meyering <meyering@fb.com>
472
473 maint: once again distribute .tar.gz files
474 * configure.ac: Reenable distribution of gzip-compressed
475 tarballs, on request from Jan Nieuwenhuizen in
476 https://lists.gnu.org/r/sed-devel/2020-01/msg00013.html
477 * NEWS (Release): Mention this.
478
4792020-01-05 Jim Meyering <meyering@fb.com>
480
481 maint: space-before-open-paren: avoid syntax-check error
482 * sed/sed.c (selinux_support): Insert space before open-paren.
483
484 build: update gnulib to latest (for thread-related test fixes)
485 * .gitignore: Add /lib/inttypes.h.
486
4872020-01-01 Jim Meyering <meyering@fb.com>
488
489 maint: update all copyright year number ranges
490 Run "make update-copyright" and then...
491 * gnulib: Update to latest with copyright year adjusted.
492 * tests/init.sh: Sync with gnulib to pick up copyright year.
493 * bootstrap: Likewise.
494
495 maint: remove explicit mention of gnulib's threadlib module
496 * bootstrap.conf (gnulib_modules): Remove explicit mention of threadlib.
497 It was added back in 2012 to avoid a bootstrap failure; that explicit
498 mention has long been unnecessary.
499
5002019-09-05 Assaf Gordon <assafgordon@gmail.com>
501
502 sed: set correct umask on temporary files
503 "sed -i" now creates temporary files with correct umask (limited to u=rwx).
504 Previously sed would incorrectly set umask, and combined with mkostemp
505 creating file with mode 0600, the result would be a file with
506 permission mode 0.
507
508 Reported by Dr N.W. Filardo <nwf20@cam.ac.uk>:
509 https://lists.gnu.org/r/sed-devel/2019-08/msg00000.html
510 "The net effect is that this patch does not do what it says on the tin:
511 it does not improve the security story at all. Things continue to
512 function because the subsequent operations are via f*() APIs, which
513 take the open file handle, and in particular fchmod() will put the
514 bits back to something sensible.
515
516 However, when running atop, for example, fuse-style filesystems which do
517 not keep open descriptors to underlying files, this is catastrophic:
518 the underlying file will have I_SRWXU of zero, and so the filesystem
519 server will be unable to open the file for the fchmod() and that's
520 the end of that."
521
522 "fuse-overlayfs" is an example of a filesystem with such issues.
523 This change was made in commit 5156c19b23c41f438bf8658e1b9a43a5ff136835
524 and was released in sed 4.2.1.
525
526 * NEWS: Mention change.
527 * sed/utils.c (ck_mkstemp): Set correct umask.
528
5292019-06-02 Assaf Gordon <assafgordon@gmail.com>
530
531 tests: inplace-selinux.sh: skip if SELinux is not supported
532 Avoid false-positive failure on system with SELinux enabled when SED
533 is built without SELinux suppport.
534
535 Reported by Jeffrey Walton <noloader@gmail.com> in
536 https://bugs.gnu.org/35997 .
537
538 * testsuite/inplace-selinux.sh: Call 'sed --version' to check if sed
539 was built with SELinux support before continuing with the test.
540
5412019-06-02 Assaf Gordon <assafgordon@gmail.com>
542
543 sed: report SELinux status in --version output
544 Report whether sed was built with SELinux support (determined at compile
545 time), and whether it is enabled on this system (determined at runtime).
546
547 Relates to https://bugs.gnu.org/35997 .
548
549 * sed/sed.c (selinux_support): New function, print SELinux status to
550 stdout. (main): Call selinux_support on --version.
551
5522019-01-20 Jim Meyering <meyering@fb.com>
553
554 build: ensure no VLA is used
555 Cause developer builds to fail for any use of a VLA.
556 VLAs (variable length arrays) limit portability.
557 * configure.ac (nw): Remove -Wvla from the list of disabled warnings,
558 thus enabling the warning when configured with --enable-gcc-warnings.
559 (GNULIB_NO_VLA) Define, disabling use of VLAs in gnulib. This commit
560 is functionally equivalent to coreutils' v8.30-44-gd26dece5d.
561
562 build: update gnulib to latest
563
5642019-01-01 Jim Meyering <meyering@fb.com>
565
566 build: update gnulib to latest
567
5682019-01-01 Assaf Gordon <assafgordon@gmail.com>
569
570 maint: update copyright dates for 2019
571 * all files: Run "make update-copyright".
572
5732018-12-20 Jim Meyering <meyering@fb.com>
574
575 maint: use https: in gnu mirror URL prefix, not http
576 This appears in the generated release announcement message.
577 * cfg.mk (url_dir_list): Use https: prefix, not http:.
578
579 maint: post-release administrivia
580 * NEWS: Add header line for next release.
581 * .prev-version: Record previous version.
582 * cfg.mk (old_NEWS_hash): Auto-update.
583
584 version 4.7
585 * NEWS: Record release date.
586
587 sed: fix \b DFA-bug in C locale
588 Under some conditions, \b would mistakenly fail to match. E.g.,
589 this would mistakenly print "123-x" instead of "123":
590 echo 123-x|LC_ALL=C sed 's/.\bx//'
591 * NEWS (Bug fixes): Mention it
592 * gnulib: Update to latest, for DFA regression fix.
593 * testsuite/word-delim.sh: New file, to test for the dfa.c regression.
594 * testsuite/local.mk (T): Add it.
595 Reported by Jan Palus in
596 https://lists.gnu.org/r/sed-devel/2018-12/msg00022.html
597
5982018-12-19 Jim Meyering <meyering@fb.com>
599
600 maint: post-release administrivia
601 * NEWS: Add header line for next release.
602 * .prev-version: Record previous version.
603 * cfg.mk (old_NEWS_hash): Auto-update.
604
605 version 4.6
606 * NEWS: Record release date.
607
6082018-12-17 Jim Meyering <meyering@fb.com>
609
610 build: update gnulib to latest for linux/sparc c-stack fix
611
6122018-12-16 Jim Meyering <meyering@fb.com>
613
614 build: update gnulib to latest for config.sub fix, etc.
615 * gnulib: Update for build- and test-related fixes,
616 including the config.sub fix for Solaris 10:
617 https://lists.gnu.org/r/grep-devel/2018-12/msg00013.html
618 * bootstrap: Update to latest.
619
6202018-12-13 Assaf Gordon <assafgordon@gmail.com>
621
622 tests: fix obinary test error due to 'wc' spaces
623 On BSD systems "wc -c" prefixes the count with spaces,
624 leading to test error.
625 Discussed in https://lists.gnu.org/r/sed-devel/2018-12/msg00014.html .
626
627 * testsuite/obinary.sh: Remove leading spaces from 'wc -c' output.
628
6292018-12-12 Jim Meyering <meyering@fb.com>
630
631 build: update gnulib to latest
632
6332018-12-09 Assaf Gordon <assafgordon@gmail.com>
634
635 tests: add text/binary mode tests
636 This test is skipped on most platforms (which do not support O_BINARY
637 and do not differentiate between TEXT and BINARY files).
638
639 On cygwin, the test is skipped because default cygwin installations
640 do not use O_TEXT/O_BINARY modes (unless file systems are mounted with
641 special options).
642
643 In practice this test will only run on native Windows (e.g. when compiled
644 with mingw or msvc). Note that almost every other test will fail with
645 such a binary (due to excesssive "\r" in the output). Thus it is
646 recommended to explictly run just this test alone:
647
648 make check SUBDIRS=. TESTS=testsuite/obinary.sh
649
650 The script tries to cover all cases mentioned in https://bugs.gnu.org/25459 .
651 See also https://lists.gnu.org/r/sed-devel/2018-10/msg00001.html .
652
653 * testsuite/obinary.sh: New test.
654 * testsuite/local.mk (TESTS): Add new test.
655
6562018-12-05 Assaf Gordon <assafgordon@gmail.com>
657
658 sed: fix -b/--binary mode under windows/mingw
659 Discussed in https://lists.gnu.org/r/sed-devel/2018-10/msg00001.html .
660
661 * NEWS: Mention change.
662 * bootstrap.conf: Add gnulib's binary-io module.
663 * sed/sed.c (main): Set stdin/stdout to binary mode if needed.
664 * sed/utils.c (ck_mkstemp): Explicitly set binary mode on file
665 descriptor. It seems that on (non-cygwin) Windows the fdopen(3) call
666 ignores the 'b' in the 'mode' argument - and the file was always opened
667 in O_TEXT mode. Thus "--binary" was not working with "--inplace".
668
6692018-12-05 Assaf Gordon <assafgordon@gmail.com>
670
671 maint: update .gitignore
672 Following gnulib recent update.
673 * lib/.gitignore, m4/.gitignore: Update file list.
674
6752018-12-05 Assaf Gordon <assafgordon@gmail.com>
676
677 build: update autoconf version requirements
678 Require version 2.64 to bootstrap. This is already required in practice
679 by bootstrap.conf, but was not updated in configure.ac.
680 After recent gnulib update, gnulib-tool would complain:
681
682 $ ./gnulib/gnulib-tool
683 ./gnulib/gnulib-tool: *** minimum supported autoconf version is 2.63.\
684 Try adding AC_PREREQ([2.63]) to your configure.ac.
685 ./gnulib/gnulib-tool: *** Stop.
686
687 Hence this update.
688
689 * configure.ac: Require autoconf version 2.64 or later.
690
6912018-12-05 Assaf Gordon <assafgordon@gmail.com>
692
693 gnulib: update to latest (for dfa improvements)
694
6952018-11-22 Jannick <thirdedition@gmx.net>
696
697 sed: fix memory leakage under lint
698 The NULL-initialized char string in_place_extension is free'ed everytime
699 it is redefined (using xstrdup) and at program exit with any return code.
700
701 See: https://lists.gnu.org/r/sed-devel/2018-11/msg00005.html
702
703 * sed/sed.c (main, cleanup): Free 'in_place_extension' if running with
704 lint.
705
7062018-11-01 Assaf Gordon <assafgordon@gmail.com>
707
708 build: rename stdin local variable
709 Under windows/msys2, defining 'bool stdin' variable results in
710 compilation errors:
711
712 ../sed/execute.c:1252:8: error: expected declaration specifiers or '...'
713 before numeric constant
714 bool stdin = (input->fp && fileno (input->fp) == 0);
715 ^~~~~
716
717 Reported by Jannick <thirdedition@gmx.net> in
718 https://lists.gnu.org/archive/html/sed-devel/2018-10/msg00019.html .
719
720 * sed/execute.c (debug_print_input): Rename 'stdin' to 'is_stdin'.
721
7222018-10-28 Jim Meyering <meyering@fb.com>
723
724 maint: fix a syntax-check nit
725 * sed/compile.c (MISSING_FILENAME): Insert a space before "(", and
726 in a following comment.
727
7282018-10-27 Jim Meyering <meyering@fb.com>
729
730 tests: avoid unnecessary dependency on Data::Dump
731 * testsuite/debug.pl: Don't use Data::Dump. Unnecessary.
732 That package, perl-Data-Dump, appear not to be default-installed
733 on at least a Fedora 29 beta system.
734
735 sed: avoid UMR in --debug code path
736 * sed/debug.c (debug_print_function) [b, t, T]: For a b, t or T
737 command with no LABEL, do not access uninitialized memory.
738 I.e., print the label name only when there is one.
739
7402018-10-24 Assaf Gordon <assafgordon@gmail.com>
741
742 sed: add --debug feature
743 $ seq 3 | sed --debug -e 's/./--&--/ ; 2d'
744 SED PROGRAM:
745 s/./--&--/
746 2 d
747 INPUT: 'STDIN' line 1
748 PATTERN: 1
749 COMMAND: s/./--&--/
750 MATCHED REGEX REGISTERS
751 regex[0] = 0-1 '1'
752 PATTERN: --1--
753 COMMAND: 2 d
754 END-OF-CYCLE:
755 --1--
756 INPUT: 'STDIN' line 2
757 PATTERN: 2
758 COMMAND: s/./--&--/
759 MATCHED REGEX REGISTERS
760 regex[0] = 0-1 '2'
761 PATTERN: --2--
762 COMMAND: 2 d
763 END-OF-CYCLE:
764 INPUT: 'STDIN' line 3
765 PATTERN: 3
766 COMMAND: s/./--&--/
767 MATCHED REGEX REGISTERS
768 regex[0] = 0-1 '3'
769 PATTERN: --3--
770 COMMAND: 2 d
771 END-OF-CYCLE:
772 --3--
773
774 Discussed in https://lists.gnu.org/r/sed-devel/2018-07/msg00006.html
775 and https://lists.gnu.org/r/sed-devel/2018-10/msg00007.html .
776
777 * NEWS: Mention new option.
778 * doc/sed.texi (Program options): Mention new option.
779 * sed/debug.c: New unit with debug printing functions.
780 * sed/sed.h (debug_print_command, debug_print_char, debug_print_program,
781 debug): Declare functions and global variable.
782 (struct sed_cmd): Add label_name member variable.
783 * sed/compile.c (compile_program): Save the label's name.
784 (cleanup_program_filenames): extracted function to free filenames.
785 (check_final_program) Don't delete the filenames, instead move it to ...
786 (finish_program) ... here.
787 * sed/execute.c (debug_print_end_of_cycle, debug_print_input,
788 debug_print_line): New debug functions (cannot be defined in debug.c as
789 execute's structures are private).
790 (execute_program, process_files): Call debug functions.
791 * sed/sed.c: (DEBUG_OPTION): New option for getoptlong.
792 (debug): New global variable.
793 (usage): Mention new option.
794 (main): Process new option and call debug functions if needed.
795 * testsuite/debug.pl: New tests.
796 * testsuite/local.mk (T): Add new tests.
797
7982018-10-19 Assaf Gordon <assafgordon@gmail.com>
799
800 sed: change internal storage for 'R' command
801 For the 'R' command, keep a pointer to 'struct output' instead of just
802 to FILE*. No change in functionality. This will help future debug code
803 to know the filename of the associated file.
804
805 As a side effect, fix invalid code in W/w execution:
806 The previous code checked for 'cur_cmd->x.fp' (which was related to R
807 command, not W/w). Since 'x' is a union, 'x.fp' was not relevant to
808 the 'x.outf' (which is the struct associted with W/w commands).
809
810 * sed/sed.h (struct sed_cmd): Replace 'FILE*' with 'struct *output' for
811 R command.
812 * sed/compile.c (compile_program): Adjust as needed.
813 * sed/execute.c (execute_program): Adjust as needed.
814
8152018-10-18 Assaf Gordon <assafgordon@gmail.com>
816
817 sed: reject r/R/w/W commands without a filename
818 w/W (and s///w) commands Without a filename would print a confusing error
819 message:
820 $ sed w
821 sed: couldn't open file : No such file or directory
822 While r/R commands with empty file name were a silent no-op.
823
824 With this change, sed programs with empty filename are rejected with a
825 clear error:
826
827 $ sed 's/1/2/w'
828 sed: -e expression #1, char 7: missing filename in r/R/w/W commands
829 $ sed r
830 sed: -e expression #1, char 1: missing filename in r/R/w/W commands
831
832 * NEWS: Mention change.
833 * sed/compile.c (get_openfile): Exit with an error message if filename
834 is missing. (compile_program): Same for 'r' command code.
835 * testsuite/missing-filename.sh: New test.
836 * testsuite/local.mk (T): Add new test.
837
8382018-10-12 Clint Adams <clint@debian.org> (tiny change)
839
840 doc: use @key{TAB} in texinfo
841 Discussed in https://bugs.gnu.org/22636 .
842
843 * doc/sed.texi: Use '@kbd{@key{TAB}}' instead of '@kbd{tab}' to improve
844 rendering in HTML and info formats.
845
8462018-10-12 Bjarni Ingi Gislason <bjarniig@rhi.hi.is> (tiny change)
847
848 doc: sed.x: some formatting corrections
849 Reported in https://bugs.gnu.org/30479 .
850
851 doc/sed.x: Change a HYPHEN-MINUS (code 0x55, 2D) to a dash (\-, minus)
852 if it matches " -[:alpha:]" or \(aq-[:alpha:] (for options); Use a pronoun
853 instead of a repeated noun.
854
8552018-10-12 Assaf Gordon <assafgordon@gmail.com>
856
857 sed: update authors
858 * sed/sed.c (AUTHORS): Update.
859 * doc/sed.texi (@author): Update.
860
8612018-08-23 Assaf Gordon <assafgordon@gmail.com>
862
863 maint: remove REG_PERL code
864 Perl-regexp syntax (PCRE) in GNU Sed is shelved indefinitely.
865 See https://bugs.gnu.org/22801 , https://bugs.gnu.org/22647 .
866 Remove all (unused) REG_PERL related code.
867
868 * sed/sed.c, sed/sed.h, sed/regexp.c, sed/compile.c: Remove REG_PERL code.
869
8702018-08-23 Assaf Gordon <assafgordon@gmail.com>
871
872 maint: remove EXPERIMENTAL_DASH_N_OPTIMIZATION code
873 The optimization was buggy and was never enabled in a released version.
874
875 * sed/execute.c: Remove EXPERIMENTAL_DASH_N_OPTIMIZATION code.
876
8772018-08-23 Assaf Gordon <assafgordon@gmail.com>
878
879 maint: replace street address with URL in license text
880 * basicdefs.h, sed/compile.c, sed/execute.c, sed/mbcs.c, sed/regexp.c,
881 sed/sed.c, sed/sed.h, sed/utils.c, sed/utils.h, testsuite/get-mb-cur-max.c,
882 testsuite/test-mbrtowc.c (GPL License notice): Replace FSF's office
883 address with 'https://www.gnu.org/licenses/'.
884
8852018-08-23 Assaf Gordon <assafgordon@gmail.com>
886
887 build: use system's native sed during build
888 Use the locally built sed binary only during 'check*' targets,
889 but not during build/installation targets - it might be buggy, or contain
890 temporary debugging/ASAN features that can break the build.
891 See: https://lists.gnu.org/r/sed-devel/2018-08/msg00013.html .
892
893 * cfg.mk (PATH): Add the 'sed' directory to the PATH only if this is a
894 'check' target.
895
8962018-08-08 Assaf Gordon <assafgordon@gmail.com>
897
898 sed: mark function as attribute(malloc)
899 Suggested by gcc-8.2.0.
900
901 * sed/compile.c (read_label): Mark as _GL_ATTRIBUTE_MALLOC.
902
9032018-08-08 Assaf Gordon <assafgordon@gmail.com>
904
905 maint: add undefined-behavior build target
906 Using gcc-specific options, a recent gcc is required.
907 build with:
908 make build-ubsan CC=gcc-8.2
909
910 * cfg.mk (build-ubsan): New target.
911
9122018-08-08 Assaf Gordon <assafgordon@gmail.com>
913
914 maint: add address-sanitizer build target
915 use 'make build-asan' to rebuild sed with gcc's address sanitizer.
916
917 * cfg.mk (build-asan): New target.
918
9192018-08-08 Assaf Gordon <assafgordon@gmail.com>
920
921 gnulib: update to latest (for regex memory leaks)
922 Specifically for gnulib commits 66b99e5259,c5e76a9560.
923 see https://lists.gnu.org/r/bug-gnulib/2018-07/msg00127.html
924
925 sed: fix memory leak
926 * sed/regexp.c (match_regex): Free the previously allocated regex struct
927 before re-building the regex during program execution.
928
9292018-08-08 Assaf Gordon <assafgordon@gmail.com>
930
931 sed: free allocated memory under lint, remove DEBUG_LEAKS
932 Under normal operation there is no need for explicit freeing,
933 as all memory will be released when sed terminates.
934 During development (and specifically, valgrind and address-sanitizing)
935 enabling lint prevents false-positive warnings about memory
936 leaks.
937 Lint mode can be enabled with CFLAGS="-Dlint". It is also automatically
938 enabled by default when building from git (as opposed to tarball).
939
940 For consistency all instances of "#ifdef DEBUG_LEAKS" are replaced
941 with "#ifdef lint".
942
943 * sed/sed.h (struct subst): Add member variable to keep the address of
944 allocated buffer in compile.c:setup_replacement().
945 (release_regex): Add declaration.
946 (finish_program): Function now takes an argument: the sed program
947 vector.
948 * sed/sed.c (main): Adjust call to finish_program.
949 * sed/compile.c (finish_program): Release program allocations.
950 (setup_replacement): Remember the allocated buffer address.
951 (compile_program): Free temporary array in 'y' command.
952 * sed/execute.c (execute_program): Free allocated but unused buffer in
953 'R' command when reaching EOF.
954 * sed/regexp.c (release_regex): Remove 'static', free the allocated
955 dfa struct.
956 * sed/utils.c (panic): Free open files linked-list elements.
957
9582018-08-08 Assaf Gordon <assafgordon@gmail.com>
959
960 sed: do not close stderr on exit
961 Not needed, and prevents leak-sanitizing from working.
962
963 * sed/utils.c (ck_fclose): Do not close stderr.
964
9652018-08-07 Jim Meyering <meyering@fb.com>
966
967 doc: insert two missing words
968 doc/sed.texi (BRE vs ERE): Insert "with a".
969
9702018-08-04 Assaf Gordon <assafgordon@gmail.com>
971
972 maint: syntax-check: prohibit-operator-at-eol
973 * cfg.mk (sc_prohibit_operator_at_end_of_line): Copied from coreutils'
974 cfg.mk.
975 * sed/execute.c (do_subst,execute_program): Adjust as needed.
976
977 maint: syntax-check: fail-0 and fail-1 in shell script tests
978 * cfg.mk (prohibit_fail_0,sc_prohibit_and_fail_1): Copied from
979 coreutils' cfg.mk
980 * testsuite/*.sh: Remove 'fail=0'.
981
982 maint: syntax-check: add various test-related checks
983 * cfg.mk (sc_prohibit_env_returns, sc_prohibit_perl_hash_quotes,
984 sc_prohibit_verbose_version, sc_prohibit_framework_failure,
985 sc_prohibit_test_backticks, sc_prohibit_test_empty): Copied from
986 coreutils' cfg.mk.
987
988 maint: syntax-check: add sc_prohibit_strncmp
989 * cfg.mk (sc_prohibit_strncmp): Copied from coreutils' cfg.mk.
990 * basicdefs.h (STREQ,STREQ_LEN,STRPREFIX): Copied from coreutils' system.h.
991 * sed/execute.c (translate_mb): Replace strncmp with STREQ_LEN.
992
993 maint: syntax-check: add sc_gitignore_missing
994 * cfg.mk (sc_gitignore_missing): Copied from coreutils' cfg.mk.
995 * .gitignore: Add missing files.
996
997 maint: syntax-check: prohibit-form-feed
998 * cfg.mk (sc_prohibit-form-feed): Copied from coreutils' cfg.mk.
999 * sed/compile.c, sed/execute.c, sed/regexp.c, sed/sed.h, sed/utils.c:
1000 Remove form feed characters.
1001
1002 maint: syntax-check: space-before-open-paren
1003 * cfg.mk (sc_space_before_open_paren): Copy target from coreutils' cfg.mk.
1004 * basicdefs.h, sed/compile.c, sed/execute.c, sed/regexp.c,
1005 sed/sed.c, sed/utils.c: Add space before parentheses.
1006
1007 maint: syntax-check: fix tab indentation
1008 * sed/execute.c (open_next_file): Replace tab with spaces.
1009
10102018-08-03 Assaf Gordon <assafgordon@gmail.com>
1011
1012 sed: replace myname with gnulib's progname
1013 * compile.c (bad_prog): Use program_name instead of myname.
1014 * execute.c (open_next_file): Same.
1015 * utils.c (panic): Same.
1016 (myname): Remove variable.
1017 * sed.c (usage): Use program_name instead of myname.
1018 (main): Call set_program_name once, don't set variables directly.
1019
1020 sed: replace ck_realloc with gnulib's xrealloc/xnrealloc
1021 * basicdefs.h (REALLOC): Call xnrealloc instead of ck_realloc.
1022 * sed/utils.c (ck_realloc): Remove.
1023
10242018-08-03 Assaf Gordon <assafgordon@gmail.com>
1025
1026 sed: replace MALLOC/ck_malloc with gnulib's XCALLOC
1027 ck_malloc zero'd out the allocated buffer, thus replaced with
1028 xcalloc/xzalloc (not xmalloc).
1029
1030 * basicdefs.h (MALLOC): Remove.
1031 * utils.c (ck_malloc): Remove.
1032 * sed/compile.c, sed/execute.c, sed/regexp.c, sed/sed.c: Replace
1033 MALLOC with XCALLOC; ck_malloc with xzalloc.
1034
10352018-08-03 Assaf Gordon <assafgordon@gmail.com>
1036
1037 sed: replace ck_strdup with gnulib's xstrdup
1038 * sed/utils.{c,h} (ck_strdup): Remove.
1039 * sed/compile.c, sed/execute.c, sed/sed.c: Replace ck_strdup with
1040 xstrdup.
1041
1042 sed: replace ck_memdup with gnulib's xmemdup
1043 * bootstrap.conf: Add gnulib's xalloc module.
1044 * basicdefs.h (MEMDUP): Remove.
1045 * sed/utils.{c,h} (ck_memdup): Remove.
1046
10472018-08-03 Assaf Gordon <assafgordon@gmail.com>
1048
1049 sed: fix heap buffer overflow from multiline EOL regex optimization
1050 sed would access invalid memory when matching EOF combined with
1051 s///n flag:
1052
1053 $ yes 0 | fmt -w 40 | head -n2 | valgrind sed 'N;s/$//2m'
1054 ==13131== Conditional jump or move depends on uninitialised value(s)
1055 ==13131== at 0x4C3002B: memchr (vg_replace_strmem.c:883)
1056 ==13131== by 0x1120BD: match_regex (regexp.c:286)
1057 ==13131== by 0x110736: do_subst (execute.c:1101)
1058 ==13131== by 0x1115D3: execute_program (execute.c:1591)
1059 ==13131== by 0x111A4C: process_files (execute.c:1774)
1060 ==13131== by 0x112E1C: main (sed.c:405)
1061 ==13131==
1062 ==13131== Invalid read of size 1
1063 ==13131== at 0x4C30027: memchr (vg_replace_strmem.c:883)
1064 ==13131== by 0x1120BD: match_regex (regexp.c:286)
1065 ==13131== by 0x110736: do_subst (execute.c:1101)
1066 ==13131== by 0x1115D3: execute_program (execute.c:1591)
1067 ==13131== by 0x111A4C: process_files (execute.c:1774)
1068 ==13131== by 0x112E1C: main (sed.c:405)
1069 ==13131== Address 0x55ec765 is 0 bytes after a block of size 101 alloc'd
1070 ==13131== at 0x4C2DDCF: realloc (vg_replace_malloc.c:785)
1071 ==13131== by 0x113BA2: ck_realloc (utils.c:418)
1072 ==13131== by 0x10E682: resize_line (execute.c:154)
1073 ==13131== by 0x10E6F0: str_append (execute.c:165)
1074 ==13131== by 0x110779: do_subst (execute.c:1106)
1075 ==13131== by 0x1115D3: execute_program (execute.c:1591)
1076 ==13131== by 0x111A4C: process_files (execute.c:1774)
1077 ==13131== by 0x112E1C: main (sed.c:405)
1078 ==13131==
1079
1080 The ^/$ optimization code added in v4.2.2-161-g6dea75e called memchr()
1081 using 'buflen', ignoring the value of 'buf_start_offset' (which, if not
1082 zero, reduces the number of bytes available for the search).
1083
1084 Reported by bugs@feusi.co (bug#32271) in
1085 https://lists.gnu.org/r/bug-sed/2018-07/msg00018.html .
1086
1087 * NEWS: Mention the fix.
1088 * sed/regexp.c (match_regex): Use correct buffer length in memchr().
1089 * testsuite/bug-32271-2.sh: Test using valgrind.
1090 * testsuite/local.mk (T): Add new test.
1091
10922018-08-03 Assaf Gordon <assafgordon@gmail.com>
1093
1094 sed: fix extraneous NUL in s///n command
1095 Under certain conditions sed would add an extraneous NUL:
1096
1097 $ echo 0 | sed -e 's/$/a/2' | od -tx1 -An
1098 30 00 0a
1099
1100 This would happen when the regex is an empty (zero-length) match at the
1101 end of the line (e.g. '$' and 'a*$') and the substitute number flag
1102 ('n' in s///n) is higher than the number of actual matches (multiple
1103 EOL matches are possible with multiline match, e.g. 's/$/a/3m').
1104
1105 Details:
1106 The comment at the top of 'execute.c:do_subst()' says:
1107
1108 /* The first part of the loop optimizes s/xxx// when xxx is at the
1109 start, and s/xxx$// */
1110
1111 Which refers to lines 1051-3:
1112
1113 1051 /* Copy stuff to the left of this match into the output string. */
1114 1052 if (start < offset)
1115 1053 str_append(&s_accum, line.active + start, offset - start);
1116
1117 The above code appends text to 's_accum' but does *not* update 'start'.
1118
1119 Later on, if the s/// command includes 'n' flag, and if 'matched == 0'
1120 (an empty match), this comparison will be incorrect:
1121
1122 1081 if (start < line.length)
1123 1082 matched = 1;
1124
1125 Will in turn will set 'matched' to 1, and the 'str_append' call that
1126 follows (line 1087) will append an additional character.
1127 Because the empty match is EOL, the appended character is NUL.
1128
1129 More examples that trigger the bug:
1130
1131 echo 0 | sed -e 's/a*$/X/3'
1132 printf "%s\n" 0 0 0 | sed -e 'N;N;s/a*$/X/4m'
1133
1134 Examples that do not trigger the bug:
1135
1136 # The 'a*' empty regex matches at the beginning of the line (in
1137 # addition to the end of the line), and the optimization in line
1138 # 1052 is skipped.
1139 echo 0 | sed -e 's/a*/X/3'
1140
1141 # There are 3 EOLs in the pattern space, s///3 is not too large.
1142 printf "%s\n" 0 0 0 | sed -e 'N;N;s/a*$/X/3m'
1143
1144 This was discovered while investigating bug#32271 reported by bugs@feusi.co
1145 in https://lists.gnu.org/r/bug-sed/2018-07/msg00018.html .
1146
1147 * NEWS: Mention the fix.
1148 * sed/execute.c (do_subst): Update 'start' as needed.
1149 * testsuite/bug-32271-1.sh: New test.
1150 * testsuite/local.mk (T): Add test.
1151
11522018-07-26 Assaf Gordon <assafgordon@gmail.com>
1153
1154 sed: do not flush output stream unless in unbuffered mode
1155 Previously sed would explicitly flush the output after
1156 every output line, except if the output was stdout in unbuffered mode.
1157
1158 In practice this was equivalent to forcing line-buffering, and was
1159 espcially was noticable with "sed -i" (where the output is a temporary
1160 file).
1161
1162 With this change, explicit flushing only happens with "sed -u",
1163 regardless of the type of output file, making "sed -i" much faster.
1164 This change also affect other write commands such as 'w'/'W' and 's///w'.
1165
1166 Reported by Vidar Holen <vidar@vidarholen.net> in
1167 https://lists.gnu.org/r/bug-sed/2018-07/msg00014.html .
1168
1169 * NEWS: Mention this.
1170 * sed/execute.c (flush_output): Never flush output unless in unbuffered
1171 mode, regardless of which file it is.
1172
11732018-07-25 Bernhard Voelker <mail@bernhard-voelker.de>
1174
1175 doc: tiny fix
1176 * doc/sed.texi (Regexp Addresses): Remove the word 'two': there are
1177 3 examples following.
1178
11792018-07-08 Assaf Gordon <assafgordon@gmail.com>
1180
1181 sed: fix heap buffer overflow from invalid references
1182 Under certain conditions sed would access invalid memory based on
1183 the requested back-reference (e.g. "s//\9/" would access the 9th element
1184 in the regex registers without checking it is at least 9 element in
1185 size).
1186
1187 The following examples would trigger valgrind errors:
1188 seq 2 | valgrind sed -e '/^/s///p ; 2s//\9/'
1189 seq 2 | valgrind sed --posix -e '/2/p ; 2s//\9/'
1190
1191 Reported by bugs@feusi.co in
1192 https://lists.gnu.org/r/bug-sed/2018-07/msg00004.html .
1193
1194 * NEWS: Mention the bugfix.
1195 * sed/execute.c (append_replacement): Check number of allocated regex
1196 replacement registers before accessing the array.
1197 * sed/testsuite/bug32082.sh: Test sed for this behaviour under valgrind.
1198 * sed/testsuite/local.mk (T): Add new test.
1199
12002018-03-31 Jim Meyering <meyering@fb.com>
1201
1202 maint: post-release administrivia
1203 * NEWS: Add header line for next release.
1204 * .prev-version: Record previous version.
1205 * cfg.mk (old_NEWS_hash): Auto-update.
1206
1207 version 4.5
1208 * NEWS: Record release date.
1209
12102018-03-30 Jim Meyering <meyering@fb.com>
1211
1212 tests: port inplace-selinux.sh to Centos7 and Fedora 25
1213 * testsuite/inplace-selinux.sh: Set the user (-u) portion of the security
1214 context rather than the type (-t), and use system_u and user_u, which
1215 appear to be reliably available, since some coreutils's tests use those.
1216 Assaf Gordon reported that this test failed on those systems in
1217 https://lists.gnu.org/r/sed-devel/2018-03/msg00018.html
1218 Also, correct copyright date to include this year.
1219
12202018-03-28 Jim Meyering <meyering@fb.com>
1221
1222 build: update gnulib to latest
1223
1224 maint: fix preceding change so "make dist" works
1225 * testsuite/local.mk (EXTRA_DIST): Also remove runtest, here.
1226
12272018-03-27 Jim Meyering <meyering@fb.com>
1228
1229 tests: don't run $(check_PROGRAMS) directly
1230 testsuite/runtest was not portable to Solaris 10 /bin/sh, but was
1231 used only to keep automake test machinery from running two compiled
1232 binaries stand-alone. We can inhibit that more cleanly by removing
1233 those two files from the list of TESTS to run and then just remove
1234 the offending script.
1235 * testsuite/local.mk (LOG_COMPILER): Set to false.
1236 (TESTS): Don't put $(check_PROGRAMS) on this list.
1237 * testsuite/runtest: Remove file.
1238 Nelson H.F. Beebe reported the Solaris 10 /bin/sh failure.
1239
1240 tests: port to solaris 10's /bin/sh
1241 * testsuite/runtest (test): Accommodate Solaris 10 /bin/sh
1242 by sourcing init.sh, as is already done in many other shell
1243 scripts in this directory, to handle (or skip test upon)
1244 use of this construct: ${1##*/}. Reported by Nelson H.F. Beebe.
1245
12462018-03-23 Jim Meyering <meyering@fb.com>
1247
1248 maint: remove old definition of UNUSED: use _GL_UNUSED instead
1249 * sed/execute.c (UNUSED): Remove macro definition.
1250 (read_always_fail): Use _GL_UNUSED instead.
1251
12522018-03-23 Assaf Gordon <assafgordon@gmail.com>
1253
1254 sed: reject RE searches on buffers larger than INT_MAX
1255 Sed uses 'size_t' internally, but gnulib's re_search uses 'signed int'.
1256 If the buffer is larger than INT_MAX, reject it (panic, exit code 4).
1257
1258 The test is marked 'very expensive' and skipped by default (due to
1259 creating a 2GB input file). To run it, use:
1260
1261 make check SUBDIRS=. RUN_VERY_EXPENSIVE_TESTS=yes \
1262 TESTS=testsuite/regex-max-int.sh
1263
1264 Reported by YushiOMOTE in https://bugs.gnu.org/30520 .
1265
1266 * NEWS: Mention this.
1267 * Makefile.am (check-expensive, check-very-expensive): New targets.
1268 * init.cfg (expensive_, very_expensive_): Copied from coreutils.
1269 * sed/regexp.c (match_regex): Check buffer length and panic if too large.
1270 * testsuite/regex-max-int.sh: New test.
1271 * testsuite/local.mk (T): Add new test.
1272
12732018-03-22 Jim Meyering <meyering@fb.com>
1274
1275 maint: ignore more artifacts
1276 * .gitignore: Also ignore sed-*.tar.xz.sig files.
1277 * lib/.gitignore: Ignore more gnulib-provided sources.
1278
1279 build: update gnulib to latest
1280 * gnulib: Update submodule.
1281 * bootstrap: Update from gnulib.
1282 * testsuite/init.sh: Likewise.
1283
12842018-03-14 0xddaa <0xddaa@gmail.com>
1285
1286 sed: treat '\x5c' as literal backslash
1287 Sed incorrectly treated '\x5c' (ASCII 92, backslash) as an escape character.
1288
1289 Old behavior:
1290 $ echo z | sed -E 's/(z)/\x5c1/' # identical to 's/(z)/\1/'
1291 z
1292
1293 New behavior:
1294 $ echo z | sed -E 's/(z)/\x5c1/'
1295 \1
1296
1297 Reported in https://bugs.gnu.org/30794.
1298
1299 * NEWS: Mention bug fix.
1300 * sed/compile.c (normalize_text): Pass backslash as literal character.
1301 * testsuite/misc.pl: Add tests.
1302
13032018-03-02 Mike Frysinger <vapier@chromium.org> (tiny change)
1304
1305 sed: improve sandbox description in --help output
1306 * sed/sed.c (usage): Add "(disable e/r/w commands)" to --sandbox text.
1307
13082018-02-15 Jim Meyering <meyering@fb.com>
1309
1310 doc: small improvements
1311 * doc/sed.texi: s/only accepts/accepts only/.
1312 (BRE vs ERE): Tweak ERE and BRE definitions, and convert a
1313 passive-voice sentence to active voice. Insert a comma.
1314
13152018-02-13 Assaf Gordon <assafgordon@gmail.com>
1316
1317 doc: change URLs to https
1318 * doc/config.texi, doc/sed-dummy.1, doc/sed.texi: Change http to https for
1319 GNU URLs. External links (e.g. sed.sf.net, autsingroup.org) currently do
1320 not support https and kept as-is.
1321
1322 maint: change http to https in license headers
1323 * all files: Change http to https for all licenses URL.
1324
1325 sed: use https in usage screen contact information
1326 * sed/sed.c (contact): Change http to https.
1327
13282018-02-04 Jim Meyering <meyering@fb.com>
1329
1330 build: update gnulib to latest
1331 * gnulib: This fixes a syntax-check failure that was due to the
1332 new use of "/proc/filesystems" in init.cfg.
1333
13342018-01-31 Jim Meyering <meyering@fb.com>
1335
1336 maint: make cfg.mk slightly more generic
1337 * cfg.mk (announcement_Cc_): Don't hard-code "sed-devel@".
1338 Use "$(PACKAGE)-devel@" instead.
1339
13402018-01-09 Jakub Martisko <jamartis@redhat.com>
1341
1342 sed: with --in-place and selinux, use the symlink's context
1343 When editing a file in place, the SELinux context (if exists)
1344 should be based on the link instead of the target file itself.
1345 --follow-symlinks option remains unchanged.
1346
1347 Bug reported by Jakub Jelen, fix proposed by Petr Lautrbach,
1348 discussed in https://lists.gnu.org/r/sed-devel/2017-12/msg00000.html
1349
1350 * NEWS: Mention this.
1351 * sed/execute.c (open_next_file): Use lgetfilecon (instead of getfilecon)
1352 to get the context of the symlink instead of the target file.
1353 * testsuite/inplace-selinux.sh: Test the above change.
1354 * testsuite/local.mk (T): Add new test file.
1355 * init.cfg (require_selinux_): Copied from coreutils, skip the test if
1356 selinux is not available.
1357
13582018-01-02 Assaf Gordon <assafgordon@gmail.com>
1359
1360 maint: update gnulib and copyright dates for 2018
1361 * gnulib: Update to latest.
1362 * all files: Run "make update-copyright".
1363
13642017-11-22 Jim Meyering <meyering@fb.com>
1365
1366 maint: update to work with GCC7's -Werror=implicit-fallthrough=
1367 * sed/sed.h (FALLTHROUGH): Define.
1368 * sed/execute.c (execute_program): Use new FALLTHROUGH macro in place
1369 of each comment.
1370 * sed/compile.c (mark_subst_opts, compile_program): Likewise.
1371
13722017-10-28 Assaf Gordon <assafgordon@gmail.com>
1373
1374 doc: fix incorrect line-wrapping example
1375 Reported by Bamber Ward in https://bugs.gnu.org/28140 .
1376
1377 * doc/sed.texi (Line length adjustment): Fix sed script;
1378 Rewrite example to long script with inlined comments;
1379 Remove second example.
1380
13812017-10-17 Assaf Gordon <assafgordon@gmail.com>
1382
1383 doc: fix missing slash in example
1384 Reported by Nick Chambers in https://bugs.gnu.org/28881 .
1385
1386 * doc/sed.texi (Invoking sed::overview): Add missing slash in
1387 's/hello/world/' command.
1388
13892017-10-05 Assaf Gordon <assafgordon@gmail.com>
1390
1391 tests: skip utf8-ru test if required locale is not found
1392 Reported by Dennis Clarke in https://bugs.gnu.org/28665#14 .
1393
1394 * init.cfg (require_ru_utf8_locale_): New function.
1395 * testsuite/utf8-ru.sh: Skip test is required locale was not found.
1396
13972017-10-05 Assaf Gordon <assafgordon@gmail.com>
1398
1399 build: require texinfo v6.1 for development builds
1400 For development builds (using ./bootstrap), require texinfo version 6.1
1401 or later (Same as GNU coreutils).
1402 Sed's manual uses texinfo's @U{} command, introduced in texinfo-6.0.
1403 This should not affect building from released tarballs, as the info
1404 manual is pre-built and pre-packaged in the tar archive.
1405 Reported by Dennis Clarke in https://bugs.gnu.org/28665#14 .
1406
1407 * bootstrap.conf: Require makeinfo 6.1 (up from 4.13).
1408
14092017-10-05 Assaf Gordon <assafgordon@gmail.com>
1410
1411 tests: remove non-functional regex C tests
1412 These C-based tests were not updated since 2004, and were not included
1413 by default. Enabling them with "./configure --enable-regex-tests"
1414 resulted in false positives:
1415 https://bugs.gnu.org/28665 , https://bugs.gnu.org/25381 .
1416
1417 This patch removes them completely.
1418
1419 * configure.ac: Remove "--with-regex-tests" option.
1420 * local.mk (check_PROGRAMS): Remove tests.
1421 * bug-regex10.c,
1422 bug-regex11.c,
1423 bug-regex12.c,
1424 bug-regex13.c,
1425 bug-regex14.c,
1426 bug-regex15.c,
1427 bug-regex16.c,
1428 bug-regex21.c,
1429 bug-regex27.c,
1430 bug-regex28.c,
1431 bug-regex7.c,
1432 bug-regex8.c,
1433 bug-regex9.c,
1434 runptests.c,
1435 runtests.c,
1436 tst-boost.c,
1437 tst-pcre.c,
1438 tst-regex.c,
1439 tst-regex2.c,
1440 tst-rxspencer.c: Remove files.
1441
14422017-05-13 Jim Meyering <meyering@fb.com>
1443
1444 maint: stop using @acronym{...} in texinfo sources
1445 * doc/sed.texi, doc/config.texi: Remove all uses of @acronym{...},
1446 per recommendation by Karl Berry.
1447 * cfg.mk (local-checks-to-skip): Remove exemption, enabling
1448 the @acronym{-prohibiting syntax-check rule.
1449
1450 gnulib: update to latest
1451
14522017-05-10 Assaf Gordon <assafgordon@gmail.com>
1453
1454 tests: fix various misspellings
1455 Reported by Jim Meyering in
1456 https://lists.gnu.org/archive/html/sed-devel/2017-05/msg00001.html .
1457
1458 * testsuite/BOOST.tests,
1459 testsuite/posix-mode-bad-ref.sh,
1460 testsuite/runptests.c,
1461 testsuite/runtests.c,
1462 testsuite/tst-pcre.c: Fix misspellings.
1463
14642017-05-10 Assaf Gordon <assafgordon@gmail.com>
1465
1466 tests: remove the 'Makefile.tests' used for old-style tests
1467 * testsuite/Makefile.tests: Removed.
1468 * testsuite/runtest: Remove code to run old-style tests.
1469 * testsuite/local.mk (EXTRA_DIST): Remove MAkefile.tests.
1470
1471 tests: convert "noeolw" test to new framework
1472 * testsuite/misc.pl (Tests): Add noeolw.
1473 * testsuite/noeolw.good: Delete file.
1474 * testsuite/noeolw.1good: Likewise.
1475 * testsuite/noeolw.2good: Likewise
1476 * testsuite/noeolw.inp: Likewise.
1477 * testsuite/noeolw.sed: Likewise.
1478 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1479 (SEDTESTS): Remove "noeolw".
1480
14812017-05-10 Assaf Gordon <assafgordon@gmail.com>
1482
1483 tests: convert "mac-mf" test to new framework
1484 All input files (mac-mf.{inp,good,sed}) are large and are kept as-is.
1485
1486 * testsuite/mac-mf.sh: New test.
1487 * testsuite/local.mk (SEDTEST): Remove mac-mf. (T): Add mac-mf.sh
1488
14892017-05-10 Assaf Gordon <assafgordon@gmail.com>
1490
1491 tests: convert "newjis" test to new framework
1492 * testsuite/newjis.sh: New test.
1493 * testsuite/newjis.{good,inp,sed}: Removed.
1494 * testsuite/local.mk (EXTRA_DIST): Remove unneeded files.
1495 (SEDTEST): Remove newjis. (T): Add newjis.sh
1496
1497 tests: convert "8to7" test to new framework
1498 * testsuite/8to7.sh: New test.
1499 * testsuite/8to7.{good,inp,sed}: Removed.
1500 * testsuite/local.mk (EXTRA_DIST): Remove unneeded files.
1501 (SEDTEST): Remove 8to7. (T): Add 8to7.sh
1502
15032017-05-10 Assaf Gordon <assafgordon@gmail.com>
1504
1505 tests: convert "madding" test to new framework
1506 All input files (madding.{inp,good,sed}) contain very long lines and
1507 are kept as-is (to avoid failing 'make syntax-check').
1508
1509 * testsuite/madding.sh: New test.
1510 * testsuite/local.mk (SEDTEST): Remove madding. (T): Add madding.sh
1511
15122017-05-10 Assaf Gordon <assafgordon@gmail.com>
1513
1514 tests: convert "badenc" test to new framework
1515 * testsuite/badenc.sh: New test.
1516 * testsuite/distrib.{good,inp,sed}: Removed.
1517 * testsuite/local.mk (EXTRA_DIST): Remove unneeded files.
1518 (SEDTEST) Remove badenc. (T): Add badenc.sh
1519
15202017-05-10 Assaf Gordon <assafgordon@gmail.com>
1521
1522 tests: convert "distrib" test to new framework
1523 The input file 'distrib.inp' has lines wider than 80 characters,
1524 and is kept as a separate file.
1525 The existing file 'distrib.sh' (which contained the same sed program as
1526 in 'distrib.sed') was never used, and is completely rewritten.
1527
1528 * testsuite/distrib.sh: Rewritten as a new test.
1529 * testsuite/distrib.{good,sed}: Removed.
1530 * testsuite/local.mk (EXTRA_DIST): Remove unneeded files.
1531 (SEDTEST) Remove distrib. (T): Add distrib.sh
1532
15332017-05-10 Assaf Gordon <assafgordon@gmail.com>
1534
1535 tests: convert "inplace-hold" test to new framework
1536 * testsuite/inplace-hold.sh: New test.
1537 * testsuite/local.mk (SEDTEST) Remove inplace-hold.
1538 (T): Add inplace-hold.sh.
1539
1540 tests: convert "stdin" test to new framework
1541 * testsuite/stdin.sh: New test.
1542 * testsuite/local.mk (SEDTEST) Remove stdin.
1543 (T): Add stdin.sh.
1544
1545 tests: convert "eval" test to new framework
1546 * testsuite/eval.sh: New test.
1547 * testsuite/eval.{sed,inp,good}: Removed.
1548 * testsuite/local.mk (EXTRA_DIST): Remove unneeded files.
1549 (SEDTEST) Remove eval.sed.
1550 (T): Add eval.sh.
1551
15522017-05-10 Assaf Gordon <assafgordon@gmail.com>
1553
1554 tests: convert 'bsd' test to new framework
1555 The 'bsd.sh' is a long shell script (imported from NetBSD) which runs
1556 multiple tests, then compares the output to 'bsd.good'.
1557 The 'bsd.sh' is not modified. Instead, a new script 'bsd-wrapper.sh'
1558 is created to work with the newer init.sh-style testing framework.
1559
1560 * testsuite/bsd-wrapper.sh: New test.
1561 * testsuite/local.mk (SEDTESTS): Remove old test. (T): Add new test.
1562
15632017-05-10 Assaf Gordon <assafgordon@gmail.com>
1564
1565 tests: convert 'xemacs' test to new framework
1566 Keep input/expected output files (xemacs.inp/xemacs.good) as they contain
1567 lines longar than 80 characters (which will fail 'make syntax-check').
1568
1569 * testsuite/xemacs.sed: Remove.
1570 * testsuite/xemacs.sh: New test.
1571 * testsuite/local.mk (EXTRA_DIST): Remove xemacs.sed.
1572 (SEDTESTS): Remove old xemacs test.
1573 (T): Add new xemacs.sh test.
1574
15752017-05-10 Assaf Gordon <assafgordon@gmail.com>
1576
1577 tests: convert 'help' test to new framework
1578 The 'help' test was implemented directly in 'Makefile.tests' - no
1579 external files to remove/adapt.
1580
1581 * testsuite/help.sh: New tests.
1582 * testsuite/local.mk (SEDTESTS): Remove old test.
1583 (T): Add new test.
1584
15852017-05-10 Assaf Gordon <assafgordon@gmail.com>
1586
1587 tests: convert 'uniq' test to new framework
1588 Add a simple init.sh-stype wrapper to run the 'uniq' tests.
1589 'uniq.sed' is a valid stand-alone script - keep it as-is.
1590 The input/expected output files (uniq.inp/uniq.good) are large - keep
1591 them as well instead of embedding them in the shell script.
1592
1593 * testsuite/uniq.sh: New test.
1594 * testsuite/local.mk (SEDTESTS): Remove uniq.sed
1595 (T): Add uniq.sh.
1596
15972017-05-10 Assaf Gordon <assafgordon@gmail.com>
1598
1599 tests: convert 'utf8-*' tests to new framework
1600 Merge utf8-{1,2,3,4} into utf8-ru.sh script.
1601
1602 * testsuite/utf8-ru.sh: New test.
1603 * testsuite/utf8-1.inp,
1604 testsuite/utf8-1.good,
1605 testsuite/utf8-1.sed,
1606 testsuite/utf8-2.inp,
1607 testsuite/utf8-2.good,
1608 testsuite/utf8-2.sed,
1609 testsuite/utf8-3.inp,
1610 testsuite/utf8-3.good,
1611 testsuite/utf8-3.sed,
1612 testsuite/utf8-4.inp,
1613 testsuite/utf8-4.good,
1614 testsuite/utf8-4.sed: Removed files.
1615 * testsuite/local.mk (EXTRA_DIST): Remove deleted inp/sed/good files.
1616 (SEDTESTS): Remove utf8-{1,2,3,4} tests.
1617 (T): Add new test.
1618
16192017-05-10 Assaf Gordon <assafgordon@gmail.com>
1620
1621 tests: convert "dc" test to new framework
1622 The 'dc.sed' program (implementing dc calculator in sed) is kept as-is.
1623 The input (dc.inp) and expected output (dc.good) are merged into the
1624 new shell script.
1625 The old-style test executed two calculations at once (Easter 2002 and
1626 square root of 2). They are now separated into two invocations of
1627 'dc.sed'.
1628
1629 * testsuite/dc.sh: New test.
1630 * testsuite/dc.inp, testuite/dc.good: Removed.
1631 * testsuite/local.mk (EXTRA_DIST): Remove inp/good files.
1632 (SEDTEST): Remove dc.sed.
1633 (T): Add dc.sh.
1634
16352017-05-10 Assaf Gordon <assafgordon@gmail.com>
1636
1637 tests: convert "binary/2/3" tests to new framework
1638 The sed scripts (binary.sed, binary2.sed, binary3.sed) are large and
1639 could function as stand-alone programs - there are kept as separate
1640 files. The input/expected output are removed, and a new script is
1641 added to run the tests.
1642
1643 * testsuite/binary.sh: New script.
1644 * testsuite/binary.inp, testsuite/binary.good: Removed.
1645 * testsuite/local.mk (EXTRA_DIST): Remove inp/good files.
1646 (SEDTEST): Remove tests.
1647 (T): Add new test.
1648
16492017-05-10 Assaf Gordon <assafgordon@gmail.com>
1650
1651 tests: convert "8bit" test to new framework
1652 The input (8bit.inp) and expected output (8bit.good) contains non-ascii
1653 octets, and are kept as-is. The sed program is converted to newer
1654 init.sh-style tests.
1655
1656 * testsuite/8bit.sed: Removed.
1657 * testsuite/8bit.sh: New test.
1658 * testsuite/local.mk (EXTRA_DIST): Remove 8bit.sed.
1659 (SEDTEST) Remove 8bit.sed.
1660 (T): Add 8bit.sh.
1661
16622017-05-10 Assaf Gordon <assafgordon@gmail.com>
1663
1664 tests: new function remove_cr_inplace in init.cfg
1665 When testing on Windows OSes, remove any CR (\r) characters
1666 from output files (before comparing them to expected output).
1667
1668 This functionality was used by the old-style tests, embedded
1669 directly in 'Makefile.tests'.
1670
1671 * init.cfg: (remove_cr_inplace): New function.
1672
16732017-05-10 Assaf Gordon <assafgordon@gmail.com>
1674
1675 tests: convert "subwrite" test to new framework
1676 * testsuite/misc.pl (Tests): Add subwrite.
1677 * testsuite/subwrite.inp: Likewise.
1678 * testsuite/subwrite.sed: Likewise.
1679 * testsuite/subwrt1.good: Delete file.
1680 * testsuite/subwrt2.good: Delete file.
1681 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1682 (SEDTESTS): Remove "subwrite".
1683
1684 tests: convert "writeout" test to new framework
1685 * testsuite/misc.pl (Tests): Add writeout.
1686 * testsuite/writeout.inp: Likewise.
1687 * testsuite/writeout.sed: Likewise.
1688 * testsuite/wrtout1.good: Delete file.
1689 * testsuite/wrtout2.good: Delete file.
1690 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1691 (SEDTESTS): Remove "writeout".
1692
1693 tests: convert 'quiet'/'file' tests to new framework
1694 * testsuite/local.mk: (SEDTESTS): Remove tests.
1695 * testsuite/misc.pl: Add tests.
1696
1697 tests: convert "brackets" test to new framework
1698 * testsuite/misc.pl (Tests): Add brackets.
1699 * testsuite/brackets.good: Delete file.
1700 * testsuite/brackets.inp: Likewise.
1701 * testsuite/brackets.sed: Likewise.
1702 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1703 (SEDTESTS): Remove "brackets".
1704
1705 tests: convert "sep" test to new framework
1706 * testsuite/misc.pl (Tests): Add sep.
1707 * testsuite/sep.good: Delete file.
1708 * testsuite/sep.inp: Likewise.
1709 * testsuite/sep.sed: Likewise.
1710 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1711 (SEDTESTS): Remove "sep".
1712
1713 tests: convert "readin" test to new framework
1714 * testsuite/misc.pl (Tests): Add readin.
1715 * testsuite/readin.good: Delete file.
1716 * testsuite/readin.inp: Likewise.
1717 * testsuite/readin.sed: Likewise.
1718 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1719 (SEDTESTS): Remove "readin".
1720
1721 tests: convert "numsub" test to new framework
1722 * testsuite/misc.pl (Tests): Add numsub.
1723 * testsuite/numsub.good: Delete file.
1724 * testsuite/numsub.inp: Likewise.
1725 * testsuite/numsub.sed: Likewise.
1726 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1727 (SEDTESTS): Remove "numsub".
1728
1729 tests: convert "numsub5" test to new framework
1730 * testsuite/misc.pl (Tests): Add numsub5.
1731 * testsuite/numsub5.good: Delete file.
1732 * testsuite/numsub5.inp: Likewise.
1733 * testsuite/numsub5.sed: Likewise.
1734 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1735 (SEDTESTS): Remove "numsub5".
1736
1737 tests: convert "numsub4" test to new framework
1738 * testsuite/misc.pl (Tests): Add numsub4.
1739 * testsuite/numsub4.good: Delete file.
1740 * testsuite/numsub4.inp: Likewise.
1741 * testsuite/numsub4.sed: Likewise.
1742 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1743 (SEDTESTS): Remove "numsub4".
1744
1745 tests: convert "numsub3" test to new framework
1746 * testsuite/misc.pl (Tests): Add numsub3.
1747 * testsuite/numsub3.good: Delete file.
1748 * testsuite/numsub3.inp: Likewise.
1749 * testsuite/numsub3.sed: Likewise.
1750 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1751 (SEDTESTS): Remove "numsub3".
1752
1753 tests: convert "numsub2" test to new framework
1754 * testsuite/misc.pl (Tests): Add numsub2.
1755 * testsuite/numsub2.good: Delete file.
1756 * testsuite/numsub2.inp: Likewise.
1757 * testsuite/numsub2.sed: Likewise.
1758 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1759 (SEDTESTS): Remove "numsub2".
1760
1761 tests: convert "newline-anchor" test to new framework
1762 * testsuite/misc.pl (Tests): Add newline-anchor.
1763 * testsuite/newline-anchor.good: Delete file.
1764 * testsuite/newline-anchor.inp: Likewise.
1765 * testsuite/newline-anchor.sed: Likewise.
1766 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1767 (SEDTESTS): Remove "newline-anchor".
1768
1769 tests: convert "middle" test to new framework
1770 * testsuite/misc.pl (Tests): Add middle.
1771 * testsuite/middle.good: Delete file.
1772 * testsuite/middle.inp: Likewise.
1773 * testsuite/middle.sed: Likewise.
1774 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1775 (SEDTESTS): Remove "middle".
1776
1777 tests: convert "xabcx" test to new framework
1778 * testsuite/misc.pl (Tests): Add xabcx.
1779 * testsuite/xabcx.good: Delete file.
1780 * testsuite/xabcx.inp: Likewise.
1781 * testsuite/xabcx.sed: Likewise.
1782 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1783 (SEDTESTS): Remove "xabcx".
1784
1785 tests: convert "manis" test to new framework
1786 * testsuite/misc.pl (Tests): Add manis.
1787 * testsuite/manis.good: Delete file.
1788 * testsuite/manis.inp: Likewise.
1789 * testsuite/manis.sed: Likewise.
1790 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1791 (SEDTESTS): Remove "manis".
1792
1793 tests: convert "linecnt" test to new framework
1794 * testsuite/misc.pl (Tests): Add linecnt.
1795 * testsuite/linecnt.good: Delete file.
1796 * testsuite/linecnt.inp: Likewise.
1797 * testsuite/linecnt.sed: Likewise.
1798 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1799 (SEDTESTS): Remove "linecnt".
1800
1801 tests: convert "khadafy" test to new framework
1802 * testsuite/misc.pl (Tests): Add khadafy.
1803 * testsuite/khadafy.good: Delete file.
1804 * testsuite/khadafy.inp: Likewise.
1805 * testsuite/khadafy.sed: Likewise.
1806 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1807 (SEDTESTS): Remove "khadafy".
1808
1809 tests: convert "inclib" test to new framework
1810 * testsuite/misc.pl (Tests): Add inclib.
1811 * testsuite/inclib.good: Delete file.
1812 * testsuite/inclib.inp: Likewise.
1813 * testsuite/inclib.sed: Likewise.
1814 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1815 (SEDTESTS): Remove "inclib".
1816
1817 tests: convert "factor" test to new framework
1818 * testsuite/misc.pl (Tests): Add factor.
1819 * testsuite/factor.good: Delete file.
1820 * testsuite/factor.inp: Likewise.
1821 * testsuite/factor.sed: Likewise.
1822 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1823 (SEDTESTS): Remove "factor".
1824
1825 tests: convert "flipcase" test to new framework
1826 * testsuite/misc.pl (Tests): Add flipcase.
1827 * testsuite/flipcase.good: Delete file.
1828 * testsuite/flipcase.inp: Likewise.
1829 * testsuite/flipcase.sed: Likewise.
1830 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1831 (SEDTESTS): Remove "flipcase".
1832
1833 tests: convert "fasts" test to new framework
1834 * testsuite/misc.pl (Tests): Add fasts.
1835 * testsuite/fasts.good: Delete file.
1836 * testsuite/fasts.inp: Likewise.
1837 * testsuite/fasts.sed: Likewise.
1838 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1839 (SEDTESTS): Remove "fasts".
1840
1841 tests: convert "enable" test to new framework
1842 * testsuite/misc.pl (Tests): Add enable.
1843 * testsuite/enable.good: Delete file.
1844 * testsuite/enable.inp: Likewise.
1845 * testsuite/enable.sed: Likewise.
1846 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1847 (SEDTESTS): Remove "enable".
1848
1849 tests: convert "cv-vars" test to new framework
1850 * testsuite/misc.pl (Tests): Add cv-vars.
1851 * testsuite/cv-vars.good: Delete file.
1852 * testsuite/cv-vars.inp: Likewise.
1853 * testsuite/cv-vars.sed: Likewise.
1854 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1855 (SEDTESTS): Remove "cv-vars".
1856
1857 tests: convert "classes" test to new framework
1858 * testsuite/misc.pl (Tests): Add classes.
1859 * testsuite/classes.good: Delete file.
1860 * testsuite/classes.inp: Likewise.
1861 * testsuite/classes.sed: Likewise.
1862 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1863 (SEDTESTS): Remove "classes".
1864
1865 tests: convert "bkslashes" test to new framework
1866 * testsuite/misc.pl (Tests): Add bkslashes.
1867 * testsuite/bkslashes.good: Delete file.
1868 * testsuite/bkslashes.inp: Likewise.
1869 * testsuite/bkslashes.sed: Likewise.
1870 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1871 (SEDTESTS): Remove "bkslashes".
1872
1873 tests: convert "amp-escape" test to new framework
1874 * testsuite/misc.pl (Tests): Add amp-escape.
1875 * testsuite/amp-escape.good: Delete file.
1876 * testsuite/amp-escape.inp: Likewise.
1877 * testsuite/amp-escape.sed: Likewise.
1878 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1879 (SEDTESTS): Remove "amp-escape".
1880
1881 tests: convert "appquit" test to new framework
1882 * testsuite/misc.pl (Tests): Add appquit.
1883 * testsuite/appquit.good: Delete file.
1884 * testsuite/appquit.inp: Likewise.
1885 * testsuite/appquit.sed: Likewise.
1886 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1887 (SEDTESTS): Remove "appquit".
1888
1889 tests: convert "0range" test to new framework
1890 * testsuite/misc.pl (Tests): Add 0range.
1891 * testsuite/0range.good: Delete file.
1892 * testsuite/0range.inp: Likewise.
1893 * testsuite/0range.sed: Likewise.
1894 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1895 (SEDTESTS): Remove "0range".
1896
1897 tests: convert "dollar" test to new framework
1898 * testsuite/misc.pl (Tests): Add dollar.
1899 * testsuite/dollar.good: Delete file.
1900 * testsuite/dollar.inp: Likewise.
1901 * testsuite/dollar.sed: Likewise.
1902 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1903 (SEDTESTS): Remove "dollar".
1904
1905 tests: convert "xbxcx3" test to new framework
1906 * testsuite/misc.pl (Tests): Add xbxcx3.
1907 * testsuite/xbxcx3.good: Delete file.
1908 * testsuite/xbxcx3.inp: Likewise.
1909 * testsuite/xbxcx3.sed: Likewise.
1910 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1911 (SEDTESTS): Remove "xbxcx3".
1912
1913 tests: convert "xabcx" test to new framework
1914 * testsuite/misc.pl (Tests): Add xabcx.
1915 * testsuite/xabcx.good: Delete file.
1916 * testsuite/xabcx.inp: Likewise.
1917 * testsuite/xabcx.sed: Likewise.
1918 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1919 (SEDTESTS): Remove "xabcx".
1920
1921 tests: convert "xbxcx" test to new framework
1922 * testsuite/misc.pl (Tests): Add xbxcx.
1923 * testsuite/xbxcx.good: Delete file.
1924 * testsuite/xbxcx.inp: Likewise.
1925 * testsuite/xbxcx.sed: Likewise.
1926 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1927 (SEDTESTS): Remove "xbxcx".
1928
19292017-05-09 Jim Meyering <meyering@fb.com>
1930
1931 tests: convert "recall2" test to new framework
1932 * testsuite/misc.pl (Tests): Add recall2.
1933 * testsuite/recall2.good: Delete file.
1934 * testsuite/recall2.inp: Likewise.
1935 * testsuite/recall2.sed: Likewise.
1936 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1937 (SEDTESTS): Remove "recall2".
1938
1939 tests: convert "recall" test to new framework
1940 * testsuite/misc.pl (Tests): Add recall.
1941 * testsuite/recall.good: Delete file.
1942 * testsuite/recall.inp: Likewise.
1943 * testsuite/recall.sed: Likewise.
1944 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1945 (SEDTESTS): Remove "recall".
1946
1947 tests: convert "insert" test to new framework
1948 * testsuite/misc.pl (Tests): Add insert-nl.
1949 * testsuite/insert.good: Delete file.
1950 * testsuite/insert.inp: Likewise.
1951 * testsuite/insert.sed: Likewise.
1952 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1953 (SEDTESTS): Remove "insert".
1954
1955 tests: convert "allsub" test to new framework
1956 * testsuite/misc.pl (Tests): Add allsub.
1957 * testsuite/allsub.good: Delete file.
1958 * testsuite/allsub.inp: Likewise.
1959 * testsuite/allsub.sed: Likewise.
1960 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1961 (SEDTESTS): Remove "allsub".
1962
1963 tests: convert "y-newline" test to new framework
1964 * testsuite/misc.pl (Tests): Add y-newline.
1965 * testsuite/y-newline.good: Delete file.
1966 * testsuite/y-newline.inp: Likewise.
1967 * testsuite/y-newline.sed: Likewise.
1968 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1969 (SEDTESTS): Remove "y-newline".
1970
1971 tests: convert "y-zero" test to new framework
1972 * testsuite/misc.pl (Tests): Add y-zero.
1973 * testsuite/y-zero.good: Delete file.
1974 * testsuite/y-zero.inp: Likewise.
1975 * testsuite/y-zero.sed: Likewise.
1976 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1977 (SEDTESTS): Remove "y-zero".
1978
1979 tests: convert "y-bracket" test to new framework
1980 * testsuite/misc.pl (Tests): Add y-bracket.
1981 * testsuite/y-bracket.good: Delete file.
1982 * testsuite/y-bracket.inp: Likewise.
1983 * testsuite/y-bracket.sed: Likewise.
1984 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1985 (SEDTESTS): Remove "y-bracket".
1986
1987 tests: convert "noeol" to new framework
1988 * testsuite/misc.pl (preserve-missing-EOL-at-EOF): New test,
1989 replacing...
1990 * testsuite/noeol.good: Delete file.
1991 * testsuite/noeol.inp: Likewise.
1992 * testsuite/noeol.sed: Likewise.
1993 * testsuite/local.mk (EXTRA_DIST): Remove their names.
1994 (SEDTESTS): Remove "noeol".
1995 * testsuite/Makefile.tests (noeol): Remove target.
1996 We also require this additional change, since the noeolw test
1997 used the just-deleted noeol.inp input file:
1998 * testsuite/noeolw.inp: New file, renamed from testsuite/noeol.inp.
1999 * testsuite/Makefile.tests: Use noeolw.inp, not the other test's file.
2000 (EXTRA_DIST): Add testsuite/noeolw.inp.
2001
2002 tests: convert "insens" to new framework
2003 * testsuite/misc.pl (case-insensitive): New test, replacing...
2004 * testsuite/insens.good: Delete file.
2005 * testsuite/insens.inp: Likewise.
2006 * testsuite/insens.sed: Likewise.
2007 * testsuite/local.mk (EXTRA_DIST): Remove their names.
2008 (SEDTESTS): Remove "insens".
2009
2010 tests: begin migrating test triples into perl framework
2011 * testsuite/head.good: Delete file.
2012 * testsuite/head.inp: Likewise.
2013 * testsuite/head.sed: Likewise.
2014 * testsuite/space.good: Likewise
2015 * testsuite/space.inp: Likewise.
2016 * testsuite/space.sed: Likewise.
2017 * testsuite/empty.good: Likewise
2018 * testsuite/empty.inp: Likewise.
2019 * testsuite/empty.sed: Likewise.
2020 * testsuite/zero-anchor.good: Likewise
2021 * testsuite/zero-anchor.inp: Likewise.
2022 * testsuite/zero-anchor.sed: Likewise.
2023 * testsuite/misc.pl: New file, subsuming the above, with one test
2024 for each of the test file triples (input, output, sed commands).
2025 (empty, empty2, head, space, zero-anchor): Converted tests.
2026 * testsuite/local.mk: Remove references to deleted files.
2027 (T): Add misc.pl.
2028
20292017-05-09 Assaf Gordon <assafgordon@gmail.com>
2030
2031 tests: keep temporary directory if SAVE_TEMPS requested
2032 When developers run 'make check SAVE_TEMPS=yes' the 'Coreutils.pm'
2033 module does not delete the temporary files, but the CuTmpdir.pm still
2034 deletes the temp directory. With this change, the temp directory is
2035 kept, and printed to the log file (e.g. test-suite.log).
2036
2037 * testsuite/CuTmpdir.pm: if $EMV{SAVE_TEMPS} is not empty, don't
2038 auto-delete the temp directory, and print it to the log.
2039
20402017-05-09 Assaf Gordon <assafgordon@gmail.com>
2041
2042 maint: fix wrong PATH in testsuite
2043 The switch to non-recursive make in v4.2.2-129-g3b29bec used a wrong
2044 directory name in the PATH construction of automake's TESTS_ENVIRONMENT
2045 variable ('/src/' instead of '/sed').
2046 This had no effect as each test shell script appended the ./sed/ path
2047 independently. However, switching to perl-based tests - this will be
2048 noticed as the just-built sed binary will not be in the PATH.
2049
2050 * testsuite/local.mk: Fix $PATH variable in test environment.
2051
20522017-04-22 Jim Meyering <meyering@fb.com>
2053
2054 maint: ignore more
2055 * .gitignore: Ignore a bunch of doc/*.* texinfo artifacts and sort.
2056
2057 tests: support perl-based tests like those of grep and coreutils
2058 * configure.ac: Define HAVE_PERL.
2059 * testsuite/Coreutils.pm: New file. From grep.
2060 * testsuite/CuSkip.pm: Likewise.
2061 * testsuite/CuTmpdir.pm: Likewise.
2062 * testsuite/local.mk (, TEST_EXTENSIONS): Add .pl.
2063 (TESTSUITE_PERL, TESTSUITE_PERL_OPTIONS): Define.
2064 (PL_LOG_COMPILER): Define.
2065 (EXTRA_DIST): Add the new .pm files.
2066
20672017-04-18 Assaf Gordon <assafgordon@gmail.com>
2068
2069 sed: enable special meaning of '+' with '-E --posix'
2070 in sed-4.2 and later, '--posix' option wrongly disabled the special meaning
2071 of '+' even in ERE mode (--posix should only disable it in BRE mode,
2072 since it is a GNU extension in BRE). Bug introduced in the original
2073 implementation of --posix in v4.1a-5-gba68fb4.
2074 Reported by Jordan Torbiak in https://bugs.gnu.org/26409 .
2075
2076 * NEWS: Mention bug fix.
2077 * sed/regexp.c (compile_regex_1): In --posix mode, set RE_LIMITED_OPS
2078 only in BRE mode.
2079 * testsuite/posix-mode-ERE.sh: New test.
2080 * testsuite/local.mk: Add new test.
2081
20822017-03-21 Assaf Gordon <assafgordon@gmail.com>
2083
2084 tests: test comments, braces after commands
2085 Test multiple combinations of comments, spaces, braces after commands,
2086 to validate recently added function 'read_end_of_cmd()'.
2087 See discussion in https://bugs.gnu.org/22460 .
2088
2089 * testsuite/command-endings.sh: New test, including y/// bug.
2090 * testsuite/local.mk: Add new test.
2091
20922017-03-21 Assaf Gordon <assafgordon@gmail.com>
2093
2094 sed: refactor end-of-line parsing
2095 Follow-up to bug#22460: extract repeated code to parse end of lines
2096 (while saving comments, braces) into a new function.
2097 See discussion in https://bugs.gnu.org/22460 .
2098
2099 * sec/compile.c (read_end_of_cmd): New function, consumes sed script
2100 input until newline, EOF, semicolon, closing brace or comment is found.
2101 (compile_program): Call new function instead of duplicating code.
2102
21032017-03-21 Thorsten Heymann <hek2mgl@metashock.net>
2104
2105 sed: allow comments, braces after y///
2106 sed-4.4 and earlier rejected the following:
2107 $ sed 'y/1/a/ #f'
2108 sed: -e expression #1, char 8: extra characters after command
2109
2110 See https://bugs.gnu.org/22460 .
2111
2112 * sed/compile.c (compile_program): Handle comments, braces after 'y' command.
2113 * NEWS: Mention it.
2114
21152017-03-19 Kent Fredric <kentnl@gentoo.org> (tiny change)
2116
2117 tests: ensure tty device is readable before running test
2118 Unreadable tty's fail with a different permissions error
2119 instead of failing with "is a tty" error.
2120 Reported in https://bugs.gnu.org/25692 .
2121
2122 * testsuite/panic-tests.sh: Run test if tty device is both readable
2123 and writable.
2124
21252017-03-07 Assaf Gordon <assafgordon@gmail.com>
2126
2127 doc: expand "locale considerations" (multibyte) section
2128 Show examples of processing valid and invalid characters.
2129 Mention \L,\U for s/// command.
2130 Combines reports from:
2131 https://bugs.debian.org/500501
2132 https://lists.gnu.org/archive/html/coreutils/2017-02/msg00039.html
2133
2134 * doc/sed.texi (Locale Consideration): Expand section.
2135 * doc/config.texi: Add variables to render unicode characters portably.
2136
21372017-02-23 Assaf Gordon <assafgordon@gmail.com>
2138
2139 doc: warn against misuse of -i with other options
2140 'sed -iE' is not the same as 'sed -Ei'. 'sed -ni' is dangerous.
2141 From https://bugs.debian.org/832088
2142
2143 * doc/sed.texi (Command-Line Options): Explain and add examples
2144 to '-i/--in-place' item.
2145
21462017-02-23 Assaf Gordon <assafgordon@gmail.com>
2147
2148 doc: elaborate about regex matching on pattern space
2149 Regex addresses work on current pattern space, not on the original
2150 input lines. From https://bugs.debian.org/284646
2151
2152 * doc/sed.texi (Regexp Addresses): Add a paragraph and an example.
2153 * doc/sed.x (Addresses): Add a sentence about regexp.
2154
21552017-02-23 Assaf Gordon <assafgordon@gmail.com>
2156
2157 doc: mention escape-sequence precedence
2158 Unescaping takes place before passing the pattern to the regex engine:
2159 $ echo 'a^c' | sed -e 's/\x5e/b/'
2160 ba^c
2161
2162 From: https://bugs.debian.org/605142
2163
2164 * doc/sed.texi (Escaping Precedence): Add new subsection under 'escape
2165 sequences' with examples.
2166
21672017-02-16 Assaf Gordon <assafgordon@gmail.com>
2168
2169 build: fix 'install-html' target
2170 Switching to non-recursive makefiles broke the 'install-html' target:
2171 The gettext plumbing requires an 'install-html' target in po/Makefile.
2172 This was fixed in gettext v0.19.8.1-41-ge5a008a, but packages using
2173 older gettext need to manually patch po/Makefile.in.in.
2174 Report and suggested fix by Eric Blake in https://debbugs.gnu.org/25690 .
2175
2176 * bootstrap.conf (bootstrap_epilogue): Add 'install-{html,pdf,dvi,ps}'
2177 targets to po/Makefile.in.in (if needed).
2178
21792017-02-09 Alexandre Jasmin <alexandre.jasmin@gmail.com>
2180
2181 doc: reference the i command in /regexp/I
2182 Remove "TODO: add @code{pxref}" in the text and add the ref.
2183
2184 * doc/sed.texi (selecting lines by text matching): Add reference.
2185
21862017-02-09 Alexandre Jasmin <alexandre.jasmin@gmail.com>
2187
2188 doc: rework BRE/ERE table to fit PDF manual
2189 Sample code in the basic/extended table was too wide to fit on a Letter
2190 size printout. Text was overlapping and unreadable. Remove margin,
2191 split commands in two lines and change the column with.
2192
2193 * doc/sed.texi (Basic and extended regexp): Rework table.
2194
21952017-02-07 Alexandre Jasmin <alexandre.jasmin@gmail.com> (tiny change)
2196
2197 doc: change description of the r command
2198 "Reads text file a file" was probably a typo. Also remove "Example: " in
2199 the summary as there's no example there.
2200
2201 * doc/sed.texi (sed scripts): Fix r command description.
2202
22032017-02-07 Alexandre Jasmin <alexandre.jasmin@gmail.com> (tiny change)
2204
2205 doc: fix copy-pasted examples of regexp
2206 The samples commands demonstrating '\B' and '\S' were both using '\w'.
2207 The commands output is correct.
2208
2209 * doc/sed.texi (Regular Expression Extensions): Use the proper commands.
2210
22112017-02-03 Jim Meyering <meyering@fb.com>
2212
2213 maint: post-release administrivia
2214 * NEWS: Add header line for next release.
2215 * .prev-version: Record previous version.
2216 * cfg.mk (old_NEWS_hash): Auto-update.
2217
2218 version 4.4
2219 * NEWS: Record release date.
2220
2221 gnulib: update to latest
2222
2223 maint: avoid %x-format argument type mismatch
2224 * sed/compile.c (savchar): Cast %x-format argument to "unsigned int"
2225 rather than to "unsigned char". Reported by Eric Blake in
2226 https://lists.gnu.org/archive/html/sed-devel/2017-02/msg00000.html
2227
22282017-02-02 Assaf Gordon <assafgordon@gmail.com>
2229
2230 doc: fix broken xref
2231 Remove an extraneous space after @xref. Older 'makeinfo' would fail with:
2232
2233 ./doc/sed.texi:3461: @xref expected braces.
2234 ./doc/sed.texi:3461: ` {Execution Cycle} and @ref{Addresses ov...' is
2235 too long for expansion; not expanded.
2236
2237 Introduced in sed-4.3-15-gb0009b8.
2238
2239 * doc/sed.texi: Remove space after @xref.
2240
22412017-01-31 Jim Meyering <meyering@fb.com>
2242
2243 gnulib: update to latest
2244
22452017-01-31 Assaf Gordon <assafgordon@gmail.com>
2246
2247 doc: add NEWS entry for recent newline bugfix
2248 Bugfix in sed-4.3-12-g44d99bf (for https://bugs.gnu.org/25390) did not
2249 included a corresponding NEWS entry.
2250
2251 * NEWS: Mention bugfix.
2252
22532017-01-28 Assaf Gordon <assafgordon@gmail.com>
2254
2255 doc: new 'multiple commands syntax' section
2256 Explain which commands can be separated by semicolon and which require
2257 newlines. Requested by Ori Avtalion in https://bugs.gnu.org/21845 .
2258
2259 * doc/sed.texi (Multiple commands syntax): New section in "sed scripts"
2260 chapter.
2261
22622017-01-24 Assaf Gordon <assafgordon@gmail.com>
2263
2264 doc: update 'other resources' chapter
2265 Remove broken link and update other resources in the manual.
2266 Reported by olszkocj@aol.com in https://bugs.gnu.org/24770 .
2267
2268 * doc/sed.texi (Other Resources): Update wording.
2269
22702017-01-18 Jim Meyering <meyering@fb.com>
2271
2272 maint: update bootstrap and init.sh
2273 * bootstrap: Update from gnulib.
2274 * testsuite/init.sh: Likewise.
2275
22762017-01-16 Assaf Gordon <assafgordon@gmail.com>
2277
2278 doc: add 'branching and flow control' section
2279 * doc/sed.texi (Branching and flow control): New section under 'Advanced
2280 Sed' chapter.
2281
2282 doc: add 'join lines' example
2283 * doc/sed.texi (Joining lines): Add example of joining SMTP header
2284 lines.
2285
22862017-01-16 Norihiro Tanaka <noritnk@kcn.ne.jp>
2287
2288 tests: new test for dfa newline bug
2289 sed-4.3 would segfault with:
2290 printf '$LINENO $LINEN\nB\n' | sed -e 'N;s/\$LINENO\(.*\n\)/\1/'
2291
2292 Culprit is dfa crash if multi-lines are read in pattern space.
2293 It is fixed at gnulib commit v0.1-1117-g823b5cb .
2294 Reported by S. Gilles in https://bugs.gnu.org/25390
2295
2296 * testsuite/newline-dfa-bug.sh: New test.
2297 * testsuite/local.mk: Add the test.
2298
22992017-01-16 Assaf Gordon <assafgordon@gmail.com>
2300
2301 gnulib: update to latest (with fix for dfa newline bug)
2302 sed-4.3 would segfault due to dfa bug, see https://bugs.gnu.org/25390 .
2303
2304 * gnulib: Update to latest with various dfa fixes and improvement.
2305 * m4/.gitignore: Add 'std-gnu11.m4', 'pthread_rwlock_rdlock.m4'.
2306
23072017-01-16 Assaf Gordon <assafgordon@gmail.com>
2308
2309 doc: improve README installation instructions
2310 Mention README-hacking for git users.
2311 Issue raised by Jean-Christophe Manciot in https://bugs.gnu.org/25377 .
2312
2313 * README: Improve installation paragraph based on coreutils' README.
2314
23152017-01-16 Jim Meyering <meyering@fb.com>
2316
2317 maint: avoid syntax-check-exposed nit
2318 * doc/local.mk (doc/sed.1): Use $(...) rather than @...@.
2319
23202017-01-15 Jim Meyering <meyering@fb.com>
2321
2322 maint: do not distribute COPYING.DOC
2323 * COPYING.DOC: Remove this file, now that we have doc/fdl.texi.
2324 * Makefile.am (EXTRA_DIST): Don't distribute it.
2325
23262017-01-14 Jim Meyering <meyering@fb.com>
2327
2328 tests: skip valgrind-running tests when ASAN-enabled
2329 * init.cfg (require_valgrind_): Skip when we detect that the
2330 binary is ASAN-enabled.
2331
23322017-01-13 Vagelis Prokopiou <drz4007@gmail.com> (tiny change)
2333
2334 maint: insert missing word in comment
2335 * sed/sed.h (struct vector)[v_allocated]: Insert "of".
2336
23372017-01-09 Assaf Gordon <assafgordon@gmail.com>
2338
2339 build: skip building man page if needed
2340 Skip building the man page if building from tarball (where 'doc/sed.1'
2341 is already prebuilt). Build a stub if building from git but generating
2342 the man page isn't possible (if there's no Perl or cross-compiling).
2343 Cross-compilation issue reported by Vishal Biswas in
2344 https://bugs.gnu.org/25358 .
2345 Problematic 'perl' is related to https://bugs.gnu.org/25367 .
2346
2347 * configure.ac: Check for Perl, cross-compilation and tarball build;
2348 Set automake variable BUILD_MAN_PAGE, BUILD_DUMMY_MAN_PAGE accordingly.
2349 * doc/local.mk (doc/sed.1): Build conditionally if BUILD_MAN_PAGE is true;
2350 Create a dummy man page if BUILD_DUMMY_MAN_PAGE is true.
2351 * doc/sed-dummy.1: Stub man page.
2352
23532017-01-08 Assaf Gordon <assafgordon@gmail.com>
2354
2355 build: fix out-of-tree builds without dep-tracking
2356 Create sed,lib,doc,testsuite subdirectories at the end of
2357 'configure', preventing build problems when building out of tree
2358 with --disable-dependency-tracking.
2359 Reported by Juan M. Guerrero in https://bugs.gnu.org/25371 .
2360
2361 * configure.ac: Call AS_MKDIR_P() to create subdirectories.
2362
23632017-01-07 Jim Meyering <meyering@fb.com>
2364
2365 doc: fix NEWS typo
2366 * NEWS: Fix typo s/introducted/introduced/
2367 * cfg.mk (old_NEWS_hash): Update.
2368 Reported by Karl Berry.
2369
23702017-01-01 Jim Meyering <meyering@fb.com>
2371
2372 maint: update gnulib and copyright dates for 2017
2373 * gnulib: Update to latest.
2374 * all files: Run "make update-copyright".
2375
2376 maint: compile warning-free with -DDEBUG_LEAKS
2377 * sed/regexp.c (release_regex) [DEBUG_LEAKS]: Modernize declaration.
2378
23792016-12-30 Jim Meyering <meyering@fb.com>
2380
2381 maint: post-release administrivia
2382 * NEWS: Add header line for next release.
2383 * .prev-version: Record previous version.
2384 * cfg.mk (old_NEWS_hash): Auto-update.
2385
2386 version 4.3
2387 * NEWS: Record release date.
2388
2389 gnulib: update to latest, to fix parallel getopt test failure
2390
23912016-12-28 Assaf Gordon <assafgordon@gmail.com>
2392
2393 doc: new annotated example for N/P/D/b commands
2394 Illustrates how to restructure line breaks over multiple lines.
2395
2396 * doc/sed.texi (Line length adjustment): New section.
2397
23982016-12-28 Assaf Gordon <assafgordon@gmail.com>
2399
2400 doc: new annotated example section for N/D commands
2401 Illustrate how to use N/D to search for doubled-word spanning
2402 multiple lines.
2403
2404 * doc/sed.texi (Text search across mutliple lines): New section.
2405
24062016-12-28 Assaf Gordon <assafgordon@gmail.com>
2407
2408 doc: add 'multiline techniques' section
2409 Expand on using D,G,H,N,P commands to process multiple lines.
2410
2411 * doc/sed.texi (Multiline techniques): New section.
2412
24132016-12-22 Assaf Gordon <assafgordon@gmail.com>
2414
2415 maint: update m4/.gitignore
2416 * m4/.gitignore: Add 'dirfd.m4', 'hard-locale.m4'.
2417
24182016-12-20 Jim Meyering <meyering@fb.com>
2419
2420 maint: RE_ICASE, RE_NO_SUB: remove useless '#ifdef's
2421 * sed/regexp.c (compile_regex_1): Remove #ifdef RE_ICASE guard,
2422 since dfa.c uses it unconditionally. Suggested by Norihiro Tanaka.
2423 Also remove the nearby "#ifdef RE_NO_SUB". Those macros are guaranteed
2424 to be defined by virtue of configure-time tests that ensure we're using
2425 either a new-enough native glibc (RE_NO_SUB was added in 2004), or the
2426 included replacement.
2427
24282016-12-19 Jim Meyering <meyering@fb.com>
2429
2430 gnulib: update to latest; dfa improvement and getopt-posix-tests build fix
2431
24322016-12-18 Jim Meyering <meyering@fb.com>
2433
2434 gnulib: update to latest and adapt to modified dfa API
2435 * sed/regexp.c (compile_regex_1): Do away with use of DFA_CASE_FOLD.
2436 This gnulib update pulls in a dfa module in which that symbol no
2437 longer exists. Instead, it uses RE_ICASE in syntax bits.
2438 * m4/.gitignore: Add files created by running bootstrap.
2439 * lib/.gitignore: Likewise.
2440
2441 tests: use just-built sed in more places
2442 * cfg.mk (PATH): Prepend $(srcdir)/src, so that we use the just-
2443 built sed also when running commands like those of "make distcheck".
2444 Tested by running this in a just-built directory:
2445 f=sed/sed; printf '%s\n' '#!/bin/sh' 'sleep 9h' > $f; chmod a+x $f
2446 and then verifying that nearly every "make syntax-check" rule hangs.
2447
24482016-12-14 Jim Meyering <meyering@fb.com>
2449
2450 doc: fix sed.1-building rule to work on mingw
2451 * doc/local.mk (doc/sed.1): Add $(EXEEXT) suffix on "sed/sed" dependent.
2452 Patch by Miodrag Milanovic via Stephan T. Lavavej, in
2453 https://lists.gnu.org/archive/html/sed-devel/2016-12/msg00026.html
2454
24552016-12-12 Jim Meyering <meyering@fb.com>
2456
2457 tests: port tests to avoid tr NUL-eliding behavior on Solaris
2458 * testsuite/Makefile.tests (elide_cr): Define this to use sed.
2459 Replace every prior use of "$(TR) -d \\r" with it.
2460 Our just-built sed can do that job (elide CR bytes) even when the
2461 input contains NUL bytes. Solaris 11.3's /bin/tr would remove any
2462 NUL byte from the result. Reported by Nelson H.F. Beebe in
2463 https://lists.gnu.org/archive/html/sed-devel/2016-12/msg00006.html
2464
2465 gnulib: update to latest, for solaris-10-vs-configure fix
2466
2467 doc: add a README-hacking file
2468 * README-hacking: New file: instructions for building from a git clone.
2469 Copied from grep's repo, but with s/grep/sed/.
2470
24712016-12-11 Jim Meyering <meyering@fb.com>
2472
2473 build: avoid "make dist" failure due to missing dependencies
2474 * sed/local.mk ($(sed_sed_OBJECTS)): Depend on $(BUILT_SOURCES).
2475 Reported by Assaf Gordon in
2476 https://lists.gnu.org/archive/html/sed-devel/2016-12/msg00016.html
2477
24782016-12-10 Assaf Gordon <assafgordon@gmail.com>
2479
2480 doc: simplify documentation building
2481 Do not bother autogenerating sed.texi from sed-in.texi. All it did
2482 was to add a few '@group' commands. Since these are rarely modified,
2483 add them manually. This simplifies the documentation-building rules
2484 and lets us distribute only one copy of the texinfo manual.
2485 See http://lists.gnu.org/archive/html/sed-devel/2016-12/msg00013.html
2486
2487 * doc/groupify.sed, doc/sed-in.texi: Remove files.
2488 * doc/sed.texi: Remove the 'auto-generated' warning, as this file is no
2489 longer auto-generated.
2490 * doc/local.mk (doc_sed_TEXINFOS): Rename from sed_TEXINFOS.
2491 (dist_noinst_DATA): The above renaming enables us to remove
2492 doc/config.texi and doc/fdl.texi from this list.
2493 (dist_noinst_SCRIPTS): Remove.
2494 (doc/sed.texi): Remove rule.
2495 (doc/s-texi): Likewise.
2496
24972016-12-06 Assaf Gordon <assafgordon@gmail.com>
2498
2499 maint: add missing fdl.texi to distribution
2500 Neglected to add it in commit v4.2.2-175-gc6a55aa.
2501
2502 * doc/local.mk (sed_TEXINFOS, dist_noinst_DATA): Add doc/fdl.texi.
2503
25042016-12-06 Assaf Gordon <assafgordon@gmail.com>
2505
2506 doc: follow-up changes for manual improvements
2507 Fixes few missing issues from commit v4.2.2-176-g801a2c8,
2508 discussed in
2509 http://lists.gnu.org/archive/html/sed-devel/2016-12/msg00005.html
2510
2511 * doc/config.texi: Add stub texinfo macros '@codequotebacktick' and
2512 '@codequoteundirected' (needed if using older versions of texinfo).
2513 * doc/sed-in.texi: Fix syntax that's accepted by newer texinfo but
2514 rejected by texinfo-4.13; Disable directed quote characters in examples.
2515 * doc/sed.texi: Auto-regenerated.
2516
25172016-12-05 Jim Meyering <meyering@fb.com>
2518
2519 gnulib: update to latest
2520
25212016-12-05 Assaf Gordon <assafgordon@gmail.com>
2522
2523 doc: reorganize and expand manual
2524 Discussed in
2525 http://lists.gnu.org/archive/html/sed-devel/2016-11/msg00005.html
2526
2527 * doc/sed-in.texi: Reorganize and expand.
2528 * doc/sed.texi: Auto-regenerated.
2529
25302016-12-02 Assaf Gordon <assafgordon@gmail.com>
2531
2532 maint: upgrade documentation license to GFDL-1.3 (or later)
2533 * bootstrap.conf: Add gnulib's fdl module.
2534 * doc/sed-in.texi: Update license blurb to latest recommended text.
2535 Remove duplicated copyright information from title page (copied from
2536 coreutil's texinfo style). Include fdl.texi in a new appendix.
2537
25382016-11-29 Jim Meyering <meyering@fb.com>
2539
2540 tests: use "returns_ N env VAR=val ..."
2541 Use "returns_ N env VAR=val ..." rather than "VAR=val returns_ N ...".
2542 Some shells do not propagate envvar settings through our use
2543 of the "returns_" function, so set any envvar via use of "env".
2544 This was an issue at least on Ubuntu, Debian and *BSD-based systems.
2545 * testsuite/mb-bad-delim.sh: As above.
2546 * testsuite/mb-y-translate.sh: Likewise.
2547
2548 gnulib: update to latest
2549
25502016-11-27 Jim Meyering <meyering@fb.com>
2551
2552 tests: use "returns_ 1" rather than "&& fail=1"
2553 * testsuite/colon-with-no-label.sh: Rather than failing only upon
2554 success (exit 0), fail upon exit with any value other than 1.
2555
2556 build: stop suppressing many -W... warnings
2557 This code in configure.ac added many -W options to the list
2558 of warnings that we do *not* enable. When I copied most of
2559 this code into this file from coreutils, I did not try to
2560 remove the options that happened not to be needed for sed.
2561 Now, compilers have improved and I have done that triage.
2562 Many -W options can be left enabled.
2563 * configure.ac (GNULIB_WARN_CFLAGS): There is no longer any
2564 need to use a different set of warnings for lib/ files, so
2565 remove this variable, along with many -W-related exemptions.
2566
2567 build: avoid "make distcheck" failure due to leftover .Po files
2568 The following definitions caused trouble for no gain. They caused
2569 some .o file names to have a long additional prefix and even
2570 resulted in some .Po files not being removed by "make distclean"
2571 when building with recent automake. The only reason to use these
2572 definitions was -- long ago -- to require different compiler options
2573 for files in lib/ than elsewhere. That is no longer necessary.
2574 * lib/local.mk (lib_libsed_a_CPPFLAGS): Remove definition.
2575 (lib_libsed_a_CFLAGS, lib_libsed_a_LIBADD): Likewise.
2576 (lib_libsed_a_DEPENDENCIES): Likewise.
2577
2578 maint: fix -Wformat-exposed errors in uses of "panic"
2579 * sed/utils.h (panic): Add __printf__ attribute, so that compilers
2580 can diagnose format/arg-type errors. This exposed the following:
2581 * sed/utils.c (ck_fwrite): Don't try to print size_t via %u.
2582 Instead, use %llu and a cast to unsigned long long.
2583 * sed/mbcs.c (is_mb_char): Cast an "int" to unsigned int, to avoid
2584 mismatch with %x.
2585
2586 maint: remove unused parameters
2587 * sed/compile.c (finish_program): This function's sole argument
2588 was unused. Remove it and update callers.
2589 * sed/sed.h: Update prototype.
2590 * sed/utils.c (register_open_file): This functions's third argument,
2591 "temp", was unused. Remove it and update callers.
2592 * sed/sed.c: Update use.
2593
2594 maint: fix two "make syntax-check" failures
2595 * cfg.mk (exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF):
2596 Also exempt zero-anchor.{inp,good}.
2597 * sed/regexp.c (match_regex): s/can not/cannot/
2598
25992016-11-16 Assaf Gordon <assafgordon@gmail.com>
2600
2601 build: remove explicit 'html' makefile target
2602 The 'html' target was a left-over from the recursive Makefiles,
2603 which were converted to non-recursive in sed v4.2.2-129-g3b29bec.
2604
2605 With this removed, the 'html' target in 'Makefile' is correctly
2606 genererated by automake (from doc/local.mk), and 'make html' works again.
2607
2608 * Makefile.am: Remove explicit 'html' target.
2609
26102016-11-12 Jim Meyering <meyering@fb.com>
2611
2612 tests: use "returns_ 1" rather than testing $? = 1
2613 * testsuite/temp-file-cleanup.sh: As above.
2614
26152016-11-04 Assaf Gordon <assafgordon@gmail.com>
2616
2617 sed: standardize exit code values
2618 Use exit-code constants, and document them:
2619 1=syntax error, 2=bad input files, 4=I/O error or panic.
2620 Add "Exit Status" section in manual.
2621
2622 * sed/utils.h: Define new constants.
2623 * sed/utils.c,
2624 sed/compile.c,
2625 sed/execute.c,
2626 sed/sed.c: Use constants instead of hard-coded values.
2627 * doc/sed-in.texi: Add "Exit Status" section.
2628 * doc/sed.texi: Automatically re-generated.
2629
26302016-11-04 Assaf Gordon <assafgordon@gmail.com>
2631
2632 maint: regenerate sed.texi after doc change
2633 Regenerate sed.texi from sed-in.texi after
2634 doc change in v4.2.2-160-10549b7 ( https://bugs.gnu.org/24799 ).
2635
2636 * doc/sed.texi: Regenerated with 'make info'.
2637
26382016-11-04 Norihiro Tanaka <noritnk@kcn.ne.jp>
2639
2640 sed: fix multi-line regex matching with -z
2641 Sed incorrectly matches the anchor '^' to a newline character
2642 (ASCII 10) despite using NUL line terminators (-z).
2643 See https://bugs.gnu.org/24615 .
2644
2645 Previous (incorrect) behavior:
2646
2647 $ printf "a\0b\0" | sed -z 'N;s/^/X/mg;' | od -An -a
2648 X a nul b nul
2649
2650 With this fix:
2651
2652 $ printf "a\0b\0" | sed -z 'N;s/^/X/mg;' | od -An -a
2653 X a nul X b nul
2654
2655 Current regex engine can not handle NUL multiline anchors.
2656 Implement such search manually (by breaking the pattern into separate
2657 NUL-terminated lines) and searching each one individually.
2658
2659 * NEWS: Mention it.
2660 * sed/regexp.c (compile_regex_1): Don't use newline_anchor of regex, if
2661 the buffer delimiter is not newline character.
2662 (match_regex): Do above case line-by-line.
2663 * testsuite/zero-anchor.good, testsuite/zero-anchor.inp,
2664 testsuite/zero-anchor.sed: New test.
2665 * testsuite/local.mk: Add the test.
2666 * testsuite/Makefile.tests: Add the test.
2667 * bootstrap.conf: Add memrchr.
2668 * lib/.gitignore, m4/.gitignore: Ignore memrchr files.
2669
26702016-11-04 Norihiro Tanaka <noritnk@kcn.ne.jp>
2671
2672 sed: optimize regex processing of lone ^ or $
2673 Optimize /^/ and /$/ patterns and avoid invoking the regular expression
2674 engine if possible.
2675 See https://bugs.gnu.org/24615 .
2676
2677 * sed/regex.c (compile_regex_1): Mark the patterns which consist of ^ or $.
2678 (match_regex): Handle the patterns which consist of ^ or $ manually.
2679 * sed/sed.h (struct regex): New members 'begline' and 'endline'.
2680 * testsuite/newline-anchor.good, testsuite/newline-anchor.sed,
2681 testsuite/newline-anchor.sed: New test.
2682 * testsuite/Makefile.tests: Add the test.
2683 * testsuite/local.mk: Add the test.
2684
26852016-10-26 Vincenzo Romano <vincenzo.romano@notorand.it>
2686
2687 doc: make an example's description more precise
2688 * doc/sed-in.texi (Regular Expressions): Mention that the match
2689 must be at the end of a line.
2690
26912016-10-02 Jim Meyering <meyering@fb.com>
2692
2693 maint: address syntax-check warnings about @pxref
2694 * doc/sed-in.texi: Improve cross-references.
2695 * doc/sed.texi: Regenerate.
2696
2697 build: address warnings from GCC 7
2698 * sed/sed.c (usage): Declare with the _Noreturn attribute to suppress
2699 this warning/error:
2700 sed/sed.c:359:11: error: this statement may fall through \
2701 [-Werror=implicit-fallthrough]
2702 usage(0);
2703 ^~~~~~~~
2704 * sed/execute.c (execute_program) [case 'q']: Add FALLTHROUGH comment
2705 to avoid warning from GCC 7's -Wimplicit-fallthrough.
2706 * sed/compile.c (compile_program): Likewise.
2707
2708 gnulib: update to latest
2709
27102016-09-25 Norihiro Tanaka <noritnk@kcn.ne.jp>
2711
2712 sed: fix incorrect match for title case
2713 * sed/regexp.c (compile_regex_1): Avoid building fastmap for case-
2714 insensitive matching.
2715 * testsuite/title-case.sh: New file, to test for this fix.
2716 * testsuite/local.mk (T): Add the new file name and sort alphabetically.
2717 * init.cfg (require_el_iso88597_locale_): Define.
2718
27192016-09-11 Jim Meyering <meyering@fb.com>
2720
2721 dfa: reflect move of dfa code to new gnulib module
2722 * bootstrap.conf (gnulib_modules): Add dfa.
2723 * sed/dfa.c: Remove file.
2724 * sed/dfa.h: Likewise.
2725 * sed/local.mk (sed_sed_SOURCES): Remove dfa.c.
2726 (NOINST_HEADERS): Remove dfa.h.
2727 * sed/regexp.c (compile_regex_1): Use new dfasyntax API.
2728 * sed/sed.c (localeinfo): New global.
2729 (main): Call init_localeinfo to initialize it.
2730 * sed/sed.h: Include localeinfo.h and declare the new global.
2731 * lib/.gitignore: Ignore new gnulib-imported files.
2732 * m4/.gitignore: Likewise.
2733 * po/POTFILES.in: s,sed/dfa.c,lib/dfa.c,
2734
2735 gnulib: update to latest, for new dfa module
2736
27372016-09-04 Assaf Gordon <assafgordon@gmail.com>
2738
2739 sed: new --sandbox option
2740 In sandbox mode, r/w/e commands are not allowed.
2741 This ensures sed operates only on files designated on the command line,
2742 and cannot execute external programs.
2743
2744 * sed/sed.c (sandbox): New option variable.
2745 (usage): List new option.
2746 (main): Accept new option in getopt.
2747 * sed/sed.h (sandbox): New extern option variable.
2748 * sed/compile.c (DISALLOWED_CMD): New error message.
2749 (read_filename): Abort in sandbox mode (r/w commands).
2750 (compile_program): Abort on 'e' in sandbox mode.
2751 * testsuite/sandbox.sh: Test new option.
2752 * testsuite/local.mk: Add new test.
2753 * NEWS: Mention new option.
2754 * doc/sed-in.texi, doc/sed.texi: Document new option.
2755
27562016-08-27 Jim Meyering <meyering@fb.com>
2757
2758 maint: fix distclean-vs-excess-.Po files more cleanly
2759 * doc/local.mk (distclean-local): Remove rule. Moved to ...
2760 * Makefile.am (distclean-local): ...here, and add a command to
2761 remove all .deps directories. It could have stayed in that .mk
2762 file, but since with this change, it is no longer specific to doc/,
2763 the top level makes more sense.
2764 * lib/local.mk (MOSTLYCLEANFILES): Remove this. Covered by the above.
2765 Reported by Assaf Gordon in
2766 https://lists.gnu.org/archive/html/sed-devel/2016-08/msg00019.html
2767
27682016-08-26 Assaf Gordon <assafgordon@gmail.com>
2769
2770 maint: update .mailmap
2771 Consolidate author's upper/lower case email addresses.
2772 Fixes the following problem:
2773 $ make THANKS
2774 GEN THANKS
2775 ./thanks-gen: THANKS.in: duplicate name: Ralf Wildenhues
2776
2777 Due to:
2778 $ git log --pretty=format:'%aN %aE' | grep -i ralf | sort -u
2779 Ralf Wildenhues ralf.wildenhues@gmx.de
2780 Ralf Wildenhues Ralf.Wildenhues@gmx.de
2781
2782 see http://lists.gnu.org/archive/html/sed-devel/2016-08/msg00023.html
2783 http://lists.gnu.org/archive/html/sed-devel/2016-08/msg00025.html
2784
2785 * .mailmap: Add email mapping.
2786
27872016-08-24 Assaf Gordon <assafgordon@gmail.com>
2788
2789 doc: update README
2790 * README: Update information: remove mention of README.boot, mention
2791 AUTHORS, THANKS, website and help/usage information.
2792
2793 maint: update program name in THANKS.in
2794 * THANKS.in: Replace 'grep' with 'sed'.
2795
2796 maint: remove superfluous name from THANKS.in
2797 * THANKS.in: Remove Pádraig Brady: He is the author of two commits
2798 (v4.2.1-1-g737ca5e and v4.2.1-37-g629ef76) and will be automatically
2799 included in the auto-generated THANKS file.
2800
2801 maint: remove README-alpha
2802 * README-alpha: Removed.
2803
28042016-08-22 Assaf Gordon <assafgordon@gmail.com>
2805
2806 maint: update AUTHORS
2807 * AUTHORS: Update information.
2808
28092016-08-18 Jim Meyering <meyering@fb.com>
2810
2811 doc: work with read-only sed.1
2812 * doc/local.mk (doc/sed.1): Also remove $@, so that mv does not
2813 prompt about read-only target.
2814
28152016-08-14 Jim Meyering <meyering@fb.com>
2816
2817 build: fix sed.1 dependency; work with latest automake
2818 * doc/local.mk (doc/sed.1): Depend not on sed.c, but on the binary
2819 that help2man must run. Also depend on .version, to be sure we
2820 pick up a version change. Also, be careful not to write directly
2821 to $@: instead write to $@-t, and make read-only to mark as generated,
2822 and then, only if all is well, rename atomically to $@.
2823 Also, prefix commands with $(AM_V_GEN) and $(AM_V_at) and ensure
2824 that doc/ exists via $(MKDIR_P).
2825 (distclean-local): New target. Use this instead of ...
2826 (dist-hook-man-page): ... this. Remove rule.
2827 (SEDBIN): Remove unnecessary $(top_builddir)/ prefix.
2828 (doc/sed.texi, doc/s-texi): Remove some uses of $(top_builddir).
2829 Replace others with $(srcdir).
2830 * Makefile (dist-hook): remove dependency on dist-hook-man-page.
2831 * lib/local.mk (MOSTLYCLEANFILES): Arrange for lib/.deps/*.Po
2832 to be removed as part of "make distclean", so that make distcheck
2833 no longer fails when using latest automake.
2834
2835 sed: remove obsolete advice from --help output
2836 * sed/sed.c (contact): Now that there is a sed-specific
2837 mailing list, there is no longer any need to include "sed"
2838 in the subject. Remove that advice.
2839
28402016-08-11 Assaf Gordon <assafgordon@gmail.com>
2841
2842 doc: mention \s,\S,\<,\> regex gnu-extensions
2843 * doc/sed-in.texi: Mention the extensions.
2844 * doc/sed.texi: Automatically re-generated.
2845
2846 doc: expand on N command
2847 * doc/sed-in.texi: Expand on gnu-extension of 'N' command.
2848 * doc/sed.texi: Automatically re-generated.
2849
28502016-08-09 Jim Meyering <meyering@fb.com>
2851
2852 sed: avoid one-byte heap buffer overrun
2853 * sed/execute.c (DFA_SLOP): Define.
2854 (resize_line): Use it in each line-related allocation.
2855 (line_init): Likewise.
2856 (line_copy): Likewise.
2857
28582016-08-08 Assaf Gordon <assafgordon@gmail.com>
2859
2860 sed: adjust line-terminator of F/l/= commands when -z is used
2861 Change F/l/= commands to use NUL line terminator if '-z' option is used.
2862 Previously F/l/= used '\n' regardless of -z option.
2863 See: http://lists.gnu.org/archive/html/sed-devel/2016-08/msg00000.html
2864 http://lists.gnu.org/archive/html/sed-devel/2016-08/msg00002.html .
2865
2866 * sed/execute.c: (do_list,execute_program): Use 'buffer_delimiter' as
2867 line delimiter instead of hard-coded '\n'.
2868 * testsuite/nulldata.sh: Adjust tests accordingly.
2869
28702016-08-08 Norihiro Tanaka <noritnk@kcn.ne.jp>
2871
2872 sed: use grep's DFA matcher to speed up regular expression matching
2873 When possible, sed now uses grep's DFA matcher to match regular
2874 expression, often resulting in a 10x speed-up.
2875 * NEWS (Improvements): Mention it. Move this section to the top.
2876 * sed/local.mk (sed_sed_SOURCES): Add dfa.c, and sort file names.
2877 (noinst_HEADERS): Add dfa.h, and sort file names.
2878 * sed/regexp.c (dfaerror, dfawarn): New functions.
2879 (compile_regex_1): Compile pattern with dfa.
2880 (match_regex): Use dfa.
2881 * sed/sed.h: Include dfa.h.
2882 (struct regex): New member dfa.
2883 * sed/dfa.c: New file, copied from grep.
2884 * sed/dfa.h: New file, copied from grep.
2885 * po/POTFILES.in: Add sed/dfa.c.
2886
28872016-08-08 Assaf Gordon <assafgordon@gmail.com>
2888
2889 sed: reject 's///e' in --posix mode
2890 's///e' modifier is a gnu extension - reject it in --posix mode.
2891
2892 * sed/compile.c: (mark_subst_opt): Exit upon 's///e' in posix mode.
2893 * testsuite/posix-mode-s.sh: Adjust tests accordingly.
2894
28952016-08-08 Assaf Gordon <assafgordon@gmail.com>
2896
2897 sed: allow multiple (non-conflicting) -E/-r parameters
2898 Accept multiple -E/-r parameters as they enable the same ERE operation
2899 mode. Previously, sed would reject multiple -E/-r/-R parameters (as
2900 preparation to supporting PERL syntax and wanting to avoid -E/-r/-R
2901 conflicts). This enables 'sed -E -E -r =' which previously would exit with
2902 a failure (and print the help screen).
2903
2904 * sed/sed.c: (main): Don't exit on multiple -E/-r parameters.
2905
29062016-07-26 Assaf Gordon <assafgordon@gmail.com>
2907
2908 maint: add static-analysis target to cfg.mk
2909 Run 'make static-anslysis' to perform static code analysis using
2910 clang's 'scan-build' tool.
2911
2912 * cfk.mk: (static-analysis,static-analysis-init,static-analysis-config,
2913 static-analysis-make): New targets.
2914
29152016-07-26 Assaf Gordon <assafgordon@gmail.com>
2916
2917 maint: add copyright/license information to configure.ac
2918 Starting year chosen as 1993 based on earliest 'configure.in' found in
2919 sed-1.18.tar.gz from that year.
2920
2921 * configure.ac: Add standard copyright and license information.
2922
29232016-07-26 Assaf Gordon <assafgordon@gmail.com>
2924
2925 maint: update .gitignore after bootstrap
2926 Added by running ./bootstrap on a clean sed repository.
2927
2928 * build-aux/.gitignore: Add config.rpath.
2929 * lib/.gitignore: Add additional gnulib C files.
2930 * m4/.gitignore: Add additional gnulib m4 files.
2931 * po/.gitignore: Add additional PO-related files.
2932
29332016-07-26 Assaf Gordon <assafgordon@gmail.com>
2934
2935 maint: update .gitignore
2936 * .gitignore: Add coverage files, .dirstamp files, testsuite files.
2937
29382016-07-25 Jim Meyering <meyering@fb.com>
2939
2940 maint: skip a check when en_US.UTF-8 collation rules are broken
2941 * cfg.mk (sc_THANKS_in_sorted): This check would fail on systems
2942 for which "." is not ignored. Add a quick sort-based check for
2943 that error, and skip the check on any broken system.
2944 This also corrects the command to use $(srcdir)/THANKS.in,
2945 rather than just THANKS.in.
2946
29472016-07-24 Jim Meyering <meyering@fb.com>
2948
2949 maint: sort THANKS.in
2950 * THANKS.in: Move J.T. Conklin's name "down" so it is in
2951 en_US.UTF-8-sorted order.
2952
29532016-07-24 Assaf Gordon <assafgordon@gmail.com>
2954
2955 build: switch to non-recursive makefile
2956 * .gitignore: Ignore '.dirstamp' files
2957 * bootstrap.conf: Add 'non-recursive-gnulib-prefix-hack' gnulib module.
2958 Add missing 'stdalign' module.
2959 (bootstrap_post_import_hook): Use module to adjust gnulib.mk file.
2960 * configure.ac: Add 'subdir-objects' automake option, don't generate
2961 makefiles in subdirectories. Adjust path of XFAIL tests.
2962 * Makefile.am: Include 'local.mk' files, adjust for non-recursive make.
2963 * doc/Makefile.am: Rename to ...
2964 * doc/local.mk: Adjust paths. Rename SED to
2965 SEDBIN variable, to avoid overriding the default system-wide SED value
2966 which is automatically set by autotools.
2967 * lib/Makefile.am: Rename to ...
2968 * lib/local.mk: Adjust paths.
2969 * lib/.gitignore: Ignore 'stdalign.h' from gnulib module.
2970 * sed/Makefile.am: Rename to ...
2971 * sed/local.mk: Adjust paths.
2972 * testsuite/Makefile.am: Rename to ...
2973 * testsuite/local.mk: Adjust paths.
2974 * testsuite/init.cfg: Move to ...
2975 * init.cfg: ... here. Moved to avoid changing the path in init.sh, and to
2976 keep the same directory structure as coreutils.
2977 (require_en_utf8_locale_): Adjust path for get-mb-cur-max executable.
2978 (require_ja_shiftjis_locale_,require_valid_ja_shiftjis_locale_): Adjust
2979 path for test-mbrtowc executable.
2980 * m4/.gitignore: Add gnulib's non-recusive-make module.
2981 * testsuite/runtest: Adjust paths of Makefile.tests and dir variables,
2982 Skip utility program 'get-mb-cur-max' which is not a standalone test.
2983 * testsuite/Makefile.tests: Adjust path of sed exeutable.
2984 * testsuite/eval.sed, testsuite/eval.good: Adjust path of sed executable.
2985 * testsuite/cmd-R.sh,
2986 testsuite/cmd-l.sh,
2987 testsuite/colon-with-no-label.sh,
2988 testsuite/comment-n.sh,
2989 testsuite/compile-errors.sh,
2990 testsuite/compile-tests.sh,
2991 testsuite/convert-number.sh,
2992 testsuite/execute-tests.sh,
2993 testsuite/follow-symlinks-stdin.sh,
2994 testsuite/follow-symlinks.sh,
2995 testsuite/help-version.sh,
2996 testsuite/in-place-hyphen.sh,
2997 testsuite/in-place-suffix-backup.sh,
2998 testsuite/invalid-mb-seq-UMR.sh,
2999 testsuite/mb-bad-delim.sh,
3000 testsuite/mb-charclass-non-utf8.sh,
3001 testsuite/mb-match-slash.sh,
3002 testsuite/mb-y-translate.sh,
3003 testsuite/normalize-text.sh,
3004 testsuite/nulldata.sh,
3005 testsuite/panic-tests.sh,
3006 testsuite/posix-char-class.sh,
3007 testsuite/posix-mode-N.sh,
3008 testsuite/posix-mode-addr.sh,
3009 testsuite/posix-mode-bad-ref.sh,
3010 testsuite/posix-mode-s.sh,
3011 testsuite/range-overlap.sh,
3012 testsuite/recursive-escape-c.sh,
3013 testsuite/regex-errors.sh,
3014 testsuite/stdin-prog.sh,
3015 testsuite/subst-mb-incomplete.sh,
3016 testsuite/subst-options.sh,
3017 testsuite/subst-replacement.sh,
3018 testsuite/temp-file-cleanup.sh,
3019 testsuite/unbuffered.sh: Adjust paths of init.sh, sed executable.
3020
30212016-07-17 Assaf Gordon <assafgordon@gmail.com>
3022
3023 tests: test --follow-symlinks option
3024 * configure.ac: (TEST_SYMLINKS): New AM_CONDITIONAL.
3025 * testsuite/follow-symlinks.sh: New tests.
3026 * testsuite/Makefile.am: (T): Conditionally add new test (and existing test
3027 'follow-symlink-stdin.sh') based on TEST_SYMLINKS.
3028
3029 tests: test y command in multibyte locales
3030 * testsuite/mb-y-translate.sh: New test.
3031 * testsuite/Makefile.am: Add new test.
3032
30332016-07-16 Assaf Gordon <assafgordon@gmail.com>
3034
3035 tests: test y,s non-slash multibyte delimiters
3036 Test various scenarios of using a multibyte delimiters (instead of
3037 slash) for s,y commands under UTF-8 and C locales.
3038
3039 * testsuite/mb-bad-delim.sh: New test.
3040 * testsuite/Makefile.am: Add new test.
3041
30422016-07-06 Assaf Gordon <assafgordon@gmail.com>
3043
3044 tests: skip tests upon buggy mbrtowc implementations
3045 Sed tests purposefully use invalid non-utf8 multibyte sequences to
3046 test sed's handling of invalid input/program.
3047 Some implementations wrongly accept invalid sequences, causing false
3048 alarms. Add a test program to detect such buggy implementations and skip
3049 the tests if needed.
3050 See discussion in:
3051 http://lists.gnu.org/archive/html/sed-devel/2016-07/msg00005.html
3052 http://lists.gnu.org/archive/html/sed-devel/2016-07/msg00000.html
3053 http://lists.gnu.org/archive/html/sed-devel/2016-06/msg00031.html
3054 http://lists.gnu.org/archive/html/sed-devel/2016-06/msg00014.html
3055
3056 * bootstrap.conf: Add gnulib's closeout module.
3057 * m4/.gitignore, lib/.gitignore, po/POTFILES.in: Adjust after adding
3058 closeout module.
3059 * testsuite/Makefile.am (check_PROGRAMS): Add new program.
3060 * testsuite/test-mbrtowc.c: New program.
3061 * testsuite/init.cfg (require_valid_ja_eucjp_locale_)
3062 (require_valid_ja_shiftjis_locale_): New functions. Call test-mbrtowc
3063 with known invalid multibyte sequences to ensure implementation is not
3064 buggy and rejects them; Skip test otherwise.
3065 * testsuite/invalid-mb-seq-UMR.sh: Use require_valid_ja_eucjp_locale_.
3066 * testsuite/mb-charclass-non-utf8.sh: Use require_valid_ja_shiftjis_locale_.
3067
30682016-07-04 Assaf Gordon <assafgordon@gmail.com>
3069
3070 sed: fix minor multibyte parsing bug
3071 Previously sed would parse multibyte characters incorrectly in two scenarios:
3072
3073 1. Slash following an incomplete-yet-valid multibyte sequence (match_slash):
3074 $ LC_ALL=en_US.UTF-8 sed $'s/\316/X/'
3075 sed: -e expression #1, char 6: unterminated `s' command
3076
3077 2. Open/close brackets as part of a valid mutilbyte string inside a character
3078 class (snarf_char_class). In the example below, '\203]' is a valid
3079 multibyte character in SHIFT-JIS locale:
3080
3081 $ LC_ALL=ja_JP.shiftjis sed $'/[\203]/]/p'
3082 sed: -e expression #1, char #5: Unmatched [ or [^
3083
3084 Both cases stem from mbcs.c:brlen() being non-intuitive:
3085 It returned 1 for valid single-byte character, invalid multibyte-character,
3086 and a for the last byte of a valid multibyte sequence - making it
3087 non-trivial to use correctly.
3088
3089 This commit replaces brlen() with a simpler is_mb_char() function:
3090 returns non-zero for multibyte sequences, zero for single/invalid sequences.
3091
3092 * sed/sed.h: (BRLEN, brlen): Remove delaration.
3093 (IS_MB_CHAR,is_mb_char): Add macro and function declaration.
3094 * sed/mbcs.c: (brlen): Remove function. (is_mb_char): New function.
3095 * sed/compile.c: (snarf_char_class, match_slash): Use IS_MB_CHAR instead of
3096 BRLEN; Adjust local variables accordingly.
3097 * testsuite/mb-match-slash.sh: New test for scenario 1.
3098 * testsuite/mb-charclass-non-utf8.sh: New test for scenario 2,
3099 requires SHIFT-JIS locale.
3100 * testsuite/Makefile.am: Add new tests
3101 * testsuite/init.cfg: (require_ja_shiftjis_locale_): New function.
3102 * NEWS: Mention bug fix.
3103
31042016-06-26 Tristan Verniquet <tverniquet@gmail.com>
3105
3106 sed: use unlocked-io
3107 Sed already imports gnulib's unlocked-io module, but it was not included
3108 in 'utils.c'. Suggested in http://bugs.gnu.org/23848 .
3109
3110 * sed/utils.c: Include 'unlocked-io.h' header.
3111 * NEWS: Mention improvement.
3112
31132016-06-05 Assaf Gordon <assafgordon@gmail.com>
3114
3115 tests: test text normalization (\X sequences)
3116 Sed understands escape-sequences such as \r \t \n \cX.
3117 Test various scenarios of text normalization.
3118
3119 * testsuite/normalize-text.sh: new test.
3120 * testsuite/Makefile.am: add new test.
3121
31222016-06-02 Assaf Gordon <assafgordon@gmail.com>
3123
3124 tests: test \dNNN \oNNN \xNN escape sequences
3125 Test different variations of \dNNN \oNNN \xNN escape sequences,
3126 exercising compile.c:convert_number().
3127
3128 * testsuite/convert-number.sh: new test.
3129 * testsuite/Makefile.am: add new test
3130
31312016-06-02 Assaf Gordon <assafgordon@gmail.com>
3132
3133 tests: test less-common compilation cases
3134 Test various odds-and-ends stemming from GNU sed implementation
3135 of the program compilation module.
3136
3137 * testsuite/compile-tests.sh: new test.
3138 * testsuite/Makefile.am: add new test.
3139
31402016-06-01 Assaf Gordon <assafgordon@gmail.com>
3141
3142 tests: test less-common execution cases
3143 * testsuite/execute-tests.sh: new test.
3144 * testsuite/Makefile.am: add new test.
3145
3146 tests: test 'R' command
3147 * testsuite/cmd-R.sh: new test.
3148 * testsuite/Makefile.am: add new test.
3149
3150 tests: test program file from STDIN
3151 * testsuite/stdin-prog.sh: new test.
3152 * testsuite/Makefile.am: add new test.
3153
3154 tests: test auto-silent mode with '#n' comments
3155 * testsuite/comment-n.sh: new test.
3156 * testsuite/Makefile.am: add new test.
3157
31582016-06-01 Assaf Gordon <assafgordon@gmail.com>
3159
3160 tests: test character-classes escaping in POSIX mode
3161 No \X escaping inside character classes in POSIX mode.
3162
3163 Compare:
3164 $ printf "t\t\n" | sed 's/[\t]/X/' | od -a
3165 0000000 t X nl
3166 $ printf "t\t\n" | sed --posix 's/[\t]/X/' | od -a
3167 0000000 X ht nl
3168
3169 * testsuite/posix-char-class.sh: new test.
3170 * testsuite/Makefile.am: add new test.
3171
31722016-06-01 Assaf Gordon <assafgordon@gmail.com>
3173
3174 tests: test substitue replacements (s//\N/)
3175 Test standard POSIX (e.g. \1 \2 \3) and gnu extension (\U \u \L \l \E)
3176 replacements in s/// command.
3177
3178 * testsuite/subst-replacement.st: new test.
3179 * testsuite/Makefile.am: add new test.
3180
31812016-06-01 Assaf Gordon <assafgordon@gmail.com>
3182
3183 tests: test s/// modifiers
3184 Test standard posix and gnu extension modifiers to s/// command.
3185
3186 * testsuite/subst-options.sh: new test.
3187 * testsuite/Makefile.am: add new test.
3188
31892016-06-01 Assaf Gordon <assafgordon@gmail.com>
3190
3191 tests: test compilation-related errors
3192 Cover code paths in copmile.c leading to errors.
3193
3194 * testsuite/compile-errors.sh: new test.
3195 * testsuite/Makefile.am: add new test.
3196
31972016-06-01 Assaf Gordon <assafgordon@gmail.com>
3198
3199 tests: test regex compilation errors
3200 Test scenarios leading to regex compilation errors.
3201
3202 * testsuite/regex-errors.sh: new test.
3203 * testsuite/Makefile.am: add new test.
3204
32052016-06-01 Assaf Gordon <assafgordon@gmail.com>
3206
3207 tests: exercise 'panic' calls
3208 Test scenarios in which GNU sed terminates with a panic error message
3209 (and verify the error message text).
3210
3211 * testsuite/panic-tests.sh: new test.
3212 * testsuite/Makefile.am: add new test.
3213
32142016-06-01 Assaf Gordon <assafgordon@gmail.com>
3215
3216 tests: test -i/--inplace with backup suffix option
3217 GNU Sed accepts optional backup filename/suffix with -i option.
3218 If the name contains '*', sed replaces it with the input filename.
3219 Test various scenarios of suffix names.
3220 Example:
3221 sed -i'*-*-*.txt' = a
3222 will generate backup file 'a-a-a.txt'.
3223
3224 * testsuite/in-place-suffix-backup.sh: new test.
3225 * testsuite/Makefile.am: add new test.
3226
32272016-06-01 Assaf Gordon <assafgordon@gmail.com>
3228
3229 tests: test -u/--unbuffered mode
3230 Test GNU Sed behaviour in --unbuffered mode (reading only the minimum
3231 needed characters from STDIN, leaving output for next program when sed
3232 terminates). Example:
3233 seq 10 | (sed -u 1q ; sort -nr )
3234
3235 * testsuite/unbuffered.sh: new test.
3236 * testsuite/Makefile.am: add new test.
3237
32382016-06-01 Assaf Gordon <assafgordon@gmail.com>
3239
3240 tests: test -z/--null-data option
3241 Test input/output line-terminators with -z option.
3242
3243 * testsuite/nulldata.sh: new test.
3244 * testsuite/Makefile.am: add new test.
3245
32462016-06-01 Assaf Gordon <assafgordon@gmail.com>
3247
3248 tests: test 'l' command
3249 Test output width of 'l' command, based on COLS envvar,
3250 lN (GNU Extension), '-l N' command-line parameter,
3251 and default output width.
3252
3253 * testsuite/cmd-l.sh: new test.
3254 * testsuite/Makefile.am: add new test.
3255
32562016-06-01 Assaf Gordon <assafgordon@gmail.com>
3257
3258 tests: test gnu address extension in gnu/posix modes
3259 The following addresses are gnu extensions:
3260 0,/regexp/
3261 addr1,+N
3262 addr2,~N
3263
3264 * testsuite/posix-mode-addr.sh: new test.
3265 * testsuite/Makefile.am: add new test.
3266
32672016-06-01 Assaf Gordon <assafgordon@gmail.com>
3268
3269 tests: test 's///' gnu extensions in gnu/posix modes
3270 s///[iImMe] should be rejected in --posix mode.
3271 s//\[lLuUN]// should have no special meaning in --posix mode.
3272
3273 * testsuite/posix-mode-s.sh: new test.
3274 * testsuite/Makefile.am: add new test.
3275
32762016-06-01 Assaf Gordon <assafgordon@gmail.com>
3277
3278 tests: test invalid backreferences in gnu/posix modes
3279 's/foo/\1/' is rejected by default (gnu extension),
3280 silently accepted in POSIX.
3281
3282 * testsuite/posix-mode-bad-ref.sh: new test.
3283 * testsuite/Makefile.am: add new test.
3284
32852016-06-01 Assaf Gordon <assafgordon@gmail.com>
3286
3287 tests: test N command in gnu/posix modes
3288 'N' with insufficient output prints nothing in POSIX mode, prints the
3289 last read line in GNU Extension mode.
3290
3291 Compare:
3292 echo a | sed N
3293 echo a | sed --posix N
3294 echo a | POSIXLY_CORRECT=y sed N
3295
3296 * testsuite/posix-mode-N.sh: test output of N command under gnu and
3297 posix modes.
3298 * testsuite/Makefile.am: add new test.
3299
33002016-06-01 Assaf Gordon <assafgordon@gmail.com>
3301
3302 tests: invalid-mb-seq-UMR: avoid false-failure
3303 * testsuite/Makefile.am (TESTS_ENVIRONMENT): Propagate the
3304 LOCALE_JA envvar setting determined at configure time into
3305 the test environment. Without this, the test would fail on
3306 some systems: at least CentOS6 and 7, but not Fedora 24.
3307
33082016-06-01 Jim Meyering <meyering@fb.com>
3309
3310 tests: don't let any envvar setting perturb tests
3311 * testsuite/envvar-check: New file. Identical to the one from
3312 grep, but with the addition of sed-specific "COLS".
3313 * testsuite/Makefile.am (EXTRA_DIST): Add it here.
3314 (TESTS_ENVIRONMENT): New prologue, mostly copied from grep.
3315
33162016-05-29 Assaf Gordon <assafgordon@gmail.com>
3317
3318 sed: reject recursive escaping after \c
3319 previously, sed 's/./\c\\/' or 's/./\c\d/' would produce incorrect
3320 results. Require two backslashes after \c to denote control sequence
3321 ^\ (ASCII 0x34), and reject recursive escaping (e.g. \c\x61).
3322
3323 * sed/compile.c: (RECURSIVE_ESCAPE_C): New error message.
3324 (normalize_text): Check for \c-backslash, reject recursive escaping.
3325 * testsuite/recursive-escape-c.sh: New file. Test new behaviour.
3326 * testsuite/Makefile.am (T): Add new test.
3327 * NEWS (Bug fixes): Mention it.
3328
33292016-01-02 Jim Meyering <meyering@fb.com>
3330
3331 revert v4.2.2-87-gc033bde, to make sed -i treat "-" as a file name
3332 Stephane Chazelas made a fine case for why sed's --in-place (-i)
3333 should treat "-" as a file name, and not as standard input in
3334 http://debbugs.gnu.org/21249
3335
3336 There was no specific test for the prior behavior, so rather than
3337 letting the revert remove the sole test, adapt and retain it:
3338 * testsuite/in-place-hyphen.sh: However, retain and adapt this
3339 file to test for the restored behavior.
3340 * testsuite/Makefile.am: Retain this change, too.
3341
33422016-01-01 Jim Meyering <meyering@fb.com>
3343
3344 maint: update copyright year, bootstrap, init.sh
3345 Run "make update-copyright" and then...
3346
3347 * gnulib: Update to latest.
3348 * tests/init.sh: Update from gnulib.
3349 * bootstrap: Likewise.
3350
33512015-12-27 Jim Meyering <meyering@fb.com>
3352
3353 sed: do not elide an invalid byte in a substitution RHS
3354 Now, sed copies such bytes into the output.
3355 * sed/execute.c (str_append_modified): Copy each invalid byte
3356 into the result string, as the comment suggests.
3357 * testsuite/invalid-mb-seq-UMR.sh: Adjust this test to conform.
3358 Perl does the same thing. Also, remove an unnecessary "-e" option.
3359 * NEWS (Bug fixes): Mention it.
3360 Bug introduced prior to the switch to git in 2004,
3361 between the releases of sed-4.0.9 and sed-4.1.
3362 This addresses http://debbugs.gnu.org/22254.
3363
3364 sed: fix a heap-clobbering buffer overrun
3365 * sed/execute.c (str_append_modified): Upon encountering an
3366 incomplete multi-byte sequence in a substitution replacement
3367 string, do not treat mbrtowc's return value of -2 as a large,
3368 positive number.
3369 * testsuite/subst-mb-incomplete.sh: New file/test.
3370 * testsuite/Makefile.am (T): Add it.
3371 Reported by Hanno Böck in http://debbugs.gnu.org/22127.
3372 Hanno used the AFL fuzzer to find the segfault-inducing input
3373 from which I derived the test's input.
3374 Introduced by v4.2.2-76-g78e8e58, this bug was never in a release.
3375
33762015-12-12 Jim Meyering <meyering@fb.com>
3377
3378 tests: add helper prog, get-mb-cur-max and re_en_utf8_locale_ function
3379
33802015-08-23 Jim Meyering <meyering@fb.com>
3381
3382 sed: reject a ":" command without a label
3383 Before, sed would accept it and treat it as a label whose name
3384 had length 0, and that could be referenced via a "b" or "t"
3385 command with no label.
3386 * sed/compile.c (errors): Add the new diagnostic.
3387 (COLON_LACKS_LABEL): Define.
3388 (compile_program): Reject ":" command with no label.
3389 * testsuite/colon-with-no-label.sh: New file.
3390 * testsuite/Makefile.am (T): Add it.
3391 * NEWS (Bug fixes): Mention it.
3392 Reported by Stephane Chazelas in http://bugs.gnu.org/21250
3393
33942015-08-01 Assaf Gordon <assafgordon@gmail.com>
3395
3396 build: comment out definitions of unused macros
3397 * sed/compile.c (OPEN_BRACE): Comment out definition, to prevent gcc-5.2
3398 from failing with -Werror -Wunused-macros.
3399 (END_ERRORS): Likewise.
3400
34012015-07-30 Jim Meyering <meyering@fb.com>
3402
3403 tests: avoid false-failure on system with no ja_JP.eucJP locale
3404 * testsuite/invalid-mb-seq-UMR.sh: Use the configure-detected
3405 locale name, $LOCALE_JA, rather than hard-coding ja_JP.eucJP.
3406 If the required type of locale was not detected, then skip
3407 this test. Reported by Assaf Gordon in http://bugs.gnu.org/21124
3408
34092015-07-24 Jim Meyering <meyering@fb.com>
3410
3411 maint: remove dead code
3412 * sed/utils.c (ck_mkstemp): Remove $TMP/$TMPDIR-envvar-using code
3413 that would have been run only if this function's second parameter
3414 were to be NULL, but that could never happen, given the current
3415 and sole caller.
3416 Also, use mode_t as the type for the saved umask value, not "int".
3417 Also, move each declaration down to point of definition.
3418 * sed/utils.h (ck_mkstemp): Mark each of the four parameters as nonnull.
3419
34202015-07-15 Stanislav Brabec <sbrabec@suse.com>
3421
3422 sed: fix --follow-symlinks to work when reading stdin
3423 When reading from stdin, use of --follow-symlinks would cause failure:
3424
3425 $ echo abc | sed --follow-symlinks s/a/d/
3426 sed: cannot stat -: No such file or directory
3427
3428 * sed/execute.c (open_next_file): Set input->in_file_name earlier,
3429 so we can rearrange logic to avoid calling follow_symlink("-").
3430 * testsuite/follow-symlinks-stdin.sh: New file.
3431 * testsuite/Makefile.am (T): Add it.
3432 * NEWS (Bug fixes): Mention it.
3433 Bug introduced by commit v4.2.1-13-g84066bf.
3434 http://bugs.gnu.org/20795
3435
34362015-06-23 Jim Meyering <meyering@fb.com>
3437
3438 typo fix: s/singlebyte/single-byte/
3439 * sed/compile.c (compile_program, normalize_text): Fix typo.
3440 * sed/mbcs.c (brlen): Likewise.
3441
34422015-06-20 Jim Meyering <meyering@fb.com>
3443
3444 sed -i: do not treat "-" as a file name
3445 Most GNU utilities treat "-" as standard input, sed itself does that --
3446 in most contexts. However, since the addition of support for
3447 --in-place (-i) in sed-4.0, sed -i has treated a "-" argument as a
3448 file name, i.e., like ./-. Now, that usage evokes a diagnostic:
3449
3450 $ sed -i s/a/b/ -
3451 sed: couldn't edit -: is a terminal
3452
3453 If you require the old behavior, specify the file name as "./-".
3454 Prompted by the report/patch from Stanislav Brabec in
3455 http://bugs.gnu.org/20796 to document the strangely
3456 inconsistent legacy behavior.
3457
3458 * sed/execute.c (open_next_file): Call panic before
3459 even attempting to operate on the file descriptor.
3460 * testsuite/in-place-hyphen.sh: New file. Test for this.
3461 * testsuite/Makefile.am (T): Add it.
3462 * NEWS (Feature removal): Mention it. Admittedly, the old behavior
3463 feels more like a misfeature.
3464
34652015-06-20 Jim Meyering <meyering@fb.com>
3466
3467 tests: initialize $fail to 0
3468 * testsuite/range-overlap.sh: Otherwise, with $fail set to
3469 nonzero in the environment, this test would report failure,
3470 even when it should pass.
3471
34722015-05-10 Jim Meyering <meyering@fb.com>
3473
3474 build: avoid warning about implicit declaration of unlink
3475 * sed/sed.c: Include <unistd.h>, for declaration of unlink.
3476 Without this change, commit makes sed v4.2.2-84-g7689015 fail
3477 to compile when configured with --enable-gcc-warnings.
3478
3479 sed -i: don't leave behind a temporary sedXXXXXX file
3480 For example, running a command like "sed -i s//b/ F" would fail
3481 to remove a temporary file named sedXXXXXX (for random XXXXXX)
3482 in the directory alongside F.
3483 * sed/sed.c (G_file_to_unlink): New global.
3484 (register_cleanup_file, cancel_cleanup, cleanup): New functions.
3485 (main): Call atexit.
3486 * sed/execute.c (open_next_file): Register for unlink.
3487 (closedown): Call cancel_cleanup right after the rename.
3488 * sed/sed.h: Declare two of the new functions.
3489 * NEWS (Bug fixes): Mention it.
3490 * testsuite/temp-file-cleanup.sh: New file. Test for this.
3491 * testsuite/Makefile.am (T): Add it.
3492 Reported by David Jones in http://bugs.gnu.org/20002.
3493
34942015-05-07 Jim Meyering <meyering@fb.com>
3495
3496 maint: remove stray blank line in the middle of a comment
3497 * sed/utils.c (ck_mkstemp): As above.
3498
3499 tests: skip the new test in presence of buggy valgrind
3500 * testsuite/invalid-mb-seq-UMR.sh: Upon failure due to a
3501 valgrind-internal assertion, skip this test.
3502 Reported by Norihiro Tanaka in http://debbugs.gnu.org/20490
3503
35042015-05-06 Norihiro Tanaka <noritnk@kcn.ne.jp>
3505
3506 sed: fix mishandling of overlapping address ranges
3507 When the line number ranges of two or more editing commands overlap,
3508 sed applies all commands but the first to a line that is just beyond
3509 the union of all ranges. E.g., with this command,
3510 seq 9|sed '2,7d;3,6d', sed would mistakenly delete line 8.
3511
3512 * sed/execute.c (match_an_address_p) [ADDR_IS_NUM]: Make this
3513 function work also in this case.
3514 (match_address_p): Move the ADDR_IS_NUM +
3515 ...->line_number == ...->addr_number comparison "up" into
3516 match_an_address_p, so we can hoist two similar if/return
3517 blocks out of "if" and "else" branches.
3518 Change so that this function returns false when the current
3519 line number is outside the specified range.
3520 * testsuite/range-overlap.sh: New file, to test for this.
3521 * testsuite/Makefile.am (T): Add it to the list.
3522 * NEWS (Bug fixes): Mention it.
3523 Reported as http://bugs.gnu.org/19899
3524
35252015-05-04 Jim Meyering <meyering@fb.com>
3526
3527 build: do not require autoconf.git
3528 * configure.ac: Use AC_CONFIG_MACRO_DIR, not
3529 the new (as yet unreleased) AC_CONFIG_MACRO_DIRS.
3530 Reported by Hongyi Zhao in http://debbugs.gnu.org/20424
3531
35322015-05-03 Jim Meyering <meyering@fb.com>
3533
3534 maint: housekeeping: sync a few rules from coreutils
3535 * cfg.mk (sc_preprocessor_indentation): New rule, from coreutils.
3536 (local-checks-to-skip): Exempt it, for now.
3537 (sc_THANKS_in_sorted): Another rule from coreutils. Enabled.
3538 (announcement_Cc_): Define, so the auto-generated announcement
3539 message template includes sed-devel@ as a recipient.
3540 (update-copyright-env) [UPDATE_COPYRIGHT_USE_INTERVALS]: Update
3541 to use =2, rather than=1, so that the next time we update
3542 copyright dates, it will collapse a few more ranges.
3543
3544 maint: tweak comments and rearrange code slightly
3545 * sed/execute.c (str_append): Trivial NSC code transformation.
3546 (str_append_modified): Tweak another comment.
3547
3548 tests: test for just-fixed UMR bug
3549 * testsuite/invalid-mb-seq-UMR.sh: New file. Test for just-fixed bug.
3550 * testsuite/Makefile.am (T): New variable.
3551 Add the two init.sh-using test names here, rather than in
3552 two separate lists.
3553 (SEDTESTS, EXTRA_DIST): Use $(T).
3554 (EXTRA_DIST): Add init.cfg.
3555 * testsuite/init.cfg: New file, to add functions from coreutils.
3556 (require_valgrind_, print_ver_): New functions.
3557
35582015-05-03 Norihiro Tanaka <noritnk@kcn.ne.jp>
3559
3560 sed: avoid a UMR bug when processing an invalid multibyte sequence
3561 * sed/execute.c (str_append_modified): When attempting to append an
3562 invalid multibyte sequence, e.g., from the RHS of a substitution
3563 expression, we would read uninitialized memory.
3564 Don't capitalize first word of diagnostic; remove exclamation point.
3565 Wrap new translatable strings in _(...).
3566 * NEWS (Bug fixes): Mention it.
3567 This addresses http://debbugs.gnu.org/20490
3568
35692015-05-02 Jim Meyering <meyering@fb.com>
3570
3571 maint: remove SED_FEATURE_VERSION; use PACKAGE_VERSION instead
3572 * configure.ac (SED_FEATURE_VERSION): Remove definition et al.
3573 * sed/compile.c (compile_program): Remove sole use.
3574 Use PACKAGE_VERSION instead.
3575
3576 maint: add "/*~" to build-aux/ and m4/.gitignore files
3577 Otherwise, bootstrap would add entries for individual file names.
3578 * build-aux/.gitignore: Add /*~
3579 * m4/.gitignore: Likewise.
3580
35812015-05-01 Jim Meyering <meyering@fb.com>
3582
3583 maint: enable sc_file_system
3584 * cfg.mk (local-checks-to-skip): Remove its exemption.
3585 * BUGS (characters): s/filesystem/file system/
3586 * ChangeLog-2014 (setup_jump): Likewise.
3587 * doc/sed-in.texi: Likewise.
3588 * doc/sed.texi: Likewise.
3589
3590 build: require gettext 0.19.2, perl-5.5
3591 * configure.ac: Require gettext-0.19.2.
3592 * bootstrap.conf: List perl and gettext version requirements.
3593
35942015-04-27 Jim Meyering <meyering@fb.com>
3595
3596 tests: set sed's expected failure status to 4
3597 * testsuite/help-version.sh (expected_failure_status_sed): As above.
3598
35992015-04-26 Jim Meyering <meyering@fb.com>
3600
3601 maint: invoke make via $(MAKE), not via "make"
3602 * Makefile.am (html): Invoke make via $(MAKE).
3603 (full-distcheck): Likewise.
3604
3605 use generated version.[ch] and add init.sh and help-version.sh
3606 * Makefile.am (DISTCLEANFILES): Initialize.
3607 (EXTRA_DIST): Add .version.
3608 (BUILT_SOURCES): Set to .version.
3609 (.version): New rule.
3610 (THANKS): Depend on .version.
3611 * sed/Makefile.am: Add rules to build version.[ch].
3612 * sed/sed.c: Include version.h, and use the new variable, Version.
3613 * testsuite/Makefile.am: Arrange to distribute and run the new
3614 help-version.sh test. Also distribute the new init.sh.
3615 * testsuite/help-version.sh: New file.
3616 * testsuite/init.sh: Likewise.
3617 * .gitignore: Ignore the generated files, .version and src/version.[ch].
3618
36192015-03-01 Jim Meyering <meyering@fb.com>
3620
3621 maint: COPYRIGHT_YEAR: remove, along with tests that use it
3622 This is covered by other tests, and the general --help/--version
3623 checks provided by help-version.sh (about to be added) are more
3624 thorough.
3625 * configure.ac (COPYRIGHT_YEAR): Remove definition and AC_SUBST.
3626 * Makefile.am (dist-hook): Remove test.
3627 * testsuite/Makefile.am (SEDTESTS): Remove "version".
3628 * testsuite/version.gin: Remove file.
3629 * .gitignore: Remove mention of generated file, version.good.
3630
36312015-01-01 Jim Meyering <meyering@fb.com>
3632
3633 maint: initialize an mbstate_t with "= { 0, };", rather than with memset
3634 I.e., use this:
3635 mbstate_t mbstate = { 0, };
3636 rather than this:
3637 mbstate_t mbstate;
3638 memset (&cur_stat, 0, sizeof (mbstate_t));
3639 Also, prefer "sizeof VAR" over sizeof(TYPE).
3640 * sed/execute.c (execute_program, translate_mb): As above.
3641 * sed/compile.c (match_slash, compile_program, normalize_text):
3642 Likewise.
3643
3644 maint: enable sc_prohibit_long_lines
3645 * cfg.mk (local-checks-to-skip): Remove the overall exemption,
3646 but continue to exempt some files in testsuite/.
3647 * configure.ac: Split a long line.
3648 * doc/sed-in.texi: Split long lines.
3649 * doc/sed.texi: Likewise.
3650 * sed/compile.c: Likewise.
3651 * sed/execute.c: Split long lines.
3652 (execute_program): Reorder "#ifdef HAVE_POPEN" and
3653 "if (pipe_fp != NULL)" if/else blocks to make the code
3654 clearer and (incidentally) the lines shorter, due to a
3655 decrease in nesting level.
3656 * sed/sed.c: Split long lines.
3657 * sed/utils.c: Likewise.
3658 * sed/utils.h: Likewise.
3659
3660 maint: translate_mb: new function factored out of 'y'-handling case
3661 * sed/execute.c (translate_mb): New function, factored out of
3662 the "case 'y':" part of...
3663 (execute_program): ...here.
3664
3665 maint: remove more unnecessary declarations
3666 * sed/execute.c: Remove now-duplicate forward declarations.
3667
3668 maint: update copyright year ranges to include 2015; update gnulib
3669
36702014-12-20 Jim Meyering <meyering@fb.com>
3671
3672 maint: enable sc_prohibit_strncpy check
3673 * cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Remove
3674 its exemption.
3675 * sed/compile.c (compile_program): Remove two misuses of strncpy;
3676 use memcpy instead.
3677 * sed/execute.c (do_list): Likewise, for one instance.
3678
3679 maint: begin to use "size_t" more, where appropriate
3680 * sed/execute.c (do_list): Update some "int" locals to "size_t",
3681 and combine a few declarations with needlessly separate initializations.
3682
3683 maint: update .gitignore
3684 * .gitignore: Ignore build artifacts.
3685
3686 maint: remove po/sed.pot from version control
3687 * po/sed.pot: Remove file. It is unnecessary and undesirable to
3688 version-control a file like this (mechanically-derived).
3689
3690 build: update build tool version requirements
3691 * bootstrap.conf (buildreq): Blindly update tool-version number
3692 requirements from those required by coreutils.
3693
3694 maint: fix "make distcheck" failure
3695 * Makefile.am (EXTRA_DIST): List THANKS.in, not THANKS.
3696 Add .mailmap, too.
3697
3698 build: build-aux/texi2dvi: remove file
3699 * build-aux/texi2dvi: Remove file. It was out of date and could
3700 no longer parse our .texi files.
3701 * Makefile.am (EXTRA_DIST): Don't list it here.
3702 * cfg.mk: Remove an exemption for that file.
3703 * doc/Makefile.am (TEXI2DVI): Remove definition.
3704
37052014-12-16 Jim Meyering <meyering@fb.com>
3706
3707 remove support for the 'L' (fmt/flow-paragraph) command
3708 * sed/Makefile.am (sed_SOURCES): Remove fmt.c.
3709 * sed/execute.c (execute_program):
3710 * sed/fmt.c: Remove file.
3711 * sed/sed.h (fmt): Remove declaration.
3712 * doc/sed.texi: Remove documentation for 'L' command.
3713 * doc/sed-in.texi: Likewise.
3714 * NEWS (Feature removal): Document it.
3715 Prompted by the report from Jodie Cunningham that using this
3716 command with a large number could cause sed to segfault:
3717 https://bugs.launchpad.net/ubuntu/+source/sed/+bug/1400575
3718
37192014-12-01 Jim Meyering <meyering@fb.com>
3720
3721 doc: NEWS: mention the gzip->xz release tarball switch
3722 * NEWS (Build-related): Mention that we are now distributing
3723 only .tar.xz archives; no more gzip-compressed tarballs.
3724
3725 build: avoid warning about unused fchown result
3726 * sed/execute.c: Include "ignore-value.h".
3727 (closedown): Explicitly ignore fchown return value.
3728 * bootstrap.conf (gnulib_modules): Add ignore-value.
3729 * lib/.gitignore: Ignore the new .h file.
3730 * .gitignore: Ignore all **~ backup files.
3731
37322014-11-30 Jim Meyering <meyering@fb.com>
3733
3734 build: use gnulib's manywarnings module
3735 bootstrap.conf: Add the module name.
3736 configure.ac: Copy boilerplate and exclusions from coreutils.
3737 sed/Makefile.am (AM_CFLAGS): Define in terms of the two new
3738 variables, $(WARN_CFLAGS) and $(WERROR_CFLAGS).
3739 m4/.gitignore: Add the two new .m4 files.
3740
3741 maint: add three casts-in-initialization to avoid warnings
3742 * sed/compile.c (special_files): When initializing, cast string
3743 literals to (char *) to avoid warnings.
3744
3745 maint: avoid a gcc "const discard" warning
3746 * sed/compile.c (compile_program): Make a local "const" to avoid
3747 discarding "const" attribute in assignment.
3748
3749 maint: avoid more gcc warnings: apply _GL_ATTRIBUTE_PURE
3750 * sed/utils.h (get_buffer, size_buffer): Make each functions
3751 sole parameter "const" and declare the function itself with the
3752 "pure" attribute.
3753 * sed/utils.c (get_buffer, size_buffer): Adjust definitions to match.
3754
3755 maint: add _Noreturn attribute to two functions
3756 This avoids two gcc may-be-noreturn warnings:
3757 * sed/sed.h (bad_prog): Add _Noreturn attribute.
3758 * sed/utils.h (panic): Likewise.
3759
3760 maint: manually convert K&R to ANSI style decls; and add "static"
3761 Convert many function definitions from K&R to ANSI style.
3762 When possible, make a function static and remove the immediately-
3763 preceding declaration of that same function.
3764 Also, add the const to a few declarations.
3765 * sed/compile.c: As above.
3766 (special_files): Likewise.
3767 * sed/execute.c: Likewise.
3768 * sed/fmt.c: Likewise.
3769 * sed/mbcs.c: Likewise.
3770 * sed/regexp.c: Likewise.
3771 * sed/sed.c: Likewise.
3772 * sed/sed.h: Likewise.
3773 * sed/utils.c: Likewise.
3774
3775 maint: declare several "int" locals to be of type size_t
3776 * sed/compile.c (compile_program): Using "int" was wrong: not only
3777 too narrow, but would also evoke warnings from gcc when comparing
3778 with variables of unsigned type.
3779
3780 maint: avoid gcc warning about unused macro
3781 * sed/regexp.c (END_ERRORS): Remove definition of unused macro.
3782
3783 maint: avoid false-positive used-uninit. warning from gcc
3784 * sed/sed.h (IF_LINT): Define.
3785 * sed/compile.c (snarf_char_class) [lint]: Use it to initialize DELIM,
3786 so that gcc doesn't report it is used uninitialized.
3787
3788 maint: enable sc_prohibit_empty_lines_at_EOF check
3789 * cfg.mk (exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF):
3790 * cfg.mk (local-checks-to-skip): Remove its exemption.
3791 Adjust many files to end in a single newline, but exempt a few
3792 test suite input and output files.
3793 * testsuite/fasts.sed: Remove three empty lines at EOF.
3794 * BUGS: Remove empty line at EOF.
3795 * sed/mbcs.c: Likewise.
3796 * sed/sed.h: Likewise.
3797 * testsuite/BOOST.tests: Likewise.
3798 * testsuite/dc.inp: Add a newline at EOF; there was none.
3799 * testsuite/flipcase.sed: Likewise.
3800 * testsuite/utf8-1.good: Likewise.
3801 * testsuite/utf8-1.inp: Likewise.
3802 * testsuite/utf8-2.good: Likewise.
3803 * testsuite/utf8-2.inp: Likewise.
3804 * testsuite/utf8-3.good: Likewise.
3805 * testsuite/utf8-3.inp: Likewise.
3806 * testsuite/utf8-4.good: Likewise.
3807 * testsuite/utf8-4.inp: Likewise.
3808 * testsuite/xbxcx.good: Likewise.
3809 * testsuite/xbxcx.inp: Likewise.
3810 * testsuite/xemacs.good: Likewise.
3811 * testsuite/xemacs.inp: Likewise.
3812
3813 maint: enable sc_prohibit_tab_based_indentation syntax check
3814 * cfg.mk (local-checks-to-skip): Remove its exemption.
3815 Exempt all files under testsuite/, for now, and a few others.
3816 * .gitmodules: Change each leading TAB to 8 spaces spaces.
3817 * BUGS: Likewise.
3818 * NEWS: Likewise.
3819 * configure.ac: Likewise.
3820 * sed/compile.c: Likewise.
3821 * sed/execute.c: Likewise.
3822 * sed/fmt.c: Likewise.
3823 * sed/regexp.c: Likewise.
3824 * sed/sed.c: Likewise.
3825 * sed/sed.h: Likewise.
3826 * sed/utils.c: Likewise.
3827 * sed/utils.h: Likewise.
3828 * COPYING: Update from coreutils.
3829
3830 maint: enable sc_m4_quote_check syntax check
3831 * cfg.mk (local-checks-to-skip): Remove its exemption.
3832 * configure.ac: Fix the under-quoting problems thus exposed.
3833
3834 maint: enable sc_cast_of_argument_to_free syntax check
3835 * cfg.mk (local-checks-to-skip): Remove its exemption.
3836 * testsuite/tst-rxspencer.c (mb_test): Remove a cast.
3837
3838 maint: enable sc_cast_of_alloca_return_value syntax check
3839 * cfg.mk (local-checks-to-skip): Remove its exemption.
3840 * sed/regexp.c (match_regex): Do not cast return value of alloca.
3841
3842 maint: enable sc_po_check syntax check
3843 * cfg.mk (local-checks-to-skip): Remove its exemption.
3844 * po/POTFILES.in: Adjust to reflect added/removed file names.
3845
3846 maint: enable sc_prohibit_always_true_header_tests syntax check
3847 * cfg.mk (local-checks-to-skip): Remove its exemption.
3848 Exempt configure.ac.
3849
3850 maint: enable sc_makefile_at_at_check syntax check
3851 * cfg.mk (local-checks-to-skip): Remove its exemption.
3852 * testsuite/Makefile.am (LDADD, TESTS_ENVIRONMENT): Use $(...)
3853 rather than obsolescent @...@ notation.
3854
3855 maint: enable sc_space_tab syntax check
3856 * cfg.mk (local-checks-to-skip): Remove its exemption.
3857 * doc/groupify.sed: Reverse SP-TAB sequences.
3858 * sed/compile.c (compile_program): Remove spaces before TAB.
3859 * sed/execute.c (append_replacement): Likewise.
3860
3861 maint: enable sc_program_name syntax check
3862 * cfg.mk (local-checks-to-skip): Remove its exemption.
3863 * sed/sed.c: Include progname.h".
3864 (program_name): Remove now-unnecessary declaration.
3865 (main): Call set_program_name.
3866 * bootstrap.conf (gnulib_modules): Add progname.
3867 * lib/.gitignore: Append the two new names.
3868
3869 maint: enable more checks
3870 * cfg.mk (local-checks-to-skip): Remove exemptions
3871 for immutable NEWS as well as the two config.h checks.
3872 Also accept "sed.h", since the first thing it does is
3873 to include <config.h>.
3874 * sed/sed.h: Change "config.h" to <config.h>, for consistency
3875 with other GNU tools.
3876 * sed/utils.c: Likewise, here and for each of the following.
3877 * testsuite/bug-regex10.c:
3878 * testsuite/bug-regex11.c:
3879 * testsuite/bug-regex12.c:
3880 * testsuite/bug-regex13.c:
3881 * testsuite/bug-regex14.c:
3882 * testsuite/bug-regex15.c:
3883 * testsuite/bug-regex16.c:
3884 * testsuite/bug-regex21.c:
3885 * testsuite/bug-regex7.c:
3886 * testsuite/bug-regex8.c:
3887 * testsuite/bug-regex9.c:
3888 * testsuite/runptests.c:
3889 * testsuite/runtests.c:
3890 * testsuite/tst-boost.c:
3891 * testsuite/tst-pcre.c:
3892 * testsuite/tst-regex.c:
3893 * testsuite/tst-regex2.c:
3894 * testsuite/tst-rxspencer.c:
3895
3896 maint: enable sc_const_long_option syntax check
3897 * sed/sed.c (main): Add "const" to decl of longopts.
3898 * cfg.mk (local-checks-to-skip): Remove its exemption.
3899
3900 maint: enable double-word prohibition
3901 * cfg.mk (local-checks-to-skip): Remove exemption for
3902 sc_prohibit_doubled_word.
3903 Exempt 4 files under testsuite/.
3904
3905 doc: remove doubled word
3906 * doc/sed-in.texi: Remove doubled "the".
3907 * doc/sed.texi: Likewise.
3908
3909 maint: add .prev-version
3910 * .prev-version: New file.
3911
3912 maint: turn on the test that prohibits use of HAVE_CONFIG_H
3913 * cfg.mk (local-checks-to-skip): Remove the exemption here.
3914 * testsuite/bug-regex10.c: Remove the use of the offending macro.
3915 * testsuite/bug-regex11.c: Likewise.
3916 * testsuite/bug-regex12.c: Likewise.
3917 * testsuite/bug-regex13.c: Likewise.
3918 * testsuite/bug-regex14.c: Likewise.
3919 * testsuite/bug-regex15.c: Likewise.
3920 * testsuite/bug-regex16.c: Likewise.
3921 * testsuite/bug-regex21.c: Likewise.
3922 * testsuite/bug-regex7.c: Likewise.
3923 * testsuite/bug-regex8.c: Likewise.
3924 * testsuite/bug-regex9.c: Likewise.
3925 * testsuite/runptests.c: Likewise.
3926 * testsuite/runtests.c: Likewise.
3927 * testsuite/tst-boost.c: Likewise.
3928 * testsuite/tst-pcre.c: Likewise.
3929 * testsuite/tst-regex.c: Likewise.
3930 * testsuite/tst-regex2.c: Likewise.
3931 * testsuite/tst-rxspencer.c: Likewise.
3932
3933 maint: generate THANKS from THANKS.in
3934 * THANKS.in: Renamed from THANKS, adjusted formatting
3935 and added header. Also remove from this list of names those
3936 that are now generated automatically.
3937 * THANKS: Removed, now that it's generated.
3938 * thanks-gen: New file.
3939 * Makefile.am (EXTRA_DIST): Add thanks-gen
3940 (THANKS): New rule.
3941 * .mailmap: New file.
3942
3943 maint: add cfg.mk, derived from grep's
3944 * cfg.mk (local-checks-to-skip): Exempt many failing tests.
3945 (old_NEWS_hash): Define.
3946 * NEWS: Tweak wording to avoid semblance of doubled word: in in-place.
3947
3948 tests: hook up gnulib-tests
3949 * Makefile.am (SUBDIRS): Add gnulib-tests.
3950 * gnulib-tests/Makefile.am: New file.
3951 * configure.ac (AC_CONFIG_FILES): Add gnulib-tests/Makefile.
3952 * .gitignore: Ignore all but Makefile.am.
3953
3954 maint: .gitignore: ignore more
3955
3956 maint: remove ACLOCAL_AMFLAGS in favor of AC_CONFIG_MACRO_DIRS
3957 * Makefile.am (ACLOCAL_AMFLAGS): Remove this assignment.
3958 * configure.ac: Use this macro instead.
3959
3960 maint: do not version-control generated files.
3961 * doc/sed.1: Remove.
3962 * po/sed.pot: Likewise.
3963 * po/Makevars: Likewise.
3964 * .gitignore: Add their names.
3965
3966 maint: begin to modernize configure.ac
3967 * configure.ac: Turn on silent rules, by default.
3968 Use git-derived versions all the time. Required a new, signed
3969 v4.2.2 tag, which I've pushed.
3970 Distribute .tar.xz tarballs, not .bzip2 or .gz.
3971 * Makefile.am (AUTOMAKE_OPTIONS): Remove.
3972 * bootstrap.conf (gnulib_modules): Add git-version-gen.
3973
3974 maint: convert obsolescent @VAR@ notation to $(VAR)
3975 * sed/Makefile.am (sed_LDADD): Use $(VAR), no @VAR@.
3976
3977 maint: update copyright dates; use gnulib's update-copyright module
3978 * bootstrap.conf (gnulib_modules): Add update-copyright.
3979 Then, run "make update-copyright".
3980 * Makefile.am: Add copyright header.
3981
3982 maint: remove all trailing white space
3983 First, run this command:
3984 git grep -l ' $'|xargs perl -pi -e 's/[ \t]+$//'
3985 Then some minor fix-up to make the two newly-failing tests
3986 pass once again:
3987 * testsuite/mac-mf.sed: Append this, s/ $//,
3988 to eliminate trailing spaces in the actual output.
3989 * testsuite/y-newline.good: Manually remove a trailing
3990 space between two concatenated prompts.
3991
3992 maint: update autogenerated .gitignore files
3993
3994 maint: update build/gnulib infrastructure; generate ChangeLog
3995 * ChangeLog-2014: Renamed from ChangeLog.
3996 * po/ChangeLog-2014: Renamed from po/ChangeLog.
3997 * Makefile.am (EXTRA_DIST): Add the two new file names.
3998 (dist-hook): Generate ChangeLog at tarball-creation time.
3999 (gen-ChangeLog): New rule. Just like the one in coreutils and grep.
4000 * bootstrap.conf (gnulib_modules): Add the modules, readme-release
4001 and gitlog-to-changelog, and revamp to be much more like grep and
4002 coreutils.
4003 * lib/Makefile.am: Update.
4004
4005 maint: update bootstrap from gnulib
4006
40072014-09-06 Jim Meyering <meyering@fb.com>
4008
4009 fixup: add the properly-named new test files
4010 * testsuite/Makefile.am (EXTRA_DIST): Add y-zero.*,
4011 not y-NUL.* here.
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