[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] readline bug with backgrounded process?
From: |
Thomas Klausner |
Subject: |
Re: [Bug-readline] readline bug with backgrounded process? |
Date: |
Mon, 21 Apr 2014 23:41:49 +0200 |
On Mon, Apr 21, 2014 at 03:43:46PM -0400, Chet Ramey wrote:
> Well, this tells me that this particular function is behaving as it should.
> The assumption here is that an application including readline is most often
> launched from a job-control shell that does appropriate process group
> management. The assumption is also that the shell does command line
> editing and modifies the terminal's settings when it has control of the
> controlling terminal.
>
> Readline saves and restores the terminal settings because it modifies them
> in order to do editing. There's an obvious race condition here: if a
> backgrounded application using readline fetches the tty settings after the
> calling shell has modified them to read the next command line, bad things
> will happen when the application is eventually brought to the foreground
> and restores the (bogus) tty settings when it exits. The call to
> ioctl is one that will deliver a SIGTTOU if the process isn't in the
> foreground, so it will presumably fetch the right tty settings once it's
> resumed.
>
> The reason I didn't bring this up earlier is that this code has been in
> readline for years (literally; I stopped looking at bash-3.2, but it's been
> there for at least that long).
>
> There's nothing keeping an application from ignoring SIGTTOU. Maybe the
> difference is that previous gnucash versions used to ignore SIGTTOU.
Thank you for the analysis.
I don't think anything changed on gnucash side, and you said nothing
relevant changed in readline, so perhaps something changed in NetBSD
itself. Anyway, ignoring SIGTTOU makes it work, and I've sent a patch
to this effect to the gnucash people where I hope it'll be accepted.
Thanks again,
Thomas