zsh-workers
 help / color / mirror / code / Atom feed
* beta21; Bug in execcmd() and job text question
@ 1996-06-26 23:25 Thorsten Meinecke
       [not found] ` <kaefer@aglaia.snafu.DE>
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Meinecke @ 1996-06-26 23:25 UTC (permalink / raw)
  To: zsh-workers

1) Whoa!

  % ls =()
  zsh: parse error in process substitution
  zsh: segmentation fault  ../../zsh-RCS-b21/Src/zsh -f

This happens in getjobtext(), after the argument of the command was
nuked in prefork().

2) I can see why getjobtext() was moved behind prefork() by the recent
reconstruction in this area.  But why can't the original, that is unsub-
stituted job text be kept when the command was a simple command?  For
example, no problem with this...

 % setopt shwordsplit; foo="sleep 10"
 % $foo& jobs
 [1] 850
 [1]  + running    sleep 10

...but wouldn't it be better to say `eval $foo' in the example below?

 % eval $foo& jobs
 [1] 884
 [1]  + running    eval sleep 10

Unless I'm missing something obvious, the patch below might fix both.
Regards,
--Thorsten


*** exec.c	1996/06/25 07:34:03	2.37
--- exec.c	1996/06/26 22:00:14
***************
*** 1165,1170 ****
--- 1165,1176 ----
  	}
      }
  
+     /* Get the text associated with this command. */
+     if (jobbing || (how & Z_TIMED))
+ 	text = getjobtext((void *) cmd);
+     else
+ 	text = NULL;
+ 
      /* Do prefork substitutions */
      prefork(args, (((type == CCASE) ? 4 : 0)
  		   | (assign ? 2 : isset(MAGICEQUALSUBST))));
***************
*** 1252,1262 ****
  	}
      }
  
!     /* Get the text associated with this command. */
!     if (jobbing || (how & Z_TIMED))
  	text = getjobtext((void *) cmd);
-     else
- 	text = NULL;
  
      /* Set up special parameter $_ */
      zsfree(underscore);
--- 1258,1266 ----
  	}
      }
  
!     /* Update the text for this command if it was not a simple one. */
!     if (!errflag && !checked && (jobbing || (how & Z_TIMED)))
  	text = getjobtext((void *) cmd);
  
      /* Set up special parameter $_ */
      zsfree(underscore);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: beta21; Bug in execcmd() and job text question
       [not found] ` <kaefer@aglaia.snafu.DE>
@ 1996-06-27  0:37   ` Bart Schaefer
  1996-06-27  0:46     ` Zefram
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 1996-06-27  0:37 UTC (permalink / raw)
  To: zsh-workers

On Jun 27,  1:25am, Thorsten Meinecke wrote:
} Subject: beta21; Bug in execcmd() and job text question
}
} ...but wouldn't it be better to say `eval $foo' in the example below?
} 
}  % eval $foo& jobs
}  [1] 884
}  [1]  + running    eval sleep 10

Hmm.  No, actually, I prefer it the way it is above.  If I change the
value of foo, seeing `eval $foo' doesn't tell me anything at all about
what's actually running.

In fact, I'd prefer it if the "eval" got stripped off so all that zsh
prints is `sleep 10'.  After all, "eval" is not a job; the thing that
was being eval'd is the job.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: beta21; Bug in execcmd() and job text question
  1996-06-27  0:37   ` Bart Schaefer
@ 1996-06-27  0:46     ` Zefram
  0 siblings, 0 replies; 3+ messages in thread
From: Zefram @ 1996-06-27  0:46 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

>}  % eval $foo& jobs
>}  [1] 884
>}  [1]  + running    eval sleep 10
>
>In fact, I'd prefer it if the "eval" got stripped off so all that zsh
>prints is `sleep 10'.  After all, "eval" is not a job; the thing that
>was being eval'd is the job.

No, the eval is backgrounded in this case.  If it were `foo="sleep
10&"; eval $foo` then the sleep would be the job.

-zefram



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-06-27  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-26 23:25 beta21; Bug in execcmd() and job text question Thorsten Meinecke
     [not found] ` <kaefer@aglaia.snafu.DE>
1996-06-27  0:37   ` Bart Schaefer
1996-06-27  0:46     ` Zefram

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