parser/word: add NULL guards to prevent segfault
ci: automate sr.ht annotations generation
Check error even when mrsh_parse_program returns non-NULL
In the future, I'd like to make mrsh_parse_program return the
partially-parsed program on error to allow interactive shells to provide
syntax highlighting while typing.
Only handle continuation lines when interactive
test: overhaul conformance tests
This introduces comprehensive conformance testing for section 2.2 of the
POSIX shell standard. However, note that mrsh does not currently pass
these new tests. For what it's worth, neither does dash.
parser/word: fix parser not failing on some errors in back-quotes
shell/task/simple_command: return 127 on command not found
parser: disable aliases when processing command substitutions
Only split fields on expansion/substitution results
test/args: ensure getopts doesn't modify main scope
Use a subshell to ensure the OPTIND variable is reset between function
calls. This fixes the Alpine and FreeBSD builds.
ensure argv passed to getopt is NULL terminated
This has two fixes, 1: in push_frame allocates an extra array
element, and uses calloc instead of malloc to ensure that element is
NULL. 2: in argv_dup, enough memory is allocated but, the last element
is left uninitialized. By using calloc instead, the last element is
guaranteed to be NULL.
I also added a test for this, although it does not always fail since it
relies on undefined behavior.
builtin/read: return 1 when an EOF is encountered
echo "hi" | read arg
should have an exit code of >0 per the POSIX spec.
A test was also added.
parser: add IO redirects to function definitions
builtin/set: fix monitor option enabled when running script
builtin/set: toggle job control at runtime
shell/job: ignore signals before grabbing control
setpgid might send SIGTTOU to the process, e.g. under strace. We need
to ignore this signal before calling setpgid.
shell/arithm: fix another crash on division by zero
When using /= or %= this time.
shell/arithm: fix crash on division by zero
Print an error instead.
shell/job: silence job_set_foreground warning
When job control has been turned off because of entering into a child
process, don't print a warning when calling job_set_foreground.