summaryrefslogtreecommitdiffstats
path: root/tools/regression/bin/sh/builtins
Commit message (Collapse)AuthorAgeFilesLines
...
* sh: Split off some special behaviour into separate tests.jilles2011-02-202-1/+7
| | | | This allows some other shells to pass the tests for basic behaviour.
* sh: Test that the read builtin passes through all byte valuesjilles2011-02-181-0/+32
| | | | | | except NUL, newline and backslash. This also passes on stable/8.
* sh: Unset some more locale vars in two tests that may cause them to break.jilles2011-02-181-0/+1
|
* sh: Weaken some tests to allow /rescue/sh to pass everything.jilles2011-02-053-3/+13
| | | | /rescue/sh has a different _PATH_STDPATH which affects command -p.
* sh: Add test for EXIT trap in command substitution.jilles2011-01-271-0/+3
| | | | This is not really realistic but is an opposition to $(trap).
* sh: If exit is used without args from a trap action, exit on the signal.jilles2011-01-161-0/+9
| | | | | | | | | | | | 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.
* sh: Fix some things about -- in trap:jilles2011-01-151-0/+19
| | | | | | | * 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.
* sh: Make exit without parameters from EXIT trap POSIX-compliant.jilles2011-01-081-0/+5
| | | | | | | 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 $?'.
* sh: Add simple test for 'exit' without parameters.jilles2011-01-081-0/+7
|
* sh: Do not call exitshell() from evalcommand() unless evalcommand() forkedjilles2011-01-051-0/+17
| | | | | | itself. This ensures that certain traps caused by builtins are executed.
* sh: Test that exit $? replaces the original exit status in an EXIT trap.jilles2011-01-011-0/+6
|
* sh: Make warnings in the printf builtin non-fatal, like in the program.jilles2010-12-202-0/+10
| | | | | | | | 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.
* sh: Make the test for cd/pwd with long pathnames more useful:jilles2010-11-281-7/+8
| | | | | * Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part * Delete our test area even if the test fails
* sh: Add another simple test for the wait builtin.jilles2010-11-191-0/+21
|
* sh: Add simple tests for printf.jilles2010-11-052-0/+6
| | | | | These are not meant as a replacement for tools/regression/usr.bin/printf/* but to detect errors specific to making it a shell builtin.
* Embellish this testcase a little bit to be more clear what the output isobrien2010-10-142-0/+18
| | | | | | 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.
* Allow one to regression test 'sh' changes without having to installobrien2010-10-128-11/+11
| | | | a potentially bad /bin/sh first.
* Correct regression test to not show a false positive when run as root.obrien2010-10-111-6/+9
|
* sh: Fix exit status if return is used within a loop condition.jilles2010-09-112-0/+9
|
* sh: Fix 'read' if all chars before the first IFS char are backslash-escaped.jilles2010-09-082-0/+18
| | | | | | Backslash-escaped characters did not set the flag for a non-IFS character. MFC after: 2 weeks
* sh: Add simple tests for backslashes in the read builtin.jilles2010-09-082-0/+20
|
* sh: Add a test that 'read' leaves the file pointer at the correct place.jilles2010-09-031-0/+31
| | | | | Naive buffering would break the common while read x... construct, which did not appear to be tested yet.
* sh: Weaken builtins/command4 test to only require a nonzero exit status.jilles2010-08-292-2/+2
| | | | | | | This matches what is in POSIX; various other shells use different exit statuses. Note that it is still required that there be no output.
* sh: Add a test for breaking from a loop outside the current function.jilles2010-08-221-0/+15
| | | | It is unwise to rely on this but I'd like to know if this would break.
* sh: Add a test for break from a trap action.jilles2010-08-182-0/+13
|
* sh: Reduce unnecessary testsuite failures with other shells.jilles2010-08-162-2/+2
|
* sh: Get rid of unnecessary non-standard empty lists.jilles2010-08-163-0/+3
| | | | | | | | 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.
* sh: Fix break/continue/return sometimes not skipping the rest of dot script.jilles2010-08-152-0/+33
| | | | | | | | | | | | | 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.
* sh: Return 0 from eval if no command was given.jilles2010-08-031-0/+4
| | | | | | | | | | | 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.
* sh: Add a test for a corner case in eval that already works correctly.jilles2010-08-011-0/+5
|
* sh: Recognize "--" in . and exec.jilles2010-05-282-0/+46
| | | | | | | | | | | | | | | | | | 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).
* sh: Add some simple tests for ., exec and return from . script.jilles2010-05-283-0/+62
|
* sh: Add some simplistic tests for the wait builtin.jilles2010-05-232-0/+38
|
* Fix error in comment.jilles2010-05-091-1/+1
|
* Generate some tests for sh's case command from the fnmatch tests.jilles2010-05-092-0/+201
| | | | | 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.
* sh: Apply locale vars on builtins, recognize LC_MESSAGES as a locale var.jilles2010-05-051-0/+133
| | | | | | | | | | | | | | | | 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.
* sh: Do not abort on a redirection error on a compound command.jilles2010-03-141-0/+14
| | | | | | | | | | | | | | 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
* sh: Make sure to popredir() even if a function caused an error.jilles2010-03-061-0/+14
|
* sh: Make sure to popredir() even if a special builtin caused an error.jilles2010-03-061-0/+14
|
* sh: Improve the command builtin:jilles2010-03-062-0/+100
| | | | | | | | * avoid unnecessary fork * allow executing builtins via command * executing a special builtin via command removes its special properties Obtained from: NetBSD (parts)
* sh: Send the "not found" message for builtin <cmd> to redirected fd 2.jilles2010-01-031-0/+31
|
* sh: Use PATH= assignment in type.jilles2009-12-311-0/+26
| | | | | Example: PATH=/var/empty; PATH=/bin type ls
* sh: Allow command -pv and command -pV (lookup using _PATH_STDPATH).jilles2009-12-313-0/+52
|
* sh: Do not run callers' exception handlers in subshells.jilles2009-12-251-0/+34
| | | | | | | 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 .'.
* Disable job control when running 'sh -i' in the testsuite.jilles2009-11-291-1/+1
| | | | | Job control tty manipulations sometimes cause the tests to stop (SIGTTOU and the like) when run from the 'prove' tool.
* sh: Ensure the same command input file is on top after executing a builtin.jilles2009-11-221-0/+27
| | | | | | | | | | | | | 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.
* trap: do not consider a bad signal name a fatal error.jilles2009-11-211-0/+12
| | | | | POSIX explicitly prescribes this. Continue processing any other signals and return status 1.
* Add a test for r199631.stefanf2009-11-211-0/+15
|
* Add a few very basic tests for cd -{L,P} and pwd -{L,P}.stefanf2009-11-211-12/+22
|
* Add some tests for a fixed bug in an uncommitted patch.jilles2009-08-271-0/+9
| | | | (Trying to get syntax errors for sh -c ':; do' and `:; do`.)
OpenPOWER on IntegriCloud