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
[bug] mapfile < missing-file: redirect-open failure is silently swallowed (no diagnostic, rc=0; GNU prints 'No such file or directory' and rc=1) #324
after1 rc=1
after2 rc=1
script: line 2: missing_file_A: No such file or directory
script: line 4: missing_file_B: No such file or directory
rubash:
after1 rc=1
after2 rc=0
script: line 2: missing_file_A: No such file or directory
(mapfile line: no diagnostic at all, rc 0.)
GNU anchor
Redirection failures for builtins: redir.cdo_redirection_internal open error propagates via redir_error to execute_builtin/execute_builtin_command (execute_cmd.c builtin path) which prints the shell-name-prefixed diagnostic and returns 1 — identical to the read path. rubash's mapfile dispatch evidently performs the redirect open after/around the point where the error can be reported.
Impact
pbb 'Get the first/last N lines of a file' + 'read a file to an array' sections: GNU emits an error line per call, rubash emits nothing — silent data loss on missing input (mapfile leaves the array untouched with rc=0, scripts proceed as if the file were empty).
Fixed by wt14/pbbfix (e76633e, master): three mapfile dispatch sites skipped the builtin redirect precheck, so a failed bare read fell into the empty-input path clearing the array with rc=0. GNU applies redirections BEFORE the builtin body (execute_cmd.c:4787+): error rc=1, array untouched, redirect failure takes priority over the identifier check. Repro matrix all identical (platform residual only: mapfile < . cannot open a directory on Windows - same known family as read).
Activity
fix(#324): mapfile redirect-open failures report and return 1 - array…
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt14/pbbfix (e76633e, master): three mapfile dispatch sites skipped the builtin redirect precheck, so a failed bare read fell into the empty-input path clearing the array with rc=0. GNU applies redirections BEFORE the builtin body (execute_cmd.c:4787+): error rc=1, array untouched, redirect failure takes priority over the identifier check. Repro matrix all identical (platform residual only: mapfile < . cannot open a directory on Windows - same known family as read).
fix(tests): temp probe paths in mapfile/comsub tests (#324/#362)\n\nB…
fix(tests): temp probe paths in mapfile/comsub tests (#324/#362)\n\nB…