Hi,

On Mon, Dec 28, 2015, Chet Ramey wrote:
> On 12/27/15 4:58 PM, Adrien Nader wrote:
> > Hi,
> > 
> > I have recently been getting "save_bash_input: buffer already exists for
> > new fd XXX" very often when running a fairly simple script (really
> > nothing complicated) with bash 4.3.42.
> > 
> > I have no idea of what could cause this, especially since very similar
> > scripts work fine.
> > Which steps should I take to make a more precise bug report?
> 
> Use bashbug and include the script so I can see if I can reproduce it.

I was stuck making a simple reproducer so I ended up doing a bit of
debugging and re-checked the patches in the 4.4 branch.

The following patch fixes the issue for me:
  
http://git.savannah.gnu.org/cgit/bash.git/patch/input.c?id=54a5fbe126d2a28913a81f7191d7ac6db70e1f43

with the important part being:
  -  if (buffers[nfd])
  +  if (nfd < nbuffers && buffers[nfd])

All my issues had nfd around 250 while I saw nbuffers at 27 at least
once (I had to get a core, do a bit of disassembly and find the
in-memory location of the variable in order to print it so I only
checked that value once).

Would it be possible to include that fix in the 4.3 branch too?
Also, if you really want a reproducer, I think that with enough time I
can manage to make a shorter one.

As a side-note and for futurreaders with e the same issue, this was
happening in a configure invocation, most probably when it was looking
for a "sane" shell to exec itself again.
Since configure tries /bin/${as_shell} and /usr/bin/${as_shell} before
looking in $PATH, it will keep getting the buggy version until the
system is updated or the CONFIG_SHELL environment variable is set to the
path to the fixed bash version.

-- 
Adrien Nader

Reply via email to