[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: portability fix.
From: |
Joel E. Denny |
Subject: |
Re: [PATCH] tests: portability fix. |
Date: |
Wed, 26 Aug 2009 13:56:57 -0400 (EDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
Hi Akim.
On Wed, 26 Aug 2009, Akim Demaille wrote:
> -echo 'start: "\T\F\0\1" ;' | tr 'TF01' '\011\014\0\1' >> input.y
> +
> +# It is not easy to create special characters, we can only trust tr.
> +# Beside we cannot even expect "echo '\0'" to output two characters
> +# (well three with \n): at least Bash 3.2 converts the two-character
> +# sequence "\0" into a single NUL character.
> +#
> +# Z for 0, O for 1.
> +echo 'start: "\T\F\Z\O" ;' | tr 'TFZO' '\011\014\0\1' >> input.y
Argh! Just a few weeks before writing that, I worked with Paolo to revise
the Autoconf documentation on echo portability. I forget so quickly.
Thanks for catching it.
According to the Autoconf documentation, we can't rely on backslash at
all, and we need to convert to a here document. So, maybe we should have:
cat <<EOF | tr 'TFZO' '\011\014\0\1' >> input.y
start: "\T\F\Z\O" ;
EOF
This works for me. But did I make it more portable? The Autoconf
documentation says Solaris tr can't be trusted to handle \0.
Maybe we need to skip this test if od shows that input.y doesn't look
right.