zsh-workers
 help / color / mirror / code / Atom feed
From: Martin.Ouwehand@sic.adm.epfl.ch (Martin Ouwehand)
To: zsh-workers@math.gatech.edu
Subject: "breaks" variable incorrectly reset in "doshfunc()"
Date: Mon, 27 Jan 1997 18:14:04 +0100	[thread overview]
Message-ID: <9701271714.AA14892@sehp1.epfl.ch> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2345 bytes --]

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);


             reply	other threads:[~1997-01-27 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-27 17:14 Martin Ouwehand [this message]
1997-01-27 21:57 ` Zoltan Hidvegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9701271714.AA14892@sehp1.epfl.ch \
    --to=martin.ouwehand@sic.adm.epfl.ch \
    --cc=ouwehand@sic.epfl.ch \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).