From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20095 invoked by alias); 23 Feb 2012 10:40:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30258 Received: (qmail 7809 invoked from network); 23 Feb 2012 10:40:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.43 as permitted sender) Received-SPF: pass (google.com: domain of dipakgaigole@gmail.com designates 10.112.86.198 as permitted sender) client-ip=10.112.86.198; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dipakgaigole@gmail.com designates 10.112.86.198 as permitted sender) smtp.mail=dipakgaigole@gmail.com; dkim=pass header.i=dipakgaigole@gmail.com 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= MIME-Version: 1.0 Date: Thu, 23 Feb 2012 16:10:15 +0530 Message-ID: Subject: zsh behavior when fork() failed From: Dipak Gaigole To: zsh-workers@zsh.org Content-Type: text/plain; charset=ISO-8859-1 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 " 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