zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: something strange with compset and/or _normal
Date: Thu, 10 Jun 1999 17:20:14 +0200 (MET DST)	[thread overview]
Message-ID: <199906101520.RAA25510@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Thu, 10 Jun 1999 18:49:26 +0400


Andrej Borsenkow wrote:

> I try to complete after sudo; the relevant part (albeit clumsy) is
> 
> if [[ $cmd -gt 0 ]] && compset -n $cmd
> then
>     _normal
> 
> where ``cmd'' is position of command to execute and is computed somewhere
> else.
> 
> Unfortunately, that is what I get in log:
> + [[ -z _umount ]]
> + _sudo

A bug with the execution-optimisation patch that showed up when
shell functions called themselves recursively.

Bye
 Sven

diff -u os/exec.c Src/exec.c
--- os/exec.c	Tue Jun  8 15:23:06 1999
+++ Src/exec.c	Thu Jun 10 17:15:35 1999
@@ -1955,7 +1954,6 @@
 
 	    if (is_shfunc) {
 		/* It's a shell function */
-		LinkList tmpa = cmd->args;
 		int ofl = cmd->flags;
 
 #ifdef PATH_DEV_FD
@@ -1968,10 +1966,8 @@
 		if (subsh_close >= 0)
 		    zclose(subsh_close);
 		subsh_close = -1;
-		cmd->args = args;
 		cmd->flags = flags;
-		execshfunc(cmd, (Shfunc) hn);
-		cmd->args = tmpa;
+		execshfunc(cmd, (Shfunc) hn, args);
 		cmd->flags = ofl;
 #ifdef PATH_DEV_FD
 		for (i = 10; i <= max_zsh_fd; i++)
@@ -2775,7 +2771,7 @@
 
 /**/
 static void
-execshfunc(Cmd cmd, Shfunc shf)
+execshfunc(Cmd cmd, Shfunc shf, LinkList args)
 {
     LinkList last_file_list = NULL;
 
@@ -2793,9 +2789,9 @@
     if (isset(XTRACE)) {
 	LinkNode lptr;
 	fprintf(stderr, "%s", prompt4 ? prompt4 : prompt4);
-	if (cmd->args)
-	    for (lptr = firstnode(cmd->args); lptr; incnode(lptr)) {
-		if (lptr != firstnode(cmd->args))
+	if (args)
+	    for (lptr = firstnode(args); lptr; incnode(lptr)) {
+		if (lptr != firstnode(args))
 		    fputc(' ', stderr);
 		fprintf(stderr, "%s", (char *)getdata(lptr));
 	    }
@@ -2803,7 +2799,7 @@
 	fflush(stderr);
     }
 
-    doshfunc(shf->nam, shf->funcdef, cmd->args, shf->flags, 0);
+    doshfunc(shf->nam, shf->funcdef, args, shf->flags, 0);
 
     if (!list_pipe)
 	deletefilelist(last_file_list);

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-06-10 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-10 15:20 Sven Wischnowsky [this message]
1999-06-10 15:04 ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
1999-06-11  6:57 Sven Wischnowsky
1999-06-11 11:09 ` Bart Schaefer
1999-06-10 14:49 Andrej Borsenkow

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=199906101520.RAA25510@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).