Hi all,
I run the following command in order to know the upper limit on argument
length when using xargs on my Debian box:
---------------------------
$ xargs --show-limits --no-run-if-empty < /dev/null
Your environment variables take up 4910 bytes
POSIX upper limit on argument length (this system): 2090194
POSIX smallest allowable upper limit on argument length (all systems):
4096
Maximum length of command we could actually use: 2085284
Size of command buffer we are actually using: 131072
---------------------------
Based on the above output, what's the real smallest allowable upper limit
on argument length for my system? I still cann't figure it out.
Furthermore, I do the following testing on my box:
$ ls ./ovpn/* | wc -l
9050
$ ls ./ovpn/* | xargs -P0 -r -s 4196 awk 'BEGINFILE{ a =0 }
/^<[/]key>/ { a ++ }
ENDFILE{ if(a == 1) print FILENAME }' |
xargs -P0 -r stat --printf="%Y %n\n" | grep 'cannot stat'
stat: cannot stat ‘./ovpn/vpngate_122.135.86.1_tcp_995.ovp./ovpn/
vpngate_174.4.184.152_tcp_1788.ovpn_CA’: No such file or directory
stat: cannot stat ‘n_JP’: No such file or directory
stat: cannot stat ‘./ovpn/vpngate_188.55.144.83_tcp_1342.o./ovpn/
vpngate_181.162.135.132_tcp_1368.ovpn_CL’: No such file or directory
[snipped]
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'
$
Any hints on these issues?
Regards
--
.: Hongyi Zhao [ hongyi.zhao AT
gmail.com ] Free as in Freedom :.