On 27/03/17 02:18, Ludovic Courtès wrote: > Hi Pádraig, > > Pádraig Brady <[email protected]> skribis: > >> On 26/03/17 06:41, Ludovic Courtès wrote: > > [...] > >>> Part of the reason, I think, is that ‘vm’ is computed by simply running >>> ‘cut -b1’: >>> >>> vm=$(get_min_ulimit_v_ cut -b1 /dev/null) \ >>> || skip_ "this shell lacks ulimit support" >>> >>> … but the last couple of tests also run sh within that limit: >> >> Are you saying the returns_ call induces a subshell? >> I suppose it might on some shells, though it doesn't seem to on bash 4.3 >> here. > > I don’t think ‘return_’ spawns a subshell, but the ulimit should account > for memory needed by the shell in addition to what ‘cut’ needs. > >>> # Explicitly disallow values above CUT_MAX >>> (ulimit -v $vm && returns_ 1 cut -b$SIZE_MAX /dev/null 2>/dev/null) || >>> fail=1 >>> (ulimit -v $vm && returns_ 1 cut -b$SIZE_OFLOW /dev/null 2>/dev/null) || >>> fail=1 >>> >>> It might be more accurate to do something like: >>> >>> vm=$(get_min_ulimit_v_ sh -c 'cut -b1 /dev/null') >> >> That give 10004 rather than 5004 on my x86_64 system here. >> Another option might be to use: >> vm=$(get_min_ulimit_v_ returns_ 0 cut -b1 /dev/null) >> >> Does that give better results for you? > > Yes the patch below on top of 8.26 (that is, without vm += 1000) works > for me. > > Thanks, > Ludo’.
Pushed in your name at: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=f542200 Marking this as done. cheers, Pádraig
