I'm writing to report a repeatable bug involving long here-documents
that have both arithmetic and variable substitution. This is the
simplest script I can come up with that shows this problem:
#!/bin/ksh
FOO=1
BAR=foobarbaz
cat <<#EOF
$(($FOO + 1))
$BAR meep
# repeat the above two lines around 20,000 times
EOF
When this is run, ksh will substitute some of the $BAR's with blanks:
tiferet:~ $> ksh foo.ksh | grep meep | grep -v foobarbaz
meep
meep
meep
meep
meep
Two things make it consistently work as expected. The first is to
remove all of the arithmetic substitution lines. The second is to
wrap BAR in braces:
$(($FOO + 1))
${BAR} meep
This is happening on both an older RedHat box with Version M 93s+
2008-01-31, and an up-to-date Debian testing box with Version JM 93u
2011-02-08.
Possibly relevant is this information:
http://lists.gnu.org/archive/html/bug-autoconf/2002-03/msg00069.html
http://www.mail-archive.com/[email protected]/msg01276.html
However, this is much older, and their fix was to *omit* braces
instead of add them. In addition, my testing shows that there must be
an arithmetic expression in the here-doc for this bug to manifest.
Thank you for your time.
--
Troy
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users