From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id SAA03381 for ; Tue, 30 Jul 1996 18:26:59 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id EAA07284; Tue, 30 Jul 1996 04:20:14 -0400 (EDT) Resent-Date: Tue, 30 Jul 1996 04:20:14 -0400 (EDT) Message-Id: <199607300819.KAA18290@hydra.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: Lethal option-related bug In-reply-to: "hzoli@cs.elte.hu"'s message of "Mon, 29 Jul 1996 20:03:45 MET." <199607291803.UAA05285@bolyai.cs.elte.hu> Date: Tue, 30 Jul 1996 10:19:09 +0200 From: Peter Stephenson Resent-Message-ID: <"rWkJa.0.kn1.-MS_n"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1836 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu hzoli@cs.elte.hu wrote: > > It turns out to be easy to reproduce: > > > > ./zsh -s > > zsh: 7863 segmentation fault (core dumped) ./zsh -s > > the right fix, so I'll leave it. > > OK, below is a simple and clean fix. POSIX says that if IFS is unset it > should be treated as if it were set to space-tab-newline. Zsh does this > but it adds an extra null here. No, that doesn't work: you need to fix up wordchars as well which causes the same problem. (I didn't mention that in the original post because I assumed whoever was making the patch would try it out and discover this and perhaps other problems.) The following less elegant patch does at least fix the core dump. *** Src/init.c.ifs Mon Jul 29 18:01:46 1996 --- Src/init.c Tue Jul 30 10:14:40 1996 *************** *** 59,64 **** --- 59,67 ---- opts[MONITOR] = 1; /* may be unset in init_io() */ opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid()); opts[USEZLE] = 1; /* may be unset in init_io() */ + ifs = ztrdup(" \t\n "); + ifs[3] = Meta; + wordchars = ztrdup(DEFAULT_WORDCHARS); parseargs(argv); /* sets INTERACTIVE, SHINSTDIN and SINGLECOMMAND */ SHTTY = -1; *************** *** 519,527 **** if (!(ttystrname = ztrdup(ttyname(SHTTY)))) ttystrname = ztrdup(""); - ifs = ztrdup(" \t\n "); - ifs[3] = Meta; - wordchars = ztrdup(DEFAULT_WORDCHARS); postedit = ztrdup(""); underscore = ztrdup(""); --- 522,527 ---- -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.