#
abe76290 |
| 21-Jun-2023 |
millert <millert@openbsd.org> |
ksh: escape control chars when displaying file name completions. If there are multiple matches when using autocomplete, the list of matching file names was output as-is. However, for a single match,
ksh: escape control chars when displaying file name completions. If there are multiple matches when using autocomplete, the list of matching file names was output as-is. However, for a single match, control characters are escaped before the file name is displayed. This makes the behavior more consistent by escaping control chars in the list of matches too. Discussed with deraadt@, OK op@
show more ...
|
#
f8c806b8 |
| 10-Oct-2022 |
kn <kn@openbsd.org> |
Trigger ERR trap on permanent I/O redirection failure
The following three cases behave identical in bash(1), but our ksh (ksh93 also) fails to run the trap in the last case:
(non-zero exit code is
Trigger ERR trap on permanent I/O redirection failure
The following three cases behave identical in bash(1), but our ksh (ksh93 also) fails to run the trap in the last case:
(non-zero exit code is trigger, no redirection) $ ksh -c 'trap "echo ERR" ERR ; false' ERR
(failed redirection is trigger, 'echo' was not executed) $ ksh -c 'trap "echo ERR" ERR ; echo >/' ksh: cannot create /: Is a directory ERR
(failed redirection, no execution, trap was NOT triggered) $ ksh -c 'trap "echo ERR" ERR ; exec >/' ksh: cannot create /: Is a directory
bash(1) prints "ERR" in all three cases, as expected. ksh93 behaves like our ksh(1).
In ksh `exec' is a builtin (CSHELL), but also special (SPEC_BI): $ type alias alias is a shell builtin $ type exec exec is a special shell builtin
Without command and redirection alone, `exec' permanently redirects I/O for the shell itself, not executing anything; it is the only (special) builtin with such a special use-case, implemented as c_sh.c:c_exec().
This corner-case is overlooked in exec.c:execute() which handles iosetup() failure for all commands, incl. builtins.
Exclude c_exec() from the rest of special builtins to ensure it runs the ERR trap as expected:
$ ./obj/ksh -c 'trap "echo ERR" ERR ; exec >/' ksh: cannot create /: Is a directory ERR
Also add three new regress cases covering this; rest keep passing.
OK millert
show more ...
|
#
b7041c07 |
| 24-Oct-2021 |
deraadt <deraadt@openbsd.org> |
For open/openat, if the flags parameter does not contain O_CREAT, the 3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which mig
For open/openat, if the flags parameter does not contain O_CREAT, the 3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
show more ...
|
#
3aaa63eb |
| 28-Jun-2019 |
deraadt <deraadt@openbsd.org> |
When system calls indicate an error they return -1, not some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if
When system calls indicate an error they return -1, not some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
show more ...
|
#
97445c82 |
| 15-Mar-2018 |
anton <anton@openbsd.org> |
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
Favor usage of __func__ in warning/error messages. Some of them referred to the wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied.
ok benno@ tb@
show more ...
|
#
6c72b531 |
| 16-Jan-2018 |
jca <jca@openbsd.org> |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
|
#
3dc0c5b1 |
| 15-Jan-2018 |
jca <jca@openbsd.org> |
Stop pretending we support building ksh without EDIT/HISTORY support
ok anton@
|
#
201e0776 |
| 27-Dec-2017 |
millert <millert@openbsd.org> |
Add -Wshadow to Makefile and fix the resulting warnings. Many of the warnings are due to the use of globals with generic names, specifically "options" and "path". I've renamed "options" to "sh_opti
Add -Wshadow to Makefile and fix the resulting warnings. Many of the warnings are due to the use of globals with generic names, specifically "options" and "path". I've renamed "options" to "sh_options" since it holds the shell options and "path" to "search_path". OK jca@ tb@
show more ...
|
#
b11c7a77 |
| 18-Dec-2017 |
anton <anton@openbsd.org> |
Get rid of a todo by stop declaring variable texec as static and instead zeroing it out prior to continuing down the recursive call chain.
Initial diff from Michael W. Bombardieri, later tweaked; ok
Get rid of a todo by stop declaring variable texec as static and instead zeroing it out prior to continuing down the recursive call chain.
Initial diff from Michael W. Bombardieri, later tweaked; ok tb@
show more ...
|
#
e6d3563b |
| 11-Dec-2016 |
millert <millert@openbsd.org> |
I missed a bit of the indentation fix from Kartik Agaram.
|
#
816bab1a |
| 11-Dec-2016 |
millert <millert@openbsd.org> |
When ERREXIT (set -e) is in effect, don't disable it after a short-circuited `&&` or `||` chain in later iterations of `for` loops. It should be disabled after a short-circuited `&&` or `||` chain o
When ERREXIT (set -e) is in effect, don't disable it after a short-circuited `&&` or `||` chain in later iterations of `for` loops. It should be disabled after a short-circuited `&&` or `||` chain only in the *final* iteration of loops (as well as in conditionals, which was already working). From Kartik Agaram.
show more ...
|
#
df011642 |
| 11-Dec-2016 |
millert <millert@openbsd.org> |
In execute() we assign xerrorok to a dummy value if it is NULL so there is no need to check xerrorok for NULL after that. From Kartik Agaram.
|
#
922d06ce |
| 11-Dec-2016 |
millert <millert@openbsd.org> |
Fix for() loop indentation for TCASE in execute() and add some braces for improved readability. Based on a diff from Kartik Agaram.
|
#
5ae5b57e |
| 30-Dec-2015 |
tedu <tedu@openbsd.org> |
rename global "e" to genv to avoid accidental shadowing and aliasing. ok millert nicm tb
|
#
4a010e0c |
| 14-Dec-2015 |
tb <tb@openbsd.org> |
Move system headers from sh.h to those files that actually need them.
ok mmcc@ a while ago
|
#
d67c3782 |
| 01-Nov-2015 |
mmcc <mmcc@openbsd.org> |
Add uses of areallocarray(). mksh and Bitrig ksh already have similar functions. With help from Theo Buehler.
ok nicm@
|
#
56018212 |
| 19-Oct-2015 |
mmcc <mmcc@openbsd.org> |
Move string.h include from sh.h to the files that use it.
ok nicm@
|
#
b608f594 |
| 19-Oct-2015 |
mmcc <mmcc@openbsd.org> |
Apply style(9) to header includes.
ok nicm@
|
#
acac6842 |
| 17-Oct-2015 |
mmcc <mmcc@openbsd.org> |
Drop two useless defines.
ok nicm@
|
#
e13e7091 |
| 17-Oct-2015 |
mmcc <mmcc@openbsd.org> |
Move a system header include from the global header (sh.h) into the files that need it. No binary change.
"This looks fine" -nicm@
|
#
63ca93ea |
| 22-Sep-2015 |
millert <millert@openbsd.org> |
Make errorf() and bi_errorf() handle a NULL argument. From Michael McConville; OK nicm@
|
#
f7654a50 |
| 18-Sep-2015 |
nicm <nicm@openbsd.org> |
Last of the (thing *)0 -> NULL, from Michael McConville. No binary change.
|
#
8c046d24 |
| 17-Sep-2015 |
nicm <nicm@openbsd.org> |
Remove unnecessary casts, from Michael McConville. No binary change.
|
#
355ffa75 |
| 15-Sep-2015 |
tedu <tedu@openbsd.org> |
correct spelling of NULL from (char *)0. from Michael McConville. ok md5
|
#
8f5d53fe |
| 14-Sep-2015 |
nicm <nicm@openbsd.org> |
Replace Tflag typedef with just int; ok tedu
|