Hi Eric, About 'tr' on Solaris:
> +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 So it's indeed two different bugs: one regarding NUL bytes in the input, another one regarding '\0' as part of the arguments. I propose to make this clearer, including the examples. In particular, make it clear that the first bug occurs also when the arguments don't ask to convert from or to '\0'. Proposed patch, to be applied with "patch -p0". 2009-12-31 Bruno Haible <br...@clisp.org> Improve documentation on Solaris tr bugs. * doc/autoconf.texi (Limitations of Usual Tools) <tr>: Refine description of NUL handling by Solaris tr. *** doc/autoconf.texi.orig Thu Dec 31 14:14:35 2009 --- doc/autoconf.texi Thu Dec 31 14:12:27 2009 *************** *** 18347,18366 **** @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 @command{/usr/xpg6/bin/tr} if that is available. @example ! $ @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 --- 18347,18377 ---- @end example Posix requires @command{tr} to operate on binary files. But at least ! 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 '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 '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