| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
This allows some other shells to pass the tests for basic behaviour.
|
|
|
|
|
|
| |
except NUL, newline and backslash.
This also passes on stable/8.
|
| |
|
|
|
|
| |
/rescue/sh has a different _PATH_STDPATH which affects command -p.
|
|
|
|
| |
This is not really realistic but is an opposition to $(trap).
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is useful so that it is easier to exit on a signal than to reset the
trap to default and resend the signal. It matches ksh93. POSIX says that
'exit' without args from a trap action uses the exit status from the last
command before the trap, which is different from 'exit $?' and matches this
if the previous command is assumed to have exited on the signal.
If the signal is SIGSTOP, SIGTSTP, SIGTTIN or SIGTTOU, or if the default
action for the signal is to ignore it, a normal _exit(2) is done with exit
status 128+signal_number.
|
|
|
|
|
|
|
| |
* Make 'trap --' do the same as 'trap' instead of nothing.
* Make '--' stop option processing (note that '-' action is not an option).
Side effect: The error message for an unknown option is different.
|
|
|
|
|
|
|
| |
It should use the original exit status, just like falling off the
end of the trap handler.
Outside an EXIT trap, 'exit' is still equivalent to 'exit $?'.
|
| |
|
|
|
|
|
|
| |
itself.
This ensures that certain traps caused by builtins are executed.
|
| |
|
|
|
|
|
|
|
|
| |
The #define for warnx now behaves much like the libc function (except that
it uses sh command name and output).
Also, it now uses C99 __VA_ARGS__ so there is no need for three different
macros for 0, 1 or 2 parameters.
|
|
|
|
|
| |
* Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part
* Delete our test area even if the test fails
|
| |
|
|
|
|
|
| |
These are not meant as a replacement for tools/regression/usr.bin/printf/*
but to detect errors specific to making it a shell builtin.
|
|
|
|
|
|
| |
and why. The first case is correct usage which has but one correct output.
The 2nd and 3rd cases are incorrect usage in which the exact output is
not standardized and various shells give various allowable output.
|
|
|
|
| |
a potentially bad /bin/sh first.
|
| |
|
| |
|
|
|
|
|
|
| |
Backslash-escaped characters did not set the flag for a non-IFS character.
MFC after: 2 weeks
|
| |
|
|
|
|
|
| |
Naive buffering would break the common while read x... construct, which did
not appear to be tested yet.
|
|
|
|
|
|
|
| |
This matches what is in POSIX; various other shells use different exit
statuses.
Note that it is still required that there be no output.
|
|
|
|
| |
It is unwise to rely on this but I'd like to know if this would break.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
POSIX does not allow constructs like:
if cmd; then fi
{ }
Add a colon dummy command, except in a test that verifies that such empty
lists do not cause crashes when used as a function definition.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In our implementation and most others, a break or continue in a dot script
can break or continue a loop outside the dot script. This should cause all
further commands in the dot script to be skipped. However, cmdloop() did not
know about this and continued to parse and execute commands from the dot
script.
As described in the man page, a return in a dot script in a function returns
from the function, not only from the dot script. There was a similar issue
as with break and continue. In various other shells, the return appears to
return from the dot script, but POSIX seems not very clear about this.
|
|
|
|
|
|
|
|
|
|
|
| |
This makes a difference if there is a command substitution.
To make this work, evalstring() has been changed to set exitstatus to 0 if
no command was executed (the string contained only whitespace).
Example:
eval $(false); echo $?
should print 0.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although "--" historically has not been required to be recognized for
certain special builtins that do not take options in POSIX, some other
implementations recognize options for them, requiring scripts to use "--" or
avoid operands starting with "-".
Operands starting with "-" can be avoided with eval by prepending a space,
and cannot occur with break, continue, exit, return and shift as they only
take numbers, nor with times as it does not take operands. With . and exec,
avoiding "-" is not so easy as it may require reimplementing the PATH
search; therefore the current proposal for POSIX is to require recognition
of "--" for them.
We continue to accept other strings starting with "-" as operands to . and
exec, and also "--" if it is alone to . (which would otherwise be invalid
anyway).
|
| |
|
| |
|
| |
|
|
|
|
|
| |
I'm committing the generated files because I don't like a build dependency
for the sh(1) tests, and they are small and will not change much.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows doing things like LC_ALL=C some_builtin to run a builtin under a
different locale, just like is possible with external programs. The
immediate reason is that this allows making printf(1) a builtin without
breaking things like LC_NUMERIC=C printf '%f\n' 1.2
This change also affects special builtins, as even though the assignment is
persistent, the export is only to the builtin (unless the variable was
already exported).
Note: for this to work for builtins that also exist as external programs
such as /bin/test, the setlocale() call must be under #ifndef SHELL. The
shell will do the setlocale() calls which may not agree with the environment
variables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Redirection errors on subshells already did not abort the shell because
the redirection is executed in the subshell.
Other shells seem to agree that these redirection errors should not abort
the shell.
Also ensure that the redirections will be cleaned up properly in cases like
command eval '{ shift x; } 2>/dev/null'
Example:
{ echo bad; } </var/empty/x; echo good
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* avoid unnecessary fork
* allow executing builtins via command
* executing a special builtin via command removes its special properties
Obtained from: NetBSD (parts)
|
| |
|
|
|
|
|
| |
Example:
PATH=/var/empty; PATH=/bin type ls
|
| |
|
|
|
|
|
|
|
| |
Reset the exception handler in the child to main's.
This avoids inappropriate double cleanups or shell duplication when the
exception is caught, such as 'fc' and future 'command eval' and 'command .'.
|
|
|
|
|
| |
Job control tty manipulations sometimes cause the tests to stop (SIGTTOU
and the like) when run from the 'prove' tool.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This avoids weirdness when 'fc -e vi' or the like is done and there is a
syntax error in the file. Formerly an interactive shell tried to execute
stuff after the syntax error and exited.
This should also avoid similar issues with 'command eval' and 'command .'
when 'command' is implemented properly as in NetBSD sh.
Special builtins did not have this problem since errors in them cause the
shell to exit or to reset various state such as the current command input
file.
|
|
|
|
|
| |
POSIX explicitly prescribes this.
Continue processing any other signals and return status 1.
|
| |
|
| |
|
|
|
|
| |
(Trying to get syntax errors for sh -c ':; do' and `:; do`.)
|