Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCHv1] [long] improvements to limit/ulimit API and doc



> 2020/11/28 5:46, Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> 
>> +	if ((tmp = ret*unit) < ret) {
> 
> I don't think that's a valid check.

Oops, sorry. It should be "if ((ret*unit)/unit != ret)".

Anyway, sorry for disturbing you.
I will prepare a patch after you finish your patch.

> The problem may be better addressed by reviewing overflow
> handling everywhere in the code, ...

Wrap around (or overflow) depends on the size and signedness of
the integer. We may use strtoimax(3) or such but need to check
the result against rlim_t again.


Another minor issue (NOT of your patch).
On my Fedora 32 box, with system's /bin/zsh (ver 5.8),

zsh% ulimit -f 18014398509481984    # 2**54 blocks = 2**63 bytes
zsh% ulimit -f
18014398509481984
zsh% exit                           # can't write history file
[1]    5486 file size limit exceeded (core dumped)  /bin/zsh

I'm not sure this is a bug of zsh or not (sorry I have no time
to investigate further).

Jun




Messages sorted by: Reverse Date, Date, Thread, Author