Commit Graph
127 Commits
Author SHA1 Message Date
Paolo Bonzini b2a79b1be7 fix help text for -i
2011-08-29  Paolo Bonzini  <bonzini@gnu.org>

	* sed/sed.c (usage): Fix documentation for -i.  Reported by
	Dennis Bartlett.
2011-08-29 10:29:38 +02:00
Jim Meyering 257d20967c avoid silent data loss when an input line is 231 bytes or longer
If one line in a file has length (including newline) of 231, then
applying sed -i to that file truncates it to size 0.  I first
noticed it like this: Create a file with line of length 231-1
  $ perl -le 'print "v"x(2**31-1)' > k
Then prepend a byte to that line:
  $ sed -i 's/^/v/' k
Surprise!  The file is empty.
* sed/utils.c (ck_getline): Declare "result" to be of type ssize_t,
rather than int, to match the return type of getline.
2011-07-25 08:44:51 +02:00
Pádraig Brady 3a7fdd5f0a avoid reopening stdin
This adjusts the change made in 3a8e165a,
to not reopen stdin on platforms where there
is no separate "binary mode".

That added some overhead and also precludes the
use of tools like `stdbuf -i...`.

* execute.c (open_next_file): Only reopen stdin on windos.
2011-07-04 12:44:54 +02:00
Paolo Bonzini 564c30de0d document corner case of \l and \u, and simplify the code handling it
2011-05-27  Paolo Bonzini  <bonzini@gnu.org>

	* doc/sed-in.texi: Explain behavior of \l and \u at the end
	of the replacement text.
	* doc/sed.texi: Regenerate.
	* sed/execute.c (append_replacement, do_subst): Further
	simplification.
2011-05-27 09:45:59 +02:00
Paolo Bonzini e3b3623c39 fix incorrect comments in the "Increment a number" example.
2011-05-27  Paolo Bonzini  <bonzini@gnu.org>

	* doc/sed-in.texi: Fix incorrect comment in the "Increment a
	number" example.  Reported by Wu Liang and Micah Cowan.
        * doc/sed.texi: Regenerate.
2011-05-27 09:45:14 +02:00
Paolo Bonzini 49864a434b clang analyzer cleanups
2011-03-11  Paolo Bonzini  <bonzini@gnu.org>

	* sed/compile.c (normalize_text): Clang analyzer cleanup.
	* sed/execute.c (append_replacement, do_subst): Same.
	* sed/utils.c (ck_getline): Same.
2011-05-27 09:44:58 +02:00
Paolo Bonzini 3537b7b10e fix Makefile.am 2011-05-27 09:43:35 +02:00
Jari Aalto fd0da133a7 order command alphabetically in man page
2010-11-13  Jari Aalto  <jari.aalto@cante.net>

	* doc/sed.x: Order commands alphabetically.
2010-12-13 14:09:19 +01:00
Paolo Bonzini ac854c6b20 small fixes to "rename files" example
2010-11-10  Paolo Bonzini  <bonzini@gnu.org>

	* doc/sed-in.texi: Fix double negation in comment, escape
	file names.
2010-12-13 14:09:19 +01:00
Eric Blake 165b9a8e12 avoid compiler warnings regarding ctype functions
* basicdefs.h (ISDIGIT): Avoid compiler warning on cygwin.
* sed/compile.c (normalize_text): Avoid undefined behavior.
2010-11-03 17:14:20 +01:00
Eric Blake a5bc8fd5d6 avoid compiler warning
* sed/sed.c (includes): Supply missing header.
2010-11-03 17:14:18 +01:00
Paolo Bonzini 619e9026d4 downgrade minimum requested version of gettext to 0.17.
2010-11-01  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Replace gettext with gettext-h.  Suggested by
	Gerald Pfeifer and Eric Blake.
	* configure.ac: Downgrade minimum requested version of gettext
	to 0.17.
2010-11-01 15:35:06 +01:00
Paolo Bonzini ad0793145b Commit regenerated doc/sed.texi 2010-11-01 15:34:41 +01:00
Paolo Bonzini 9d53087645 2010-10-31 Gerald Pfeifer <gerald@pfeifer.com>
* doc/sed-in.texi (Extended regexps): Add '|' to the list of
	differences.  Note that "\|" is a GNU extension to begin with.
2010-10-31 22:56:30 +01:00
Paolo Bonzini 311bd56c6c fix previous commit 2010-10-31 22:55:44 +01:00
Paolo Bonzini 3c9cae6ca8 fix lseek errors from flushing input pipes on interix
2010-10-20  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add fwriting.
	* sed/utils.c: Use it.
2010-10-20 19:59:18 +02:00
Paolo Bonzini b6844362ed bump minimal gettext version 2010-08-30 14:06:44 +02:00
Paolo Bonzini 157f5391e0 use version-etc-fsf
2010-08-30  Paolo Bonzini  <bonzini@gnu.org>

	* Makefile.am (dist-hook): Remove COPYRIGHT_YEAR check.
	* autoboot.conf (gnulib_modules): Add version-etc-fsf.
	* configure.ac (COPYRIGHT_YEAR): Remove.  Change package name to
	"GNU sed".
	* doc/sed.1: Regenerate.
	* sed/sed.c (AUTHORS): New.
	(main): Use version_etc.
2010-08-30 14:06:44 +02:00
Paolo Bonzini a4fb8b02e0 fix typo in the manual
2010-05-03  Timothy Baker  <timothypaulbaker@gmail.com> (tiny change)

	* doc/sed.texi (Regular expressions): Fix typo.
2010-08-30 11:10:12 +02:00
Paolo Bonzini 0567fdb243 fix imprecision in the documentation of `D'
2010-08-17  Paolo Bonzini  <bonzini@gnu.org>

	Fix imprecision in the documentation of `D'.
	* doc/sed-in.texi (D command): Fix documentation of behavior for
	pattern space ending with \n and with no other newline.
	Reported by Randall Cotton.
	* doc/sed.x (D command): Fix documentation of behavior for
	pattern space ending with \n and with no other newline.
	* doc/sed.texi: Regenerate.
	* doc/sed.1: Regenerate.

2010-07-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2010-08-17 02:00:05 +02:00
Ralf Wildenhues 327beba781 Let --posix turn off nonportable scripts ending in backslash.
* sed/compile.c (errors, INCOMPLETE_CMD): New error string.
(compile_program): In strict posix mode, complain about incomplete
command.
* NEWS: Update.
Report by Bruno Haible.
2010-08-17 02:00:05 +02:00
Paolo Bonzini f38d4c196a use mkostemp(template, 0) instead of mkstemp to work around Cygwin oddity
2010-07-16  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf (gnulib_modules): Replace mkstemp with mkostemp.
	* bootstrap.sh.in: Compile mkostemp.c instead of mkstemp.c.
        * gnulib: Update.
        * NEWS: Mention change.
	* sed/utils.c (ck_mkstemp): Use mkostemp to work around Cygwin
	oddity.  Reported by Stepan Kasal.
2010-08-17 02:00:04 +02:00
Paolo Bonzini ef5fa3958d ignore INSTALL 2009-12-27 17:20:22 +01:00
Ralf Wildenhues 0ae2f2809b add F command.
2009-11-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* doc/sed.texi (Extended Commands): Document F command.
	* doc/sed-in.texi: Regenerate.
	* sed/compile.c (compile_program): Accept 'F' if not --posix.
	* sed/execute.c (open_next_file): Always initialize in_file_name.
	(execute_program): Handle 'F'.
	* configure.ac: Bump SED_FEATURE_VERSION.
	* NEWS: Update.
2009-12-27 17:20:11 +01:00
Paolo Bonzini 118d2df47a fix debian bug 559539
2009-12-07  Clint Adams  <schizo@debian.org>  (tiny change)

	* sed/execute.c (open_next_file): If is_selinux_enabled returns -1,
	treat it as "disabled".
2009-12-07 14:41:49 +01:00
Paolo Bonzini 70172377a7 merge 5156c19b correctly
2009-10-15  Paolo Bonzini  <bonzini@gnu.org>

	* sed/execute.c (closedown, open_next_file): Merge 5156c19b correctly.
	* sed/utils.c: Likewise.
2009-10-15 20:13:26 +02:00
Paolo Bonzini d5af5096d9 handle incomplete sequences as if they were invalid
2009-10-15  Paolo Bonzini  <bonzini@gnu.org>
	    WANG Yunfeng  <uhuruh@gmail.com>

	* sed/execute.c (str_append, str_append_modified): Handle incomplete
	sequences as if they were invalid.
2009-10-15 20:03:17 +02:00
Paolo Bonzini 0d0505663e more configury simplification
2009-10-14  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Use cache variables rather than AC_CHECK_FUNC.
2009-10-14 11:13:04 +02:00
Paolo Bonzini b318a62f16 simplify some configury
2009-10-14  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Remove obselete configure tests.
	* sed/fmt.c: Assume limits.h is always present.
	* sed/utils.c: Assume vfprintf is always present.
2009-10-14 11:08:34 +02:00
Yury G. Kudryashov 727f353d70 override LC_ALL in testsuite rather than LANG
2009-10-14  Yuri G. Kudryashov  <urkud.urkud@gmail.com> (tiny change)

	* testsuite/Makefile.tests: Override LC_ALL, not LANG.
2009-10-14 10:54:09 +02:00
Ralf Wildenhues b651f13f6b manual fixes
2009-10-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* doc/sed-in.texi (Invoking sed): Add index entries for --posix,
	-s, --separate.
	(Other Commands): Fix typo.
	* doc/sed.texi: Regenerate.
2009-10-12 11:04:50 +02:00
Paolo Bonzini c91576d9b5 document how to separate commands
2009-09-07  Dmitry Chistikov <dd1email@gmail.com> (tiny change)

	* doc/sed-in.texi: Document how to separate commands.
2009-09-07 08:55:38 +02:00
Paolo Bonzini a45983f407 configury tweaks
2009-08-30  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add ssize_t.
	* configure.ac: Remove useless stuff, bump gettext requirement to 0.17.
2009-08-31 10:18:36 +02:00
Bake Timmons 026b129c6a Fix documentation typo.
2009-08-10  Bake Timmons  <b3timmons@speedymail.org> (tiny change)

	* doc/sed-in.texi: Fix typo.
2009-08-10 20:09:11 +02:00
Pádraig Brady 6f9a9b60da make -u unbuffer input files as per the documentation
* sed/execute.c: call setvbuf() to turn off input buffering
* sed/sed.c: rename unbuffered_output to more accurate unbuffered
* sed/sed.h: ditto
2009-07-22 18:42:09 +02:00
Paolo Bonzini 730fc21dd1 security fixes for partially created files
2009-06-25  Paolo Bonzini  <bonzini@gnu.org>

	* execute.c: Do not copy ACLs until the file is copied.
	* utils.c (ck_mkstemp): Set a restrictive umask on temporary files.
2009-06-25 20:54:10 +02:00
Paolo Bonzini 3817efe1dd preserve security contexts too on sed -i
2009-06-25  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add selinux-h.
	* execute.c: Copy over file creation context before creating a new file.
2009-06-25 20:53:47 +02:00
Paolo Bonzini 2b26b63822 add memchr module from gnulib again
2009-06-15  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add memchr again.
	* gnulib: Update.
2009-06-25 20:49:00 +02:00
Paolo Bonzini 47e188fb2c fix off-by-one bug causing -i problems under Cygwin
2009-06-11  Sergey Farbotka  <z8sergey8z@gmail.com>  (tiny change)

	* sed/execute.c (open_next_file): Fix off-by-one causing problems
	under Cygwin.
2009-06-11 12:09:56 +02:00
Paolo Bonzini f94164fd9f fix bug with s/[[[]//
2009-05-11  Paolo Bonzini  <bonzini@gnu.org>

	* sed/compile.c (snarf_char_class): Fix logic bug with [[[ in regular
	expressions (and a possibly uninitialized use of variable delim stemming
	from the bug).  Uninitialized variable bug reported by Zhongxing Xu.
	* testsuite/brackets.good: New.
	* testsuite/brackets.inp: New.
	* testsuite/brackets.sed: New.
	* testsuite/Makefile.am: Add test.
	* testsuite/Makefile.tests: Add test.
2009-05-11 10:56:05 +02:00
Paolo Bonzini 1104ef346a fix copyright years and notice
2009-05-11  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Define COPYRIGHT_YEAR.
	* Makefile.am (dist-hook): Test it.
	* sed/mbcs.c: Fix copyright years.
	* sed/sed.c: Fix copyright years.  Change COPYRIGHT_NOTICE to
	COPYRIGHT_YEAR.
	* sed/utils.c: Fix copyright years.
	* testsuite/version.gin: Use COPYRIGHT_YEAR.
2009-05-11 10:56:04 +02:00
Paolo Bonzini 7dcd3eca60 declare bool arguments as int instead to please AIX XLC
2009-04-30  Paolo Bonzini  <bonzini@gnu.org>

	* sed/compile.c: Declare bool arguments as int instead to please AIX XLC.
	* sed/execute.c: Declare bool arguments as int instead to please AIX XLC.
	* sed/utils.c: Declare bool arguments as int instead to please AIX XLC.
	* sed/utils.h: Declare bool arguments as int instead to please AIX XLC.
2009-05-11 10:55:56 +02:00
Paolo Bonzini 67a10f7750 XFAIL bsd test where appropriate
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: XFAIL bsd test where appropriate.
2009-05-11 10:55:45 +02:00
Paolo Bonzini 0270ded98d fix readin test properly
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Do not create homonymous links from builddir to srcdir.
	* testsuite/Makefile.tests: Create readin.in2 here.
	* testsuite/Makefile.am: Do not distribute it.
2009-05-11 10:55:24 +02:00
Paolo Bonzini 888ad7b090 handle CRLF endings in the testsuite for mingw
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* testsuite/Makefile.tests: Handle CRLF endings for mingw.
2009-04-27 12:14:34 +02:00
Paolo Bonzini c651492afc add rename module from gnulib
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* autoboot.conf: Add rename.
	* gnulib: Update.
2009-04-27 12:13:08 +02:00
Paolo Bonzini 8dfd22c9e7 fixes after Bruno's testing
2009-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* configure.ac: Link readin.in2 into builddir.
	* configure: Regenerate.
	* doc/Makefile.am: Do not distribute sed.html.  Do not update
	sed.texi if the output does not change.
	* sed/Makefile.am: Order libraries according to their dependencies.
	* sed/compile.c (get_openfile): Declare FAIL as int.
	* sed/sed.c: Avoid printf ("") if REG_PERL is not defined.
	* testsuite/eval.in2: Do not include in the repository.
	* testsuite/Makefile.am: Clean always eval.in2 and never readin.in2.
	* testsuite/Makefile.tests: Provide a default empty definition of TIME
	and remove rules for readin.in2.
2009-04-27 12:11:54 +02:00
Paolo Bonzini d2779dddb6 update gnulib prior to release 2009-04-27 12:09:39 +02:00
Paolo Bonzini 9e05f0af86 fix macro redefinition warnings for bootstrap.sh
2009-03-31  Paolo Bonzini  <bonzini@gnu.org>

	* bootstrap.sh.in: Add __bool_true_false_are_defined.
	* bootstrap.sh: Regenerate.
	* basicdefs.h: Do not provide bool definitions for BOOTSTRAP at all.
2009-04-27 12:07:39 +02:00
Paolo Bonzini a47e642f46 improve `sed --version' output
2009-03-31  Paolo Bonzini  <bonzini@gnu.org>

	* sed/sed.c (contact): New.
	(usage): From here.
	(main): Use it for `sed --version' too.

        * configure.ac: Point to GNU project mailing lists.
        * sed/sed.c (contact): Use PACKAGE_BUGREPORT.
        * testsuite/version.gin: Likewise.
        * testsuite/version.good: Regenerate.
        * doc/sed.1: Regenerate.

        * bootstrap.sh.in (PACKAGE_BUGREPORT): New.
        * bootstrap.sh: Regenerate.
2009-04-27 12:07:38 +02:00