CVSROOT:        /cvs
Module name:    src
Changes by:     t...@cvs.openbsd.org    2016/03/21 07:35:00

Modified files:
        regress/bin/ksh: obsd-regress.t 
        bin/ksh        : c_ksh.c ksh.1 sh.1 

Log message:
More ksh POSIX compliance fixes by Martijn Dekker:

This simple patch makes the 'command' builtin POSIX-compliant and
consistent with other current shells. It fixes two things:

a) 'command -v' does not find shell reserved words (a.k.a. keywords).
For instance, 'command -v select' outputs nothing but should output
'select'.

b) 'command -pv' always outputs the path of an external command, even
if 'command -p' would execute a builtin. For instance, 'command -p kill'
executes the 'kill' builtin, as expected, but 'command -pv kill' outputs
'/bin/kill'. The '-v' option is supposed to reflect what would actually
be executed, so 'command -pv kill' should output 'kill'. The -p option
sets the PATH to a default system value before doing the search, but
that has no bearing on the fact that builtins take precedence over
external commands.

The patch fixes both issues for 'command' without affecting the
behaviour of the ksh-specific builtin 'whence', which is handled by the
same C function.

Regression test added to obsd-regress.t.

Issues found and fixed by Martijn Dekker, ok millert@

Reply via email to