Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in ulimit ?
- X-seq: zsh-workers 23286
- From: Micah Cowan <micah@xxxxxxxxxx>
- To: Micah Cowan <micah@xxxxxxxxxx>
- Subject: Re: Bug in ulimit ?
- Date: Tue, 17 Apr 2007 03:49:03 -0700
- Cc: davidpeer@xxxxxxxxxxxxx, zsh-workers@xxxxxxxxxx
- In-reply-to: <46249BC7.8070200@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <46248CC2.4010901@xxxxxxxxxxxxx> <462493C0.20700@xxxxxxxxxx> <20070417094244.GA4955@xxxxxxxxxxxxxxx> <46249BC7.8070200@xxxxxxxxxx>
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/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author