From 6c11abd6fcb523b1c9d3d39a8fe0191761a2918b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 31 Dec 2009 06:50:44 -0700 Subject: [PATCH] Improve documentation on Solaris tr bugs. * doc/autoconf.texi (Limitations of Usual Tools) : Refine description of NUL handling by Solaris tr. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ doc/autoconf.texi | 31 +++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0a4474a..01439892 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-31 Bruno Haible + + Improve documentation on Solaris tr bugs. + * doc/autoconf.texi (Limitations of Usual Tools) : Refine + description of NUL handling by Solaris tr. + 2009-12-31 Eric Blake Another tr tweak. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 6e1356e3..df4c5845 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -18347,20 +18347,31 @@ add @end example Posix requires @command{tr} to operate on binary files. But at least -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 +Solaris @command{/usr/ucb/tr} and @command{/usr/bin/tr} silently discard +@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 'ab\0c' | /usr/ucb/tr 'a\0' '\0d' | od -An -tx1} +$ @kbd{printf 'a\0b' | /usr/ucb/tr x x | od -An -tx1} + 61 62 +$ @kbd{printf 'a\0b' | /usr/bin/tr x x | od -An -tx1} + 61 62 +$ @kbd{printf 'a\0b' | /usr/xpg4/bin/tr x x | od -An -tx1} + 61 00 62 +@end example + +Solaris @command{/usr/ucb/tr} additionally fails to handle @samp{\0} as the +octal escape for @code{NUL}. + +@example +$ @kbd{printf 'abc' | /usr/ucb/tr 'bc' '\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 +$ @kbd{printf 'abc' | /usr/bin/tr 'bc' '\0d' | od -An -tx1} + 61 00 64 +$ @kbd{printf 'abc' | /usr/xpg4/bin/tr 'bc' '\0d' | od -An -tx1} + 61 00 64 @end example @end table -- 2.11.4.GIT