From owner-svn-src-all@FreeBSD.ORG Sun Feb 10 13:28:02 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EE32A957; Sun, 10 Feb 2013 13:28:02 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E1363D64; Sun, 10 Feb 2013 13:28:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1ADS2QY072612; Sun, 10 Feb 2013 13:28:02 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1ADS2bU072611; Sun, 10 Feb 2013 13:28:02 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302101328.r1ADS2bU072611@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 10 Feb 2013 13:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246618 - head/usr.bin/find X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Feb 2013 13:28:03 -0000 Author: jilles Date: Sun Feb 10 13:28:02 2013 New Revision: 246618 URL: http://svnweb.freebsd.org/changeset/base/246618 Log: find: In -execdir ... {} +, only pass one file per invocation. This is inefficient but ensures that -execdir ... {} + does not mix files from different directories in one invocation; the command could not access some files. Files from the same directory should really be handled in one invocation but this is somewhat more complicated. Modified: head/usr.bin/find/function.c Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Sun Feb 10 13:20:23 2013 (r246617) +++ head/usr.bin/find/function.c Sun Feb 10 13:28:02 2013 (r246618) @@ -711,7 +711,13 @@ c_exec(OPTION *option, char ***argvp) for (ep = environ; *ep != NULL; ep++) argmax -= strlen(*ep) + 1 + sizeof(*ep); argmax -= 1 + sizeof(*ep); - new->e_pnummax = argmax / 16; + /* + * Ensure that -execdir ... {} + does not mix files + * from different directories in one invocation. + * Files from the same directory should be handled + * in one invocation but there is no code for it. + */ + new->e_pnummax = new->flags & F_EXECDIR ? 1 : argmax / 16; argmax -= sizeof(char *) * new->e_pnummax; if (argmax <= 0) errx(1, "no space for arguments");