From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22500 invoked from network); 27 Jan 1997 17:29:00 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 27 Jan 1997 17:29:00 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id MAA28221; Mon, 27 Jan 1997 12:13:14 -0500 (EST) Resent-Date: Mon, 27 Jan 1997 12:13:14 -0500 (EST) From: Martin.Ouwehand@sic.adm.epfl.ch (Martin Ouwehand) Message-Id: <9701271714.AA14892@sehp1.epfl.ch> To: zsh-workers@math.gatech.edu Subject: "breaks" variable incorrectly reset in "doshfunc()" Reply-To: ouwehand@sic.epfl.ch Date: Mon, 27 Jan 1997 18:14:04 +0100 Resent-Message-ID: <"1PwZ7.0.uu6.f8Exo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2821 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Hello, here is a bug report and a patch for zsh-3.0.2. First the description of the bug: - run "zsh" (the bug happens even with with the "-f" flag and no /etc/zshenv) - define the "TRAPDEBUG()" function to be anything, eg: TRAPDEBUG() { return 0 } - enter (for this to be really useful, you would put "set -o AUTO_PUSHD" and "export DIRSTACKSIZE=10" in eg ".zshrc") select dir in `dirs` do eval cd $dir break done - the bug is that the "break" in the above loop is not executed, so that you have to exit the loop with a "^D", otherwise you remain in the loop forever. My analysis is that "doshfunc()" is called because TRAPDEBUG is set and this function resets the "breaks" variable to 0 a bit too early. See below for the patch I propose (I don't know if it will break something else.) Martin -- Martin Ouwehand Tél +41 21 693 22 29 ouwehand@sic.epfl.ch Service Informatique Central Central Computing Service Ecole Polytechnique Fédérale - Lausanne - Swiss Federal Institute of Technology ================== PGP public key: http://sehp1.epfl.ch:8001 ================== *** zsh-3.0.2.orig/Src/exec.c Tue Dec 17 21:14:11 1996 --- zsh-3.0.2/Src/exec.c Mon Jan 27 17:14:16 1997 *************** *** 2484,2489 **** --- 2484,2490 ---- char **tab, **x, *oargv0 = NULL; int xexittr, oldzoptind, oldlastval; LinkList olist; + int obreaks; char *s, *ou; void *xexitfn; char saveopts[OPT_SIZE]; *************** *** 2533,2538 **** --- 2534,2540 ---- } PERMALLOC { olist = locallist; /* save the old locallist since shell functions may be nested */ + obreaks = breaks; locallist = newlinklist(); /* make a new list of local variables that we have to destroy */ } LASTALLOC; locallevel++; *************** *** 2552,2558 **** zfree(locallist, sizeof(struct linklist)); locallist = olist; /* restore the old list of local variables */ ! breaks = retflag = 0; freearray(pparams); if (oargv0) { zsfree(argzero); --- 2554,2561 ---- zfree(locallist, sizeof(struct linklist)); locallist = olist; /* restore the old list of local variables */ ! breaks = obreaks; ! retflag = 0; freearray(pparams); if (oargv0) { zsfree(argzero);