From: Dipak Gaigole <dipakgaigole@gmail.com>
To: zsh-workers@zsh.org
Subject: zsh behavior when fork() failed
Date: Thu, 23 Feb 2012 16:10:15 +0530 [thread overview]
Message-ID: <CADs2-=SFXA0rt1tKvBTnJC=UGdeaQk_GhSp_xM9EGFi_RW_YxA@mail.gmail.com> (raw)
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
next reply other threads:[~2012-02-23 10:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-23 10:40 Dipak Gaigole [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADs2-=SFXA0rt1tKvBTnJC=UGdeaQk_GhSp_xM9EGFi_RW_YxA@mail.gmail.com' \
--to=dipakgaigole@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).