In interactive mode, there is a race between xargs prompting
about the next command to be run, vs. the execution of the
echo command:
$ echo 1 2 | xargs -n 1 -p
/bin/echo 1 ?...y
/bin/echo 2 ?...1
y
2
This behavior violates POSIX:
(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html):
The xargs utility shall then invoke the constructed command line
and wait for its completion. This sequence shall be repeated until
one of the following occurs: [...]
* xargs/xargs.c (xargs_do_exec): Move the code for waiting for forked
processes up, so that the child process terminates before we prompt
for the next command.
* NEWS: Mention the fix.
Reported by jidanni@jidanni.org in
http://lists.gnu.org/archive/html/bug-findutils/2013-07/msg00015.html
* find/testsuite/sv-34976-execdir-fd-leak.sh: Avoid using seq;
instead, use pre-generated lists of test file names. Also avoid
using file descriptors 0, 1, 2 in the test.
Prevent "Failed to save working dir[...]: Too many open files"
error by closing the file descriptor of the working directory.
* find/exec.c (impl_pred_exec): Free the working directory if find
executes the command in the local dir, i.e. if it has been saved
by record_exec_dir(). Re-indent code.
* find/testsuite/sv-34976-execdir-fd-leak.sh: Add test.
* find/testsuite/Makefile.am (test_shell_progs): Mention the test.
* NEWS: Mention the fix.
Look for '${host}-ar' as set by AC_CANONICAL_HOST before looking for
the unprefixed 'ar'. This is useful when cross-compiling when all
your binutils are prefixed.
* find/find.c (NOT_AN_INODE_NUMBER): Add missing identifier which
(when missing) caused a compilation error on system where struct
dirent lacks a d_ino member.
* find/find.1 (SEE ALSO): Explain how to invoke info to read the
Texinfo manual.
* locate/locate.1 (SEE ALSO): Likewise.
* locate/updatedb.1 (SEE ALSO): Likewise.
* xargs/xargs.1 (SEE ALSO): Likewise.
Also, do not reject -perm /MODE merely because of POSIXLY_CORRECT.
Problem reported in <https://savannah.gnu.org/bugs/?38474>.
* NEWS:
* doc/find.texi (Mode Bits): Document this.
(Environment Variables): POSIXLY_CORRECT does not affect -perm.
* find/parser.c (parse_help): Mention /MODE, not +MODE.
(non_posix_mode): Remove.
(parse_perm): Remove support for -perm +MODE.
Do not reject -perm /MODE merely because POSIXLY_CORRECT is set;
POSIXLY_CORRECT is not supposed to be for pedantic checking.
* build-aux/src-sniff.py (checkers): Check for #define directives
which use a macro name which is reserved.
(MakefileRegexChecker): New class which performs regex checks on
makefiles; this ensures that we don't check Makefile.in if we're
going to check Makefile.am anyway.
* lib/unused-result.h: Don't use a reserved identifier in the
macro name defined as the #include guard.
* locate/locatedb.h: Likewise.
* Makefile.am (findutils-check-smells): Don't check gnulib code.
* import-gnulib.sh (hack_gnulib_tool_output): Move the 'do' of a
for loop onto the line following the 'for' (instead of the same
line).
* doc/find.texi (xargs options): Explain that the logical end of
file marker string set with -E is not special if -d or -0 was
specified.
* xargs/xargs.c (usage): Mention this in the --help output.
(read_string): Correct the function header comment to point out
that there is no logical end-of-file processing for this case.
Also point out that the delimiter may not always be NUL.
This documentation update fixes Savannah bug #36652.
(main): Emit a warning message if -0/-d is specified and -E was
also used.
* xargs/testsuite/xargs.gnu/E_-0.exp: Don't compare stderr output,
since for this case xargs now emits a warning message.
* NEWS: Mention this change.
* xargs/xargs.1: Expand on the warning about sharing stdout for
"xargs -P".
* doc/find.texi (Controlling Parallelism): Add a suitable warning
about sharing resources here, too.
* NEWS: Mention that all relevant documentation was updated with
this warning.
* xargs/xargs.1 (-P option): Add a note that it is the duty of the
called processes to access shared resources like stdout properly to
avoid undetermined results like mangled output.
Reported by Congshi Huang in http://sv.gnu.org/bugs/?38356.
Smaller chunks are easier to handle for translators, ideally
one msgid per option. Separate them.
Change "mandatory arguments ..." note: optional arguments to long
options are also optional for their corresponding short option.
Remove the general note about the meaning of square brackets - the
reader has to know this already.
Fix the long --replace option: the equal sign must go into the
square brackets: --replace[=R].
Clarify -l option: separate from -L to emphasize that MAX-LINES
is optional for the -l option; therefore, mention the optional
argument with the option as "-l[MAX-LINES]".
* xargs/xargs.c (usage): Define HTL macro to print one help text
line (or entry). Split the option descriptions up by using the
above macro. Refine the messages to adapt to the common way:
change the start of each option's description to lower case,
do not use periods at the end, use semicolons where needed,
indent secondary lines, several other minor improvements.
Reported by Benno Schulenberg in
http://lists.gnu.org/archive/html/bug-findutils/2013-02/msg00017.html
* find/parser.c (insert_type): Give a more comprehensible error
message when the type letter following -type or -xtype corresponds
to a type of file which was unknown on the system which compiled
the find binary.
* NEWS: Mention this improvement.
* import-gnulib.config (modules): Import the safe-read module.
* xargs/xargs.c (xargs_do_exec): Use safe_read so that the read
system-call is retried if we handle a signal (for example
SIGUSR[12]) while we are trying to read the errno vlaue from the
child process.
* import-gnulib.sh (check_old_gnulib_dir_layout): Really apply the
bugfix by Kamil Dudka which eliminates a misleading message of
import-gnulib.sh on a fresh repository obtained by 'git clone
--recursive', by requiring gnulib/.git to exist but not requiring
it to be a directory.
* lib/Makefile.am (coverage-clean): Remove output files left
behind by gcc -fprofile-arcs -ftest-coverage by using $(RM) with a
glob pattern rather than a $(libfindtools_a_SOURCES.c=.gcno)
Makefile substitution, because the latter caused us to delete
header files entirely (their names do not end in .c). This had
meant that it was impossible to compile findutils after "make
clean". Bug report by David Gilbert.
* find/Makefile.am (coverage-clean): Likewise.
* xargs/Makefile.am (coverage-clean): Likewise.
* locate/Makefile.am (coverage-clean): Likewise.
* Makefile.am (coverage-clean): Likewise, but also do this in the
subdirectories whose Makefile.am files are generated by
gnulib-tool.
... on a fresh repository obtained by 'git clone --recursive'.
* import-gnulib.sh (check_old_gnulib_dir_layout): Do not require
./gnulib/.git to be a directory.
* locate/locate.c (cleanup_quote_opts): New atexit function, frees
quote_opts which otherwise would leak.
(dolocate): Eliminate the redundant boolean variable
they_chose_db, whose true/false-ness followed the not-NULL-ness of
locate_path. Rename locate_path to user_selected_locate_path to
make this explicit.
(dolocate): When we get to the bottom of the loop, don't try to
check for a further element in user_selected_locate_path if it is
NULL (that is, $LOCATE_PATH was unset and the -d option was not
used).
* find/exec.c (impl_pred_exec): Once pushing an argument for
-exec{,dir} ... +, Only set state.execdirs_outstanding if
there were previously no todo items on ths command line.
This avoids spurious calls to complete_pending_execdirs().
* doc/find.texi (Top): Re-order menu items to be consistent with
ordering of sections ('Reference' is moved).
(Print File Information): Add missing menu item 'Formatting Flags'
and remove that menu item from inside 'Format Directives'.
(Formatting Flags): Hence this is a subsection, not a
subsubsection.