Commit Graph

2013 Commits

Author SHA1 Message Date
169161fa0e xargs: wait for process before prompting in interactive mode (-p)
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
2013-09-21 23:18:19 +01:00
Dmitry V. Levin
29f3173a56 find: fix potential buffer overflow in -execdir and -okdir
* lib/buildcmd.c (bc_push_arg): Take prefix length into account
to avoid state->argbuf overflow.
* NEWS: Mention this fix.
2013-09-21 22:55:43 +01:00
James Youngman
2376e7c4a8 Make sv-34976-execdir-fd-leak.sh test more POSIX-compliant.
* 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.
2013-09-21 00:22:32 +01:00
James Youngman
9b0079c1d3 Fix typo "sturct".
* find/exec.c (impl_pred_exec): Typo fix: struct/struct.
* ChangeLog (2007-03-28): Likewise.
2013-09-21 00:06:04 +01:00
183115d048 find: fix fd leak with --execdir option (bug#34976)
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.
2013-09-20 22:14:05 +01:00
James Youngman
80c3d55922 Updated Greek translation.
* po/el.po: Updated Greek translation from the Translation
Project.
2013-09-20 21:27:23 +01:00
193d1255e6 xargs: Fix integer overflow in implicit conversion in do_exec.
* xargs/xargs.c (xargs_do_exec): Change type of r from int to
size_t, since that is the type that safe_read actually returns.
2013-09-20 21:00:19 +01:00
James Youngman
c67dc56c81 Add Bernhard Voelker to AUTHORS.
* AUTHORS: Add Bernhard Voelker.
2013-09-20 20:52:09 +01:00
James Youngman
c0ebcada29 Add Benedikt Morbach to THANKS 2013-09-20 19:59:37 +01:00
James Youngman
4afb645b82 Check for prefixed versions of ranlib, too.
* configure.ac: Check for prefixed versions of ranlib, too.
2013-09-20 19:51:19 +01:00
Benedikt Morbach
f15fa8ecf7 configure.ac: look for prefixed ar
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.
2013-09-20 19:44:57 +01:00
James Youngman
c47259c0fa Fix compilation error where struct dirent lacks a d_ino member.
* 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.
2013-09-20 18:42:27 +01:00
James Youngman
1ccfd46a25 Refer to the info manual in a clearer and more explicit way.
* 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.
2013-09-20 17:56:29 +01:00
James Youngman
be6ddda792 Be consistent about what we call the places the search starts.
* find/find.1: Consistently describe the paths at which the search
begins as "satrting points".
2013-09-20 17:42:21 +01:00
James Youngman
5d3bf5aa7f Add unlinkat moduile.
* import-gnulib.config (modules): Add unlinkat module, following
bug report from Martin von Gagern.
2013-06-02 14:36:00 +01:00
Paul Eggert
3d13be5654 More removal of support for -perm +MODE.
* find/parser.c (parse_perm): Remove no-longer-needed local var
and associated code.  Reported by Eric Blake in
<http://savannah.gnu.org/bugs/?38474#comment9>.
2013-04-24 07:55:38 +01:00
Paul Eggert
90f0c5d241 Remove support for obsolete -perm +MODE syntax.
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.
2013-04-22 22:18:15 +01:00
James Youngman
2957a7ae55 Fix documentation typo.
* doc/find.texi (Mode Bits): Fix typo "it set" -> "is set".
2013-04-22 21:49:40 +01:00
Paul Eggert
a8981eb058 doc: fix typos uncovered by texinfo 5.0
* doc/find-maint.texi: Fix typos that cause 'make' to fail
if texinfo 5.0 is installed.
2013-04-22 21:30:52 +01:00
James Youngman
35b0ec1143 Enable assertions in locate.
* locate/locate.c: Don't #define NDEBUG.
2013-04-22 21:19:01 +01:00
James Youngman
b8ffa159fe Explain rounding semantics of -size more clearly in manpage.
* find/find.1 (-size): explain the rounding-up semantics more
clearly.
2013-04-21 23:09:47 +01:00
James Youngman
40e255e6c0 Add example for find -printf.
* doc/find.texi (Print File Information): Add an example for "find
-printf" suggested by Karl Berry.
2013-04-21 18:50:09 +01:00
James Youngman
95ba1e2c60 Further documentation improvements.
* doc/find.texi: use @code for environment variable names, and
other improvements.
2013-04-21 18:36:04 +01:00
Peter Breitenlohner
f9ac5014b4 slocate: add a testcase to expose bug, and fix it
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2013-04-20 15:54:41 +01:00
Peter Breitenlohner
40f7cebadd locate: fix off-by-one bugs and enable assertions
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2013-04-20 15:48:29 +01:00
Peter Breitenlohner
a1795dfc82 Remove duplicate paragraph in texinfo
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2013-04-20 15:44:48 +01:00
James Youngman
16e147b990 Don't use reserved identifiers in macro names; fix other code smells.
* 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).
2013-03-31 20:25:49 +01:00
James Youngman
fdaa57adba Document that -0/-d turns off logical end-of-file processing.
* 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.
2013-03-29 16:39:01 +00:00
James Youngman
0f2c2df9e4 Updated the Galician translation.
* gl.po: Updated Galician translation.
2013-03-29 16:22:02 +00:00
James Youngman
30cd395cda Updated a number of translations.
* cs.po: Updated Czech translation.
* et.po: Updated Estonian translation.
* fi.po: Updated Finnish translation.
* fr.po: Updated French translation.
* gl.po: Updated Galician translation.
* nl.po: Updated Dutch translation.
* pl.po: Updated Polish translation.
* ru.po: Updated Russian translation.
* uk.po: Updated Ukrainian translation.
* vi.po: Updated Vietnamese translation.
* zh_CN.po: Updated Chinese (simplified) translation.
2013-03-27 00:25:21 +00:00
Kamil Dudka
02a26d7ce5 Fix compile-time warnings.
* find/defs.h (struct predicate): Add a missing const modifier.
* find/find.c (wd_sanity_check): Suppress a warning in #else branch.
(process_dir): Remove an unused variables and statements.
* find/pred.c (pred_context): Use const modifier in the prototype.
* lib/buildcmd.{c,h} (bc_args_exceed_testing_limit): Remove a const
modifier causing unnecessary warnings.
* xargs/xargs.c (main): Add explicit type-casts.
2013-03-26 23:46:30 +00:00
James Youngman
842a39c81b Expand on warning about xargs -P and stdout, including in Info.
* 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.
2013-03-24 23:14:06 +00:00
1611816e08 xargs: document need to manage access to resources with -P option
* 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.
2013-03-24 23:14:06 +00:00
5a20251ff6 xargs: split usage text to help translators
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
2013-03-24 22:45:54 +00:00
74db15e221 Improve error message for find -type X (X = an unknown file type).
* 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.
2013-03-24 22:12:42 +00:00
James Youngman
14adbdd321 Fix Savannah bug #38583: errno-buffer read failed in xargs_do_exec
* 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.
2013-03-24 21:54:35 +00:00
James Youngman
c1dc4c7802 Fix misleading message from import-gnulib.sh; allow .git symlink.
* 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.
2013-03-24 21:07:37 +00:00
James Youngman
a917eb988f Bugfix to "make clean": do not delete header files.
* 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.
2013-03-24 14:09:14 +00:00
James Youngman
36b4a73e63 Move on from 4.5.11, to 4.5.12-git
* NEWS: Add a new section for 4.5.12-git.  Mention the bugfix to
find/testsuite/sv-bug-32043.sh.
* configure.ac: Update the version number.
2013-03-24 14:02:01 +00:00
James Youngman
e3712a951a Fix Bash-ism [[ ... ]].
* find/testsuite/sv-bug-32043.sh: Change [[ ... ]] to [ ... ]
because the first pattern is a Bash-ism.  Bug reported by David
Gilbert.
2013-03-24 12:46:34 +00:00
James Youngman
7225ba74e5 Merge branch 'kamil-dudka/45/bugfix-contribs' 2013-02-03 23:22:39 +00:00
Kamil Dudka
609853e791 Avoid using 'INCLUDES =' in automake templates.
* find/Makefile.am: Use AM_CPPFLAGS instead of deprecated INCLUDES.
* lib/Makefile.am: Likewise.
* locate/Makefile.am: Likewise.
* xargs/Makefile.am: Likewise.
2013-02-03 23:18:23 +00:00
Kamil Dudka
e1afb49ba9 Eliminate a misleading message of import-gnulib.sh
... 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.
2013-02-03 23:18:13 +00:00
James Youngman
4b7c8a4486 Fix Savannah bug #38239, missing variable initialisation in locate
* 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).
2013-02-03 22:58:11 +00:00
James Youngman
15391f0106 UPdated findutils.pot from the Translation Project
* po/findutils.pot: Updated template file from the Translation
Project
2013-02-03 21:22:18 +00:00
James Youngman
6b240251d5 Release findutils-4.5.11.
* NEWS: update version number from 4.5.11-git to 4.5.11.
* configure.ac (AC_INIT): Likewise.
v4.5.11
2013-02-02 14:31:22 +00:00
James Youngman
5f7a605f5e Reduce needless calls to complete_pending_execdirs.
* 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().
2013-02-02 12:21:14 +00:00
James Youngman
728989bd7d Make the manual section ordering and menu item ordering consistent.
* 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.
2012-12-19 00:50:34 +00:00
Stefano Lattarini
62a4507b2e build: remove redundant AC_SUBST of var INCLUDES
* configure.ac: Here.

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-12-16 19:57:57 +00:00
James Youngman
434c894cb6 Avoid 9P, cifs and nfs4 filesystems by default in updatedb. 2012-12-15 15:08:24 +00:00