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?
Created attachment 1146835 [details] [PATCH] clarify exit status handling of -exec command {} +
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.
(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...
(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
upstream commit: http://git.savannah.gnu.org/cgit/findutils.git/commit/?id=ae424b95
downstream commit: http://pkgs.fedoraproject.org/cgit/rpms/findutils.git/commit/?id=cbc69330
findutils-4.6.0-5.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-e38c21c74b
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
findutils-4.6.0-6.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-d6e23194b1
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
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.
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.