Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in zsh-2.6-beta21



I wrote:
> alainc@xxxxxxxxx wrote:
> > exec <3 <(ls -l)
> > 
> > --->  zsh: no such file or directory: 3
> > 
> > So far so good, but after that it seems that zle is broken as the up
> > arrow does not retrieve the last command entered.
> 
> 1) Do we delay entersubsh() until after the redirections are handled?

Here's a patch for this.  It's fairly simple, so I don't see any
problems with it.

*** Src/exec.c.subsh	Thu Jul  4 15:30:39 1996
--- Src/exec.c	Thu Jul  4 15:39:05 1996
***************
*** 1102,1108 ****
      int save[10];
      int fil, dfil, is_cursh, type, i;
      int nullexec = 0, assign = 0, forked = 0;
!     int is_shfunc = 0, is_builtin = 0;
      /* Various flags to the command. */
      int cflags = 0, checked = 0;
  
--- 1102,1108 ----
      int save[10];
      int fil, dfil, is_cursh, type, i;
      int nullexec = 0, assign = 0, forked = 0;
!     int is_shfunc = 0, is_builtin = 0, is_exec = 0;
      /* Various flags to the command. */
      int cflags = 0, checked = 0;
  
***************
*** 1420,1426 ****
  	/* This is an exec (real or fake) for an external command.    *
  	 * Note that any form of exec means that the subshell is fake *
  	 * (but we may be in a subshell already).                     */
! 	entersubsh(how, 1, 1);
      }
  
      if (!(cflags & BINF_NOGLOB))
--- 1420,1426 ----
  	/* This is an exec (real or fake) for an external command.    *
  	 * Note that any form of exec means that the subshell is fake *
  	 * (but we may be in a subshell already).                     */
! 	is_exec = 1;
      }
  
      if (!(cflags & BINF_NOGLOB))
***************
*** 1551,1556 ****
--- 1551,1563 ----
      }
  
      if (unset(NOEXEC)) {
+ 	/*
+ 	 * We delay the entersubsh() to here when we are exec'ing
+ 	 * the current shell (including a fake exec to run a builtin then
+ 	 * exit) in case there is an error return.
+ 	 */
+ 	if (is_exec)
+ 	    entersubsh(how, 1, 1);
  	if (type >= CURSH) {
  	    static int (*func[]) _((Cmd)) =
  	    {

-- 
Peter Stephenson <pws@xxxxxx>       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.




Messages sorted by: Reverse Date, Date, Thread, Author