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

zsh behavior when fork() failed



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



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