Bug 1325049 - Documentation issue for '-exec {} +' syntax
Summary: Documentation issue for '-exec {} +' syntax
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: findutils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-08 04:49 UTC by Pavel Raiskup
Modified: 2016-06-21 19:23 UTC (History)
2 users (show)

Fixed In Version: findutils-4.6.0-4.fc25 findutils-4.6.0-5.fc24 findutils-4.6.0-6.fc24
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-18 18:53:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
[PATCH] clarify exit status handling of -exec command {} + (1.43 KB, patch)
2016-04-13 12:20 UTC, Kamil Dudka
praiskup: review+
Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1324814 0 unspecified CLOSED [PATCH] doc fix request for insecure find example 2021-02-22 00:41:40 UTC

Internal Links: 1324814

Description Pavel Raiskup 2016-04-08 04:49:59 UTC
Man page for 'find' says:

     -exec command {} +
            This variant of the -exec action runs the specified  command  on
            the  selected  files, but the command line is built by appending
            each selected file name at the end; the total number of  invoca‐
            tions  of  the  command  will  be  much  less than the number of
            matched files.  The command line is built in much the  same  way
            that  xargs builds its command lines.  Only one instance of `{}'
            is allowed within the command.  The command is executed  in  the
            starting directory.  If find encounters an error, this can some‐
            times cause an immediate exit, so some pending commands may  not
            be run at all.  This variant of -exec always returns true.

But:

  $ touch example
  $ find . -name example -exec false {} +
  $ echo $?
  1

So the statement "This variant of -exec always returns true." does not seem to
be right.  Or is it only in case of premature exit?  By the "error" is mean
find's error, or error of subsequent command?

Comment 1 Kamil Dudka 2016-04-13 12:20:45 UTC
Created attachment 1146835 [details]
[PATCH] clarify exit status handling of -exec command {} +

Comment 2 Pavel Raiskup 2016-04-13 12:40:09 UTC
Comment on attachment 1146835 [details]
[PATCH] clarify exit status handling of -exec command {} +

The interesting point to me is that:

  $ find -name NAME -exec false {} +
  $ echo $?
  1

.. but unexpectedly:

  $ find -name NAME -exec false \;
  $ echo $?
  0

There is probably reason for this?

But as this patch fixes just the '-exec {} +' syntax documentation,
it looks OK to me.

Comment 3 Kamil Dudka 2016-04-13 12:59:33 UTC
(In reply to Pavel Raiskup from comment #2)
> .. but unexpectedly:
> 
>   $ find -name NAME -exec false \;
>   $ echo $?
>   0
> 
> There is probably reason for this?

The man page says the following for '-exec command ;':

    Execute command; true if 0 status is returned.

So the exit status of the invocation affects truth value of the -exec predicate (instead of find's resulting exit status):

$ find -name NAME -exec false \; -print; echo $?
0

$ find -name NAME -exec true \; -print; echo $?
./NAME
0

> But as this patch fixes just the '-exec {} +' syntax documentation,
> it looks OK to me.

Thanks for review!  I will propose the patch upstream...

Comment 4 Kamil Dudka 2016-04-13 13:41:33 UTC
(In reply to Kamil Dudka from comment #3)
> I will propose the patch upstream...

http://lists.gnu.org/archive/html/bug-findutils/2016-04/msg00014.html

Comment 5 Kamil Dudka 2016-04-18 15:47:45 UTC
upstream commit:

http://git.savannah.gnu.org/cgit/findutils.git/commit/?id=ae424b95

Comment 6 Kamil Dudka 2016-04-18 15:59:25 UTC
downstream commit:

http://pkgs.fedoraproject.org/cgit/rpms/findutils.git/commit/?id=cbc69330

Comment 7 Fedora Update System 2016-05-31 12:47:53 UTC
findutils-4.6.0-5.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-e38c21c74b

Comment 8 Fedora Update System 2016-06-01 08:29:19 UTC
findutils-4.6.0-5.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-e38c21c74b

Comment 9 Fedora Update System 2016-06-17 13:34:06 UTC
findutils-4.6.0-6.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-d6e23194b1

Comment 10 Fedora Update System 2016-06-18 16:25:48 UTC
findutils-4.6.0-6.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-d6e23194b1

Comment 11 Fedora Update System 2016-06-18 18:53:52 UTC
findutils-4.6.0-5.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2016-06-21 19:22:50 UTC
findutils-4.6.0-6.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.