Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh behavior when fork() failed
- X-seq: zsh-workers 30258
- From: Dipak Gaigole <dipakgaigole@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: zsh behavior when fork() failed
- Date: Thu, 23 Feb 2012 16:10:15 +0530
- Authentication-results: mr.google.com; spf=pass (google.com: domain of dipakgaigole@xxxxxxxxx designates 10.112.86.198 as permitted sender) smtp.mail=dipakgaigole@xxxxxxxxx; dkim=pass header.i=dipakgaigole@xxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=bARqlfW6F9wfmJEv2qTBxHDg9EPwkhxz/2QJv2coxaQ=; b=UmcjYvNDj613VslX160nFp7fIEpG5goYRI2OHYLiFTsc3E2YO/EqdLBgZU2UBvhTbT 7weAieLfW64uptQ6pq+llfCH869wv2ignUocNiKBaAUgHKh1s/MzK1+C9h2y5veVqvL1 IdjsRqCGq15P18Pye4OWDKAf4f07RbflZJZ+s=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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