From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15915 invoked by alias); 31 Aug 2014 01:17:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33077 Received: (qmail 20063 invoked from network); 31 Aug 2014 01:17:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140830181702.ZM23166@torch.brasslantern.com> Date: Sat, 30 Aug 2014 18:17:02 -0700 In-reply-to: <140830161714.ZM27208@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Getting unexpected error from piping "read -d"" (Aug 30, 4:17pm) References: <140830150813.ZM28921@torch.brasslantern.com> <140830161714.ZM27208@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Getting unexpected error from piping "read -d" MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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 */