bug-bash
[Top][All Lists]
Advanced

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

Re: `declare -fp` mishandles heredoc with || statement


From: Chet Ramey
Subject: Re: `declare -fp` mishandles heredoc with || statement
Date: Sat, 01 Jun 2013 17:07:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/31/13 10:37 PM, Mike Frysinger wrote:
> simple code snippet:
> $ cat test.sh
> func() {
> cat > / <<EOF || echo FAIL
> 11
> EOF
> }
> declare -fp
> 
> when run, we see the || statement is incorrectly moved to after the heredoc:
> $ bash ./test.sh
> func () 
> { 
>     cat > /  <<EOF
> 11
> EOF
>  || echo FAIL
> }
> 
> every version of bash i tried fails this way (2.05b through 4.2.45)

I don't get this.  I see, when using bash-4.2.45:

$ ./bash-4.2-patched/bash ./x1
func ()
{
    cat > /tmp/xxx  <<EOF ||
11
EOF
 echo FAIL
}

I get the same thing going all the way back to bash-4.0.  I see the same
results you do on bash-3.2.51, but that's old enough that it's not going
to change.

Chet
- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlGqYo4ACgkQu1hp8GTqdKvGJgCfbyxPaZCd4yQOthCXdWwxGqHC
I34An14UuDqYYcKE9ONVH+8SPj9FCJ2U
=W3hu
-----END PGP SIGNATURE-----



reply via email to

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