On Sun, Dec 02, 2018 at 01:26:52PM +0100, Bruno Haible wrote: > Roman Bolshakov wrote: > > But then we will need to correct calculation of VC_ARG_MAX. We can take > > formulae from [2]: > > expr `getconf ARG_MAX` - `env|wc -c` - `env|egrep '^[^ ]+='|wc -l` \* 4 - > > 2048 > > This formula assumes that a pointer in the 'environ' array is 4 bytes long. > On 64-bit platforms it surely is 8 bytes long. > > More generally, I find this formula too fragile. It assumes so many things. > I would prefer a formula which does not attempt to produce the highest > possible > value, but makes less assumptions. How about > expr `getconf ARG_MAX` / 2 > ? >
Hi Bruno, I agree the command knows too much. I wasn't sure if it's important for someone if we use maximum possible value. I've found some prior art in computing max effective argument length in libtool (3/4 of ARG_MAX on GNU/BSD): http://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4#n1682 If someone needs the value, probably it's worth to move the computation from libtool to gnulib. Thank you, Roman