From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25781 invoked from network); 10 Jun 1999 15:20:30 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 10 Jun 1999 15:20:30 -0000 Received: (qmail 21737 invoked by alias); 10 Jun 1999 15:20:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6579 Received: (qmail 21729 invoked from network); 10 Jun 1999 15:20:19 -0000 Date: Thu, 10 Jun 1999 17:20:14 +0200 (MET DST) Message-Id: <199906101520.RAA25510@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Thu, 10 Jun 1999 18:49:26 +0400 Subject: Re: something strange with compset and/or _normal 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