Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCHv1] [long] improvements to limit/ulimit API and doc
2020-11-27 00:22:05 +0900, Jun. T:
>
> > 2020/11/26 22:55, Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> >
> > But:
> >
> > $ bash --posix -c 'ulimit 18446744073709551617; ulimit'
> > 1
>
> I think this is a bug of bash.
> It seems bash checks the wrap around only for the calculation of
> bytes = 512*blocks, and does not check if the number of blocks
> is already wrapped around.
Yes, looks like it does:
if (limit * factor / factor != limit) error(out of range)
(where limit is converted from string without overflow check).
>
> > There's also the question of the actual value of RLIM_INFINITY,
> > RLIM_SAVED_MAX, RLIM_SAVED_CUR and whether we can assume
> > RLIM_INFINITY is the maximum possible value.
>
> I guess zsh need not care about these things.
>
> # I must say I don't know what it means if RLIM_SAVED_XXX is not
> # equal to RLIM_INFINITY.
I can't say I know anything about those RLIM_SAVED_XXX. I
came across them for the first time today.
> Zsh only need to check whether the new limit user wants to set is
> within the range of rlim_t.
Yes, but how do you determine that range? Should we not also
reject 18446744073709551615 as out-of-range on systems where
it's RLIM_INFINITY since it's not preventing file sizes to get
past 18446744073709551615 for instance.
$ bash --posix -c 'ulimit -t 18446744073709551615 && ulimit -t'
unlimited
yash rejects it:
$ yash -c 'ulimit -t 18446744073709551614 && ulimit -t'
18446744073709551614
$ yash -c 'ulimit -t 18446744073709551615 && ulimit -t'
ulimit: Numerical result out of range
$ yash -c 'ulimit -t 18446744073709551616 && ulimit -t'
ulimit: `18446744073709551616' is not a valid integer
In any case, while I agree they are valid (though minor)
concerns, I won't address them in this round. I can add a
"BUGS" entry though.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author