From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17984 invoked from network); 17 Apr 2007 13:03:43 -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.4 required=5.0 tests=AWL,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 13:03:43 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 73564 invoked from network); 17 Apr 2007 13:03:37 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Apr 2007 13:03:36 -0000 Received: (qmail 22473 invoked by alias); 17 Apr 2007 13:03:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23289 Received: (qmail 22463 invoked from network); 17 Apr 2007 13:03:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Apr 2007 13:03:30 -0000 Received: (qmail 72846 invoked from network); 17 Apr 2007 13:03:30 -0000 Received: from smtpout0137.sc1.he.tucows.com (HELO n066.sc1.he.tucows.com) (64.97.136.137) by a.mx.sunsite.dk with SMTP; 17 Apr 2007 13:03:26 -0000 Received: from sc.homeunix.net (82.26.163.82) by n066.sc1.he.tucows.com (7.2.069.1) id 45FC2B72001CAF94; Tue, 17 Apr 2007 13:03:24 +0000 Received: from chazelas by sc.homeunix.net with local (Exim 4.63) (envelope-from ) id 1HdnL3-0004Kr-0B; Tue, 17 Apr 2007 14:03:17 +0100 Date: Tue, 17 Apr 2007 14:03:16 +0100 From: Stephane Chazelas To: Micah Cowan , zsh-workers@sunsite.dk Subject: Re: Bug in ulimit ? Message-ID: <20070417130316.GD4955@sc.homeunix.net> Mail-Followup-To: Micah Cowan , zsh-workers@sunsite.dk References: <46248CC2.4010901@cs.huji.ac.il> <462493C0.20700@cowan.name> <20070417094244.GA4955@sc.homeunix.net> <46249BC7.8070200@cowan.name> <20070417104303.GB4955@sc.homeunix.net> <4624A79F.1020107@cowan.name> <20070417125355.GC4955@sc.homeunix.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20070417125355.GC4955@sc.homeunix.net> User-Agent: Mutt/1.5.6i On Tue, Apr 17, 2007 at 01:53:55PM +0100, Stephane Chazelas wrote: [...] > The limit doesn't seem to get inherited by the child process: > > ~$ perl -MBSD::Resource -le 'setrlimit(RLIMIT_CPU,0,RLIM_INFINITY); print for getrlimit(RLIMIT_CPU); while (1) { ; }' > 0 > -1 > zsh: cpu limit exceeded perl -MBSD::Resource -le > (152)~$ perl -MBSD::Resource -le 'setrlimit(RLIMIT_CPU,0,RLIM_INFINITY); print for getrlimit(RLIMIT_CPU); if (fork) {wait} else {while (1) { ; }}' > 0 > -1 > [...] That doesn't explain everything though. In zsh -c 'ulimit -t 0; (while :; do :; done)' we get the SIGXCPU, but that's because of zsh's optimisation not to fork() for the () that is the last statement of the inline script. zsh -c 'ulimit -t 0; (while :; do :; done); :' lasts more than 1 second. $ sh -c 'ulimit -t 0; sh -c "ulimit -t"; :' 0 So it would seem that the limit is inherited but not applied in the child (and I couldn't see any signal being blocked or ignored). So that's probably not a libc issue, rather a Linux issue. -- Stéphane