Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16689

Shell exits after process substitution when using DEBUG trap with extdebug

From Jonathan Rascher <jon@bcat.name>
Newsgroups gnu.bash.bug
Subject Shell exits after process substitution when using DEBUG trap with extdebug
Date 2020-08-03 20:44 -0500
Message-ID <mailman.705.1596517946.2739.bug-bash@gnu.org> (permalink)
References <CAFG5iOhJ61520b7DKiHbjSAOcR01jHOhnYa-biv9dTowK11Vtg@mail.gmail.com>

Show all headers | View raw


$ bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)

$ uname -a
Linux penguin 5.4.40-04224-g891a6cce2d44 #1 SMP PREEMPT Tue Jun 23 20:21:29
PDT 2020 x86_64 GNU/Linux

(This is a Pixelbook running the default Crostini Linux VM under Chrome
OS 84.0.4147.110. I can reproduce the issue on regular Debian too, though.)

To reproduce, run the following commands:

shopt -s extdebug
trap : DEBUG
: < <(:)

Now, type any character (e.g., 'a'). At this point, you'll see bash print
`exit`, and the shell does indeed exit. Additionally, assuming you ran bash
inside another shell, you'll see the 'a' character is echoed.

It's a hard to describe clearly, but the result looks like this
(`bcat@penguin:pts/0` is the prompt from my outer shell):

bcat@penguin:pts/0 J:0 ~
$ bash --norc
bash-5.0$ shopt -s extdebug
bash-5.0$ trap : DEBUG
bash-5.0$ : < <(:)
bash-5.0$ [I TYPED 'a' HERE]exit
bcat@penguin:pts/0 J:0 ~
$ a

The inner shell with the DEBUG trap acts as if it received an EOF on stdin,
and exits accordingly, but the 'a' character I typed into my terminal is
indeed still there, and it's echoed by the outer shell after the inner
shell (wrongly) exits. I wonder if stdin of the inner shell is getting
screwed up by the extdebug DEBUG trap somehow.

Cheers,
Jon

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Shell exits after process substitution when using DEBUG trap with extdebug Jonathan Rascher <jon@bcat.name> - 2020-08-03 20:44 -0500

csiph-web