bugfindutils - Bugs: bug #31005, -exec {} + and -execdir {} + are...


bug #31005: -exec {} + and -execdir {} + are always true (but documentation does not say so)

Submitted by:  Aaron D. Ball <adb>
Submitted on:  Thu 09 Sep 2010 10:47:42 PM UTC  
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: Fixed
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Open/Closed: Closed
Release: 4.4.2Fixed Release: 4.5.13

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 07 Oct 2010 09:34:14 AM UTC, comment #1:

Yes, the documentation should mention this (and I'm surprised it doesn't already; sorry).

James Youngman <jay>
Project AdministratorIn charge of this item.
Thu 09 Sep 2010 10:47:42 PM UTC, original submission:

A naive user (e.g., I until a few minutes ago) would expect both of these commands

find -exec false \; -o -print
find -exec false '{}' \+ -o -print

to print all the files in the directory tree. Instead, the former prints everything and the latter prints nothing: i.e., the multi-argument form of "-exec" always returns true.

Since the documentation doesn't say anything about the truth values differing between the two forms of the statement, it seems natural to expect that, if -exec foo {} + invokes

foo file1 file2 ...

then the truth value at each file used in the invocation would be equal to the truth value of the whole invocation.

After thinking about it a little while, I see that we might need the truth value for file1 before we can decide whether to feed file2 to the command, so there may not be a logical way to fix this. In any case, the documentation should accurately describe the behavior of the '+' variant of the commands.

(In my own selfish interest, I should point out that the way I'm using this feature would actually work fine if the truth value were always "true" for every file but the last one in a command invocation, which is logically possible to implement.)

Aaron D. Ball <adb>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by jay (Posted a comment)
  • -unavailable- added by adb (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 16 Jul 2014 07:49:24 AM UTCjayOpen/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.5.13
    Sat 26 Oct 2013 01:57:09 PM UTCjayStatusConfirmed=>Fixed
    Thu 07 Oct 2010 09:40:32 AM UTCjayStatusNone=>Confirmed
    Thu 07 Oct 2010 09:34:14 AM UTCjayAssigned toNone=>jay

    Back to the top

    Powered by Savane 3.1-cleanup1