autoconf-patches
[Top][All Lists]
Advanced

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

Re: tr portability


From: Eric Blake
Subject: Re: tr portability
Date: Sat, 26 Apr 2008 06:35:12 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 4/26/2008 6:06 AM:
| Ralf Wildenhues wrote:
|>>> I hear that there really do exist systems in actual use
|>>> on which tr still does not honor backslash-escapes like \r and \n.
|>> Which platforms, please?
|> Solaris 10 /usr/ucb/tr.  Not likely to be early in PATH, but hey, people
|> do all kinds of weird things to their path.  ;-)
|
| This is not documented in the autoconf manual, section "Limitations of
| Usual Tools". But I can confirm the fact:
|
| $ { echo moon; echo light; } | /usr/ucb/tr -d '\n' ; echo
| moo
| light
|
| $ { echo moon; echo light; } | /usr/bin/tr -d '\n' ; echo
| moonlight
| $ { echo moon; echo light; } | /usr/ucb/tr -d '\012' ; echo
| moonlight

Thanks.  I've committed this:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgTIX8ACgkQ84KuGfSFAYBB+gCfYd72JUZ1KLzv8b1r2EK/Qjho
F0cAn0RxWzJxGTUVZ7fY5znL9NtyziI7
=FP9E
-----END PGP SIGNATURE-----
>From c242f622dcbd6a9c467fe9213254d7ffac3535f3 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sat, 26 Apr 2008 06:32:19 -0600
Subject: [PATCH] Mention Solaris /usr/ucb/tr pitfall.

* doc/autoconf.texi (Limitations of Usual Tools) <tr>: Add section.
Reported by Bruno Haible and Jim Meyering.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog         |    6 ++++++
 doc/autoconf.texi |   22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fad30e7..705e71e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-26  Eric Blake  <address@hidden>
+
+       Mention Solaris /usr/ucb/tr pitfall.
+       * doc/autoconf.texi (Limitations of Usual Tools) <tr>: Add section.
+       Reported by Bruno Haible and Jim Meyering.
+
 2008-04-24  Eric Blake  <address@hidden>
 
        Mention m4sugar's internal quote strings.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index ff7ffc7..a5e880a 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15607,6 +15607,28 @@ fails to work on SunOS 4.1.3 when the empty file is on 
an
 @acronym{NFS}-mounted 4.2 volume.
 However, these problems are no longer of practical concern.
 
address@hidden @command{tr}
address@hidden ---------------
address@hidden @command{tr}
address@hidden carriage return, deleting
address@hidden deleting carriage return
+Not all versions of @command{tr} handle all backslash character escapes.
+For example, Solaris 10 @command{/usr/ucb/tr} falls over, even though
+Solaris contains more modern @command{tr} in other locations.
+Therefore, it is more portable to use octal escapes, even though this
+ties the result to @acronym{ASCII}, when using @command{tr} to delete
+newlines or carriage returns.
+
address@hidden
+$ @address@hidden echo moon; echo light; @} | /usr/ucb/tr -d '\n' ; echo}
+moo
+light
+$ @address@hidden echo moon; echo light; @} | /usr/bin/tr -d '\n' ; echo}
+moonlight
+$ @address@hidden echo moon; echo light; @} | /usr/ucb/tr -d '\012' ; echo}
+moonlight
address@hidden example
+
 @end table
 
 
-- 
1.5.5.1


reply via email to

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