* cfg.mk (PATH): Prepend $(srcdir)/src, so that we use the just-
built sed also when running commands like those of "make distcheck".
Tested by running this in a just-built directory:
f=sed/sed; printf '%s\n' '#!/bin/sh' 'sleep 9h' > $f; chmod a+x $f
and then verifying that nearly every "make syntax-check" rule hangs.
* testsuite/Makefile.tests (elide_cr): Define this to use sed.
Replace every prior use of "$(TR) -d \\r" with it.
Our just-built sed can do that job (elide CR bytes) even when the
input contains NUL bytes. Solaris 11.3's /bin/tr would remove any
NUL byte from the result. Reported by Nelson H.F. Beebe in
https://lists.gnu.org/archive/html/sed-devel/2016-12/msg00006.html
Do not bother autogenerating sed.texi from sed-in.texi. All it did
was to add a few '@group' commands. Since these are rarely modified,
add them manually. This simplifies the documentation-building rules
and lets us distribute only one copy of the texinfo manual.
See http://lists.gnu.org/archive/html/sed-devel/2016-12/msg00013.html
* doc/groupify.sed, doc/sed-in.texi: Remove files.
* doc/sed.texi: Remove the 'auto-generated' warning, as this file is no
longer auto-generated.
* doc/local.mk (doc_sed_TEXINFOS): Rename from sed_TEXINFOS.
(dist_noinst_DATA): The above renaming enables us to remove
doc/config.texi and doc/fdl.texi from this list.
(dist_noinst_SCRIPTS): Remove.
(doc/sed.texi): Remove rule.
(doc/s-texi): Likewise.
Fixes few missing issues from commit v4.2.2-176-g801a2c8,
discussed in
http://lists.gnu.org/archive/html/sed-devel/2016-12/msg00005.html
* doc/config.texi: Add stub texinfo macros '@codequotebacktick' and
'@codequoteundirected' (needed if using older versions of texinfo).
* doc/sed-in.texi: Fix syntax that's accepted by newer texinfo but
rejected by texinfo-4.13; Disable directed quote characters in examples.
* doc/sed.texi: Auto-regenerated.
* bootstrap.conf: Add gnulib's fdl module.
* doc/sed-in.texi: Update license blurb to latest recommended text.
Remove duplicated copyright information from title page (copied from
coreutil's texinfo style). Include fdl.texi in a new appendix.
Use "returns_ N env VAR=val ..." rather than "VAR=val returns_ N ...".
Some shells do not propagate envvar settings through our use
of the "returns_" function, so set any envvar via use of "env".
This was an issue at least on Ubuntu, Debian and *BSD-based systems.
* testsuite/mb-bad-delim.sh: As above.
* testsuite/mb-y-translate.sh: Likewise.
This code in configure.ac added many -W options to the list
of warnings that we do *not* enable. When I copied most of
this code into this file from coreutils, I did not try to
remove the options that happened not to be needed for sed.
Now, compilers have improved and I have done that triage.
Many -W options can be left enabled.
* configure.ac (GNULIB_WARN_CFLAGS): There is no longer any
need to use a different set of warnings for lib/ files, so
remove this variable, along with many -W-related exemptions.
The following definitions caused trouble for no gain. They caused
some .o file names to have a long additional prefix and even
resulted in some .Po files not being removed by "make distclean"
when building with recent automake. The only reason to use these
definitions was -- long ago -- to require different compiler options
for files in lib/ than elsewhere. That is no longer necessary.
* lib/local.mk (lib_libsed_a_CPPFLAGS): Remove definition.
(lib_libsed_a_CFLAGS, lib_libsed_a_LIBADD): Likewise.
(lib_libsed_a_DEPENDENCIES): Likewise.
* sed/utils.h (panic): Add __printf__ attribute, so that compilers
can diagnose format/arg-type errors. This exposed the following:
* sed/utils.c (ck_fwrite): Don't try to print size_t via %u.
Instead, use %llu and a cast to unsigned long long.
* sed/mbcs.c (is_mb_char): Cast an "int" to unsigned int, to avoid
mismatch with %x.
* sed/compile.c (finish_program): This function's sole argument
was unused. Remove it and update callers.
* sed/sed.h: Update prototype.
* sed/utils.c (register_open_file): This functions's third argument,
"temp", was unused. Remove it and update callers.
* sed/sed.c: Update use.
The 'html' target was a left-over from the recursive Makefiles,
which were converted to non-recursive in sed v4.2.2-129-g3b29bec.
With this removed, the 'html' target in 'Makefile' is correctly
genererated by automake (from doc/local.mk), and 'make html' works again.
* Makefile.am: Remove explicit 'html' target.
Regenerate sed.texi from sed-in.texi after
doc change in v4.2.2-160-10549b7 ( https://bugs.gnu.org/24799 ).
* doc/sed.texi: Regenerated with 'make info'.
Sed incorrectly matches the anchor '^' to a newline character
(ASCII 10) despite using NUL line terminators (-z).
See https://bugs.gnu.org/24615 .
Previous (incorrect) behavior:
$ printf "a\0b\0" | sed -z 'N;s/^/X/mg;' | od -An -a
X a nul b nul
With this fix:
$ printf "a\0b\0" | sed -z 'N;s/^/X/mg;' | od -An -a
X a nul X b nul
Current regex engine can not handle NUL multiline anchors.
Implement such search manually (by breaking the pattern into separate
NUL-terminated lines) and searching each one individually.
* NEWS: Mention it.
* sed/regexp.c (compile_regex_1): Don't use newline_anchor of regex, if
the buffer delimiter is not newline character.
(match_regex): Do above case line-by-line.
* testsuite/zero-anchor.good, testsuite/zero-anchor.inp,
testsuite/zero-anchor.sed: New test.
* testsuite/local.mk: Add the test.
* testsuite/Makefile.tests: Add the test.
* bootstrap.conf: Add memrchr.
* lib/.gitignore, m4/.gitignore: Ignore memrchr files.
Optimize /^/ and /$/ patterns and avoid invoking the regular expression
engine if possible.
See https://bugs.gnu.org/24615 .
* sed/regex.c (compile_regex_1): Mark the patterns which consist of ^ or $.
(match_regex): Handle the patterns which consist of ^ or $ manually.
* sed/sed.h (struct regex): New members 'begline' and 'endline'.
* testsuite/newline-anchor.good, testsuite/newline-anchor.sed,
testsuite/newline-anchor.sed: New test.
* testsuite/Makefile.tests: Add the test.
* testsuite/local.mk: Add the test.
* sed/sed.c (usage): Declare with the _Noreturn attribute to suppress
this warning/error:
sed/sed.c:359:11: error: this statement may fall through \
[-Werror=implicit-fallthrough]
usage(0);
^~~~~~~~
* sed/execute.c (execute_program) [case 'q']: Add FALLTHROUGH comment
to avoid warning from GCC 7's -Wimplicit-fallthrough.
* sed/compile.c (compile_program): Likewise.
* sed/regexp.c (compile_regex_1): Avoid building fastmap for case-
insensitive matching.
* testsuite/title-case.sh: New file, to test for this fix.
* testsuite/local.mk (T): Add the new file name and sort alphabetically.
* init.cfg (require_el_iso88597_locale_): Define.
In sandbox mode, r/w/e commands are not allowed.
This ensures sed operates only on files designated on the command line,
and cannot execute external programs.
* sed/sed.c (sandbox): New option variable.
(usage): List new option.
(main): Accept new option in getopt.
* sed/sed.h (sandbox): New extern option variable.
* sed/compile.c (DISALLOWED_CMD): New error message.
(read_filename): Abort in sandbox mode (r/w commands).
(compile_program): Abort on 'e' in sandbox mode.
* testsuite/sandbox.sh: Test new option.
* testsuite/local.mk: Add new test.
* NEWS: Mention new option.
* doc/sed-in.texi, doc/sed.texi: Document new option.
* doc/local.mk (distclean-local): Remove rule. Moved to ...
* Makefile.am (distclean-local): ...here, and add a command to
remove all .deps directories. It could have stayed in that .mk
file, but since with this change, it is no longer specific to doc/,
the top level makes more sense.
* lib/local.mk (MOSTLYCLEANFILES): Remove this. Covered by the above.
Reported by Assaf Gordon in
https://lists.gnu.org/archive/html/sed-devel/2016-08/msg00019.html
* THANKS.in: Remove Pádraig Brady: He is the author of two commits
(v4.2.1-1-g737ca5e and v4.2.1-37-g629ef76) and will be automatically
included in the auto-generated THANKS file.
* doc/local.mk (doc/sed.1): Depend not on sed.c, but on the binary
that help2man must run. Also depend on .version, to be sure we
pick up a version change. Also, be careful not to write directly
to $@: instead write to $@-t, and make read-only to mark as generated,
and then, only if all is well, rename atomically to $@.
Also, prefix commands with $(AM_V_GEN) and $(AM_V_at) and ensure
that doc/ exists via $(MKDIR_P).
(distclean-local): New target. Use this instead of ...
(dist-hook-man-page): ... this. Remove rule.
(SEDBIN): Remove unnecessary $(top_builddir)/ prefix.
(doc/sed.texi, doc/s-texi): Remove some uses of $(top_builddir).
Replace others with $(srcdir).
* Makefile (dist-hook): remove dependency on dist-hook-man-page.
* lib/local.mk (MOSTLYCLEANFILES): Arrange for lib/.deps/*.Po
to be removed as part of "make distclean", so that make distcheck
no longer fails when using latest automake.
When possible, sed now uses grep's DFA matcher to match regular
expression, often resulting in a 10x speed-up.
* NEWS (Improvements): Mention it. Move this section to the top.
* sed/local.mk (sed_sed_SOURCES): Add dfa.c, and sort file names.
(noinst_HEADERS): Add dfa.h, and sort file names.
* sed/regexp.c (dfaerror, dfawarn): New functions.
(compile_regex_1): Compile pattern with dfa.
(match_regex): Use dfa.
* sed/sed.h: Include dfa.h.
(struct regex): New member dfa.
* sed/dfa.c: New file, copied from grep.
* sed/dfa.h: New file, copied from grep.
* po/POTFILES.in: Add sed/dfa.c.
's///e' modifier is a gnu extension - reject it in --posix mode.
* sed/compile.c: (mark_subst_opt): Exit upon 's///e' in posix mode.
* testsuite/posix-mode-s.sh: Adjust tests accordingly.