Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Certain pattern causing shell to crash
On Thu, 6 Jan 2011 21:38:02 +0530
Raghavendra D Prabhu <raghu.prabhu13@xxxxxxxxx> 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 <pws@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author