Commit Graph
457 Commits
Author SHA1 Message Date
Jim Meyering 031fa38f4e tests: support perl-based tests like those of grep and coreutils
* configure.ac: Define HAVE_PERL.
* testsuite/Coreutils.pm: New file. From grep.
* testsuite/CuSkip.pm: Likewise.
* testsuite/CuTmpdir.pm: Likewise.
* testsuite/local.mk (, TEST_EXTENSIONS): Add .pl.
(TESTSUITE_PERL, TESTSUITE_PERL_OPTIONS): Define.
(PL_LOG_COMPILER): Define.
(EXTRA_DIST): Add the new .pm files.
2017-04-22 13:23:03 -04:00
Assaf Gordon 11a2a701ec sed: enable special meaning of '+' with '-E --posix'
in sed-4.2 and later, '--posix' option wrongly disabled the special meaning
of '+' even in ERE mode (--posix should only disable it in BRE mode,
since it is a GNU extension in BRE). Bug introduced in the original
implementation of --posix in v4.1a-5-gba68fb4.
Reported by Jordan Torbiak in https://bugs.gnu.org/26409 .

* NEWS: Mention bug fix.
* sed/regexp.c (compile_regex_1): In --posix mode, set RE_LIMITED_OPS
only in BRE mode.
* testsuite/posix-mode-ERE.sh: New test.
* testsuite/local.mk: Add new test.
2017-04-18 20:47:41 -04:00
Assaf Gordon 156e6be99f tests: test comments, braces after commands
Test multiple combinations of comments, spaces, braces after commands,
to validate recently added function 'read_end_of_cmd()'.
See discussion in https://bugs.gnu.org/22460 .

* testsuite/command-endings.sh: New test, including y/// bug.
* testsuite/local.mk: Add new test.
2017-03-21 22:33:39 -04:00
Assaf Gordon 9b26a0651a sed: refactor end-of-line parsing
Follow-up to bug#22460: extract repeated code to parse end of lines
(while saving comments, braces) into a new function.
See discussion in https://bugs.gnu.org/22460 .

* sec/compile.c (read_end_of_cmd): New function, consumes sed script
input until newline, EOF, semicolon, closing brace or comment is found.
(compile_program): Call new function instead of duplicating code.
2017-03-21 22:30:17 -04:00
Thorsten Heymann cf8eb6cb39 sed: allow comments, braces after y///
sed-4.4 and earlier rejected the following:
  $ sed 'y/1/a/ #f'
  sed: -e expression #1, char 8: extra characters after command

See https://bugs.gnu.org/22460 .

* sed/compile.c (compile_program): Handle comments, braces after 'y' command.
* NEWS: Mention it.
2017-03-21 22:14:29 -04:00
Kent Fredric b092d4a6c0 tests: ensure tty device is readable before running test
Unreadable tty's fail with a different permissions error
instead of failing with "is a tty" error.
Reported in https://bugs.gnu.org/25692 .

* testsuite/panic-tests.sh: Run test if tty device is both readable
and writable.

Copyright-paperwork-exempt: Yes
2017-03-19 22:28:42 -04:00
Assaf Gordon 05800ee0b7 doc: expand "locale considerations" (multibyte) section
Show examples of processing valid and invalid characters.
Mention \L,\U for s/// command.
Combines reports from:
 https://bugs.debian.org/500501
 https://lists.gnu.org/archive/html/coreutils/2017-02/msg00039.html

* doc/sed.texi (Locale Consideration): Expand section.
* doc/config.texi: Add variables to render unicode characters portably.
2017-03-08 01:06:01 +00:00
Assaf Gordon a36e8abccc doc: warn against misuse of -i with other options
'sed -iE' is not the same as 'sed -Ei'. 'sed -ni' is dangerous.
From https://bugs.debian.org/832088

* doc/sed.texi (Command-Line Options): Explain and add examples
to '-i/--in-place' item.
2017-02-24 01:18:28 -05:00
Assaf Gordon de6b6ccd74 doc: elaborate about regex matching on pattern space
Regex addresses work on current pattern space, not on the original
input lines. From https://bugs.debian.org/284646

* doc/sed.texi (Regexp Addresses): Add a paragraph and an example.
* doc/sed.x (Addresses): Add a sentence about regexp.
2017-02-24 00:49:20 -05:00
Assaf Gordon a805d57e1f doc: mention escape-sequence precedence
Unescaping takes place before passing the pattern to the regex engine:
    $ echo 'a^c' | sed -e 's/\x5e/b/'
    ba^c

From: https://bugs.debian.org/605142

* doc/sed.texi (Escaping Precedence): Add new subsection under 'escape
sequences' with examples.
2017-02-24 00:22:51 -05:00
Assaf Gordon 75e5a9b686 build: fix 'install-html' target
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).
2017-02-16 21:07:21 -05:00
Alexandre Jasmin 1c6030213b doc: reference the i command in /regexp/I
Remove "TODO: add @code{pxref}" in the text and add the ref.

* doc/sed.texi (selecting lines by text matching): Add reference.
2017-02-09 23:00:35 -05:00
Alexandre Jasmin 45aae495cb doc: rework BRE/ERE table to fit PDF manual
Sample code in the basic/extended table was too wide to fit on a Letter
size printout. Text was overlapping and unreadable. Remove margin,
split commands in two lines and change the column with.

* doc/sed.texi (Basic and extended regexp): Rework table.
2017-02-09 23:00:35 -05:00
Alexandre Jasmin 5fbc15c812 doc: change description of the r command
"Reads text file a file" was probably a typo. Also remove "Example: " in
the summary as there's no example there.

* doc/sed.texi (sed scripts): Fix r command description.

Copyright-paperwork-exempt: Yes
2017-02-07 09:29:48 +00:00
Alexandre Jasmin 755e9434c0 doc: fix copy-pasted examples of regexp
The samples commands demonstrating '\B' and '\S' were both using '\w'.
The commands output is correct.

* doc/sed.texi (Regular Expression Extensions): Use the proper commands.

Copyright-paperwork-exempt: Yes
2017-02-07 09:28:04 +00:00
Jim Meyering fe3f8af814 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2017-02-03 17:17:45 -08:00
Jim Meyering 63101f3408 version 4.4
* NEWS: Record release date.
v4.4
2017-02-03 17:14:13 -08:00
Jim Meyering d8962bc8e1 gnulib: update to latest 2017-02-03 16:35:47 -08:00
Jim Meyering db7c7674ae maint: avoid %x-format argument type mismatch
* sed/compile.c (savchar): Cast %x-format argument to "unsigned int"
rather than to "unsigned char".  Reported by Eric Blake in
https://lists.gnu.org/archive/html/sed-devel/2017-02/msg00000.html
2017-02-03 16:35:47 -08:00
Assaf Gordon 61cf98dc1c doc: fix broken xref
Remove an extraneous space after @xref. Older 'makeinfo' would fail with:

  ./doc/sed.texi:3461: @xref expected braces.
  ./doc/sed.texi:3461: ` {Execution Cycle} and @ref{Addresses ov...' is
                         too long for expansion; not expanded.

Introduced in sed-4.3-15-gb0009b8.

* doc/sed.texi: Remove space after @xref.
2017-02-03 02:38:45 -05:00
Jim Meyering e9ab614280 gnulib: update to latest 2017-01-31 09:45:43 -08:00
Assaf Gordon 3b0404131f doc: add NEWS entry for recent newline bugfix
Bugfix in sed-4.3-12-g44d99bf (for https://bugs.gnu.org/25390) did not
included a corresponding NEWS entry.

* NEWS: Mention bugfix.
2017-01-31 12:22:46 -05:00
Assaf Gordon cca9795a71 doc: new 'multiple commands syntax' section
Explain which commands can be separated by semicolon and which require
newlines. Requested by Ori Avtalion in https://bugs.gnu.org/21845 .

* doc/sed.texi (Multiple commands syntax): New section in "sed scripts"
chapter.
2017-01-28 15:21:39 -05:00
Assaf Gordon 3365c939c8 doc: update 'other resources' chapter
Remove broken link and update other resources in the manual.
Reported by olszkocj@aol.com in https://bugs.gnu.org/24770 .

* doc/sed.texi (Other Resources): Update wording.
2017-01-24 22:23:23 -05:00
Jim Meyering 572d0a59d3 maint: update bootstrap and init.sh
* bootstrap: Update from gnulib.
* testsuite/init.sh: Likewise.
2017-01-18 08:03:15 -08:00
Assaf Gordon b0009b8dd7 doc: add 'branching and flow control' section
* doc/sed.texi (Branching and flow control): New section under 'Advanced
Sed' chapter.
2017-01-17 00:11:25 -05:00
Assaf Gordon 8143a730f2 doc: add 'join lines' example
* doc/sed.texi (Joining lines): Add example of joining SMTP header
lines.
2017-01-17 00:11:25 -05:00
Norihiro Tanaka 0f98f0055e tests: new test for dfa newline bug
sed-4.3 would segfault with:
   printf '$LINENO $LINEN\nB\n' | sed -e 'N;s/\$LINENO\(.*\n\)/\1/'

Culprit is dfa crash if multi-lines are read in pattern space.
It is fixed at gnulib commit v0.1-1117-g823b5cb .
Reported by S. Gilles in https://bugs.gnu.org/25390

* testsuite/newline-dfa-bug.sh: New test.
* testsuite/local.mk: Add the test.
2017-01-16 23:40:25 -05:00
Assaf Gordon 44d99bf5c9 gnulib: update to latest (with fix for dfa newline bug)
sed-4.3 would segfault due to dfa bug, see https://bugs.gnu.org/25390 .

* gnulib: Update to latest with various dfa fixes and improvement.
* m4/.gitignore: Add 'std-gnu11.m4', 'pthread_rwlock_rdlock.m4'.
2017-01-16 23:40:00 -05:00
Assaf Gordon 2ecd4e1d91 doc: improve README installation instructions
Mention README-hacking for git users.
Issue raised by Jean-Christophe Manciot in https://bugs.gnu.org/25377 .

* README: Improve installation paragraph based on coreutils' README.
2017-01-16 21:47:24 -05:00
Jim Meyering 33e29e5863 maint: avoid syntax-check-exposed nit
* doc/local.mk (doc/sed.1): Use $(...) rather than @...@.
2017-01-16 14:36:00 -08:00
Jim Meyering 03e44bade8 maint: do not distribute COPYING.DOC
* COPYING.DOC: Remove this file, now that we have doc/fdl.texi.
* Makefile.am (EXTRA_DIST): Don't distribute it.
2017-01-15 09:19:12 -08:00
Jim Meyering 1d7ee2d553 tests: skip valgrind-running tests when ASAN-enabled
* init.cfg (require_valgrind_): Skip when we detect that the
binary is ASAN-enabled.
2017-01-14 15:34:08 -08:00
Vagelis Prokopiou 2724baeb68 maint: insert missing word in comment
* sed/sed.h (struct vector)[v_allocated]: Insert "of".
Copyright-paperwork-exempt: Yes
2017-01-13 14:39:54 -08:00
Assaf Gordon a0a25e3ee3 build: skip building man page if needed
Skip building the man page if building from tarball (where 'doc/sed.1'
is already prebuilt). Build a stub if building from git but generating
the man page isn't possible (if there's no Perl or cross-compiling).
Cross-compilation issue reported by Vishal Biswas in
https://bugs.gnu.org/25358 .
Problematic 'perl' is related to https://bugs.gnu.org/25367 .

* configure.ac: Check for Perl, cross-compilation and tarball build;
Set automake variable BUILD_MAN_PAGE, BUILD_DUMMY_MAN_PAGE accordingly.
* doc/local.mk (doc/sed.1): Build conditionally if BUILD_MAN_PAGE is true;
Create a dummy man page if BUILD_DUMMY_MAN_PAGE is true.
* doc/sed-dummy.1: Stub man page.
2017-01-09 22:24:07 -05:00
Assaf Gordon ad68a128df build: fix out-of-tree builds without dep-tracking
Create sed,lib,doc,testsuite subdirectories at the end of
'configure', preventing build problems when building out of tree
with --disable-dependency-tracking.
Reported by Juan M. Guerrero in https://bugs.gnu.org/25371 .

* configure.ac: Call AS_MKDIR_P() to create subdirectories.
2017-01-08 21:36:25 -05:00
Jim Meyering 2a6eccb7ee doc: fix NEWS typo
* NEWS: Fix typo s/introducted/introduced/
* cfg.mk (old_NEWS_hash): Update.
Reported by Karl Berry.
2017-01-07 16:46:55 -08:00
Jim Meyering 1ceaa652a5 maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2017-01-01 03:17:39 -08:00
Jim Meyering a14ff8c426 maint: compile warning-free with -DDEBUG_LEAKS
* sed/regexp.c (release_regex) [DEBUG_LEAKS]: Modernize declaration.
2017-01-01 03:12:34 -08:00
Jim Meyering a05ba694a3 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2016-12-30 01:28:29 -08:00
Jim Meyering c99c370e7c version 4.3
* NEWS: Record release date.
v4.3
2016-12-30 01:27:19 -08:00
Jim Meyering 1e7c126cda gnulib: update to latest, to fix parallel getopt test failure 2016-12-30 01:24:10 -08:00
Assaf Gordon 5a77cbf29a doc: new annotated example for N/P/D/b commands
Illustrates how to restructure line breaks over multiple lines.

* doc/sed.texi (Line length adjustment): New section.
2016-12-28 22:33:02 -05:00
Assaf Gordon aed5e43919 doc: new annotated example section for N/D commands
Illustrate how to use N/D to search for doubled-word spanning
multiple lines.

* doc/sed.texi (Text search across mutliple lines): New section.
2016-12-28 22:33:02 -05:00
Assaf Gordon 1d57c105e6 doc: add 'multiline techniques' section
Expand on using D,G,H,N,P commands to process multiple lines.

* doc/sed.texi (Multiline techniques): New section.
2016-12-28 21:26:28 -05:00
Assaf Gordon 53e2747eb5 maint: update m4/.gitignore
* m4/.gitignore: Add 'dirfd.m4', 'hard-locale.m4'.
2016-12-22 09:44:33 +01:00
Jim Meyering 24393537a7 maint: RE_ICASE, RE_NO_SUB: remove useless '#ifdef's
* sed/regexp.c (compile_regex_1): Remove #ifdef RE_ICASE guard,
since dfa.c uses it unconditionally.  Suggested by Norihiro Tanaka.
Also remove the nearby "#ifdef RE_NO_SUB".  Those macros are guaranteed
to be defined by virtue of configure-time tests that ensure we're using
either a new-enough native glibc (RE_NO_SUB was added in 2004), or the
included replacement.
2016-12-20 12:25:10 +01:00
Jim Meyering 6df8dd295f gnulib: update to latest; dfa improvement and getopt-posix-tests build fix 2016-12-19 08:50:14 -08:00
Jim Meyering 9ce9ee19f8 gnulib: update to latest and adapt to modified dfa API
* sed/regexp.c (compile_regex_1): Do away with use of DFA_CASE_FOLD.
This gnulib update pulls in a dfa module in which that symbol no
longer exists.  Instead, it uses RE_ICASE in syntax bits.
* m4/.gitignore: Add files created by running bootstrap.
* lib/.gitignore: Likewise.
2016-12-18 11:13:06 -08:00
Jim Meyering 937b1ba642 tests: use just-built sed in more places
* 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.
2016-12-18 11:19:15 +01:00