Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Jonathan Rascher Newsgroups: gnu.bash.bug Subject: Shell exits after process substitution when using DEBUG trap with extdebug Date: Mon, 3 Aug 2020 20:44:42 -0500 Lines: 40 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1596517947 26996 209.51.188.17 (4 Aug 2020 05:12:27 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=zKckpXP9KL/iko+C/5IDxonrTG4KCK8EoWREKfHtqnc=; b=sx8vv2lQmwhpRA42XaWQyK+SYae+qpixJvNgXtUaqepD97n8BaM3n8vtQw/vOX0W5o PozwDcveYhHAiZlSsBjKBghlKobm3+zYtXFxGmpwjs/Vj9c/V4yKC4RBrEdyVr5eSCHT fAfxkPCwapac5t81GyEOKCTrfVPOp/EnftMTrle988H9sUw+48uJhWB4AdUm6Z2LrwLW 7Bg5vBlaS7FH7ETt1THht5D/D/4E0HGsVdYNdAZVF4ZNC6uWhr+/gUExtaBTK/iU7E88 8M/R24HWAeAvoIntACZ5M+LIeZy8hpb17TYguWChmyVZikkWTVxHGqMISZXVy1xRQfZ9 tWXQ== X-Gm-Message-State: AOAM531S/02lCqma2S0CItjDxiBe21P7uIUSPSlWrehfNdRkUlnnB7zo JPDB1EcgZnVMMYHKf7Px/AL5/XuNIvG0aRpxKF2ZLm0n X-Google-Smtp-Source: ABdhPJzfWQZZMKm2TBjZ0wXnMOpm1BRSjVQqJGfbC0/BFekm4dnuUsZlCbmMQX03vXg2nCfPnj/nhOQWSkOX/9OJ9+Y= X-Received: by 2002:a2e:9a15:: with SMTP id o21mr8831406lji.419.1596505493979; Mon, 03 Aug 2020 18:44:53 -0700 (PDT) Received-SPF: pass client-ip=209.85.208.169; envelope-from=jrascher@gmail.com; helo=mail-lj1-f169.google.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/03 21:44:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 04 Aug 2020 01:12:25 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:16689 $ 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