[prev in list] [next in list] [prev in thread] [next in thread]
List: ast-users
Subject: Re: [ast-users] Bug with arithmetic and variable substitution in long
From: David Korn <dgk () research ! att ! com>
Date: 2011-12-08 0:13:05
Message-ID: 201112080013.pB80D5DI001576 () penguin ! research ! att ! com
[Download RAW message or body]
cc: ast-users@research.att.com
Subject: Re: [ast-users] Bug with arithmetic and variable substitution in long here-docs
--------
> 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/autoconf-patches@gnu.org/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
>
Thanks for reporting this problem and for providing a way to reproduce
the problem. I have found and fixed this problem for the next update.
If you are building from the source, I can send you a patch.
If you find any other problem with here-documents, (or any other problem),
please report them and they will be resolved.
David Korn
dgk@research.att.com
_______________________________________________
ast-users mailing list
ast-users@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic