From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1667 invoked by alias); 20 Jul 2013 17:12:11 -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: 31545 Received: (qmail 19769 invoked from network); 20 Jul 2013 17:11:55 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.215.173 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=y7P6vMaB7vgy/OKNmer9MbARxZKtho3FtoFC3w+TrSY=; b=gCNso+D2nmYmUVMx3d+Q+06mBazohlS9bYq/CqCCtCcHViJcp7hAmErpAAkjDYvhqs HDq/6ujVA83e1VeWiOwxczRTd7MBFFWJ6+042v62Ttfhp3JAu4+OqoSvq8q21RMTW2Ba k9WbKkpS7VvEVe+o3LRigycF/jq9OPASew765oDVPB8ShBTwklPr9JtYnw2uVEdMQpcs Ypg1wTMIwmy5+5C8bZ8Ub5LcpbXUIKBCQ6dPezaY5U/gZb/zomWhTV+BQUosSIe48msC i6MZmTbNt7fOXm7zMaLm355ZSW3c3Cqd/5rqOEDW9NFe8ckwQ3EuQFbJI4FENt31lfVY SC8g== X-Received: by 10.15.24.129 with SMTP id j1mr21036193eeu.17.1374340307912; Sat, 20 Jul 2013 10:11:47 -0700 (PDT) X-ProxyUser-IP: 86.6.30.159 Date: Sat, 20 Jul 2013 18:11:44 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: bug with eval, proc-subst and pipes Message-ID: <20130720181144.1b5a7fc0@pws-pc.ntlworld.com> In-Reply-To: <20130719205853.GB8712@chaz.gmail.com> References: <20130715133525.GA7694@chaz.gmail.com> <130715100624.ZM14123@torch.brasslantern.com> <20130716215540.22d88a27@pws-pc.ntlworld.com> <130717000027.ZM15643@torch.brasslantern.com> <20130717201733.2c0b029b@pws-pc.ntlworld.com> <20130718095741.3f54725f@pwslap01u.europe.root.pri> <20130718102227.527429bd@pwslap01u.europe.root.pri> <20130718123210.054f1ea1@pwslap01u.europe.root.pri> <20130719200159.GA8712@chaz.gmail.com> <20130719205853.GB8712@chaz.gmail.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmTJ4KlIKvJobtuHIYunv9MPlAYvRHLYW4j+PU2PDAk+aOlF0ZRbPuvugnYhHDx0ceULIM9 On Fri, 19 Jul 2013 21:58:53 +0100 Stephane Chazelas wrote: > and fd 13 by closedumps() (the missing link to compinit?). That's distinctly suspicious, if 13 was opened for the process substitution. Does the following fix it, or is there yet more? If it does we still have an error for older systems, but I suspect FD_CLOEXEC (and O_CLOEXEC) are widely enough supported that may be more a theoretical then an actual problem. diff --git a/Src/exec.c b/Src/exec.c index d462d97..f9efb3a 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -448,7 +448,9 @@ zexecve(char *pth, char **argv, char **newenvp) else sprintf(buf + 2, "%s/%s", pwd, pth); zputenv(buf); +#ifndef FD_CLOEXEC closedumps(); +#endif if (newenvp == NULL) newenvp = environ; diff --git a/Src/parse.c b/Src/parse.c index 753080d..b670925 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -3171,6 +3171,9 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len) d->dev = sbuf->st_dev; d->ino = sbuf->st_ino; d->fd = fd; +#ifdef FD_CLOEXEC + fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif d->map = addr + (other ? (len - off) / sizeof(wordcode) : 0); d->addr = addr; d->len = len; @@ -3439,6 +3442,7 @@ decrdumpcount(FuncDump f) } } +#ifndef FD_CLOEXEC /**/ mod_export void closedumps(void) @@ -3448,6 +3452,7 @@ closedumps(void) for (p = dumps; p; p = p->next) zclose(p->fd); } +#endif #else @@ -3461,11 +3466,13 @@ decrdumpcount(FuncDump f) { } +#ifndef FD_CLOEXEC /**/ mod_export void closedumps(void) { } +#endif #endif -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/