1707 Commits

Author SHA1 Message Date
James Youngman
c054722450 Describe previous change
Signed-off-by: James Youngman <jay@gnu.org>
v4.5.6
2010-03-30 21:01:12 +01:00
James Youngman
391bc69a27 Prepare for release of findutils-4.5.6
* configure.ac: Update version number.
* NEWS: Update version number.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 21:00:45 +01:00
James Youngman
4968d14544 Support O_CREAT in open_cloexec.
* lib/fdleak.c: Include <stdarg.h> and "cloexec.h".
(open_cloexec): Support O_CREAT.  Use O_CLOEXEC if it is available.
(O_CLOEXEC): #define to 0 if not already #defined.
* import-gnulib.config (modules): Import modules open (for
PROMOTED_MODE_T) and stdbool (for 'true').
* lib/fdleak.h: Update prototype of open_cloexec to allow mode to
be passed.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 20:34:40 +01:00
James Youngman
fc181262f8 Apply bugfixes and suggestions from Eric's comments.
* configure.ac: Check for <sys/resource.h> and the getrusage
function.
* lib/fdleak.c: Don't #include <sys/resource.h> if we don't have it.
(get_max_fd): If neither /proc/self/fd not getrusage is available,
return _POSIX_OPEN_MAX.
(remember_non_cloexec_fds): Also check for leaks in file
descriptors 0, 1, 2, just in case the caller closed them.
(find_first_leaked_fd): Likewise.
(open_cloexec): Make sure we are not creating a file (for some odd
system where O_CREAT is 0).

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 20:34:40 +01:00
James Youngman
4913a1f4c8 Bugfixes to the handling of %Z in the Red Hat SELinux patch.
* find/pred.c (do_fprintf): If getfilecon fails, print the
relevant segment anyway, with the file context expanding to an
empty string.
* find/parser.c (make_segment): For %Z, set the cost to
NeedsAccessInfo.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 10:11:30 +01:00
Kamil Dudka
1a05af6a0f find: add SELinux support
* find/defs.h: Add SELinux related definitions.
* find/tree.c: Add -context predicate to lookup.
* find/pred.c: Handle %Z printf directive.
* find/parser.c: Parse -context predicate and %Z printf directive.
* find/find.1: Mention -context predicate and %Z printf directive.
* doc/find.texi: Mention -context predicate and %Z printf directive.
* find/Makefile.am: Add SELinux libraries.
* import-gnulib.config: Require module selinux-at and the corresponding
version of gnulib.

Signed-off-by: Kamil Dudka <kdudka@redhat.com>
2010-03-30 10:11:30 +01:00
James Youngman
f6ca105f71 Ignore c++defs.h 2010-03-30 00:51:21 +01:00
James Youngman
4845d6a414 Turn the leak checker on by setting GNU_FINDUTILS_FD_LEAK_CHECK. 2010-03-30 00:51:21 +01:00
James Youngman
cd12308c46 Update to current gnulib version.
* import-gnulib.config (gnulib_version): Update to more recent
version of gnulib.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 00:51:21 +01:00
James Youngman
6c6a72bb00 Fix file descriptor leaks.
* import-gnulib.config (gnulib_version): Update to more recent
version of gnulib.  Import the cloexec module too.
* lib/fdleak.c: New file; a module for detecting file descriptor
leaks.   Also define an open_cloexec() function.
* lib/fdleak.h: Declare the global functions defined in fdleak.c.
* lib/Makefile.am (libfind_a_SOURCES): Add fdleak.c and fdleak.h.
* find/find.c (main): Call remember_non_cloexec_fds in order to
detect file descriptor leaks.
(main): set FD_CLOEXEC on starting_desc.
(safely_chdir_lstat): Likewise for dotfd.
(safely_chdir_nofollow): Likewise for fd.
* find/ftsfind.c (inside_dir): set FD_CLOEXEC on curr_fd.
(main): Call remember_non_cloexec_fds in order to detect file
descriptor leaks.
(main): set FD_CLOEXEC on starting_desc.
* find/pred.c (launch): before we exec the child, call
complain_about_leaky_fds in order to complain about non-FD_CLOEXEC
file descriptors that weren't open when the program was run.
* find/sharefile.c (sharefile_fopen): Set FD_CLOEXEC on the files
we open.
* gnulib-local/lib/save-cwd.c.diff: Patch gnulib to set FD_CLOEXEC
on the file descriptors opened by save_cwd.
* gnulib-local/modules/save-cwd.diff: Hence the save-cwd module
depends on the cloexec module.
* import-gnulib.sh (run_gnulib_tool): Pass the --local-dir option
in order to apply these patches.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 00:51:00 +01:00
James Youngman
a0a42e6418 Add missing exec-nogaps.{exp,xo}.
* find/testsuite/Makefile.am (EXTRA_DIST_XO): Add exec-nogaps.xo.
(EXTRA_DIST_EXP): Add exec-nogaps.exp.

Signed-off-by: James Youngman <jay@gnu.org>
2010-03-30 00:32:01 +01:00
Francesco Cosoleto
921be56884 Remove some extra spaces present in locate usage text.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2010-03-12 21:26:50 +00:00
James Youngman
d4f2e4453e Explain the problems with "-name a/b" and "-path foo/".
* find/find.1 (-iname): We already refer to -name, so duplicate
less text.
(-name): Explain that -name a/b will never match anything.
* doc/find.texi (Base Name Patterns): Explain that -name a/b will
never match anything.
(Full Name Patterns): Fix typo.

Signed-off-by: James Youngman <jay@gnu.org>
2010-02-25 11:06:53 +00:00
James Youngman
773a25dd7d Simplify the wording in the manpage description of "xargs -i".
* xargs/xargs.1: Simplify the wording in the description of "xargs
-i".

Signed-off-by: James Youngman <jay@gnu.org>
2010-02-22 00:30:56 +00:00
James Youngman
99bba2b4f4 Update #include directives for the openat module, to comply with
recent POSIX-compliance changes.
2010-02-21 23:49:47 +00:00
James Youngman
8c633be8f1 Update to current version of gnulib.
* import-gnulib.config (gnulib_version): Update $gnulib_version.
* build-aux/.cvsignore: Ignore new files built by gnulib.
* build-aux/.gitignore: Likewise.

Signed-off-by: James Youngman <jay@gnu.org>
2010-02-21 23:30:14 +00:00
James Youngman
bf6f055cde Fix Savannah bug #27846: assertion failure in xargs.c on AIX.
* xargs/xargs.c (smaller_of): New function, returns the smaller of
its two size_t arguments.
(main): Instead of asserting that the value of bc_ctl.arg_max is
smaller than some value, simply adjust the value if necessary.

Signed-off-by: James Youngman <jay@gnu.org>
2010-02-20 20:39:06 +00:00
James Youngman
61f9b1c1cf Fix Savannah bug#28872, Mistake in "Problems with -exec and filenames"
* doc/find.texi (Problems with -exec and filenames): Add missing
$0 argument in example for sh -c 'something "$@" sh ...
* NEWS: Mention this change.

Signed-off-by: James Youngman <jay@gnu.org>
2010-02-20 19:54:35 +00:00
James Youngman
93623752ec Fix Savannah bug# 28824: "-ctime x" yields "missing argument to `-ctime'".
* find/parser.c (parse_fls): If the argument is invalid, reverse
the change that collect_arg() made to *arg_ptr (that is, don't
consume the argument).
(parse_fprint0): Likewise.
(parse_gid): Likewise.
(parse_group): Likewise.
(parse_inum): Likewise.
(parse_links): Likewise.
(do_parse_xmin): Likewise.
(parse_name): Likewise.
(parse_printf): Likewise.
(parse_uid): Likewise.
(parse_used): Likewise.
(parse_time): Likewise.
* NEWS: mention this change.

Signed-off-by: James Youngman <jay@gnu.org>
2010-02-20 13:24:20 +00:00
James Youngman
8ba9443ed5 Fix Savannah bug #26868: compilation error in pred.c on Solaris x86_64.
* import-gnulib.config (modules): Include gnulib's math module, to
avoid a compilation error for "-HUGE_VAL" on Solaris x86_64.
* NEWS: Mention this change.

Signed-off-by: James Youngman <jay@gnu.org>
2009-12-04 22:24:47 +00:00
James Youngman
2147b794da Updated Dutch translation
Signed-off-by: James Youngman <jay@gnu.org>
2009-12-04 17:06:04 +00:00
James Youngman
6e5648e8a0 New tests for find -exec .. {} + and find -exec ... {} ;.
* find/testsuite/find.posix/exec-nogaps.exp: New test for find
-exec 	... {} ; and find -exec ... {} +, both of which simply
ensure that all exec arguments are processed exactly once each.
* find/testsuite/find.posix/exec-nogaps.xo: Expected output file
for the test in exec-nogaps.exp.

Signed-off-by: James Youngman <jay@gnu.org>
2009-11-29 22:50:02 +00:00
James Youngman
265a49c66d Fix Savannah bug#27328, segfault if the initial exec for "find -exec" fails, and Savannah bug #27975: Infinite loop for -exec [..] {} +.
2009-11-29  James Youngman  <jay@gnu.org>

	Fix Savannah bug#27328, segfault if the initial exec for "find
	-exec" fails.  Also bug #27975: Infinite loop for -exec [..] {} +.
	* lib/buildcmd.h (struct buildcmd_state): Introduce
	largest_successful_arg_count and smallest_failed_arg_count in
	order to avoid an assumption that we understand how the operatingn
	system interprets ARG_MAX and the assumption that the compile-time
	ARG_MAX value (or the equivalent from sysconf()) is avtually
	correct.
	(struct buildcmd_control): Change the calling convention of the
	exec callback to allow us to pass the argument list separately.
	(bc_args_exceed_testing_limit): declare this new funciton.
	* lib/buildcmd.c (bc_args_complete): New function, NULL-terminates
 	the argv list.   We use this instead of passing NULL to
	bc_push_arg().
	(update_limit): New function.  Decides how many arguments to
	pass to the invoked command on the next attempt.
	(copy_args): Build an argument list containing all the initial
	arguments plus some of the other args (the number to be used is
	decided by update_limit).
	(bc_do_exec): Avoid special-casing the first call to exec.  Use
	update_limit to decide how many arguments to pass and copy_args to
	build the argument list.  The new form of the loop should fix
	Savannah bug #27328.
	(bc_push_arg): Drop support for passing NULL as an argument (to
	terminate the arg list we just pass in a special argument instead).
	(bc_args_exceed_testing_limit): New function, returns nonzero if
	the argument list exceeds a testing limit (used for failure
	injection by tests).
	(exceeds): New support function, implementing part of
	bc_args_exceed_testing_limit.
	(bc_init_state): Initialise largest_successful_arg_count and
	smallest_failed_arg_count.
	* find/defs.h (struct exec_val): New member last_child_status.
	This stores the status of the most recently completed child.
	* find/pred.c (new_impl_pred_exec): Use last_child_status.
	(launch): Use the new calling convention for the exec callback.
	Set last_child_status.  Call bc_args_exceed_testing_limit() to do
	failure injection for unit tests.
	* find/util.c (do_complete_pending_execdirs): Call bc_do_exec
	rather than calling launch directly in order to allow for breaking
	the argument list up if it's too long.
	* xargs/xargs.c (xargs_do_exec): Update to use the new caling
	convention for the exec callback.

Signed-off-by: James Youngman <jay@gnu.org>
2009-11-29 16:52:01 +00:00
Jim Meyering
79779d572a Adjust two xargs diagnostics (was: Localization bugs in findutils
James Youngman wrote:
> On Fri, Oct 23, 2009 at 6:09 PM, Jorma Karvonen
> <karvonen.jorma@gmail.com> wrote:
>> Hello,
>>
>> here are some messages that probably need to be localized. I have
>> shown them in localized form:
>
> Thanks, I'm not sure which version of findutils you started with, but
> since you gave the strings too, I had no problems finding the messages
> you were referring to.  A couple of them were obsolete, but thanks for
> finding the ones that were still in there!
>
> I have left a few of the messages un-translated as they're just debug
> messages.   I attach the patch I just pushed.
>
> Thanks again!
> James.
...
> -  const char *errmsg = "arithmetic overflow while converting %s "
> -    "days to a number of seconds";
> +  const char *errmsg = _("arithmetic overflow while converting %s "
> +			 "days to a number of seconds");
>    struct timespec origin;
>
>    if (!collect_arg(argv, arg_ptr, &timearg))

Hi James,

I spotted at least one more with this:

  $ grep -nE '\<error \([^"]*"[^"]*[a-z]{3}' $(g ls-files) | grep -v '_('
  xargs/xargs.c:1009:         error (1, errno, "/dev/tty");
  xargs/xargs.c:1093:     error (1, errno, "could not create pipe before fork");

Regarding this one,
  xargs/xargs.c:1009:         error (1, errno, "/dev/tty");
it's better for those on the receiving end of such a diagnostic
to say what operation was being attempted, so...

[btw, the above check for unmarked-yet-translatable diagnostics is automated
 in gnulib's maint.mk.  If you're interested, running "make syntax-check"
 can detect problems like this;  to enable, use gnulib's maintainer-makefile
 module. ]

From 333b90e420200f8c083264ba1781dc01221d2807 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 9 Nov 2009 10:39:35 +0100
Subject: [PATCH] Adjust two xargs diagnostics.

* xargs/xargs.c (print_args): Give a better diagnostic when
failing to open /dev/tty.
(xargs_do_exec): Mark a diagnostic for translation.
2009-11-09 10:06:34 +00:00
James Youngman
a49936fc25 Localise some previously non-localised strings.
* find/find.c (init_mounted_dev_list): Pass translatable string
gettext.
(safely_chdir_lstat): Likewise.
* find/fstype.c (must_read_fs_list): Likewise.
* find/parser.c (safe_atoi): Likewise.
2009-11-08 22:26:30 +00:00
James Youngman
a8b6afafd2 Update a number of translation messages.
* po/it.po: Updated Italian translation.
* po/fi.po: Updated Finnish translation.
* po/vi.po: Updated Vietnamese translation.
* po/hu.po: Updated Hungarian translation.
* po/de.po: Updated German translation.
* po/ru.po: Updated Russian translation.
2009-11-08 21:46:26 +00:00
James Youngman
5a8d448792 lib/check-regexprops.sh portability fixes for FreeBSD.
* lib/check-regexprops.sh: Portability fixes for FreeBSD (mktemp
requires an argument, dialect differences in sed regexes).

Signed-off-by: James Youngman <jay@gnu.org>
2009-08-16 16:16:15 +01:00
James Youngman
44440f375c Update to the current version of gnulib 2009-08-15 22:14:16 +01:00
James Youngman
19fe6cc41c fix typo in comment 2009-07-18 14:49:18 +01:00
James Youngman
f782d9ec1c Fix up some problems introduced in a manual conflict resolution.
Fix up some problems introduced in a manual conflict resolution.
* find/parser.c (insert_path_check): Add missing third argument to
insert_primary_withpred.
(parse_iwholename): Remove redundant extra definition.
(parse_ipath): Likewise.
2009-07-18 14:44:06 +01:00
James Youngman
66078f8c2c Mention the bugfix in NEWS (and update the change date to the date
when the patch was applied to "master").
2009-07-14 23:54:29 +01:00
James Youngman
a9ffeaf3cf Fix Savannah bug #27017: find -D opt / -fstype ext3 -print , -quit coredump (vs. 4.5.x)
Fix Savannah bug #27017: find -D opt / -fstype ext3 -print , -quit
coredumps.
* find/tree.c (set_new_parent): Initialise struct
predicate->arg_text to NULL (instead of leaving it uninitialised).
(get_new_pred_noarg): Likewise.
(get_new_pred): Initialise predicate->arg_text to
"ThisShouldBeSetToSomethingElse" to make it easier to notice
bugs.
(get_new_pred_chk_op): Use get_new_pred_noarg.
(print_predicate): Use an if statement instead of
two ternary operators.
* find/util.c (insert_primary_withpred): Accept new argument, arg,
being the argument (if any) of this predicate.  Pass it to
get_new_pred_chk_op.
(insert_primary): Likewise (pass arg to insert_primary_withpred).
(insert_primary_noarg): New function; calls insert_primary with
arg=NULL.
* find/parser.c (collect_arg_stat_info): Add an output parameter;
the filename from which we collected the stat information.
(parse_closeparen, parse_delete, parse_and, parse_or,
parse_comma): Use get_new_pred_noarg.
(parse_cnewer, parse_newer, parse_anewer): Use new
collect_arg_stat_info and insert_primary interface.
(parse_print, parse_prune, parse_nouser, parse_empty): Use
insert_primary_noarg.
(parse_accesscheck, parse_false): Use insert_primary_noarg.
(parse_used, parse_iname, parse_fprint, insert_fprint,
parse_fstype, parse_ilname): Use new collect_arg and
insert_primary interfaces.
(parse_ipath, parse_lname, do_parse_xmin, parse_name, parse_path,
parse_perm, parse_size, parse_user, parse_time): Use new
collect_arg and insert_primary_withpred interface.
(parse_negate, parse_openparen): Use new get_new_pred_chk_op interface.
(parse_newerXY, parse_nogroup): Use new insert_primary interface.
(insert_regex, parse_samefile): Use new insert_primary_withpred
interface.
(insert_type, insert_fprintf, new_insert_exec_ok, insert_num): Use
new insert_primary_withpred interface.
* find/defs.h (struct predicate.arg_text): make const.
Add declarations for new function get_new_pred_noarg and
insert_primary_noarg.  Add 'arg' parameter to get_new_pred_chk_op
and insert_primary_withpred.
2009-07-14 23:49:19 +01:00
James Youngman
9986eefc62 Savannah bug #23920: warn about -path arguments ending in /.
Savannah bug #23920: warn about -path arguments ending in /.
* find/parser.c (insert_path_check): new function; abstracts the
common functionality of parse_path, parse_ipath, parse_wholename,
parse_iwholename.  Also check for a trailing slash and warn about
it (unless $POSIXLY_CORRECT is set).  Don't warn if the pattern
also happens to be a start_point, because those could be matched.
(parse_path, parse_ipath, parse_wholename, parse_iwholename): Use
insert_path_check.
* find/tree.c (is_start_point): new function; returns true if the
indidated string matches a start point.
(num_start_points, start_points): new variables, storing the
starting points listed on the command line.
(build_expression_tree): Set num_start_points and start_points.
* find/defs.h: Declare is_start_point.
* doc/find.texi (Full Name Patterns): Explain that candidate names
for -path, -regex etc. will never end in a slash, so "-path /tmp/"
will never match anything.
* find/find.1: Likewise.
2009-07-14 23:30:55 +01:00
James Youngman
2392eedaea Typo fix: "prarallel". 2009-07-12 21:54:32 +01:00
James Youngman
dd8d4634eb Updated the po files 2009-07-12 13:09:16 +01:00
James Youngman
203b547f2b Bug #26327: xargs manpage: clarify the number of times command is executed.
Fix Savannah bug #26327: xargs man page is vague about the number
of times command is executed.
* xargs/xargs.1 (DESCRIPTION): Explain more clearly that the
command will be executed many times.  Indicate that -L can also be
useful with -P.
* NEWS: Mention this change.
2009-07-12 12:57:25 +01:00
James Youngman
6be5c5a6f7 NEWS: Set the version to 4.5.6-git, so that we can make test releases 2009-07-11 16:07:53 +01:00
James Youngman
029fd7e945 Adjust the date in the ChangeLog entry to match the date when the
change was merged into the master branch.
2009-07-11 10:49:51 +01:00
James Youngman
98656f47e1 Make import-gnulib.sh faster when neither import-gnulib.config nor gnulib has changed.
* import-gnulib.sh (gnulib_changed): New variable.
(do_checkout): set gnulib_changed=true if the gnulib code didn't
already correspond to our configured version.  Don't use a large
subshell, because we need to set $gnulib_changed and don't want
the value to be discarded.
(main): Run gnulib-tool if gnulib was not at the correct version
or the import-gnulib.config file has changed.

Signed-off-by: James Youngman <jay@gnu.org>
2009-07-11 10:48:36 +01:00
James Youngman
c874225e20 Mention Reuben's recent change. 2009-07-10 10:55:50 +01:00
Reuben Thomas
c440d6c1ad Fix quotation punctuation in find manual page.
* find/find.1: Use ` instead of ' at the start of quoted text.  Use
\(aq instead of ' or \' in commands to get a literal straight quote.
Use ` and ' instead of `` and '' (for consistency).

Signed-off-by: James Youngman <jay@gnu.org>
2009-07-10 10:52:16 +01:00
James Youngman
a05e4b62b4 Update to the current version of gnulib. 2009-07-10 10:08:09 +01:00
James Youngman
d9456d939a Mention the bugfix for bug #24873 in NEWS and describe the changes in ChangeLog 2009-07-10 09:55:55 +01:00
James Youngman
78e5943ceb Updated copyright years in modified files 2009-07-10 09:42:48 +01:00
James Youngman
784460936b Fix Savannah bug #24873, Duplicate fprint option corrupts output by opening each output file only once.
Fix Savannah bug #24873, Duplicate fprint option corrupts output
by opening each output file only once.
* find/sharefile.c: New file; keeps a mapping from dev/inode to
FILE*, allowing us to determine when the file we just opened is
the same as something else we already opened.
* import-gnulib.config (modules): Import the hash module, used by
sharefile.c.
* find/sharefile.h: Function declarations for same.
* find/find.c (main): Call sharefile_init().
* find/ftsfind.c (main): Likewise.
* find/parser.c (open_output_file): Call sharfile_fopen to open an
output file, instead of fopen_safer.
* find/util.c (cleanup): Close any shared output files that are
open.  Also fflush stdout.
(undangle_file_pointers): Set the relevant FILE* pointers to
NULL.
(flush_and_close_output_files): Remove (since sharefile_destroy
has the desired effect).
* find/Makefile.am (libfindtools_a_SOURCES): Add sharefile.c.
(EXTRA_DIST): Add sharefile.h.
* find/defs.h: #include sharefile.h.
(struct state): Add member shared_files, holding a handle to the
shared-file hash table implemented in sharefile.[ch].
* find/testsuite/find.gnu/fprintf-samefile.exp: New test,
exercising -fprintf (though it is not able to detect bug #24873).
* find/testsuite/Makefile.am (EXTRA_DIST_EXP): Add
find.gnu/fprintf-samefile.exp.

Signed-off-by: James Youngman <jay@gnu.org>
2009-07-10 09:42:39 +01:00
James Youngman
fb10598617 Move on from 4.5.5. 2009-07-07 08:33:48 +01:00
James Youngman
a2b23a2ae5 Indicate that -wholename is no longer preferred over -ipath. 2009-07-07 00:01:40 +01:00
James Youngman
0138b0092d Did make dist v4.5.5 FINDUTILS_4_5_5-1 2009-07-06 23:29:29 +01:00
James Youngman
5b75abb55f Prepare for release of findutils version 4.5.5.
* configure.ac: Set version number to 4.5.5.
* NEWS: Likewise.
2009-07-06 23:28:50 +01:00
Andreas Metzler
9f499c6664 * doc/find.texi: Various typo fixes.
Signed-off-by: James Youngman <jay@gnu.org>
2009-07-06 22:55:42 +01:00