zsh-workers
 help / color / mirror / code / Atom feed
* zsh behavior when fork() failed
@ 2012-02-23 10:40 Dipak Gaigole
  2012-02-23 16:14 ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Dipak Gaigole @ 2012-02-23 10:40 UTC (permalink / raw)
  To: zsh-workers

Hi,

Recently I have observed that the behavior of zsh differs from other
shells like bash, ksh whenever fork () fails.
In order to simulate and make fork () fail with EAGAIN error I have
used "ulimit -u <no>"

BASH:
bash-2.05b$ ulimit -u 11
bash-2.05b$ echo $$
4699
bash-2.05b$ bash
bash: fork: Resource temporarily unavailable
bash-2.05b$ echo $$
4824
bash-2.05b$ date
bash: fork: Resource temporarily unavailable
bash-2.05b$ echo $?
1
bash-2.05b$


KSH:
bash-2.05b$ ksh
$ date
ksh: cannot fork - try again
$ echo $?
1
$


ZSH:
bash-2.05b$ zsh
/etc/zshrc:21: fork failed: resource temporarily unavailable
[dipak@rhas30]/tmp% date
zsh: fork failed: resource temporarily unavailable
[dipak@rhas30]/tmp% echo $?
0
[dipak@rhas30]/tmp%


As we can see that in zsh whenever fork() fails with EAGAIN, the
return status is incorrect (i.e. $? is 0) and this causes further
failures if this happens in a big script where script's progress
depends on execution of previous command i.e $?

I have tried this with zsh version 4.0.7, 4.3.4 as well as 4.3.15
(latest as of now I suppose) and found the same behavior.

So this looks like a bug to me. Please correct me if I am wrong.


Thanks,
Dipak


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

end of thread, other threads:[~2012-03-06  9:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-23 10:40 zsh behavior when fork() failed Dipak Gaigole
2012-02-23 16:14 ` Bart Schaefer
2012-02-24 11:08   ` Dipak Gaigole
2012-02-24 18:05     ` Bart Schaefer
2012-02-25 16:33       ` Dipak Gaigole
2012-02-26 19:52         ` Bart Schaefer
2012-02-26 21:57           ` Bart Schaefer
2012-02-29 12:57           ` Dipak Gaigole
2012-02-29 19:06             ` Bart Schaefer
2012-03-06  9:01               ` Dipak Gaigole

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