From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32282 invoked from network); 15 Nov 2023 04:43:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Nov 2023 04:43:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1700023391; b=Ni/FQbpgEJxJGUUj59wDUijVnvJ3ZygL3frf1noPmfR68T5sUTdU9R3X7e7ZYuQbM5zXsWHrN1 70OuL8tFzvCJHaT5AHlOZHmZsHfkbczx4YmvowcvFx3MhbwWcVTNXh1A1UXdlnfCdsbbwgjKhM q3z2BgJQz4eRZHZG22yMVEknaQ9+s7FOMoolc1DbVksEPr5hdD43vvCzacb7tjHDCoUXH/qB1E LlFLGBTdsYbpuGAMFGzRLHlreGXpznJ2TDRF0cTG3E8oWfjZQLZHLv/8DrIfiB3sW+cZZ324bj 4iEaBrQ+LvKkgye1PqOcZNU76bAbF1hwXrFcO5T3VT9Epw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f42.google.com) smtp.remote-ip=209.85.218.42; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1700023391; bh=Pnf8dVNsomsdjtmCtK/quLxuN8MXRu08QT+n2Z3Lgdw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=PgBhbOTvNqn7dH1SNP1L78Agw2dsmahld78hiKLXGiim9ff0ZG7hvF/NBrGl46loxokSSpZFoT rXySRSjbzroGw0e6BIT2kvxwNo+ay+FZXo0kGcQ5rF4yMk3yuU1HbrbRBcY/KbVLQ5O/35q4qy ci1B7McYD6ll4zYw2LPmztLgE/WGGL9WX7NSKDNqAcTAKowU1koo+NbR1ScQ+v3DlFvsUxC/jj JbVTbUyMPH83Ui08qJqyyw5qCS8LyDnQJY27/6vlOqnqF3rvG5jXBdAT5i7+Dly+wFbAMy2PT4 3HyefjSQjORf3SioJyacC5hGMYrp32lO87kO57NYlNeo4g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ZJihqj5quPN9WaWw8qoMIH5dEN69zOzjNResORZV+6s=; b=abn8rU2A/8r95HbMKle9C4A2Dh tqruG/AYuiF2GMXX8onASchDA6OjR/U91ujBonOyrSH4rvkDOZwDYzB2WHOx9x9CLmm7bqPUeVm9Q fcTx+6oE0VGiN/+VWb2GYk5T9Mb1p/thUT2DSuYdr0gQe71nThrMiOJ5bhM2VORml7SAXPxiTR7yT GE0HOwZNyRE5SxecHugE/jJXEH3i4AFTmcT5RejBqodtSowiJyBa4PVUlGYpaxaGTnoOM23HQ579F xdMvbnT9eXSVo15IqZS6U8TsC57nEujaPjGHZfbwyhnx60TXJm1C0M6xqsQ4ByEPSBLRBM6lz8eZY oykBUZ4w==; Received: by zero.zsh.org with local id 1r37k6-0001fp-KW; Wed, 15 Nov 2023 04:43:10 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f42.google.com) smtp.remote-ip=209.85.218.42; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f42.google.com ([209.85.218.42]:52447) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1r37jo-0001Md-B2; Wed, 15 Nov 2023 04:42:53 +0000 Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-9f282203d06so55990266b.0 for ; Tue, 14 Nov 2023 20:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1700023372; x=1700628172; darn=zsh.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZJihqj5quPN9WaWw8qoMIH5dEN69zOzjNResORZV+6s=; b=Ecm8RWAygnJZ1QVKaCDD+QqV6tzUt+VeRHg8auDN/nAN1j9X3lusPsvNagAessRTyc a9Yo68hNbT1xyC6OuLeR9DFamX1i3OT9Z0Hzgsz98JYRZ1P5mTAlPhR3oqd0P0Ht8j9h RYly4DmgrIAwJAxojUiN7I6ve2ldATLFsjPZd78LkCjXvOm353h29FjcD+gq74pw1GAA SSjxM9057gSzC29tlC/xYyJuyE8aJLYOTc7NeqJWkHasLXOQaE+3iaN96mj40aryPxwn tj1KmAXugaUJpJKhgrutlt4WCnBxQi97V3q3Tww6qzWlEvfdH0YvC8zjTymWR/hF2Kg/ B57Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700023372; x=1700628172; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZJihqj5quPN9WaWw8qoMIH5dEN69zOzjNResORZV+6s=; b=SwJ8p1nRMGpffgnTVKrcGcBsCQEe6Yy0zfhNMpm5axf6Xad9AvHfJUUi5EsGc+IfLD fhdblGLwE/pJXOp9OptyhPbhpfRHIDUEfDKveYiIOXcCTlRq0YpWB07fcgL7OGO4qifJ sy3l1EcJboiKh6Ou/yeywYMFFndnn8SbWnFmUZkv5WOucMZ1FHBI4qBd1QC6YYbJm8S9 oIKkGaDSYRif+dfdktBj8ai5VeyeC/q0OP0m8QQ19KSo6ITekPNuzcY4j4kF5Sy0k6FN sHmK/lsNGuwwvRR76HMYacvIoub2hkbsm+vQQNTi5h7+DitSfyg+gxHszAL/H7SIQkcy pzzw== X-Gm-Message-State: AOJu0YySYBO3S9vRvfaVErkQo9vaGSUvUWpRce/VyuFbNifWFWvRQ3Ot Gm9zxpcZv97LRwhv0y4WpruNXVUTbvUBd5WrbFz6Rw== X-Google-Smtp-Source: AGHT+IFdTm1ziZ9UhqBQ/e7JLYIuwjURzcG43NLYyEqbcr5tgeFf406GUrjP8w5FYAa8jib/bZ361HTNGI1ixRs+wNU= X-Received: by 2002:a17:907:7b92:b0:9de:be52:6094 with SMTP id ne18-20020a1709077b9200b009debe526094mr11393354ejc.9.1700023371685; Tue, 14 Nov 2023 20:42:51 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 14 Nov 2023 20:42:40 -0800 Message-ID: Subject: Re: Bug: reading from tty inside process substitution To: "Mark J. Reed" Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52305 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Tue, Nov 14, 2023 at 7:33=E2=80=AFPM Bart Schaefer wrote: > > > read foo < <(read bar; echo $bar) > That still doesn't respond to interrupts So what seems to be going on here is that the shell enters waitonejob() via waitjobs() from execpline(). At that point it has a nonzero auxprocs pointer, so it calls zwaitjob() which for the same reason eventually calls signal_suspend(SIGCHLD), which adds SIGINT to the ignored signals to allow the presumed foreground child to handle the signal. The problem is that by that point the auxiliary "foreground" process -- the process substitution -- has already exited. It was promptly reaped, but zwaitjob() is in a loop waiting with SIGINT still blocked for the parent's jn->stat to be updated to either 0 or STAT_DONE. Trouble is, that parent is the multio loop, which is actively skipping over interrupts and won't quit until EOF. What about the following? Is there some simple way to check that the multio tty is the same tty as SHIN ? Also, even with this in place, something is still ignoring TSTP (^z), perhaps because "read foo" is in the top-level interactive shell, so this can't be suspended. diff --git a/Src/exec.c b/Src/exec.c index 285d2c5ad..97823760f 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2309,7 +2309,7 @@ closemn(struct multio **mfds, int fd, int type) for (i =3D 0; i < mn->ct; i++) while ((len =3D read(mn->fds[i], buf, TCBUFSIZE)) !=3D 0) { if (len < 0) { - if (errno =3D=3D EINTR) + if (errno =3D=3D EINTR && !isatty(mn->fds[i])) continue; else break; (This patch may not apply cleanly due to gmail ... I'll prepare a proper one if deemed OK.)