NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/58690: ksh: "command" doesn't make special builtins not special



>Number:         58690
>Category:       bin
>Synopsis:       ksh: "command" doesn't make special builtins not special
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 23 01:00:01 +0000 2024
>Originator:     Valery Ushakov
>Release:        NetBSD 10
>Organization:
>Environment:
>Description:
When "command" is applied to a special builtin, it stops being special.

To quote ksh(1)'s own manpage:

       command [-pvV] cmd [arg1 ...]
              If neither the -v nor -V options are given, cmd is executed
              exactly as if the command had not been specified, with two
              exceptions: first, cmd cannot be a shell function, and second,
              special built-in commands lose their specialness (i.e.,
              redirection and utility errors do not cause the shell to exit,

but while sh(1) handles this correctly:

  $ sh -c 'set -o foo; echo OK'
  set: Unknown option -o foo
  $ sh -c 'command set -o foo; echo OK'
  set: Unknown option -o foo
  OK


ksh(1) doesn't:

  $ ksh -c 'set -o foo; echo OK'
  ksh: set: foo: bad option
  $ ksh -c 'command set -o foo; echo OK'
  ksh: set: foo: bad option

>How-To-Repeat:
See above.
>Fix:



Home | Main Index | Thread Index | Old Index