From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24929 invoked from network); 15 May 2008 15:45:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 May 2008 15:45:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 80134 invoked from network); 15 May 2008 15:45:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 May 2008 15:45:07 -0000 Received: (qmail 16044 invoked by alias); 15 May 2008 15:45:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25040 Received: (qmail 16019 invoked from network); 15 May 2008 15:45:02 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 15 May 2008 15:45:02 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [85.115.41.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 5BA9B8059114 for ; Thu, 15 May 2008 17:44:55 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly22g.srv.mailcontrol.com (MailControl) with ESMTP id m4FFioWr017568 for ; Thu, 15 May 2008 16:44:51 +0100 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 15 May 2008 16:44:46 +0100 Date: Thu, 15 May 2008 16:44:46 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: zpty woes Message-ID: <20080515164446.4971b8de@news01> In-Reply-To: <20080515132609.GB5190@sc.homeunix.net> References: <34AE8142-F5DA-44FD-96BA-61BDE12BC74E@mac.com> <20080515132609.GB5190@sc.homeunix.net> Organization: CSR X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 May 2008 15:44:46.0203 (UTC) FILETIME=[99D724B0:01C8B6A2] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.71.0.132 X-Virus-Scanned: ClamAV 0.91.2/7128/Thu May 15 12:45:41 2008 on bifrost X-Virus-Status: Clean On Thu, 15 May 2008 14:26:09 +0100 Stephane Chazelas wrote: > "+myscript:1> scp hello...." > > (by, the way, shouldn't it be something like "+(zpty):1> scp > hello"?) zpty currently exec's code directly, it doesn't go through eval. Borrowing the code from eval should fix this. There may be other parse_string()/execode() pairs that need this. This is crying out to be object-orientated... Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.194 diff -u -r1.194 builtin.c --- Src/builtin.c 14 May 2008 10:48:28 -0000 1.194 +++ Src/builtin.c 15 May 2008 15:42:33 -0000 @@ -4681,7 +4681,7 @@ /* eval: simple evaluation */ /**/ -int ineval; +mod_export int ineval; /**/ int Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.190 diff -u -r1.190 utils.c --- Src/utils.c 14 May 2008 10:48:28 -0000 1.190 +++ Src/utils.c 15 May 2008 15:42:37 -0000 @@ -33,7 +33,7 @@ /* name of script being sourced */ /**/ -char *scriptname; +mod_export char *scriptname; #ifdef MULTIBYTE_SUPPORT struct widechar_array { Index: Src/Modules/zpty.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/zpty.c,v retrieving revision 1.37 diff -u -r1.37 zpty.c --- Src/Modules/zpty.c 25 Jan 2008 16:48:24 -0000 1.37 +++ Src/Modules/zpty.c 15 May 2008 15:42:37 -0000 @@ -290,22 +290,34 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock) { Ptycmd p; - int master, slave, pid; + int master, slave, pid, oineval = ineval; + char *oscriptname = scriptname; Eprog prog; + /* code borrowed from bin_eval() */ + ineval = !isset(EVALLINENO); + if (!ineval) + scriptname = "(zpty)"; + prog = parse_string(zjoin(args, ' ', 1)); if (!prog) { errflag = 0; + scriptname = oscriptname; + ineval = oineval; return 1; } if (get_pty(1, &master)) { zwarnnam(nam, "can't open pseudo terminal: %e", errno); + scriptname = oscriptname; + ineval = oineval; return 1; } if ((pid = fork()) == -1) { zwarnnam(nam, "can't create pty command %s: %e", pname, errno); close(master); + scriptname = oscriptname; + ineval = oineval; return 1; } else if (!pid) { /* This code copied from the clone module, except for getting * @@ -406,6 +418,8 @@ if (nblock) ptynonblock(master); + scriptname = oscriptname; + ineval = oineval; return 0; } -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070