From e47f3b7b9f4479e296e2ee927b7e08891474a521 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Apr 2001 23:16:55 +0000 Subject: o The -s limit is ARG_MAX - 4K, not ARG_MAX - 2K. o Mention that the current environment is part of the -s calculation. o Add a BUGS section that warns against executing a program that increases the size of the argument list or the size of the environment. I have wondered for a while what the difference is between get a big list | xargs sudo command which fails and get a big list | sudo xargs command which succeeds. The answer is that in the first case, sudo expands the environment and pushes the amount of data passed into execve over the E2BIG threshold. --- usr.bin/xargs/xargs.1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'usr.bin/xargs/xargs.1') diff --git a/usr.bin/xargs/xargs.1 b/usr.bin/xargs/xargs.1 index b7f4cdb..671edc3 100644 --- a/usr.bin/xargs/xargs.1 +++ b/usr.bin/xargs/xargs.1 @@ -112,16 +112,17 @@ is 5000. .It Fl s Ar size Set the maximum number of bytes for the command line length provided to .Ar utility . -The sum of the length of the utility name and the arguments passed to +The sum of the length of the utility name, the arguments passed to .Ar utility (including .Dv NULL -terminators) will be less than or equal to this number. +terminators) and the current environment will be less than or equal to +this number. The current default value for .Ar size is .Dv ARG_MAX -- 2048. +- 4096. .It Fl t Echo the command to be executed to standard error immediately before it is executed. @@ -164,10 +165,19 @@ If any other error occurs, exits with a value of 1. .Sh SEE ALSO .Xr echo 1 , -.Xr find 1 +.Xr find 1 , +.Xr execvp 3 .Sh STANDARDS The .Nm utility is expected to be .St -p1003.2 compliant. +.Sh BUGS +If +.Ar utility +attempts to envoke another command such that the number of arguments or the +size of the environment is increased, it risks +.Xr execvp 3 +failing with +.Dv E2BIG . -- cgit v1.1