From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Getting unexpected error from piping "read -d"
Date: Sat, 30 Aug 2014 18:17:02 -0700 [thread overview]
Message-ID: <140830181702.ZM23166@torch.brasslantern.com> (raw)
In-Reply-To: <140830161714.ZM27208@torch.brasslantern.com>
On Aug 30, 4:17pm, Bart Schaefer wrote:
}
} #0 gettyinfo (ti=0xbff0a5f0) at ../../zsh-5.0/Src/utils.c:1526
} #1 0x0805c0d9 in bin_read (name=0xb7d58700 "read", args=0xb7d58760,
} ops=0xbff0a7d0, func=0) at ../../zsh-5.0/Src/builtin.c:5367
}
} Looks like SHTTY has become an invalid file descriptor in the child that
} is forked to do the read. Theoretically it should therefore have been
} set to -1, but that didn't happen. Looks like workers/27134 is the
} culprit.
The problem with that theory being that there hasn't been an exec() in
the branch where bin_read() runs.
Anyway, the following seems to fix this, and I can't see how it can be
incorrect in any case:
diff --git a/Src/exec.c b/Src/exec.c
index 5ad957f..bf50d0f 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3569,8 +3569,11 @@ closem(int how)
for (i = 10; i <= max_zsh_fd; i++)
if (fdtable[i] != FDT_UNUSED &&
- (how == FDT_UNUSED || fdtable[i] == how))
+ (how == FDT_UNUSED || fdtable[i] == how)) {
+ if (i == SHTTY)
+ SHTTY = -1;
zclose(i);
+ }
}
/* convert here document into a here string */
prev parent reply other threads:[~2014-08-31 1:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-30 22:08 Bart Schaefer
2014-08-30 22:34 ` Bart Schaefer
2014-08-30 23:17 ` Bart Schaefer
2014-08-31 1:17 ` Bart Schaefer [this message]
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=140830181702.ZM23166@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).