I will probably push these shortly. One is a bad comment in configure files, another is related to this thread: http://news.gmane.org/gmane.comp.lib.gnulib.bugs
It turns out that the set size issue is already mentioned in POSIX: "When the −d option is not specified: ...When the array specified by string2 is shorter that the one specified by string1, the results are unspecified." >From 53f30e4287a820f8a039dad2af19a16546dab819 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Mon, 21 Dec 2009 16:47:57 -0700 Subject: [PATCH 1/2] Fix comment in AC_CHECK_DECLS. * lib/autoconf/general.m4 (AC_CHECK_DECL): Document the includes argument to the shell function. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 6 ++++++ lib/autoconf/general.m4 | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64a499e..ad43245 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-29 Eric Blake <e...@byu.net> + + Fix comment in AC_CHECK_DECLS. + * lib/autoconf/general.m4 (AC_CHECK_DECL): Document the includes + argument to the shell function. + 2009-12-15 Ralf Wildenhues <ralf.wildenh...@gmx.de> Add testsuite exposure for shtool usage. diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e41c2c9..6580e7f 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2811,8 +2811,9 @@ m4_define([_AC_CHECK_DECL_BODY], AC_DEFUN([AC_CHECK_DECL], [AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_decl], [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_decl], - [LINENO SYMBOL VAR], - [Tests whether SYMBOL is declared, setting cache variable VAR accordingly.])], + [LINENO SYMBOL VAR INCLUDES], + [Tests whether SYMBOL is declared in INCLUDES, setting cache variable + VAR accordingly.])], [_$0_BODY])]dnl [AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])]dnl [ac_fn_[]_AC_LANG_ABBREV[]_check_decl ]dnl -- 1.6.4.2 >From 1e5723b1551099ed50188272dc69f96c6ea05e71 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Tue, 29 Dec 2009 14:57:35 -0700 Subject: [PATCH 2/2] Improve documentation on tr portability. * doc/autoconf.texi (Limitations of Usual Tools) <tr>: Refine description of NUL handling. Document set size issue. Reported by Bruno Haible. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 5 +++++ doc/autoconf.texi | 30 +++++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad43245..9f83625 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-12-29 Eric Blake <e...@byu.net> + Improve documentation on tr portability. + * doc/autoconf.texi (Limitations of Usual Tools) <tr>: Refine + description of NUL handling. Document set size issue. + Reported by Bruno Haible. + Fix comment in AC_CHECK_DECLS. * lib/autoconf/general.m4 (AC_CHECK_DECL): Document the includes argument to the shell function. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 76bb279..335bb33 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -18336,23 +18336,31 @@ Limitations of Usual Tools HAZY FANTAZY @end example +When providing two arguments, be sure the second string is at least as +long as the first. + +...@example +$ @kbd{echo abc | /usr/xpg4/bin/tr bc d} +adc +$ @kbd{echo abc | tr bc d} +add +...@end example + Posix requires @command{tr} to operate on binary files. But at least -Solaris @command{/usr/ucb/tr} and @command{/usr/bin/tr} still fail to -handle @samp{\0} as the octal escape for @code{NUL}; these programs -always discard all @code{NUL} bytes from the input. On Solaris, when +Solaris @command{/usr/ucb/tr} fails to handle @samp{\0} as the octal +escape for @code{NUL}, and Solaris @command{/usr/bin/tr} silently +discards @code{NUL} in the input prior to doing any translation. When using @command{tr} to process a binary file that may contain @code{NUL} bytes, it is necessary to use @command{/usr/xpg4/bin/tr} instead, or @command{/usr/xpg6/bin/tr} if that is available. @example -$ @kbd{printf 'a\0b\n' | /usr/ucb/tr '\0' '~' | wc -c} -3 -$ @kbd{printf 'a\0b\n' | /usr/xpg4/bin/tr '\0' '~' | wc -c} -4 -$ @kbd{printf 'a\0b\n' | /usr/ucb/tr x x | wc -c} -3 -$ @kbd{printf 'a\0b\n' | /usr/xpg4/bin/tr x x | wc -c} -4 +$ @kbd{printf 'ab\0c' | /usr/ucb/tr 'a\0' '\0d' | od -An -tx1} + 61 62 63 +$ @kbd{printf 'ab\0c' | /usr/bin/tr 'a\0' '\0d' | od -An -tx1} + 00 62 63 +$ @kbd{printf 'ab\0c' | /usr/xpg4/bin/tr 'a\0' '\0d' | od -An -tx1} + 00 62 64 63 @end example @end table -- 1.6.4.2