Repository navigation
winx3-xargs: fix #1318-#1323 (empty input, exit codes, -p source, quoting, -I/-t/-E/--show-limits, -s accounting) - #1387
Merged
Merged
Conversation
Previously the delimiter/-0 parser synthesized one empty item from empty input (the trailing push), so -r could not suppress the run and a bare run executed once with an empty argument. Fixes #1318
GNU maps any child exit status 1-254 to 123; only a signal-shaped abnormal termination (a negative/high-bit DWORD status here) maps to 125, and 255 maps to 124 with an 'exited with status 255; aborting' diagnostic. The old table sent 128-254 to 125 and printed nothing for 255. Fixes #1319
GNU reads the -p answer from /dev/tty, never from the item stream, so a -p run whose stdin is already consumed as input must not silently skip everything with exit code 0. The Windows counterpart is CONIN$, tried first; when no console exists it falls back to stdin, and a read failure on either source is a loud Fatal (message + exit code 1) rather than a silent skip. The answer is judged by its first character only. The prompt quoting helper introduced here is shared with -t (see #1322). Fixes #1320
Default mode: inside double quotes only $, backquote, double quote and backslash are escapable (other backslashes stay literal); a newline inside either quote kind is an unmatched-quote error; a trailing backslash at EOF is dropped; a CR at token start is skipped but is literal inside a token. -I mode is rewritten on the same quote rules: leading blanks are stripped, trailing blanks kept, blank lines are space/tab/CR-only, a trailing backslash continues the line (keeping the newline literally) while a double backslash does not, and an empty quoted line yields an empty item. -L keeps its trailing-blank continuation but no longer strips CR. Note: the -I leading-blank strip (a #1322 sub-item) rides along in this rewrite. Fixes #1321
…limits -t (and the -p prompt) now print arguments with GNU-style quoting (single-quote style, double-quote style for lone single quotes, control characters as closed-quote + $'\x' + reopened quote). -0 and -d no longer have a fixed priority: the last one on the command line wins. -E under -0/-d prints the GNU warning once and continues. --show-limits prints six lines to stderr (Windows ARG_MAX equivalent 32767, real environment block size, 4096 smallest limit, INT_MAX parallelism) and no longer suppresses execution. Fixes #1322
-s accounting now sums len+1 over every argv entry (command + initial arguments + batch items) in raw UTF-8 bytes, never the Windows-quoted command line. A single item that fits nowhere is an error with exit code 1 even without -x (cannot-fit when the command + initial arguments alone exceed -s, otherwise argument-line-too-long); the old clamp that lifted -s up to the command line is removed. Multi-item batches still split with or without -x. The echo path gets the same accounting and the same cannot-fit pre-check (after --show-limits, before -r), except -I with no items, where GNU runs nothing. Fixes #1323
caomengxuan666
marked this pull request as ready for review
October 26, 2026 10:00
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1318
Fixes #1319
Fixes #1320
Fixes #1321
Fixes #1322
Fixes #1323
winx3-xargs cluster (REPORT: workspace/winuxcmd-fix/clusters/winx3-xargs/REPORT.md).
Verification (integration window, 2026-10-26): mingw+Wine mini harness probes re-run against the PR-head tree binary: 46/46 PASS (harness/probes.sh). The committed gtest file (108 tests) runs in Windows CI: the repo suite executes the installed winuxcmd binary and needs a full product build, which the mingw line cannot provide; behavior is covered locally by the 46 GNU-oracle probes.
i18n: paired winuxcmd-i18n PR #10 (6 new keys + 2 stale keys dropped, VERSION 0.6.20 -> 0.6.21, validate -> valid), merged with this PR.
Known non-scope observations (not fixed here, for follow-up): bare command names are not PATH-resolved by the mini harness dispatcher (found during probing); -p CONIN$ path cannot be exercised under Wine (no console) and needs real-Windows confirmation.