output of 'ulimit -c' and posix: whats showing?

Viewed 20

I have inherited some scripts where 'ulimit -c ' is set and 'set -o posix' and giving me as a result twice the value or half if I turn it off again. I see this on "Red Hat Enterprise Linux Server release 6.10 (Santiago)" and on "release 7.9 (Maipo)".

How to replicate:

[app@host] ~ $ ulimit -c
2048
[app@host] ~ $ set  -o posix
[app@host] ~ $ ulimit -c
4096

Is it only a display issue? Why is this happening, can someone please explain. Regards

1 Answers

Quoting from the bash manual entry (on my Ubuntu machine):

"Values are in 1024-byte increments, except for -t, which is in seconds; -p, which is in units of 512-byte blocks; -P, -T, -b, -k, -n, and -u, which are unscaled values; and, when in posix mode, -c and -f, which are in 512-byte increments."


So ...

Is it only a display issue?

No. It would affect the setting of limits too.

Why is this happening, can someone please explain.

Because the documentation says so. (Presumably, the bash developers thought that 1024 was a more natural / expected unit for -c and -f.)

Related