From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: 3.1.5-pws-17: read after pipeline bug
Date: Sat, 08 May 1999 18:36:26 +0200 [thread overview]
Message-ID: <9905081636.AA46827@ibmth.df.unipi.it> (raw)
This looks like being an old bug, it's also in 3.0.5.
zsh -f
% echo foo | read foo; read foo
%
The (interactive) shell doesn't wait. It turns out the read gets an EIO
--- repeatedly, so it's not a hang over from the previous read.
I discovered read foo </dev/tty also didn't work, while if there was an
intervening external command it did. After almost two hours of fruitless
searching when I'd almost given up (oddly enough, this has happened to me
before, even with zsh), it occurred to me to wonder about tty process
groups, which get reset after an external command but not an internal one.
This seemed to be the problem. So the following does the check for
resetting the process group even if the pipeline which just finished had a
builtin at its tail end. Some version of this should go into 3.0.6.
--- Src/jobs.c.eio Sat May 8 14:50:27 1999
+++ Src/jobs.c Sat May 8 18:33:45 1999
@@ -180,11 +180,16 @@
} else { /* job is done, so remember return value */
lastval2 = val;
/* If last process was run in the current shell, keep old status
- * and let it handle its own traps
+ * and let it handle its own traps, but always allow the test
+ * for the pgrp.
*/
- if (job == thisjob && !(jn->stat & STAT_CURSH)) {
- lastval = val;
- inforeground = 1;
+ if (job == thisjob) {
+ if (jn->stat & STAT_CURSH)
+ inforeground = 1;
+ else {
+ lastval = val;
+ inforeground = 2;
+ }
}
}
@@ -223,7 +228,7 @@
* process group from the shell, so the shell will not receive *
* terminal signals, therefore we we pretend that the shell got *
* the signal too. */
- if (inforeground && isset(MONITOR) && WIFSIGNALED(status)) {
+ if (inforeground == 2 && isset(MONITOR) && WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
if (sig == SIGINT || sig == SIGQUIT) {
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
reply other threads:[~1999-05-08 17:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9905081636.AA46827@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).