bug-bash
[Top][All Lists]
Advanced

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

Re: weird bug in small for loop and here documents and bash-4.x


From: Mike Frysinger
Subject: Re: weird bug in small for loop and here documents and bash-4.x
Date: Mon, 22 Mar 2010 15:35:36 -0400
User-agent: KMail/1.13.1 (Linux/2.6.33.1; KDE/4.4.1; x86_64; ; )

On Sunday 21 March 2010 21:21:36 Chet Ramey wrote:
> On 3/21/10 1:55 AM, Mike Frysinger wrote:
> > i have a small bit of code in a function:
> > foo() {
> > 
> >     local f
> >     for f in src/assembler.S src/assembler_opt.S ; do
> >     
> >             cat <<-EOF >> ${f}
> >             #ifdef __ELF__
> >             .section .note.GNU-stack,"",%progbits
> >             #endif
> >             EOF
> >     
> >     done
> > 
> > }
> > 
> > under bash-4.0_p37 and bash-4.1_p2, the first file is correctly appended
> > but the second is not.  using bash-3.2_p50 and i get correct behavior --
> > both files are appended.  we're seeing this on a bunch of different
> > Gentoo systems.
> > 
> > i'm having a hard time debugging this because as soon as i stick any
> > statement inside the for loop (before or after), both files are updated
> > with bash-4.x. for example, simply adding a `:` or an `echo` before the
> > cat.
> > 
> > when i strace bash, i see both files being opened, set to stdout, and
> > then cat executed, but only in the first file (src/assembler.S) does
> > there appear to be any data waiting for cat on stdin.  the second file's
> > cat reads stdin and gets back 0 bytes.
> > 
> > trying to debug the bash source itself is a bit beyond me though ...
> 
> You might have to.  I can't reproduce this on Mac OS X, Ubuntu, or RHEL.

the implied question was, where are the interesting points in the source tree 
i should be looking (i.e. setting breakpoints and checking state) ?

i can easily attach gdb at the point where it falls down since placing code 
outside of the for loop seems to make no difference to the buggy behavior.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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