Hide Forgot
Reproduced on findutils-4.5.11-5.el7 +++ This bug was initially created as a clone of Bug #1223557 +++ Description of problem: I'm using Scientific Linux 6.6, but I am fairly sure this is an RHEL problem. When using the '-execdir' option to find, the program apparently opens a new file descriptor every time it runs the command, and never closes it. As a result, if you're traversing a directory tree that contains more than $(ulimit -n) files (1024 by default), find will fail with the message find: Failed to save working directory in order to run a command on `foo': Too many open files Version-Release number of selected component (if applicable): findutils-4.4.2-6.el6.x86_64 Steps to Reproduce: An easy way to see what is happening is to run "find . -execdir sh -c 'ls /proc/self/fd | wc -l' ';'". Actual results: The number of open file descriptors increases every time the command is run. When it reaches 1024, find aborts with an error. Expected results: The number of file descriptors should be constant, and the 'find' command should succeed, regardless of how many files are found. Additional info: This problem doesn't occur with the Debian version of find (which is the same upstream version, 4.4.2.) --- Additional comment from Kamil Dudka on 2015-05-22 13:59:33 EDT --- Thank you for reporting the bug. I believe the following upstream commit will fix it: http://git.savannah.gnu.org/cgit/findutils.git/commit/?id=183115d0 diff --git a/find/pred.c b/find/pred.c index d6bbaea..2a89a37 100644 --- a/find/pred.c +++ b/find/pred.c @@ -681,14 +681,16 @@ impl_pred_exec (const char *pathname, 0); } /* Actually invoke the command. */ result = execp->ctl.exec_callback(&execp->ctl, &execp->state); } + if (local) + free_cwd (execp->wd_for_exec); if (target != pathname) { assert (local); free (target); } return result; }
Good point. This was fixed upstream in v4.5.11-41-g183115d, so it is not included in the 4.5.11 upstream release, which the el7 findutils package is based on.
*** Bug 1475645 has been marked as a duplicate of this bug. ***
*** Bug 1563265 has been marked as a duplicate of this bug. ***
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3076