Update of bug #61009 (project findutils): Assigned to: None => berny
_______________________________________________________ Follow-up Comment #1: I have to confess that I like the idea of having an option to immediately stop processing when an invocation of the command exits with a non-Zero status. POSIX [1] specifies the following conditions when xargs shall terminate processing: * child exits with 255, * child was killed by a signal, or * when reading the 'eofstr' string if the '-E eofstr' option is given, or * when regularly reaching EOF when reading from stdin. Still, our xargs might implement such an option as a GNU extension. I would recommend a long-option like --stop-on-error for such an extension. Why did you propose '-F'? Is there any precedence in other xargs implementations? [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html Regarding the examples - and just to be sure: I assume that the reproducer with 'cp' was just a simplification to demonstrate your actual use case, right? This is my guess because the shown use of find/xargs is quite excessive (one cp(1) invocation per file) and unsafe (unusual filenames would break the construct). In such a case - when launching one process per file is required -, I'd maybe better use the `find -exec ... '{}' \;' syntax without xargs, which could also be used in conjunction with -quit to terminate the processing when 'cp' fails: # Create source and destination directory. $ mkdir src dst # Create a regular file 'dst/f' which will cause 'cp' to fail later. $ touch dst/f # Create test sub-directories 'a' .. 'g', and a file 'x' in each of them. $ cd src $ mkdir a b c d e f g $ touch a/x b/x c/x d/x e/x f/x g/x # Run find to copy all files to 'dst', but stopping if 'cp' hits an error. # Note the use of the '(' ... ')' to enforce the wanted OR-precedence for -quit # when cp(1) fails. $ find . -type f '(' -exec cp -fv '{}' '../dst/{}' \; -o -quit ')' './b/x' -> '../dst/./b/x' cp: cannot create regular file '../dst/./b/x': No such file or directory # Alternatively, avoid the OR-syntax with -not before -exec: $ find . -type f -not -exec cp -fv '{}' '../dst/{}' \; -quit _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?61009> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/