From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21424 invoked by alias); 6 Jan 2011 18:22:09 -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: 28582 Received: (qmail 18691 invoked from network); 6 Jan 2011 18:22:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 6 Jan 2011 18:22:01 +0000 From: Peter Stephenson To: Subject: Re: Certain pattern causing shell to crash Message-ID: <20110106182201.27da4de9@pwslap01u.europe.root.pri> In-Reply-To: <20110106160802.GA4655@Xye> References: <20110106160802.GA4655@Xye> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.8 (GTK+ 2.20.1; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Jan 2011 18:22:01.0332 (UTC) FILETIME=[9CA81340:01CBADCE] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.71.0.138 On Thu, 6 Jan 2011 21:38:02 +0530 Raghavendra D Prabhu wrote: > Sourcing following function in a clean shell (zsh -f) followed by > which or tab completion is causing shell to segfault > > ================= > view () { > if [[ -z $1 ]] > then > ranger ~/Documents > elif [[ $1 =~ ^http:* ]] > then > url=${1#*=} > dest="$HOME/Documents/${1##*/}" > wget -c --content-disposition -O - -q $url > $dest > detach mupdf -r 143 $dest > else > detach mupdf -r 143 "$@" > fi > } > ====================================== Yes, I can get that. The following is about the most simple form that still causes it to happen: crashme() { if [[ $1 =~ ^http:* ]] then url=${1#*=} fi } which crashme It appears that the code that decodes the '=~' expression (it doesn't happen if I turn that into '=') is causing the state to go awry, so that the code in the line after the "then" is being read wrongly. It's got something to do with the regular expression, too; putting that in parentheses or otherwise quoting the "^" makes it go away, so it maybe related to how "^" is handled in this case. It shouldn't be too hard to localise; it's a shame that the the wordcode is completely impenetrable. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom