A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1872 ====================================================================== Reported By: steffen Assigned To: ====================================================================== Project: 1003.1(2024)/Issue8 Issue ID: 1872 Category: Shell and Utilities Type: Clarification Requested Severity: Editorial Priority: normal Status: Resolved Name: steffen Organization: User Reference: Section: find Page Number: 2946 Line Number: 98444 ff. Interp Status: --- Final Accepted Text: https://austingroupbugs.net/view.php?id=1872#c6956 Resolution: Accepted As Marked Fixed in Version: ====================================================================== Date Submitted: 2024-11-07 21:34 UTC Last Modified: 2024-11-16 08:54 UTC ====================================================================== Summary: find: clarify "less safe" statement ======================================================================
---------------------------------------------------------------------- (0006957) stephane (reporter) - 2024-11-16 08:54 https://austingroupbugs.net/view.php?id=1872#c6957 ---------------------------------------------------------------------- re: https://austingroupbugs.net/view.php?id=1872#c6956 With the "may ignore" removed replaced with an error and "may use them as the last argument" added, it's not totally clear what should happen if it's not used as last argument or what the "error" entails. Should xargs exit with a 1-125 exit status as soon as it comes to the realisation that the last input record is undelimited? Or abort the last run only? Or do the last run with or without that undelimited record, but report the error before or after and exit with a 1-125 exit status after? What if the utility does a exit(255) not on the last run but after xargs came to the realisation that the last record was undelimited? Should it still output an error message? You'd think that one should not happen as if EOF is reached before a run that is not the last (for which the list of arguments is full), you'd hope xargs would not treat it as EOF and try reading again after in case some data has been added in the interval (possibly even by the previous run), but in practice that's not what happens with GNU xargs at least: $ printf '%s\0' {1..9999} > a $ xargs -n1000 -r0 sh -c '[ "$1" -eq 8001 ] && printf "end\0" >> a; eval "echo \"\$1\" .. \"\${$#}\""' sh < a 1 1000 1001 .. 2000 2001 .. 3000 3001 .. 4000 4001 .. 5000 5001 .. 6000 6001 .. 7000 7001 .. 8000 8001 .. 9000 9001 .. 9999 That (delimited) "end" added by the second-last run was not included in the last run. It is included with busybox xargs Fun fact: echo 1 | xargs -n1 sh -c 'echo "$(( $1 + 1 ))" >> /dev/stdin; echo "$1"' sh On Linux where /dev/stdin when fd 0 is a pipe acts like a named pipe, does give you an infinite number sequence with busybox or ast-open xargs but not GNU nor toybox. Issue History Date Modified Username Field Change ====================================================================== 2024-11-07 21:34 steffen New Issue 2024-11-07 21:34 steffen Name => steffen 2024-11-07 21:34 steffen Section => find 2024-11-07 21:34 steffen Page Number => 2946 2024-11-07 21:34 steffen Line Number => 98444 ff. 2024-11-07 21:38 steffen Note Added: 0006951 2024-11-08 01:40 steffen Note Added: 0006952 2024-11-08 01:42 steffen Note Edited: 0006952 2024-11-08 08:31 stephane Note Added: 0006953 2024-11-12 09:48 geoffclare Note Added: 0006954 2024-11-13 18:19 steffen Note Edited: 0006952 2024-11-14 17:03 geoffclare Note Added: 0006956 2024-11-14 17:04 geoffclare Interp Status => --- 2024-11-14 17:04 geoffclare Final Accepted Text => https://austingroupbugs.net/view.php?id=1872#c6956 2024-11-14 17:04 geoffclare Status New => Resolved 2024-11-14 17:04 geoffclare Resolution Open => Accepted As Marked 2024-11-14 17:05 geoffclare Tag Attached: tc1-2024 2024-11-14 17:08 geoffclare Note Edited: 0006956 2024-11-16 08:54 stephane Note Added: 0006957 ======================================================================
