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
signature.asc
Description: This is a digitally signed message part.