[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

another doc update about Solaris 'tr'

From: Bruno Haible
Subject: another doc update about Solaris 'tr'
Date: Mon, 31 Aug 2009 01:21:49 +0200
User-agent: KMail/1.9.9


Just noticed that the problem with "tr '\0' '~'" is not really with the
'\0' argument, but with the NUL bytes in the input. This version of 'tr'
discards NUL bytes in the input even when not asked to do so. It occurs
with "tr x x" but also with "tr -d '\r'". Here is a suggested doc update.

Also, a mention that using /usr/xpg6/bin/tr might be preferable to
/usr/xpg4/bin/tr, when it exists. It supports the '-C' option, the
latter doesn't.

2009-08-30  Bruno Haible  <address@hidden>

        * doc/autoconf.texi (Limitations of Usual Tools): Mention that Solaris
        /usr/bin/tr does not only have problems with replacing NUL bytes but
        discards all NUL bytes from the input.

--- doc/autoconf.texi.orig      2009-08-31 01:16:01.000000000 +0200
+++ doc/autoconf.texi   2009-08-31 01:12:38.000000000 +0200
@@ -17815,16 +17815,21 @@
 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}.  On Solaris, when
-using @command{tr} to neutralize a binary file by converting @code{NUL}
-to a different character, it is necessary to use
address@hidden/usr/xpg4/bin/tr} instead.
+handle @samp{\0} as the octal escape for @code{NUL}; these programs
+always discard all @code{NUL} bytes from the input.  On Solaris, 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
address@hidden/usr/xpg6/bin/tr} if that is available.
 $ @kbd{printf 'a\0b\n' | /usr/ucb/tr '\0' '~' | wc -c}
 $ @kbd{printf 'a\0b\n' | /usr/xpg4/bin/tr '\0' '~' | wc -c}
+$ @kbd{printf 'a\0b\n' | /usr/ucb/tr x x | wc -c}
+$ @kbd{printf 'a\0b\n' | /usr/xpg4/bin/tr x x | wc -c}
 @end example
 @end table

reply via email to

[Prev in Thread] Current Thread [Next in Thread]