#4 bitshift in Arithmetic crashes heredoc parser

open
nobody
None
5
2012-11-07
2012-11-07
Robin Johnson
No

Sample input:
# _ip6rd_inet_itoa 16843009
# should print 1.1.1.1
_ip6rd_inet_itoa()
{
local ipi=$1 bitmask v
bitmask=$(( (1 << 24)-1 ))
for i in 0 1 2 3; do
v=$(( (ipi & ~bitmask) >> 24 ))
ipi=$(( (ipi & bitmask) << 8 ))
if [ $i != 3 ] ; then
printf "%d." $v
else
printf "%d\n" $v
fi
done
}

Gives error:
error: testcase: Unterminated heredoc found, EOF reached. Wanted: <24>

Discussion