bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: portability fix.


From: Akim Demaille
Subject: Re: [PATCH] tests: portability fix.
Date: Wed, 26 Aug 2009 21:19:43 +0200


Le 26 août 09 à 19:56, Joel E. Denny a écrit :

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.

Well, my environment did it for me :)

According to the Autoconf documentation, we can't rely on backslash at
all,

In a first draft I had used tr to \ -> / :)

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.

I would rather use Perl, which is widely available and it's easy to skip if it is not, to generate the input.



reply via email to

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