* bootstrap.conf: Gnulib's stdckdint and stdbool modules are
deprecated, in favor of stdckdint-h and bool.
Induce this change with the following:
perl -pi -e 's{^stdckdint$}{$1-h};s{^stdbool$}{bool}' bootstrap.conf
And sort the resulting list of module names.
Following Pádraig Brady's example from coreutils, ...
* bootstrap.conf: Add an explicit requirement on m4.
Add an explicit requirement on texi2pdf -- often packaged separately
rather than with makeinfo -- its absence would otherwise induce a
failure late in the build process.
Replace the rsync dependency with wget,
which gnulib changed to in 2018.
Also, add an xz requirement and a version for autopoint.
* basicdefs.h: Do not include alloca.h.
* bootstrap.conf (gnulib_modules): Remove alloca, stdalign,
c-ctype, closeout, mbrlen, verify.
Add version-etc.
* lib/.gitignore, m4/.gitignore: Omit now-unused files.
* po/POTFILES.in: Remove closeout.c.
* testsuite/test-mbrtowc.c: Do not include closeout.h.
(main): Close stdout by hand, to avoid a dependency on closeout.
Fix some some longstanding but unlikely integer overflows.
Internally, 'sed' now more often prefers signed integer arithmetic,
which can be checked automatically via 'gcc -fsanitize=undefined'.
* basicdefs.h (countT): Remove. All uses replaced
with a more-specific signed type, e.g., idx_t.
Similarly, change uses of types like size_t to
signed types like idx_t when appropriate.
(REALLOC): Remove; no longer used. We now use xpalloc
because that detects integer overflow in size calculations.
Also, we no longer use XCALLOC since the code never relies
on the storage being zero, and leaving it uninitialized is
more likely to catch errors when debugging implementations
are used. We use XNMALLOC instead, or xpalloc.
* bootstrap.conf (gnulib_modules): Add stdckdint, strtoimax.
* lib/.gitignore, m4/.gitignore: Update for new Gnulib modules.
* sed/compile.c: Include stdckdint.h.
(VECTOR_ALLOC_INCREMENT): Remove; no longer used.
(in_integer): Return maximal value if integer overflow.
All callers changed to expect this.
(next_cmd_entry): Use xpalloc instead of reallocating by hand,
which might suffer integer overflow.
(normalize_text): Don’t rely on system-defined conversion
of out-of-range size_t to int.
(next_cmd_entry): Arg is now pointer, not pointer-to-pointer.
All uses changed.
* sed/debug.c (debug_print_function): Don’t attempt to
fwrite a null pointer with a zero size.
* sed/execute.c: Include <stdckdint.h>, "minmax.h".
(resize_line): LEN arg is now increment, not total length,
to avoid overflow when calculating total length.
All uses changed. Do not assume lb->alloc * 2 cannot overflow.
(resize_line, line_copy): Use xpalloc instead of doing realloc by
hand, which might suffer integer overflow.
(str_append_modified): Do not add n to to->length until
after it's known this cannot overflow.
(read_file_line): Don’t assume ssize_t fits in long.
(get_backup_file_name): Don’t assume string length fits in int.
Do not assume PTR-1+1 works; behavior is undefined if PTR
is at buffer start. Check for integer overflow in buffer
size calculation.
(read_pattern_space): Check for line number overflow.
(match_address_p): Check for address overflow.
(debug_print_line): Omit unnecessary test for in->active being null.
(execute_program): Check for Q overflow.
* sed/regexp.c: Include <stdckdint.h>.
(match_regex): Don’t assume TYPE_MAXIMUM (regoff_t) == INT_MAX.
* sed/sed.c: Include inttypes.h, for strtoimax.
(main): Use strtoimax, not atoi.
* sed/utils.c (init_buffer): Use xmalloc and xpalloc
instead of guessing sizes ourselves, and unnecessarily
initializing.
(resize_buffer): Remove; all callers changed to use xpalloc.
(free_buffer): Don’t call free (NULL), since we already
test whether the pointer is null.
* bootstrap.conf (gnulib_modules): Add mempcpy.
* sed/utils.c (ck_mkstemp): Use mempcpy instead of sprintf,
which doesn’t work with strings longer than INT_MAX.
* basicdefs.h, sed/regexp.c (N_): Remove; no longer used.
* bootstrap.conf (XGETTEXT_OPTIONS):
Treat bad_prog as a function that translates its first arg.
Omit unnecessary flags.
* sed/compile.c, sed/regexp.c (errors): Remove this array of
concatenated strings, and associated macros. All users of these
macros now simply call bad_prog ("diagnostic") instead of bad_prog
(_(DIAGNOSTIC_MACRO)). This is easier to read and maintain, and
made it easy to catch two diagnostics that were never properly
translated before: "cannot specify modifiers on empty regexp",
"missing filename in r/R/w/W commands".
* sed/compile.c (bad_command): Remove; no longer used.
(vbad_prog): New function, with most of the old bad_prog contents.
(bad_prog): Now variadic, like printf. Always translate WHY.
All callers changed.
(bad_prog_notranslate): New function.
* bootstrap.conf (gnulib_modules):
Add eloop-threshold, idx, minmax, readlink.
* configure.ac: Do not check for lstat; no longer needed.
(ENABLE_FOLLOW_SYMLINKS): Remove; all uses removed.
(TEST_SYMLINKS): Depend only on readlink.
* sed/utils.c: Include eloop-threshold.h, idx.h, minmax.h.
(SSIZE_IDX_MAX): New macro.
(follow_symlink): Rewrite to not loop when given a symlink cycle.
Do not use lstat, since readlink suffices. Use just one memory
buffer, not two; this simplifies memory management.
* testsuite/follow-symlinks.sh: Adjust diagnostics to
to match revised behavior. Test for symlink loops.
* bootstrap.conf (gnulib_modules): Remove
non-recursive-gnulib-prefix-hack.
(gnulib_tool_option_extras): Add --automake-subdir.
(bootstrap_post_import_hook): No need to massage lib/gnulib.mk.
* configure.ac [AM_INIT_AUTOMAKE]: Move subdir-objects onto the same line
as the function name, so gnulib-tool sees it.
Before this change, the two perl-requiring tests would fail
on systems without perl. Now, they are skipped, as intended.
* bootstrap.conf (gnulib_modules): Add perl.
* testsuite/no-perl: New file. From coreutils.
* testsuite/local.mk (EXTRA_DIST): Add it.
(TESTSUITE_PERL): Include testsuite/ prefix.
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* bootstrap.conf (gnulib_modules): Remove explicit mention of threadlib.
It was added back in 2012 to avoid a bootstrap failure; that explicit
mention has long been unnecessary.
Discussed in https://lists.gnu.org/r/sed-devel/2018-10/msg00001.html .
* NEWS: Mention change.
* bootstrap.conf: Add gnulib's binary-io module.
* sed/sed.c (main): Set stdin/stdout to binary mode if needed.
* sed/utils.c (ck_mkstemp): Explicitly set binary mode on file
descriptor. It seems that on (non-cygwin) Windows the fdopen(3) call
ignores the 'b' in the 'mode' argument - and the file was always opened
in O_TEXT mode. Thus "--binary" was not working with "--inplace".
For development builds (using ./bootstrap), require texinfo version 6.1
or later (Same as GNU coreutils).
Sed's manual uses texinfo's @U{} command, introduced in texinfo-6.0.
This should not affect building from released tarballs, as the info
manual is pre-built and pre-packaged in the tar archive.
Reported by Dennis Clarke in https://bugs.gnu.org/28665#14 .
* bootstrap.conf: Require makeinfo 6.1 (up from 4.13).
Switching to non-recursive makefiles broke the 'install-html' target:
The gettext plumbing requires an 'install-html' target in po/Makefile.
This was fixed in gettext v0.19.8.1-41-ge5a008a, but packages using
older gettext need to manually patch po/Makefile.in.in.
Report and suggested fix by Eric Blake in https://debbugs.gnu.org/25690 .
* bootstrap.conf (bootstrap_epilogue): Add 'install-{html,pdf,dvi,ps}'
targets to po/Makefile.in.in (if needed).
* 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.
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.
* .gitignore: Ignore '.dirstamp' files
* bootstrap.conf: Add 'non-recursive-gnulib-prefix-hack' gnulib module.
Add missing 'stdalign' module.
(bootstrap_post_import_hook): Use module to adjust gnulib.mk file.
* configure.ac: Add 'subdir-objects' automake option, don't generate
makefiles in subdirectories. Adjust path of XFAIL tests.
* Makefile.am: Include 'local.mk' files, adjust for non-recursive make.
* doc/Makefile.am: Rename to ...
* doc/local.mk: Adjust paths. Rename SED to
SEDBIN variable, to avoid overriding the default system-wide SED value
which is automatically set by autotools.
* lib/Makefile.am: Rename to ...
* lib/local.mk: Adjust paths.
* lib/.gitignore: Ignore 'stdalign.h' from gnulib module.
* sed/Makefile.am: Rename to ...
* sed/local.mk: Adjust paths.
* testsuite/Makefile.am: Rename to ...
* testsuite/local.mk: Adjust paths.
* testsuite/init.cfg: Move to ...
* init.cfg: ... here. Moved to avoid changing the path in init.sh, and to
keep the same directory structure as coreutils.
(require_en_utf8_locale_): Adjust path for get-mb-cur-max executable.
(require_ja_shiftjis_locale_,require_valid_ja_shiftjis_locale_): Adjust
path for test-mbrtowc executable.
* m4/.gitignore: Add gnulib's non-recusive-make module.
* testsuite/runtest: Adjust paths of Makefile.tests and dir variables,
Skip utility program 'get-mb-cur-max' which is not a standalone test.
* testsuite/Makefile.tests: Adjust path of sed exeutable.
* testsuite/eval.sed, testsuite/eval.good: Adjust path of sed executable.
* testsuite/cmd-R.sh,
testsuite/cmd-l.sh,
testsuite/colon-with-no-label.sh,
testsuite/comment-n.sh,
testsuite/compile-errors.sh,
testsuite/compile-tests.sh,
testsuite/convert-number.sh,
testsuite/execute-tests.sh,
testsuite/follow-symlinks-stdin.sh,
testsuite/follow-symlinks.sh,
testsuite/help-version.sh,
testsuite/in-place-hyphen.sh,
testsuite/in-place-suffix-backup.sh,
testsuite/invalid-mb-seq-UMR.sh,
testsuite/mb-bad-delim.sh,
testsuite/mb-charclass-non-utf8.sh,
testsuite/mb-match-slash.sh,
testsuite/mb-y-translate.sh,
testsuite/normalize-text.sh,
testsuite/nulldata.sh,
testsuite/panic-tests.sh,
testsuite/posix-char-class.sh,
testsuite/posix-mode-N.sh,
testsuite/posix-mode-addr.sh,
testsuite/posix-mode-bad-ref.sh,
testsuite/posix-mode-s.sh,
testsuite/range-overlap.sh,
testsuite/recursive-escape-c.sh,
testsuite/regex-errors.sh,
testsuite/stdin-prog.sh,
testsuite/subst-mb-incomplete.sh,
testsuite/subst-options.sh,
testsuite/subst-replacement.sh,
testsuite/temp-file-cleanup.sh,
testsuite/unbuffered.sh: Adjust paths of init.sh, sed executable.
Sed tests purposefully use invalid non-utf8 multibyte sequences to
test sed's handling of invalid input/program.
Some implementations wrongly accept invalid sequences, causing false
alarms. Add a test program to detect such buggy implementations and skip
the tests if needed.
See discussion in:
http://lists.gnu.org/archive/html/sed-devel/2016-07/msg00005.htmlhttp://lists.gnu.org/archive/html/sed-devel/2016-07/msg00000.htmlhttp://lists.gnu.org/archive/html/sed-devel/2016-06/msg00031.htmlhttp://lists.gnu.org/archive/html/sed-devel/2016-06/msg00014.html
* bootstrap.conf: Add gnulib's closeout module.
* m4/.gitignore, lib/.gitignore, po/POTFILES.in: Adjust after adding
closeout module.
* testsuite/Makefile.am (check_PROGRAMS): Add new program.
* testsuite/test-mbrtowc.c: New program.
* testsuite/init.cfg (require_valid_ja_eucjp_locale_)
(require_valid_ja_shiftjis_locale_): New functions. Call test-mbrtowc
with known invalid multibyte sequences to ensure implementation is not
buggy and rejects them; Skip test otherwise.
* testsuite/invalid-mb-seq-UMR.sh: Use require_valid_ja_eucjp_locale_.
* testsuite/mb-charclass-non-utf8.sh: Use require_valid_ja_shiftjis_locale_.
bootstrap.conf: Add the module name.
configure.ac: Copy boilerplate and exclusions from coreutils.
sed/Makefile.am (AM_CFLAGS): Define in terms of the two new
variables, $(WARN_CFLAGS) and $(WERROR_CFLAGS).
m4/.gitignore: Add the two new .m4 files.
* configure.ac: Turn on silent rules, by default.
Use git-derived versions all the time. Required a new, signed
v4.2.2 tag, which I've pushed.
Distribute .tar.xz tarballs, not .bzip2 or .gz.
* Makefile.am (AUTOMAKE_OPTIONS): Remove.
* bootstrap.conf (gnulib_modules): Add git-version-gen.
* ChangeLog-2014: Renamed from ChangeLog.
* po/ChangeLog-2014: Renamed from po/ChangeLog.
* Makefile.am (EXTRA_DIST): Add the two new file names.
(dist-hook): Generate ChangeLog at tarball-creation time.
(gen-ChangeLog): New rule. Just like the one in coreutils and grep.
* bootstrap.conf (gnulib_modules): Add the modules, readme-release
and gitlog-to-changelog, and revamp to be much more like grep and
coreutils.
* lib/Makefile.am: Update.
headers.
2013-10-06 Jose E. Marchesi <jemarch@gnu.org>
* basicdefs.h (PATH_MAX): Defined to some constant in case it is
not defined by system headers.
* sed/utils.c: Do not include pathmax.h anymore.
* bootstrap.conf (gnulib_modules): Do not use the gnulib module
pathmax.
Without this change, trying to bootstrap GNU sed from a freshly-cloned
Git checkout aborts with an error like this:
./bootstrap: aclocal --force -I m4 ...
./bootstrap: autoconf --force ...
configure.ac:20: error: possibly undefined macro: gl_DISABLE_THREADS
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
* bootstrap.conf (gnulib_modules): Add 'threadlib'.
Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>