yash-rs icon indicating copy to clipboard operation
yash-rs copied to clipboard

The `source` built-in is not fully honoring POSIX consequences of shell errors

Open magicant opened this issue 3 months ago • 0 comments
trafficstars

According to POSIX.1-2024, “An unrecoverable read error while reading from the file operand of the dot special built-in shall be treated as a special built-in utility error.” This means that if you use the source (.) built-in through the command built-in and an unrecoverable read error occurs, the shell should not exit immediately.

The current implementation does not use the arrange_message_and_divert function for read errors that may happen after the script file is opened. Instead, it simply passes the divert value returned from read_eval_loop, which does not reflect whether the built-in is called directly or through the command built-in.

magicant avatar Aug 10 '25 04:08 magicant