From unknown Thu Aug 14 21:44:28 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#21712 <21712@debbugs.gnu.org> To: bug#21712 <21712@debbugs.gnu.org> Subject: Status: Suspected bug in find -exec '+' Reply-To: bug#21712 <21712@debbugs.gnu.org> Date: Fri, 15 Aug 2025 04:44:28 +0000 retitle 21712 Suspected bug in find -exec '+' reassign 21712 coreutils submitter 21712 richard.white@embedded-expertise.com severity 21712 normal tag 21712 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 19 11:34:55 2015 Received: (at submit) by debbugs.gnu.org; 19 Oct 2015 15:34:55 +0000 Received: from localhost ([127.0.0.1]:56893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoCSc-000285-Dd for submit@debbugs.gnu.org; Mon, 19 Oct 2015 11:34:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38675) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zo8hj-0004oa-0V for submit@debbugs.gnu.org; Mon, 19 Oct 2015 07:34:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zo8hh-0004kr-Ky for submit@debbugs.gnu.org; Mon, 19 Oct 2015 07:34:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_50,HTML_MESSAGE, MSGID_MULTIPLE_AT autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo8hh-0004kn-Ha for submit@debbugs.gnu.org; Mon, 19 Oct 2015 07:34:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo8hg-0001TV-DO for bug-coreutils@gnu.org; Mon, 19 Oct 2015 07:34:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zo8hb-0004jz-E8 for bug-coreutils@gnu.org; Mon, 19 Oct 2015 07:34:12 -0400 Received: from b.painless.aa.net.uk ([81.187.30.52]:59794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo8hb-0004jr-3S for bug-coreutils@gnu.org; Mon, 19 Oct 2015 07:34:07 -0400 Received: from 150.110.198.146.dyn.plus.net ([146.198.110.150] helo=RCWXPS) by b.painless.aa.net.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77) (envelope-from ) id 1Zo8ha-0007XR-63 for bug-coreutils@gnu.org; Mon, 19 Oct 2015 12:34:06 +0100 From: "Richard White" To: Subject: Suspected bug in find -exec '+' Date: Mon, 19 Oct 2015 12:33:34 +0100 Message-ID: <01cc01d10a62$009591d0$01c0b570$@white@embedded-expertise.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01CD_01D10A6A.6259F9D0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdEKYfzhPHFfRW11QwGiEgT7YUHBpA== Content-Language: en-gb Organization: Embedded Expertise Ltd X-Info: Organization headers replaced by smtp.aa.net.uk based on Authenticated ID X-Original-Organization: Embedded Expertise Ltd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 19 Oct 2015 11:34:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: richard.white@embedded-expertise.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This is a multi-part message in MIME format. ------=_NextPart_000_01CD_01D10A6A.6259F9D0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The find utility supports execution of a nominated command per file = found. The command argument list is terminated with a ';' parameter. =20 The enhanced GNU version specifies an alternative version of the = =E2=80=93exec option using a '+' list terminator. This option is = provided to support an xargs-like batched execution of the nominated = command resulting in greater efficiency. =20 It seems like find =E2=80=93exec ';' and find =E2=80=93exec '+' do not = behave consistently with regard to '{}' argument expansion. =20 =20 An example: =20 mkdir /tmp/test cd /tmp/test touch a b find . =E2=80=93type f =E2=80=93exec echo Prefix{}Suffix ';' =C3=A8 Prefix./bSuffix =C3=A8 Prefix./aSuffix find . =E2=80=93exec echo Prefix{}Suffix '+' =C3=A8 ./b ./a =20 Is the latter result correct? I would have expected the same result as = for the ';' version? =20 Richard White Embedded Expertise =20 Richard White, Director, Embedded = Expertise Ltd = richard.white@embedded-expertise.com t: +44 (0) 333 112 8740 m: +44 (0) 7973 393348 =20 =20 =20 ------=_NextPart_000_01CD_01D10A6A.6259F9D0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

The find = utility supports execution of a nominated command per file found.=C2=A0 = The command argument list is terminated with a ';' = parameter.

 

The enhanced GNU version specifies an alternative = version of the =E2=80=93exec option using a '+' list terminator.=C2=A0 = This option is provided to support an xargs-like batched execution of = the nominated command resulting in greater efficiency.

 

It seems = like find =E2=80=93exec ';' and find =E2=80=93exec '+' do not behave = consistently with regard to '{}' argument expansion.=C2=A0 =

 

An example:

 

mkdir = /tmp/test

cd = /tmp/test

touch a b

find . =E2=80=93type f =E2=80=93exec echo = Prefix{}Suffix ';'

=C3=A8 Prefix./bSuffix

=C3=A8 Prefix./aSuffix

find = . =E2=80=93exec echo Prefix{}Suffix '+'

=C3=A8 ./b = ./a

 

Is the latter result correct?=C2=A0 I would have = expected the same result as for the ';' version?

 

Richard = White

Embedde= d

Experti= se

 

Richard = White, Director, Embedded Expertise = Ltd

richard.white@embedded-expertise.com

t: +44 (0) 333 112 8740=C2=A0 m: = +44 (0) 7973 393348

 

 

 

------=_NextPart_000_01CD_01D10A6A.6259F9D0-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 19 11:48:50 2015 Received: (at control) by debbugs.gnu.org; 19 Oct 2015 15:48:50 +0000 Received: from localhost ([127.0.0.1]:56910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoCg5-0002Rv-OI for submit@debbugs.gnu.org; Mon, 19 Oct 2015 11:48:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46241) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoCg1-0002Rf-T6; Mon, 19 Oct 2015 11:48:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B94E28CF53; Mon, 19 Oct 2015 15:48:44 +0000 (UTC) Received: from [10.3.113.176] (ovpn-113-176.phx2.redhat.com [10.3.113.176]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9JFmhUM012488; Mon, 19 Oct 2015 11:48:44 -0400 Subject: Re: bug#21712: Suspected bug in find -exec '+' To: richard.white@embedded-expertise.com, 21712-done@debbugs.gnu.org, GNU bug control References: <01cc01d10a62$009591d0$01c0b570$@white@embedded-expertise.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg X-Enigmail-Draft-Status: N1110 Organization: Red Hat, Inc. Message-ID: <562510D7.2060904@redhat.com> Date: Mon, 19 Oct 2015 09:48:39 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <01cc01d10a62$009591d0$01c0b570$@white@embedded-expertise.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hguSX6KpJqmADi177ArmJIEgfHIWgFCXu" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hguSX6KpJqmADi177ArmJIEgfHIWgFCXu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tag 21712 notabug thanks On 10/19/2015 05:33 AM, Richard White wrote: > The find utility supports execution of a nominated command per file fou= nd. Thanks for the report. However, you sent it to the coreutils list, although find is maintained by the findutils project. Therefore, we cannot address the bug here, and I'm marking the bug closed since it is not a coreutils problem. Feel free to make further comments on this thread, though. > It seems like find =E2=80=93exec ';' and find =E2=80=93exec '+' do not = behave consistently with regard to '{}' argument expansion. =20 Correct, they ARE different. And this is behavior described by POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html -exec utility_name [argument ...] ; -exec utility_name [argument ...] {} + The end of the primary expression shall be punctuated by a or by a . Only a that immediately follows an argument containing only the two characters "{}" shall punctuate the end of the primary expression. Other uses of the shall not be treated as special. If the primary expression is punctuated by a , the utility utility_name shall be invoked once for each pathname and the primary shall evaluate as true if the utility returns a zero value as exit status. A utility_name or argument containing only the two characters "{}" shall be replaced by the current pathname. If a utility_name or argument string contains the two characters "{}", but not just the two characters "{}", it is implementation-defined whether find replaces those two characters or uses the string without change. If the primary expression is punctuated by a , the primary shall always evaluate as true, and the pathnames for which the primary is evaluated shall be aggregated into sets. The utility utility_name shall be invoked once for each set of aggregated pathnames. Each invocation shall begin after the last pathname in the set is aggregated, and shall be completed before the find utility exits and before the first pathname in the next set (if any) is aggregated for this primary, but it is otherwise unspecified whether the invocation occurs before, during, or after the evaluations of other primaries. If any invocation returns a non-zero value as exit status, the find utility shall return a non-zero exit status. An argument containing only the two characters "{}" shall be replaced by the set of aggregated pathnames, with each pathname passed as a separate argument to the invoked utility in the same order that it was aggregated. The size of any set of two or more pathnames shall be limited such that execution of the utility does not cause the system's {ARG_MAX} limit to be exceeded. If more than one argument containing the two characters "{}" is present, the behavior is unspecified. > Is the latter result correct? I would have expected the same result as= for the ';' version? As mentioned by the POSIX wording, you are attempting to do something that is unspecified. So all bets are off, and it's hard to call it a bug. In fact, I'd argue that: find . -exec echo Prefix{}Suffix + should be a usage error, rather than a valid find command, because there is no terminating ';', and because the '+' is not proceeded by a lone {}. The fact that it is not a usage error may be a particular GNU find extension, but you probably shouldn't rely on it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hguSX6KpJqmADi177ArmJIEgfHIWgFCXu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWJRDbAAoJEKeha0olJ0NqQn8H/19FQB7AVAVl4f09RGqgpcU7 IQx410/xV07u3gCrINekqZZ5gxpfja0ms8hdjs9PY4mRWr5Mg/zAocdgAwfuLrBL ecyEQnF0LZj4PCmMyQELh5McfkO4Aw48HmvU4OcQtnMm0ZSmafsU7BuFR6K1+2rB 2SQyLSt1+FPDNis52tb/xtTYtTImEw2+uoldEwokSX6K60Yh5zJe52h8LOGZ1ooo sReiao1zLvwUXNR9LwSS7TZgIry97qluOoArz2CAmw0cpR8YtK+usTdGYNSjoyC6 Ird5QEE7Nd3NaGbs+b+cNe0bJd2px6vO9YdLdkEb2lv11+kQKneinRQAL7fESaA= =0ZhE -----END PGP SIGNATURE----- --hguSX6KpJqmADi177ArmJIEgfHIWgFCXu-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 19 12:40:39 2015 Received: (at 21712) by debbugs.gnu.org; 19 Oct 2015 16:40:39 +0000 Received: from localhost ([127.0.0.1]:56966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoDUD-0005GP-CU for submit@debbugs.gnu.org; Mon, 19 Oct 2015 12:40:37 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:57015) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoDUB-0005GH-QN for 21712@debbugs.gnu.org; Mon, 19 Oct 2015 12:40:36 -0400 Received: from [10.0.2.15] ([62.153.148.194]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0MOiCE-1Zs2yd1cIg-0063Yo; Mon, 19 Oct 2015 18:40:33 +0200 Subject: Re: bug#21712: Suspected bug in find -exec '+' To: 21712@debbugs.gnu.org, eblake@redhat.com, richard.white@embedded-expertise.com References: <01cc01d10a62$009591d0$01c0b570$@white@embedded-expertise.com> <562510D7.2060904@redhat.com> From: Bernhard Voelker Message-ID: <56251CFE.4050200@bernhard-voelker.de> Date: Mon, 19 Oct 2015 18:40:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <562510D7.2060904@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:Dl3FON366tiA7s5P1wckDopehFEe9Kj1Zq75omhH+MVsOoAuf9q oYNsAztkWUO8ukL+TaRm3YuySo3/GGYieyC2c3JXHrkMrK9nRKFsCaoxvpOAC3tzndjj6LK KZ1A1LUYhp85zhZESpfm1a749t7uPaQId978+ZKCmdheR2Z5qzAPh69MxGvfCJp1xGB/jhC MMewj3GzW/DJYeCgY0cLg== X-UI-Out-Filterresults: notjunk:1;V01:K0:NUY4E7418H8=:1CQl97sYPPzT3uyDfTxt3q cXIPZXC/xsrn0+RD50/y+10jXlcE5kjgmMxSun9kB3i0zbtyxHAM5wukFmZ+Bt3Od9yfQbCea x+RBEZwjtQxu1Q3qpmgw4nOulbnX81dnknR19Q7LSd3iXOoFfjuOx4IgIDY7HtEN0jx0KXHKR 9YlKa5GtLEmeVTwnkUruP3xWkmlq+0iQeVJcxPOoMBouX7RrW5+6n1U253EGivI7NCFnhHRhI U9our/ML9v2zZ2ENJyXJcKlVECVn6myw/cJsFxq3FFBJlgLJIHVkJk3vR8VEWforMDVRpQ4s+ MkF/2CfbVYcNT2gqpWeWo2LVynHx51txcOYydnQlPRHOXzaCSFnC3wuiDYMdWqg9FAp2bhm8w NeXe0Ue3dDCA0xQUbHT01xG12HLPUbCoxK60LX9tOSKPvEXYBQMefADCjl7CrU/5dtVzsHMVS GWrPja2pWhym0/9dHez1iMLFxj3x+lNk10HqVxz67QaXwE02u0D7bvJV1Ij8vm3ERpAoySnjq ALJTCw/eoFPQx7FqiAB60XaQgfKX8dMUOURd3/AYDiZgb2/Vs8dax9QixU7wegqwbrf2T9k1H fl/IAC1ZZeIlVa5l9PeS6Eb0xsTzsWs+cfaSN7Hx2BgHS8ctU81nEsC9Eg/M25RgOBPkxjRMy aLkjY5pYW7iY70c1ZNJRrAlZn1JXWuTDEsnOjJ5IslmcPc0EPglgg0V0mfk+Xnmy0ZSiNKegV ECWyelMe5LasCatv X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 10/19/2015 05:48 PM, Eric Blake wrote: > [...]. In fact, I'd argue that: > > find . -exec echo Prefix{}Suffix + > > should be a usage error, [...] It is: $ find . -exec echo Prefix{}Suffix + find: In ‘-exec ... {} +’ the ‘{}’ must appear by itself, but you specified ‘Prefix{}Suffix’ $ find --version find (GNU findutils) 4.5.14 [...] Have a nice day, Berny From unknown Thu Aug 14 21:44:28 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 17 Nov 2015 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator