On Mon, 05 Dec 2016 14:01:39 +0000, Hongyi Zhao wrote:
> As you can see, the ``-s 4196'' will trigger error; while ``-s 4096''
> will run smoothly:
>
> $ ls ./ovpn/* | xargs -P0 -r -s 4096 awk 'BEGINFILE{ a =0 }
> /^<[/]key>/{ a ++ }
> ENDFILE{ if(a == 1) print FILENAME }' |
> xargs -P0 -r stat --printf="%Y %n\n" | grep 'cannot stat'
> $
I do some further testings, it shows that the smallest allowable upper
limit on argument length is about 3330 bytes on my box. The methods and
steps are as follows:
[1] Using the ``-n1'' of xargs to obtain a standard reference file:
$ ls ./ovpn/* | xargs -P0 -r -n1 awk 'BEGINFILE{ a =0 }
/^<[/]key>/{ a ++ }
ENDFILE{ if(a == 1) print FILENAME }' |
xargs -P0 -r -n1 stat --printf="%Y %n\n" | sort -k1n > 111
[2] Using different values for ``-s'' of xargs and compare the result
with the result obtained by ``-n1'' of xargs:
$ ls ./ovpn/* |
xargs -P0 -r -s 3340 awk 'BEGINFILE{ a =0 }
/^<[/]key>/{ a ++ }
ENDFILE{ if(a == 1) print FILENAME }' |
xargs -P0 -r -s 3340 stat --printf="%Y %n\n" | sort -k1n > 222
$ diff 111 222
0a1,2
> vpn_ID
> 95.ovpn_US
236d237
< 1480727540 ./ovpn/vpngate_5.53.124.169_tcp_995.ovpn_RU
6952d6952
< 1480941107 ./ovpn/vpngate_68.82.90.209_tcp_1509.ovpn_US
8588c8588
< 1480946476 ./ovpn/vpngate_36.72.168.3_tcp_1577.ovpn_ID
---
> 1480946476 ./ovpn/vpngate_36.72.168.3_tcp_1577.o1480727540 ./ovpn/
vpngate_5.53.124.169_tcp_995.ovpn_RU
8993c8993
< 1480946669 ./ovpn/vpngate_68.82.119.70_tcp_995.ovpn_US
---
> 1480946669 ./ovpn/vpngate_68.82.119.70_tcp_91480941107 ./ovpn/
vpngate_68.82.90.209_tcp_1509.ovpn_US
$ ls ./ovpn/* |
xargs -P0 -r -s 3330 awk 'BEGINFILE{ a =0 }
/^<[/]key>/{ a ++ }
ENDFILE{ if(a == 1) print FILENAME }' |
xargs -P0 -r -s 3330 stat --printf="%Y %n\n" | sort -k1n > 222
$ diff 111 222
$
Why does this happen? Any hints?
Regards
--
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.