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.
shell/trap: don't mark job control traps as set
trap(1) was previously printing job control traps as ignored. Hide this
from the user.
shell/trap: reset traps in subshells
> When a subshell is entered, traps that are not being ignored shall be set to
> the default actions, except in the case of a command substitution containing
> only a single trap command, when the traps need not be altered.
shell/trap: fix interaction between job control and trap(1)
shell/trap: disallow setting trap when ignored on entry
> Signals that were ignored on entry to a non-interactive shell cannot be
> trapped or reset
shell/trap: save and restore $?
builtin/trap: proper escaping when printing traps
builtin: add exec implementation
builtin/trap: add support for XSI numeric signal names