* lib/buildcmd.c (bc_do_exec): Declare variables at the top of the
relevant block, in order to avoid mixing declarations and
statements.
* xargs/xargs.c (main): Likewise.
* NEWS: Mention the fix for bug #22708 in the correct section.
2008-03-23 Leslie Polzer <leslie.polzer@gmx.net>
Merge Leslie Polzer's ARG_MAX enhancements to xargs which were
produced as part of the Google Summer of Code 2007.
These changes fix Savannah bug #22708.
* find/pred.c (launch): The struct buildcmd_control* argument is
no longer const.
* find/defs.h: Likewise
* lib/buildcmd.c (bc_do_insert): The struct buildcmd_control*
argument is no longer const.
(bc_push_arg): Likewise.
(cb_exec_noop): Likewise.
(get_stringv_len): New function; measures the length of
a NULL-terminated argv sequence.
(bc_do_exec): Rename from do_exec, and make global. Modify the
function to react to exec failing with E2BIG by trying again
with fewer arguments.
* xargs/xargs.1: Mention that xargs automatically adopts to the
situation where exec fails with E2BIG.
* xargs/xargs.c: (parent): New variable, the PID of the parent
process.
(main): initialise the variable 'parent'. Don't fail immediately
due to lack of space when the environment is large. Call
xargs_do_exec via bc_do_exec.
(xargs_do_exec): The struct buildcmd_control* argument is no
longer const. When exec fails in the child, communicate the
errno value back to the parent through a pipe which is
close-on-exec; this allows us to accurately determine the cause of
the failure and also to distinguish exec failures from all
possible exit codes in the child.
(wait_for_proc): If the utility cannot be found or cannot be run,
we now find out about this by reading an errno value from the
pipe, so this means that exit codes 126 and 127 in the child no
longer have a special interpretation.
* NEWS: mention these changes.
Remove "lib/wait.h", since gnulib provides <sys/wait.h>.
* lib/Makefile.am (EXTRA_DIST): Remove wait.h, since gnulib
provides it.
* lib/wait.h: Not needed.
* find/pred.c: Include <sys/wait.h> instead of "wait.h".
* lib/waitpid.c: Likewise.
* xargs/xargs.c: Likewise.
Remove unnecessary include guards.
* lib/dircallback.c: gnulib provides <locale.h>, so no need for
include guards.
* locate/locate.c: Likewise.
* lib/listfile.c: Likewise.
* lib/savedirinfo.c: Likewise with <sys/stat.h>
* find/defs.h: gnulib provides <inttypes.h>, so no need for
include guards.
* lib/nextelem.c: Likewise with <string.h> and <stdlib.h>.
* locate/bigram.c: Likewise.
* locate/frcode.c: Likewise.
* lib/buildcmd.c: Likewise with <locale.h> and <wchar.h>
* xargs/xargs.c: Likewise with <locale.h>, <wchar.h> and <stdlib.h>
* import-gnulib.config (modules): Import the mbrtowc and whchar
modules.
* lib/qmark.c (multibyte_qmark_chars): Don't surround with
HAVE_MBRTOWC, since we now have a replacement for mbrtowc.
Likewise, don't protect inclusion of <string.h> with
HAVE_STRING_H. Likewise with <wchar.h>.
(multibyte_qmark_chars): Rename to qmark_chars.
(qmark_chars): Remove old version (since it is replaced by the
function that used to be multibyte_qmark_chars).
* lib/printquoted.c: Don't include <wchar.h>, we don't need it.
Signed-off-by: James Youngman <jay@gnu.org>
Update gnulib version.
* import-gnulib.config (gpl3_update_files): No longer need to
update the licenses of build-aux/mdate-sh, build-aux/texinfo.tex
or build-aux/ylwrap as they are already GPLv3+.
(modules): Use the strdup-posix module instead of strdup, and stop
using the obsolete modules memcmp and memset, since we now assume
those functions will already be present on the host system.
* import-gnulib.sh (rehack): Be more verbose about which files
actually needed a license edit and which did not.
Follow gnulib-tool's Makefile.am edit suggestions.
* find/Makefile.am (LDADD): Use $(LIBINTL) instead of @INTLLIBS@
and use $(LIB_CLOCK_GETTIME) instead of @LIB_CLOCK_GETTIME@.
* lib/Makefile.am: Likewise.
* locate/Makefile.am: Likewise.
* xargs/Makefile.am: Likewise.
* import-gnulib.sh (hack_gnulib_tool_output): Add
m4/gnulib-cache.m4 to EXTRA_DIST in gnulib/Makefile.am, as
gnulib-tool suggests.
* find/pred.c (scan_for_digit_differences): Remove declaration of
unused local, "ok".
(do_time_format): Remove decl of "done"; replace sole use with a
constant, "true". Initialize "i" and "n".
* lib/dircallback.c: Don't include unistd.h. Not needed.
* configure.ac (DEFAULT_ARG_SIZE): Check environment for a default
size override.
* lib/buildcmd.c (bc_use_sensible_arg_max): Use default size from
configure, if requested.
* README (DEFAULT_ARG_SIZE): Mention the ability to tune this at
configure time.
* NEWS: Document the change.
the same inode number for more than one file (smbfs, FAT, sometimes
some FUSE-based ones). This happens for unreferenced files. Fix
suggested by Jim Meyering.