zsh-workers
 help / color / mirror / code / Atom feed
From: Micah Cowan <micah@cowan.name>
To: Micah Cowan <micah@cowan.name>
Cc: davidpeer@cs.huji.ac.il, zsh-workers@sunsite.dk
Subject: Re: Bug in ulimit ?
Date: Tue, 17 Apr 2007 03:49:03 -0700	[thread overview]
Message-ID: <4624A61F.8010006@cowan.name> (raw)
In-Reply-To: <46249BC7.8070200@cowan.name>

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:

<snip>

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
<loops forever>
$ bash -c 'ulimit -St 0; while :; do :; done'
CPU time limit exceeded (core dumped)
$ bash -c 'ulimit -St 0; (while :; do :; done)'
<loops forever>

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
<loops>
$ zsh -c 'ulimit -Ht 0; (ulimit -Ht; while :; do :; done)'
0
<loops>
$ 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/


  parent reply	other threads:[~2007-04-17 10:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-17  9:00 David Peer
2007-04-17  9:30 ` Micah Cowan
2007-04-17  9:33   ` David Peer
2007-04-17  9:42   ` Stephane Chazelas
2007-04-17 10:04     ` Micah Cowan
2007-04-17 10:43       ` Stephane Chazelas
2007-04-17 10:55         ` Micah Cowan
2007-04-17 12:53           ` Stephane Chazelas
2007-04-17 13:03             ` Stephane Chazelas
2007-04-17 13:24               ` Stephane Chazelas
2007-04-17 13:34                 ` Stephane Chazelas
2007-04-17 13:54                   ` David Peer
2007-04-17 13:57                     ` David Peer
2007-04-17 15:02                   ` [OT] " Stephane Chazelas
2007-04-17 10:49       ` Micah Cowan [this message]
2007-04-17 14:15   ` Tom Alsberg
2007-04-17 15:48     ` David Peer
     [not found]     ` <20070417151501.GH4955@sc.homeunix.net>
2007-04-18  7:46       ` (Off-Topic) " Tom Alsberg
2007-04-18  8:22         ` Stephane Chazelas
2007-04-18  9:23           ` (Off-Topic) Bug in ulimit? Tom Alsberg
2007-04-18 10:10             ` Stephane Chazelas

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=4624A61F.8010006@cowan.name \
    --to=micah@cowan.name \
    --cc=davidpeer@cs.huji.ac.il \
    --cc=zsh-workers@sunsite.dk \
    /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).