From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7086 invoked from network); 4 Jan 2008 14:42:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) 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.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Jan 2008 14:42:53 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 42359 invoked from network); 4 Jan 2008 14:42:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Jan 2008 14:42:48 -0000 Received: (qmail 5227 invoked by alias); 4 Jan 2008 14:42:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24356 Received: (qmail 5213 invoked from network); 4 Jan 2008 14:42:43 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 Jan 2008 14:42:43 -0000 Received: from virusfilter.dotsrc.org (bifrost [127.0.0.1]) by spamfilter.dotsrc.org (Postfix) with ESMTP id 058AE8058FF2 for ; Fri, 4 Jan 2008 15:42:41 +0100 (CET) Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [217.69.20.190]) by bifrost.dotsrc.org (Postfix) with ESMTP for ; Fri, 4 Jan 2008 15:42:40 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly06d.srv.mailcontrol.com (MailControl) with ESMTP id m04EgbLs028637 for ; Fri, 4 Jan 2008 14:42:37 GMT Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Fri, 4 Jan 2008 14:42:36 +0000 Date: Fri, 4 Jan 2008 14:42:37 +0000 From: Peter Stephenson To: zsh-workers Subject: Re: Crash with =~ in script, but not interactively Message-ID: <20080104144237.0eac6c2b@news01> In-Reply-To: <237967ef0801040127k49e92485rf09ce72c47d076c5@mail.gmail.com> References: <237967ef0801040127k49e92485rf09ce72c47d076c5@mail.gmail.com> Organization: CSR X-Mailer: Claws Mail 3.1.0 (GTK+ 2.10.14; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Jan 2008 14:42:36.0863 (UTC) FILETIME=[0C7404F0:01C84EE0] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.68.0.116 X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 4 Jan 2008 10:27:40 +0100 "Mikael Magnusson" wrote: > I was going to make a wrapper script that replaces the :43: in gcc > warnings with +43 so i can open in vim easierly, but ran into some > problems. > > #!/bin/zsh > #this makes zsh segfault > if [[ $#@ = 1 ]]; then > if [[ $1 =~ /?[^/]+:[0-9]+:$ ]]; then > echo hello > fi > fi > > If i save that in a file and run 'zsh file' it crashes, but if i run > 'source file' in an open shell it works as expected. Thanks, the problem was fairly obvious (luckily, since debugging the wordcode is another thing that's a nightmare). Index: Src/text.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/text.c,v retrieving revision 1.20 diff -u -r1.20 text.c --- Src/text.c 1 May 2007 22:05:06 -0000 1.20 +++ Src/text.c 4 Jan 2008 14:28:51 -0000 @@ -732,7 +732,8 @@ taddstr(" "); taddstr(ecgetstr(state, EC_NODUP, NULL)); if (ctype == COND_STREQ || - ctype == COND_STRNEQ) + ctype == COND_STRNEQ || + ctype == COND_REGEX) state->pc++; } else { /* Unary test: `-f foo' etc. */ Index: Test/C02cond.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/C02cond.ztst,v retrieving revision 1.19 diff -u -r1.19 C02cond.ztst --- Test/C02cond.ztst 13 Dec 2007 21:21:29 -0000 1.19 +++ Test/C02cond.ztst 4 Jan 2008 14:28:51 -0000 @@ -211,6 +211,18 @@ 0:-nt shouldn't abort on non-existent files >status = 1 +# core dumps on failure + if zmodload -i zsh/regex 2>/dev/null; then + echo >regex_test.sh 'if [[ $# = 1 ]]; then + if [[ $1 =~ /?[^/]+:[0-9]+:$ ]]; then + : + fi + fi + exit 0' + $ZTST_testdir/../Src/zsh -f ./regex_test.sh + fi +0:regex tests shouldn't crash + %clean # This works around a bug in rm -f in some versions of Cygwin chmod 644 unmodish -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070