]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Document more binary file portability traps.
authorEric Blake <ebb9@byu.net>
Thu, 2 Oct 2008 15:02:37 +0000 (09:02 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 2 Oct 2008 15:02:37 +0000 (09:02 -0600)
* doc/autoconf.texi (Limitations of Usual Tools) <sed>: Remind
reader that NUL and sed don't always mix.
<tr>: Mention Solaris /usr/ucb/tr bug with \0.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi

index 6b3f95b5907a15f1ca122b5ece48baa59d6114a3..dbba2f8830d7116b7a50471f0f38401506f14ce4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-02  Eric Blake  <ebb9@byu.net>
+
+       Document more binary file portability traps.
+       * doc/autoconf.texi (Limitations of Usual Tools) <sed>: Remind
+       reader that NUL and sed don't always mix.
+       <tr>: Mention Solaris /usr/ucb/tr bug with \0.
+
 2008-10-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Implement parallel Autotest test execution: testsuite --jobs.
index e515a8705908041064aa4616d36b66c147668ffb..939eaea7f7c5720863ca4a36b6498b339d6a9dcf 100644 (file)
@@ -15849,7 +15849,9 @@ sed: 1: "s/x/x/;;s/x/x/": invalid command code ;
 @end example
 
 Input should not have unreasonably long lines, since some @command{sed}
-implementations have an input buffer limited to 4000 bytes.
+implementations have an input buffer limited to 4000 bytes.  Likewise,
+not all @command{sed} implementations can handle embedded @code{NUL} or
+a missing trailing newline.
 
 Portable @command{sed} regular expressions should use @samp{\} only to escape
 characters in the string @samp{$()*.0123456789[\^n@{@}}.  For example,
@@ -16101,6 +16103,19 @@ $ @kbd{@{ echo moon; echo light; @} | /usr/ucb/tr -d '\012' ; echo}
 moonlight
 @end example
 
+Posix requires @command{tr} to operate on binary files.  But at least
+Solaris @command{/usr/ucb/tr} still fails 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 @command{/usr/xpg4/bin/tr} instead.
+
+@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
+@end example
+
 @end table