ulimit -c unlimited

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ulimit -c unlimited

積丹尼 Dan Jacobson
$ ulimit -c 99999999999999
$ ulimit -c 9999999999
$ ulimit -c unlimited
bash: ulimit: core file size: cannot modify limit: Operation not permitted

Maybe say: try again with numbers, not letters.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ulimit -c unlimited

Reuti

> Am 26.07.2017 um 03:43 schrieb 積丹尼 Dan Jacobson <[hidden email]>:
>
> $ ulimit -c 99999999999999
> $ ulimit -c 9999999999
> $ ulimit -c unlimited
> bash: ulimit: core file size: cannot modify limit: Operation not permitted
>
> Maybe say: try again with numbers, not letters.

Do you get this as root too?

If the hard limit is unlimited, then you can raise the soft limit again also as normal user to be unlimited. So the statement "Operation not permitted" is correct, although it means: "can't raise hard limit again" as without -S or -H it sets both limits. The soft limit OTOH can be changed between a value and unlimited as often as you like, as the long as the hard limit stays to be set to unlimited.

-- Reuti


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ulimit -c unlimited

Chet Ramey
In reply to this post by 積丹尼 Dan Jacobson
On 7/25/17 9:43 PM, 積丹尼 Dan Jacobson wrote:
> $ ulimit -c 99999999999999
> $ ulimit -c 9999999999
> $ ulimit -c unlimited
> bash: ulimit: core file size: cannot modify limit: Operation not permitted

The limits are not quite what you think they are.  Here's what happens on
my system.

The core file size limit starts at 0 (the soft limit).  The hard limit is
9223372036854775807.

The first command sets the hard and the soft limits to 99999999999999,
scaled by the block factor, since ulimit sets both the hard and soft limits
unless otherwise directed.

The second command lowers the hard and soft limits to 9999999999, again
scaled by the block factor. This is permitted.

The third command attempts to increase the limit beyond the current hard
limit. If you're not root, this is not permitted.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ulimit -c unlimited

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
$  ulimit -c
0
$  ulimit -c 99
$  ulimit -c
99
$  ulimit -c 9999999999999999999999999999999999999999999999
bash: ulimit: 9999999999999999999999999999999999999999999999: limit out of range
$  ulimit -c 9999999999999999999999999999999
bash: ulimit: 9999999999999999999999999999999: limit out of range
$  ulimit -c 9999999999999999999
bash: ulimit: 9999999999999999999: limit out of range

Hmmm, maybe make the above error message say what the range is, so the
user doesn't have to probe it. Or say "do ... to see the valid range".


$  ulimit -c 9999999999999
bash: ulimit: core file size: cannot modify limit: Operation not permitted
$  ulimit -c 9999999999
bash: ulimit: core file size: cannot modify limit: Operation not permitted
$  ulimit -c 999999
bash: ulimit: core file size: cannot modify limit: Operation not permitted

By this time the user has probably given up... thinking that it isn't
the value that is the problem, but the basic Operation. (But if he
probes further, indeed some values work.)

$  ulimit -c 99
$  ulimit -c 999
bash: ulimit: core file size: cannot modify limit: Operation not permitted

Odd, a little later I try
$ ulimit -c 99
bash: ulimit: core file size: cannot modify limit: Operation not permitted

>>>>> "R" == Reuti  <[hidden email]> writes:

R> Do you get this as root too?

I'm just trying to say the messages are confusing for the normal user.
I don't want make my report too big, so am not trying it for root.

R> If the hard limit is unlimited, then you can raise the soft limit
R> again also as normal user to be unlimited. So the statement "Operation
R> not permitted" is correct, although it means: "can't raise hard limit
R> again" as without -S or -H it sets both limits. The soft limit OTOH
R> can be changed between a value and unlimited as often as you like, as
R> the long as the hard limit stays to be set to unlimited.

Hmmm...Wait... I was using "help ulimit",
now I see on the bash man page

              The -H and -S options specify that the hard or soft limit is set
              for the given resource.  A hard limit cannot be increased  by  a
              non-root  user  once it is set; a soft limit may be increased up
              to the value of the hard limit.

So maybe that explains why the user can only set it once (99 above) then
cannot change it...

OK I recommend the "help ulimit" now say

      [-S|-H] -a        all current limits are reported
      [-S|-H] -b        the socket buffer size
      [-S|-H] -c        the maximum size of core files created
      [-S|-H] -d        the maximum size of a process's data segment
      [-S|-H] -e        the maximum scheduling priority (`nice')
      [-S|-H] -f        the maximum size of files written by the shell and its children

and perhaps the same on the bash man page.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ulimit -c unlimited

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
CR> The third command attempts to increase the limit beyond the current hard
CR> limit. If you're not root, this is not permitted.

I find it odd that a normal user can raise it only once...

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ulimit -c unlimited

Greg Wooledge
In reply to this post by 積丹尼 Dan Jacobson
On Wed, Jul 26, 2017 at 10:22:49PM +0800, 積丹尼 Dan Jacobson wrote:
> $  ulimit -c 9999999999999999999999999999999999999999999999
> bash: ulimit: 9999999999999999999999999999999999999999999999: limit out of range
> $  ulimit -c 9999999999999999999999999999999
> bash: ulimit: 9999999999999999999999999999999: limit out of range
> $  ulimit -c 9999999999999999999
> bash: ulimit: 9999999999999999999: limit out of range
>
> Hmmm, maybe make the above error message say what the range is, so the
> user doesn't have to probe it. Or say "do ... to see the valid range".

It's not really a bash thing.  It's an underlying operating system
(kernel) thing.  See "man setrlimit" for the libc interface.

Bash doesn't really have any way of knowing what the valid ranges are.
That isn't part of the getrlimit/setrlimit interface.  The only things
you can ask for are the current hard and soft limits.

Loading...