From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6619 invoked from network); 17 Apr 2007 10:49:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.8 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Apr 2007 10:49:28 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 87235 invoked from network); 17 Apr 2007 10:49:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Apr 2007 10:49:22 -0000 Received: (qmail 22704 invoked by alias); 17 Apr 2007 10:49:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23286 Received: (qmail 22693 invoked from network); 17 Apr 2007 10:49:19 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Apr 2007 10:49:19 -0000 Received: (qmail 86886 invoked from network); 17 Apr 2007 10:49:19 -0000 Received: from flpi101.sbcis.sbc.com (207.115.20.70) by a.mx.sunsite.dk with SMTP; 17 Apr 2007 10:49:15 -0000 X-ORBL: [76.211.249.141] Received: from [76.211.249.141] (adsl-76-211-249-141.dsl.pltn13.sbcglobal.net [76.211.249.141]) by flpi101.sbcis.sbc.com (8.13.8 out.dk.spool/8.13.8) with ESMTP id l3HAmG4f004774; Tue, 17 Apr 2007 03:48:16 -0700 Message-ID: <4624A61F.8010006@cowan.name> Date: Tue, 17 Apr 2007 03:49:03 -0700 From: Micah Cowan User-Agent: Thunderbird 1.5.0.10 (X11/20070403) MIME-Version: 1.0 To: Micah Cowan CC: davidpeer@cs.huji.ac.il, zsh-workers@sunsite.dk Subject: Re: Bug in ulimit ? References: <46248CC2.4010901@cs.huji.ac.il> <462493C0.20700@cowan.name> <20070417094244.GA4955@sc.homeunix.net> <46249BC7.8070200@cowan.name> In-Reply-To: <46249BC7.8070200@cowan.name> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Micah Cowan wrote: > Stephane Chazelas wrote: >> Works as I'd expect from your man page quote here: >> >> $ time zsh -c 'ulimit -t 0; while :; do :; done' >> zsh: cpu limit exceeded zsh -c 'ulimit -t 0; while :; do :; done' >> zsh -c 'ulimit -t 0; while :; do :; done' 0.72s user 0.28s system 95% cpu 1.050 total > > Yes, I get those same results. However, in an interactive shell: Of course, this doesn't explain why you got your results for /soft/ limits above. I'm having some trouble isolating what the exact difference is, but there does seem to be a difference between current process's set limit, and child process whose limit was set by parent. $ bash -c 'ulimit -t 0; ulimit -Ht; while :; do :; done' 0 Killed $ bash -c 'ulimit -t 0; ulimit -Ht; (while :; do :; done)' 0 $ bash -c 'ulimit -St 0; while :; do :; done' CPU time limit exceeded (core dumped) $ bash -c 'ulimit -St 0; (while :; do :; done)' We can see that for both hard and soft limits, the child is not stopped. (Note that bash's default is to set the hard limit, unlike zsh which sets soft. POSIX gives very little specification to ulimit whatsoever). But: $ zsh -c 'ulimit -Ht 0; ulimit -Ht; while :; do :; done' 0 $ zsh -c 'ulimit -Ht 0; (ulimit -Ht; while :; do :; done)' 0 $ zsh -c 'ulimit -St 0; ulimit -St; while :; do :; done' 0 CPU time limit exceeded (core dumped) $ zsh -c 'ulimit -St 0; (ulimit -St; while :; do :; done)' 0 CPU time limit exceeded (core dumped) Note that zsh's behavior seems to depend more on whether it's hard or soft, rather than whether it's the child or the original. I can't make heads nor tails of it, but /something/'s definitely screwy. -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer... http://micah.cowan.name/