ShellSpawn and its parser: the record of known issues

This is the single list of currently known problems of the posix_spawn executor (claude/pspawn-ShellSpawn.pm, claude/pspawn-tree.tar.gz-base64.txt) and of the bugs it found elsewhere. Each item keeps its ID when it is fixed; fixed items move to the end. Older records, now summarized here: Run's Changes, 0.05 and 0.06 (Run R1–R5), pspawn-run-shortcomings.md (0.03) (in Proc-Spawner 0.03) (Run, summary), pspawn-upstream-reports.md (0.03) (in Proc-Spawner 0.03) (P1).

Updated 2026-11-02, 07:50 Pacific. Module names: since 07:30 every module is under Proc:: (ShellSpawn is Proc::ShellSpawn, the binding PosixSpawn is part of Proc::Spawner); rows written before keep the old names. Table: pspawn-spawner.md, top.

Open

| ID | Where | What | Status | |---|---|---|---| | X1 | executor | Background jobs still running when run() returns went on only in later run() calls (until 0.04): run('sleep 1 && echo b &'), then 3 s of other work, ran echo b at second 3, not 1. Since post-0.04 (K3, the user's choice B, 2026-11-03) they go on between calls too, with a documented cost: the program's own sleep and select return early when a child ends (pspawn-design.md, section 6). An END block still waits for them, so Perl exits later than sh -c 'sleep 2 &' would. A background job that never ends keeps Perl from exiting at all: tail -F xxxx | tee -a yyyy & (corpus sample NB:9731) ends at once in both shells, which leave the job running, and never in ours (the run-time comparison of post4-0.04 timed it out after 5 s). | Design question K3 on the checklist "Run Graph API" (run-graph-api.html (0.03) in Proc-Spawner 0.03): this is its choice C (at exit, finish every job) with A (a job whose object is gone goes on). The alternatives offered there, not taken: B, dropping a job waits for it; D, at exit, start nothing more and leave the running processes alone. Decided 2026-11-03 for the time between calls: the user's choice B of the new question (a handler between calls, with sleep/select returning early documented). | | X2 | executor | $! is the pid of the background job's first process. It is empty when the job starts no process before the & returns, e.g. : & echo $! (dash prints the subshell's pid). Two more effects of the same design, seen by large-subset-difffuzz.pl (post-0.11): wait $! then waits for nothing, status 0 (the shells give the job's status, e.g. 127); and a background job of builtins runs at once, so { echo B; } & echo fg prints B first (dash and bash: fg first; both orders are allowed for an asynchronous job). | Design question K4. | | X3 | executor | Brace expansion (parser option brace) dies: not implemented. | Open. | | X4 | executor | Option redir_strict (Q1) is not implemented; only the default (dash's) behaviour. | Open. | | X5 | executor | Arithmetic error messages are worded differently from dash's (status 2 is the same). | Cosmetic. | | X6 | executor | With PATH unset, no default search path is used (dash has one). Untested. | Open. | | X7 | executor | While run() runs, Perl ignores SIGINT and SIGQUIT, as Perl's system does; the caller's own handlers for them are suspended meanwhile. | By design; say if not wanted. | | X8 | executor | Once, a run printed "Undefined value assigned to typeglob" at the line that restores the previous SIGCHLD action; not reproduced in 4,000 later runs. | Very likely X14. | | X9 | executor | The virtual current directory is passed to children as a path (addchdir_np). A directory renamed or removed after cd breaks it; addfchdir_np on a kept fd would not. | Open (see the table in pspawn-design.md, section 9). | | X10 | executor | Only Linux tested, with glibc 2.39 (and builds with some or all extensions left out). visible() (may >&N use fd N?) reads /proc/self/fdinfo; elsewhere it accepts any open fd. The graph's non-blocking writes open pipes anew through /proc/self/fd (L10). The shell layer needed posix_spawn's chdir extension (glibc 2.29). | Since 0.07 chdir is done around the call where the libc lacks it (checked post-0.08: built without chdir and fchdir, t/dash.t passes, 13 of 13); since post-0.08 a libc without posix_spawn at all is served by fork and exec (M2). Since 2026-11-02 the XS builds with any libc: Makefile.PL probes each posix_spawn extension by compiling a call, and an option the libc lacks is dropped or fails with ENOTSUP, as %Proc::Spawner::UNSUPPORTED says (seen failing to build on glibc 2.36 before). | | X14 | executor | ❰BUG❱ The SIGCHLD handler is installed with POSIX::sigaction without safe(1), so it is an immediate handler: Perl runs it inside the signal, in the middle of any Perl operation. In a stress test such a handler corrupted Perl's heap in 4 runs out of 4 (glibc abort); a deferred one never did. A deferred handler alone can miss a wake-up just before select. Details: perl-signals-findings.md, S1–S3. | Interim fix applied 2026-11-01 (B1 on the page “Child Exit Wake-up”): a deferred handler and a 50 ms timeout on select. Before it, the executor itself died with a segmentation fault in 4 stress runs out of 4; after it, 4 out of 4 finished normally. Final fix applied the same day, EXPERIMENTAL and awaiting approval: D1 option A, a C handler in the binding (pspawn-extensions.md, section 6); B1 is now only the fallback. | | X15 | executor | Some reference cycles are still broken by hand at the end of a run (release_all, %$c = () in run), against the user's rule that cycles must go through weakened references only. | Narrowed 2026-11-02: the new modules Proc::Spawner and Proc::Spawner::Graph have no cycles (weak back references only). The ones left are in the shell layer: each context sits in its shell's or loop's scope list, which the context holds. Open. | | X13 | executor | Once, battery.txt gave 40/43 instead of 41/43, right after the graph objects went in; the extra line was not captured, and 21 later runs gave 41/43. | Watch. | | X16 | executor | If other code takes the status of one of our children first (its own wait or waitpid(-1)), the child is reported with an unknown status, and the shell's $? is 1. Before 2026-11-02 the loop would have waited for it forever. | By design (G3 in pspawn-spawner.md); EXPERIMENTAL. | | X17 | executor | (minor, the large-subset session's L9) Under set -u, an unset parameter inside eval is reported by dash as eval: x: parameter not set; ours drops eval: . The status is the same (2). | Open: messages do not yet know whether they come from inside eval. | | X18 | executor | Process-wide state flipped for a while is bullet-proof only in non-threaded execution: Perl's umask around Proc::Spawner::start's call (posix_spawn has no umask setting) and around opening a redirection's file (Proc::ShellSpawn::open_end); the SIGCHLD action while wait_until waits; SIGINT, SIGQUIT and SIGPIPE ignored, and traps set in %SIG, while run() runs. (posix_spawn also cannot make a child ignore a signal, nor set resource limits or the nice value: since post-0.08 these are set around the call too, in C, sigignore, rlimit, nice, M1; per thread on Linux for nice and the signal mask, process-wide for the rest.) | Documented limitation (the user, 2026-11-02), in the modules' comments and pspawn-spawner.md, section 7. | | X24 | executor | A trap action that sends its own signal again (trap 'kill -INT $$' INT; kill -INT $$) recurses until Perl warns "Deep recursion" (dash crashes with a segmentation fault; bash stops quietly). | Open; seen in 0.03 too. Both shells fail, so the subset could reject it, but the parser cannot see it. A trap that counts down and stops re-sending (n=37; trap 'n=$((n-1)); [ $n -gt 0 ] && kill -INT $$' INT; kill -INT $$) ends in ours as in both shells, also with n=2000 (checked post-0.04); the issue is only the trap that never stops. | | X27 | measurement (TODO) | The run-time comparison (doc/large-subset/large-subset-state.md, section 7) runs each sample once, in an almost empty directory (a few fixed files), with almost no variables set, and with every program but the plain text tools only logging its arguments. A form that behaves differently only with other files, other values or other programs' output is therefore not exercised: an agreement there says little, and so may a difference (kill $(pgrep x) reached kill with no process ID only because pgrep printed nothing). | TODO (the user, 2026-11-05): inspect each sample mentally and mark which do not depend on the environment (their agreement is a real one); classify the rest (by what they depend on: files, variables, a program's output, time, process IDs); then decide what to do with each class (more fixtures, chosen values, real programs, or nothing). Classified (post-0.08, 2026-11-07; the user's method: parse in one batch, split into atomic blocks marked with their samples, pass only what is shown unaffected): doc/large-subset/tools/large-subset-blocks.pl sorts the 40,410 samples from the parse trees into strict 365 (0.9 %), held 2 (assumptions known to hold in every tested environment), almost strict 34,291 (84.9 %, under named assumptions, mostly about programs) and undecided 5,752 (14.2 %, with codes of what they may depend on), with whether the run could control each (doc/large-subset/large-subset-environment.md; the record, one line per sample by snippet ID: doc/large-subset/large-subset-provenance.tsv). Checked by probes, by reading all strict and random other samples, and against the run's differences; no sample was run again. Open: what to do with each code (the user's). The run's environment varied (post-0.09, 2026-11-08: large-subset-runcompare.pl -env, a second run with the other case of echo, locale, pipeline, devfd, and fresh or fixed places for the path- codes): large-subset-environment.md, section 9; it found that the samples meet in /tmp across the whole run, and X33. | | X30 | parser | $LINENO anywhere in a text makes the parser count each command's line from the start of the text (lineof in Proc::ShellSubset::Large), so the parse time grows with the square of the text's length: the 40,212 corpus samples joined into one text (1.5 MB, 41,412 lines) parse in 8.4 s, and in 89 s with one echo $LINENO among them (found 2026-11-07, X27's batch check; 8,000 lines: 0.8 s, with $LINENO 3.2 s). Harmless for one-liners; it matters for long scripts. Since post-0.04 (G8: $LINENO as the line number), so in every release since 0.05. | Open; a fix (count the lines once, look positions up) changes no tree. | | X56 | parser | ❰BUG❱ (ours; found post-0.11 by the run of the library again, section 7 of large-subset-state.md: exec command -with -flags, from tldr) exec followed by a builtin's name: dash and bash run only a program there, so exec set -e, exec umask, exec type ls, exec command -v ls all say exec: NAME: not found, status 127 (no such program); ours runs its builtin (exec umask prints the mask, status 0; exec command -with -flags: status 248, A4, as command -with alone). The large grammar refuses every builtin it runs itself after exec ("unsupported 'exec' form"), but the base grammar (Proc::ShellSubset), tried first, refuses only cd, : and exit, and what it accepts is not checked again. Seen in that one sample of the library (before X53's fix it ran a program named -with and failed with 127, as the shells, by chance). | Open: a fix (the base grammar refusing what the large one refuses after exec) changes the parser, so the parse figures are measured again with it. | | X20 | tests | One make test from a freshly unzipped distribution failed (2026-11-02, 10:00); its output was not kept. 7 later runs passed, including another fresh unzip. | Watch; keep the output if it recurs. | | X21 | executor, Windows | The subset runs echo, printf, test, [, kill, time, pwd, true and false as programs, and the rule "the program beats the shells' difference" (doc/large-subset/large-subset-state.md, section 2) makes the coreutils behaviour part of the subset's meaning. Windows has no such programs. | Partly done (post-0.09; the user, 2026-11-08: "echo, printf, test", "inside the Perl process"): echo, printf, test, [, true, false (and since post-0.10 pwd, as pwd -L: 352 runs checked) run inside Perl (lib/Proc/ShellSpawn/Programs.pm), as coreutils 9.4, on every platform by default (decision IP1, the user: "when a well-debugged builtin is already present, use it. (By default; Configurable.)"; PROC_SHELLSPAWN_INPROC=none runs the programs). Checked against coreutils 9.4 on 12,348 runs and 3,000 random words for %q, and by t/programs.t (2,284 runs recorded in t/programs.txt; the shell layer with and without, the same). Known differences: --help and --version print a short text; printf's floating conversions use a double, coreutils a long double (digits beyond a double's precision, e.g. %f of 1.5e300); %q follows gnulib's current rule (decision IP2, the user: "Use the builtin"), not coreutils 9.4's ❰BUG❱ (gnulib's quotearg keeps a stale state when it starts a word over, fixed since): for a word with a ' and a character it escapes, 9.4 writes an extra '' at the start, or, when the word starts with such a character, no $' before it, so the shell reads it back wrong (the word ESC, ', form feed comes out as '\033'\'''$'\f'). Whose echo (decision EC1, the user, 2026-11-09): PROC_SHELLSPAWN_ECHO=coreutils (the default; it heeds POSIXLY_CORRECT), dash or bash (their builtins, which do not; t/echo-shells.txt). kill and time are still open. Proc::ShellSpawn runs on Windows since post-0.10 (pspawn-shell-windows.md). | | X22 | upstream (bash) | ❰BUG❱ bash 5.2.21: the manual's "Bash POSIX Mode" item 24 says a non-interactive shell exits when a POSIX special builtin returns an error status; bash --posix -c 'shift 3; echo after' and bash --posix -c 'export "1x=2"; echo after' print after (status 1 from the builtin). set -o nosuch and unset -x do exit. | Not ours to fix; the executor follows dash (it stops). Report to bug-bash if wanted. |

Fixed

| ID | Where | What | Fixed | |---|---|---|---| | X11 | executor | No posix_spawn on Win32: there the executor would need Run's wraparound (claude/Run-0.06.tar.gz-base64.txt), or a CreateProcessW binding. Not integrated. | Decided 2026-11-01: W1–W3 Go (W2 option C), experimental, to be written in Proc::Spawner, which exists since 2026-11-02 (pspawn-spawner.md). Closed (the user, 2026-11-07): done; the CreateProcessW binding is win_spawn.h (0.07), and without posix_spawn and fork Run's redirections serve Perl's own spawn (M2, system1); both checked under Wine (t/windows.t). What remains for Windows is listed in TODO. | | X12 | tests | The corpora (tldr, NL2Bash, …) have not been run through the executor. Plan: section "Corpus testing" below. | Proposed. The reporter program exists (sgraph/reporter, used for hand-written graphs); the corpora are still to be restored. Closed (the user, 2026-11-07): done another way, by the run-time comparison of post4-0.04 (every accepted corpus sample run in dash, bash --posix and ours: doc/large-subset/large-subset-state.md, section 7; its limits: X27). | | X19 | executor | trap "echo int" INT; x=$(kill -INT $$); echo after printed after before int in about 1 run of 30 (dash: always int, then after); also with a subshell. Cause: the trap's action was deferred like any reaction, so the command after the substitution could run first. | Fixed in 0.04: a caught signal is queued on the shell that set the trap, and a list runs the queued actions before its next command (run_pending); 0 wrong orders in 160 runs; the FLAKY entries in t/dash-known.txt are gone. | | X25 | executor, parser | ❰BUG❱ (ours; in every version since 0.01, so on CPAN in 0.02, 0.03, 0.04) break or continue in a group that is a pipeline element inside a loop (for v in 1; do echo a \| { continue; }; done) died with Perl's "Modification of non-creatable array value attempted, subscript -1": the parser (Proc::ShellSubset, which counts loops through pipelines) let it through, but the executor (Proc::ShellSpawn) runs each pipeline element as a shell of its own, which knows no loops. Checked: 0.01 and 0.04 die so. | Fixed in post-0.04: it ends that shell with status 0, as dash (rule E, as for a subshell). | | X26 | parser, executor | ❰BUG❱ (ours; checked: the parsers of 0.01 and 0.04 accept it, so every CPAN release has it) unset array[2] and unset foo[$i] were accepted; post3-0.04's executor then did nothing, with status 0: dash stops with "bad variable name" (status 2), bash unsets an array element (or fails with status 1 for a plain variable). The detector missed the difference, so the corpus measurement counted these samples as accepted correctly. | Fixed in post4-0.04: rejected, as bash's arrays are; detector feature unsetarr (probe unsetarr). | | X29 | executor | ❰BUG❱ (ours; 0.07, 0.08) Where the fd actions are done around the call (a libc without them; PROC_SPAWNER_MISSING in tests; Perl's own spawn, M2), the copies of the fds put back after were made above the highest number in the actions, an open's flags and mode included (O_WRONLY|O_CREAT|O_TRUNC is 577), plus 1000: above the common soft limit of 1024 fds, so F_DUPFD failed and the call with it (EINVAL). Not seen in the tests, where root's limit here is 20000; found on Windows. | Fixed post-0.08: the copies go just above the highest fd the actions name (the extra 1000 served nothing). Checked: 0.08's code with ulimit -n 1024 fails, the new one works. | | X28 | tests, executor | ❰BUG❱ (ours; RT #182479, Slaven Rezic, FreeBSD) The tests needed Linux's /proc and /bin/true, /bin/grep; and without /proc the library itself (checked by running the suite on Linux with /proc hidden by an empty mount): Perl's write into a pipe it shares with children made the shared open file non-blocking, so the children's writes failed with EAGAIN and output was lost (the fallback of L10); an fd's close-on-exec flag was read from /proc/self/fdinfo, and every fd taken as inherited without it; ulimit died. | Fixed in 0.06: tests portable or skipped with a reason; a pipe of ours is a named FIFO opened once more for Perl's own writes where /proc/self/fd cannot open it anew, a pipe we were given takes PIPE_BUF bytes per blocking write; fcntl (Proc::Spawner::__fd_cloexec); ulimit asked a shell (dash, bash --posix, ksh or sh; in /bin first, then on PATH); since post-0.08 it uses getrlimit (Proc::Spawner's XSUB), with or without /proc. FreeBSD itself not tested here. | | X31 | Windows | ❰BUG❱ (ours; post-0.08, unreleased: only in the Windows code, which no release builds yet) Proc::Spawner's open file action on Windows (win_spawn.h, WIN_FA_OPEN) hands the path to CreateFileW as it is, joined with the working directory, so /dev/null there means \dev\null on the current drive and fails; Perl's own open, sysopen and fopen map the exact name /dev/null (any case) to NUL (win32/win32.c, win32_open, win32_fopen, win32_freopen, Perl 5.38.2). The shell layer is not affected: Proc::ShellSpawn opens redirection targets with Perl's sysopen and hands on the handle. (/dev/nul is no way out: a last component nul was taken as the device in any directory by older Windows, but Windows 11 narrowed that rule; unchecked here.) Found 2026-11-07 (X27's devnull). | Fixed post-0.08: WIN_FA_OPEN maps /dev/null (any case) to NUL, as Perl does. Checked under Wine from a directory on C: (on Wine's Z:, which is the Linux root, \dev\null is Linux's own and hides the bug): a test program of win_spawn.h failed before (ENOENT) and passes after; t/windows.t (new test 8) passes with both primitives. Perl's other Windows special cases were checked against ours: program lookup, quoting, cmd.exe and batch files, the child's directory, binary pipes, appending were already matched; kill, isatty, stat, unlink, rename go through Perl. | | X32 | executor | ❰BUG❱ (ours; possible, not observed) Perl's own writes into a pipe (the shell's builtins, $( … ) plumbing) never block where Perl has a non-blocking open of its own: a pipe reopened through /proc/self/fd/N, or, without /proc, a pipe of ours made as a named FIFO. Without /proc, a pipe Perl was given (an fd of the caller's, e.g. its stdout as a pipe) has neither: it is written only when select says writable, at most PIPE_BUF bytes at a time, with a blocking write. If another writer (a child) fills the pipe between the select and the write, Perl blocks; if the reader is waiting on Perl itself, that is the hang of L10. | Open (found by reading the code, 2026-11-07; not reproduced, no test). Only without /proc (FreeBSD and the like), only for pipes the caller gave, only with several writers. A fix needs an open of the pipe of Perl's own, which needs a name; or a reader that is not Perl. | | P1 | parser | ❰BUG❱ A setting before a command could get the wrong NAME when its value had $( … ) (A=$(true) B=$(false) env gave t and B): push @env, $1, word('e') passes $1 by alias and word() matches again. Same in ShellSubsetSmall.pm. | 2026-11-01, in the project's ShellSubset.pm and ShellSubsetSmall.pm (claude/pspawn-parser-setting-name.patch; now in the style push @env, "$1", word('e'), and other bare $1 arguments also became "$1"), with tests OWN:205–207 that compare the whole tree. shell-subset-tests.pl now can check trees, not only acceptance. | | E1 | executor | Every child had SIGFPE ignored: Perl ignores it for itself and posix_spawn passes that on (Perl's own exec puts back the disposition Perl found at startup, PERL_FPU_PRE_EXEC, PL_sigfpe_saved). | 2026-11-01: SIGFPE is in sigdefault unless it was ignored when Perl started (PosixSpawn::fpe_at_exec()). | | E2 | executor | Background children did not have SIGINT and SIGQUIT ignored, as POSIX asks of an asynchronous list without job control (dash: SigIgn 0x6). | 2026-11-01: ignored in Perl while run() runs; foreground children get them back by sigdefault, background ones keep them. | | E3 | executor | Environment entries whose names are not identifiers (BAD-NAME=1) were passed to children; dash drops them. | 2026-11-01. | | E4–E18 | executor | 15 problems found by the cold review of 2026-11-01: a hang when SIGCHLD interrupted select; fds leaked by exit in loops; a memory leak through reference cycles; read splitting with non-blank IFS, backslashes and continuation lines; two reads on one fd; >&N reaching the module's own fds; settings across a $( ); $! in subshells and pipelines; && || ?: short-circuit in $(( )); [[:alpha:]] in case; continue and the loop status; where redirection errors are written; an XS leak on croak; read a <&-; ./nosuch message. | 2026-11-01 (pspawn-design.md, section 7). | | E19 | tests | fdbattery.txt, mem.pl and xs.pl used absolute paths into an earlier session's scratchpad, so in a new session fdbattery.txt gave 12/14 and mem.pl did not start. | 2026-11-01: ./fds, and paths relative to the scripts (FindBin). | | E20 | executor | A command with many words (echo with 200 arguments, for over 300 words) printed "Deep recursion on subroutine" warnings: each word's expansion called the next one directly. | 2026-11-01: expand_list loops while words expand at once, and resumes from a $( ) later. | | U1–U5 | parser | **❰BUG❱**s found by the ShellSubsetLarge session (large-subset-upstream-reports.md (0.03) (in Proc-Spawner 0.03)): strings starting with - or + (sh takes them as options), patterns that may match . or .. (dash and bash differ), \" in backquotes inside "${…}", digits before a redirection operator in a target (x >&2>f), and settings of names the shell sets (UID=5 cmd). | 2026-11-01: claude/large-subset-shellsubset.patch applied to claude/ShellSubset.pm and its two test files (222/0 own, 612/0 corpus, 142/0 large-subset tests). The four that apply ported to claude/ShellSubsetSmall.pm (claude/pspawn-small-u1-u5.patch; Small has no ${…} forms, so U3 does not apply): 0 of 1,039 strings differ between the two parsers. In the executor's batteries, echo .* \| wc -w (t3) is now outside the subset. | | E21 | executor | Every $(( )) leaked about 5.6 KB: the two parsers inside arith held each other in closures, a reference cycle. Found by sigprobe/mem-large.pl, now t/memory.t (mem.pl has no arithmetic). | 2026-11-01: the closures refer to each other through weakened references. | | E22 | executor | A command whose words all expand to nothing skipped its redirections (x=; $x >f did not create f). | 2026-11-01 (visible only with the large grammar, which allows $x as the command name). | | L1–L5 | executor | **❰BUG❱**s found by the ShellSubsetLarge session's random-string comparison with dash (large-subset/tools/large-subset-difffuzz.pl; details in large-subset-upstream-reports.md (0.03) (in Proc-Spawner 0.03)): L1 "$@" with no parameters gave one empty field; L2 field splitting ignored IFS; L3 OPTIND did not start at 1; L4 set -u missed ${x%p} and the like; L5 an EXIT trap of a background job or pipeline element that had already started a program ran after the shell's fds were released ("Bad file descriptor"). | 2026-11-01 (evening), in lib/ShellSpawn.pm. L5: a shell whose EXIT trap is set keeps its own fds until the trap has run. Lines for all five are in largebattery.txt. | | L6 | executor | ❰BUG❱ (reported by the large-subset session, large-subset-upstream-reports.md (0.03) (in Proc-Spawner 0.03)) kill … $$ in a subshell, a pipeline element or $( … ) ignored the main shell's trap for that signal and ended the whole string; in sh $$ is the main shell, which runs its trap. | 2026-11-02: a subshell's state knows its main shell (main); kill looks up the main shell's trap and, if set, runs it as a real signal would. Tests: four lines added to largebattery.txt. | | L7 | executor | ❰BUG❱ (minor, same report) getopts with new arguments after an earlier loop had run to its end did not start over as dash does. | 2026-11-02: with OPTIND past the end of the arguments, getopts starts over at 1 (as dash's getoptscmd). | | L8 | executor | ❰BUG❱ (minor, same report) When getopts found no more options it unset OPTARG; dash leaves it as it was. | 2026-11-02. | | A4s | executor | The status for a construct outside the subset found at run time was 2; the large-subset session decided 248 (large-subset/large-subset-spec.md, section 5). | 2026-11-02: claude/large-subset-a4-status.patch applied ($ShellSpawn::Large::UNSUPPORTED). | | L10 | executor | ❰BUG❱ (reported by the large-subset session, large-subset-upstream-reports.md (0.03) (in Proc-Spawner 0.03)) Perl's own output (error messages, umask, command -v, cd -, getopts messages, A4's message) was written with a blocking POSIX::write. When a child had already filled the same pipe, the whole loop stopped; with Perl as the reader ($( … )) it never resumed: x=$(head -c 10000000 /dev/zero & umask; wait); echo ${#x} hung. | 2026-11-02, two parts. (1) The shell layer: every such write goes through the graph's perl_write (new put($c, FD, TEXT, THEN); msg and fail($c, STATUS, TEXT) use it), and the command goes on only in THEN, after the write is done, so nothing started later overtakes the text. (2) The graph: making a pipe non-blocking would make the children writing to the same pipe fail with EAGAIN (the flag belongs to the open file, which they share), so perl_write opens the pipe or FIFO anew through /proc/self/fd/N (Linux: a new open file of the same pipe) and makes only that one non-blocking; elsewhere it falls back to the previous behaviour (X10). Tests: pspawn-l10.txt (9 strings, 1.4 s; the 4 differences are message prefixes inside captured text, and printf being a program here), a line in largebattery.txt. All six snapshotted batteries identical before and after. | | D2 | executor, parser | Not a bug: the large-subset session's request (the user's decision D2(A)): redirections without a command (> f), and settings with redirections (x=1 >f). | 2026-11-02: claude/large-subset-d2-base.patch (ShellSubset.pm) and claude/large-subset-d2-exec.patch (x_set) applied as sent; the bundle's parser/ShellSubsetLarge.pm (now lib/Proc/ShellSubset/Large.pm), parser/large-subset-tests.pl (now t/parser/) and large-subset-difffuzz.pl refreshed from the Project. Tests: pspawn-d2.txt (9 of 11 agree; the two others are a test-file artefact and < f alone, rejected on purpose), two lines in largebattery.txt. | | E23 | executor | $( … ) kept NUL bytes; dash drops them (x=$(printf "a\0b"); echo ${#x}: dash 2, ours 3). Found while testing L10. | 2026-11-02 (rule A5, as dash). A line in largebattery.txt. | | X23 | executor | pwd runs the program /bin/pwd (decision B2 of the base parser's checklist, not the B2 of "Shell Corpus Gaps"), which prints the directory with symbolic links resolved; both shells print it as reached (cd link; pwd: …/link in both, …/real with the program). large-subset-state.md, section 1, wrongly counted pwd among the programs where the shells agree anyway. pwd -L and pwd -P agree with both shells. | Post2-0.03, the user's choice C: pwd runs as /bin/pwd -L with PWD set to the shell's own directory, operands dropped (Proc::ShellSpawn::Large::b_pwd); it prints what both shells print. Options both shells refuse (pwd -x) are rejected since post-0.03 (rule Q1; test LS:111 changed). | | X33 | measurement | ❰BUG❱ (ours; in large-subset-runcompare.pl since post4-0.04) The runner opened each run's standard output and error files as root before dropping to the run's user, so they belonged to root. On Linux /dev/stdout and /dev/stderr reopen the file by its path (through /proc/self/fd), so echo x > /dev/stderr failed with "Permission denied" in all three shells alike: the samples that write to /dev/stdout or /dev/stderr were compared failing, not working. Of the 40,410 accepted samples 3 name them, none in a redirection; one of the 3 opens one for writing in a program that really runs there (echo 'ee' \| tee /dev/stderr \| foo; the other two give it to find and duckdb, which only log). Found 2026-11-08 by a probe for X27's environment variants. | Fixed post-0.09: the files are made and given to the run's user first. | | X34 | executor | ❰BUG❱ (ours; 0.07 to 0.09, in the Windows code: win_spawn.h) The process handles kept for the children's exit codes were in a fixed table of 1,024; a child started while it was full had its handle closed at once, and if it ended before it was waited for, nobody held a handle to it any more and its status was lost. Checked under Wine: 1,100 children started before any is waited for, all ended by then: 76 statuses lost (1,100 - 1,024). | Fixed post-0.09: the table grows (on the process heap); the same check loses none. | | X35 | executor | ❰BUG❱ (ours, probable; found 2026-11-08 by X27's stand-in run) unset of a word that is not a name (from an expansion: unset $(locale \| cut -d= -f1) given a.txt) does nothing, with status 0. dash fails ("unset: a.txt: bad variable name", status 2, and as a special builtin's error it ends the shell); bash takes the word for a function's name (status 0); unset -v a.txt fails in bash too (status 1). Ours checks names in read but not in unset (Proc::ShellSpawn::Large::b_unset). Rule A5 (errors at run time as dash) would make it fail as dash. | Fixed post-0.09 (the user, 2026-11-08: as dash): such a word stops the shell with "unset: WORD: bad variable name" and status 2, the names before it already unset; unset -f takes any word, as dash. Checked against dash on 8 strings, 6 of them now in largebattery.txt (t/dash.t). Found in 2 corpus samples, only with a stand-in's output (large-subset-environment.md, section 9). | | X36 | binding | ❰BUG❱ (ours; 0.01 to 0.09; RT #182809, "Undefined symbol "av_count"", Slaven Rezic, 2026-11-08, perl 5.30.3 on FreeBSD) Spawner.xs used av_count(), which perl has only since 5.33.1, though MIN_PERL_VERSION is 5.020: with any perl before 5.34 Spawner.so failed to load ("Undefined symbol "av_count""), and every test with it. | Fixed post-0.09: Spawner.xs defines av_count where perl does not, as perl does (AvFILL + 1). Checked with perl 5.30.3 built here (Linux): 0.09 fails to load as reported, the fixed tree passes the suite; against perl 5.20.3's headers the XS compiles with no undeclared function (that perl did not build here, so its suite was not run). FreeBSD itself not tested here. | | X37 | executor | ❰BUG❱ (ours; 0.10, in the programs that run inside Perl since IP1, Proc::ShellSpawn::Programs) printf's \u and \U always printed the character, UTF-8 encoded, also where the locale cannot encode it: in the C locale printf '\u20AC' gave € where coreutils 9.4 prints \u20AC (gnulib's print_unicode_char: the escape, in capital hex, \UXXXXXXXX above U+FFFF; above U+10FFFF everywhere), and a surrogate (\ud800) gave bytes where coreutils stops with "invalid universal character name \ud800" and status 1; %b printed nothing of its argument before an invalid escape, where coreutils prints what came before it. Found 2026-11-08 by the behaviour run with the in-process programs (one corpus sample, printf "\u20AC %.2f\n" 123.4; large-subset-state.md, section 7). | Fixed post-0.10: as coreutils in the C and UTF-8 locales (another legacy locale, which coreutils would convert to with iconv, gets the escape); 14 runs added to t/programs.txt, which fail without the fix. | | X38 | executor | ❰BUG❱ (ours; Windows, the primitive system1 only, that is Perl's own spawn, used where the module has no posix_spawn, as with PROC_SPAWNER_MISSING=posix_spawn) The child gets every inheritable handle of ours, not only the fds given to it. Perl's pipe on Windows makes inheritable handles (on POSIX Perl marks fds above $^F close-on-exec, on Windows it does not), and Perl's spawn passes them all. A child given the read end of our pipe as its fd 0 then also holds the write end, and never sees end of file. Found 2026-11-09 under Wine by t/spawner.t (its megabyte test hung, once the file ran on Windows); with our two ends marked not inheritable (__set_cloexec) all 52 tests pass. Not affected: the posix_spawn primitive (win_spawn.h passes exactly the handles listed), and the graph's own pipes (made not inheritable). Perl's side: ❰BUG❱ in Perl, perl-win32-system-bugs.md, 4. | Fixed post-0.10 (the user, 2026-11-09: "do as on POSIX"): around system1's call on Windows our fds from 3 up are made not inheritable and put back after; not thread-safe (pspawn-spawner.md, section 8, M2). The test passes through both primitives under Wine without marking its ends. | | X39 | executor | ❰BUG❱ (ours; found 2026-11-10 by X27's step 2: large-subset-environment.md, section 10) . of an empty file, or of a directory: ours printed "sh: the: not found", then Perl died ("Can't use an undefined value as a subroutine reference", status 11); dash does nothing (status 0). b_dot read the file in list context as an argument of run_text: an empty file gave no argument at all, so the message "the text of '. FILE'" became the text and the continuation was lost. | Fixed post-0.11 (branch x27-step2): read in scalar context; test: t/batteries/largebattery.txt (an empty file and a directory, as dash). | | X42 | executor | ❰BUG❱ (ours; found 2026-11-10 by X27's step 2) A value that is not a number where a number is wanted, known only at run time: exit $v with v=x1 exits with status 0 after Perl's warning "Argument "x1" isn't numeric"; return $v sets $? to x1; $((v+1)) prints Perl's warning before ours' own error. dash and bash agree for exit and return ("Illegal number", "numeric argument required", status 2); for arithmetic dash fails, bash takes x1 for a variable's name (0). Written literally (exit x1) the parser refuses it (outside the subset). | Fixed post-0.11 (branch x27-step2), decision NV1 (the user, 2026-11-10: "as the shells"): an operand of exit, return, break, continue known only at run time must be a number as dash takes it (digits, maybe after +, at most 2^31-1; break, continue at least 1), else "exit: Illegal number: x1", status 2, and the shell ends (a special builtin's error, as dash; where bash differs, after break 0, exit -1, dash's way); arithmetic on such a value: ours' own error without Perl's warning. Tests: t/batteries/largebattery.txt. | | X43 | executor | ❰BUG❱ (ours; found 2026-11-10 by X27's step 2) set -o "$o" with a name that is no option, known only at run time (o=x1, or empty), does nothing, with status 0; dash and bash fail ("Illegal option -o x1", "invalid option name", status 2; bash lists the options for an empty name). Written literally, the parser refuses it. | Fixed post-0.11 (branch x27-step2), NV1: "set: Illegal option -o x1", status 2, the shell ends, as dash; also an option letter that is no option (set -$v with v=z); set -o with no name at run time lists in both shells: A4 (outside the subset), as the parser has it. | | X40 | executor | ❰BUG❱ (ours; found 2026-11-10 by X27's step 2, large-subset-environment.md, section 10) A character class in a bracket expression of pathname expansion never matches: ls *[[:digit:]].jpg with m0.jpg there lists nothing (the word stays as it is), dash and bash list m0.jpg; also [[:alpha:]].jpg. Pathname expansion goes through Perl's File::Glob::bsd_glob, which has no character classes; case patterns and ${v#p} (ours, glob_re) have them. | Fixed post-0.11 (branch x27-step2): each [:class:] of a bracket expression is spelled out as its characters (the C locale's, as dash there) before bsd_glob sees it; in a UTF-8 locale dash also counts other letters (é in [:alpha:]), ours does not. [^...] stays negation (rule E). Test: t/batteries/largebattery.txt. | | X41 | parser | ❰BUG❱ (ours; found 2026-11-10 by X27's step 2) In "${v#$x}" (and %, ##, %%) the value of $x is taken literally: the parser marks $x quoted, as if "${v#"$x"}" had been written. POSIX: enclosing the whole expansion in double quotes does not quote the pattern's characters, quoting within the braces does; dash and bash agree (x='a*'; v=abcabc; echo "${v#$x}": bcabc; ours abcabc). Unquoted, ${v#$x} is right; a literal pattern, "${v#a*}", is right too. | Fixed post-0.11 (branch x27-step2): in a % or # pattern word the parser no longer marks an expansion quoted by the outer "..." (also inside a bracket expression); "${v#"$x"}" stays literal. The figures' digest changed (89075620…); measured again (the stored scan reparsed): the figures, samples.tsv, the scan and large-subset-provenance.tsv identical. Test: t/batteries/largebattery.txt. | | X44 | executor | ❰BUG❱ (ours; found 2026-11-10 by X27's step 2, large-subset-environment.md, section 10) cd DIR into a directory the user may not search (mode 000) succeeded in ours, which keeps the shell's directory itself and checked only that it is a directory; dash and bash fail ("can't cd to DIR", status 2; bash "Permission denied", 1), and the commands after it then ran elsewhere than in the shells. | Fixed post-0.11 (branch x27-step2): the directory must also be searchable (-x; not on Windows, which has no such bit), else dash's message and status 2. Test: t/programs.t (as a user other than root, who may enter any directory). | | X45 | executor | ❰BUG❱ (ours; found the same way) cd without operand with HOME set but empty failed ("cd: HOME not set", status 1, which rule E chose for HOME unset); dash and bash do nothing, status 0. | Fixed post-0.11 (branch x27-step2): HOME empty, nothing and status 0, as both shells; unset, as before (rule E). Test: t/batteries/largebattery.txt. | | X46 | executor | ❰BUG❱ (ours; found 2026-11-10 by X27's match report, large-subset-environment.md, section 11) shift with an operand known only at run time that is no number as dash takes it: shift $(($#-1)) with no arguments (shift -1) did nothing, with status 0; shift $v with v='[n]' printed Perl's warning. dash and bash fail ("Illegal number", status 2; bash "shift count out of range", 1). | Fixed post-0.11 (branch x27-step2), as NV1 (X42): dash's error, status 2, and the shell ends. Test: t/batteries/largebattery.txt. | | X47 | executor | ❰BUG❱ (ours; found the same way) The message of a command that does not start ("not found", "Permission denied") went to the shell's own standard error, not to the command's: nosuch 2>log left log empty, nosuch 2>&1 \| cat and x=$(nosuch 2>&1) did not see it; dash and bash write it where the command's fd 2 goes (in a group, { nosuch; } 2>log, ours was right, the group's redirection being the shell's). | Fixed post-0.11 (branch x27-step2): the message is written through the command's own descriptors (a redirection that fails, "Bad file descriptor", still to the shell's). Test: t/batteries/largebattery.txt. | | X48 | executor | ❰BUG❱ (ours; found post-0.11 by large-subset-difffuzz.pl, ported back) return outside a function (not in eval or . text) always ended the shell, status 2, though rule E says "an error, as bash": bash --posix ends the shell only where return stands as a command of its own (return; echo n, echo a && return); where its status is tested (left of && or \|\|, after !, the condition of if, while, until) it gives status 2 and the shell goes on (return \|\| echo o prints o); dash ends silently, status 0. | Fixed post-0.11: in a tested place (the context set -e already knows, cond) the message, status 2, and on; checked against bash --posix in 16 forms. Test: t/programs.t. | | X49 | executor | ❰BUG❱ (ours; found the same way) A signal ignored on entry (as the commands of an unattended session often have SIGINT) could still be trapped (trap 'echo int' INT; kill -INT $$ ran the action), and kill -INT $$ without a trap ended the string; POSIX: "Signals that were ignored on entry to a non-interactive shell cannot be trapped or reset", and both shells do nothing then. | Fixed post-0.11: trap leaves such signals alone, and kill ... $$ with one does nothing ("on entry": when Proc::ShellSpawn was loaded, %IGN0, already used for the children). Where the shells differ, trap - INT then kill -INT $$ (bash dies, dash goes on), ours is as dash (A5). Test: t/programs.t. | | X50 | executor | ❰BUG❱ (ours; found post-0.11 by large-subset-difffuzz.pl with -j 4, seed 3, two hours) An expansion error inside a here-document's body (set -u with an unset variable, ${x:?}, an arithmetic error) ended the shell; dash fails only that redirection: the command does not run, status 2, the shell goes on (a special builtin's failed redirection, as : <<E, still ends it). bash ends the shell for a builtin, a function or a compound command, and gives status 127 and goes on for a program. Also, the message and a $( ) in the body did not go through the command's redirections made before the here-document (cat 2>/dev/null <<E), as in both shells. | Fixed post-0.11: the body is expanded with the redirections so far, and an error that would end the shell fails the redirection instead (as dash, rule A5); checked against dash in 10 forms. Test: t/programs.t. | | X51 | executor | ❰BUG❱ (ours; found the same way) A trapped signal's action ran as soon as the signal came, also while the foreground command was still running inside this process (trap "echo int" INT; kill -INT $$ \| while getopts ...; do echo $o; done printed int first; both shells: after the pipeline, as POSIX says: "the trap ... shall not be executed until after the foreground command has completed"). And a trap in a subshell (a pipeline element, ( )) replaced the main shell's handler for the whole process, so a later signal was lost (two kill -INT $$ gave one int); in both shells a subshell is another process, which a signal sent to $$ does not reach. | Fixed post-0.11: a caught signal is only queued, and the main shell's list runs the queued actions before its next command (X19's place); trap in a subshell records its action (for trap and for the signals its programs inherit) but leaves the process's handlers alone. Checked against dash in 13 forms, 5 runs each. Limit: a real signal sent to this process while a subshell runs (a program's kill $PPID) is the main shell's, not the subshell's. Test: t/programs.t. | | X52 | executor | ❰BUG❱ (ours; found post-0.11 by a probe of how the three split and glob values from the environment, X27) A word from an unquoted expansion whose only pattern characters are escaped by a backslash was matched against files: x='x\*'; echo $x with a file x* there printed x*; dash and bash do no pathname expansion then and keep the word as it is, x\* (the backslash is no quote in an expansion's result, but it does escape in the pattern, so x='[x]\*' matches x* in all three). | Fixed post-0.11: only a pattern character not escaped by a backslash makes a word a pattern. Test: t/programs.t. | | X53 | executor | ❰BUG❱ (ours; found post-0.11 by step 2 on step 3's class affects-shell, X27) A form of command the parser refuses (another option than -p and -v, -v with more than one name, -p followed by an option), made only by expansions at run time (x=-n; command $x), was run: -n as a program name (not found, 127; command -v a b: only a); both shells take the option as command's (an error, status 2). | Fixed post-0.11: such a form is outside the subset at run time, as A4 decides (the message, status 248). Test: t/programs.t. | | X54 | executor | ❰BUG❱ (ours; found post-0.11 by step 2 on step 3's names with an expansion, X27) cd with more operands made by an expansion at run time (x="d e"; cd $x, cd $(dirname $a $b)) said cd: bad argument, status 2: neither shell (dash takes the first, bash: "too many arguments", status 1), and not as ours with the operands in the text (as bash, rule E). | Fixed post-0.11: "too many arguments", status 1, as bash, either way. Whether ours may answer as bash there stays TODO A13 (cd with extra words). Test: t/programs.t. | | X55 | executor | ❰BUG❱ (ours; found post-0.11 by the races of X27's step 3, run many times) The deferred SIGCHLD handler that moves background jobs on between run() calls (K3) reaps through waitpid, which sets $? (to -1 when it finds nothing yet), and did not keep the program's $? and $!: a job that ended while the program ran its own code changed the program's $?. Seen as ours' status 255 without a message in about 1 run of 200 of … & samples (exit $st sets $?, the handler ran before the END block's local $?, and Perl exited with -1). | Fixed post-0.11: the handler keeps $? and $! (local). Test: t/between.t. | | R1–R5 | Run | See Run's Changes, 0.05 and 0.06. | Run 0.05 and 0.06. |

Corpus testing (X12), proposed (closed 2026-11-07: done by the run-time comparison, large-subset-state.md, section 7)

Run every one-liner of the corpora under dash and under the executor, with every program replaced by a reporter: a PATH directory holding one small program under every command name that occurs, which appends to a log what it was started with, then behaves like a filter.