You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xargs panics (index out of bounds) with -I/-i/--replace on empty input #735
xargs -I {} CMD … (and -i, --replace) aborts (panic, exit 101) when its input is empty. In replace mode xargs runs the command once per input item; with zero items it should run nothing, but the final builder is still executed and CommandBuilder::execute unconditionally indexes extra_args[0] — which is empty — so it panics.
Steps to reproduce
$ printf''| xargs -I {} echo hello {}thread 'main' panicked at src/xargs/mod.rs:429:46:index out of bounds: the len is 0 but the index is 0
$ echo$?101
With the default no_run_if_empty = false, process_input always calls the final current_builder.execute() even when no items were read. In replace mode execute indexes the first extra arg:
Activity