NetBSD Problem Report #58690

From www@netbsd.org  Mon Sep 23 00:55:43 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0D3D41A923D
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 23 Sep 2024 00:55:43 +0000 (UTC)
Message-Id: <20240923005541.CA3A21A923E@mollari.NetBSD.org>
Date: Mon, 23 Sep 2024 00:55:41 +0000 (UTC)
From: uwe@stderr.spb.ru
Reply-To: uwe@stderr.spb.ru
To: gnats-bugs@NetBSD.org
Subject: ksh: "command" doesn't make special builtins not special
X-Send-Pr-Version: www-1.0

>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
>Last-Modified:  Mon Sep 23 17:40: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:

>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/58690: ksh: "command" doesn't make special builtins not special
Date: Tue, 24 Sep 2024 00:09:49 +0700

 Our /bin/ksh has so many bugs, and no-one is even pretending to
 maintain it these days, that I doubt attempting to fix that one
 (or any others which don't actually prevent its use at all) is
 really worth the bother.

 If you desire a ksh style interface, install mksh or ksh93 from pkgsrc,
 even pdksh if you want something closer to /bin/ksh, pdksh is probably
 just slightly better.

 kre

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/58690: ksh: "command" doesn't make special builtins not
 special
Date: Mon, 23 Sep 2024 20:19:08 +0300

 On Mon, Sep 23, 2024 at 17:10:02 +0000, Robert Elz via gnats wrote:
 >  If you desire a ksh style interface

 I don't, but I was touching the profile/shrc files and they have to
 work with the ksh we ship.  ksh doesn't have "tabcomplete" option, so

     set -o tabcomplete

 will cause it to exit.  The usual feint of

     command set -o tabcomplete 2> /dev/null

 doesn't work b/c of this bug, so we have instead

   ( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete

 in /etc/shrc, a mouthful...


 -uwe

From: LU <X13_SPIDER@proton.me>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/58690: ksh: "command" doesn't make special builtins not special
Date: Mon, 23 Sep 2024 17:35:56 +0000

 KSH is only there for Co-process functionality



 weep not for me
 run for your life

 Lu

 Sent with Proton Mail secure email.

 On Monday, September 23rd, 2024 at 1:20 PM, Valery Ushakov via gnats <gnats=
 -admin@NetBSD.org> wrote:

 > The following reply was made to PR bin/58690; it has been noted by GNATS.
 >=20
 > From: Valery Ushakov uwe@stderr.spb.ru
 >=20
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: bin/58690: ksh: "command" doesn't make special builtins not
 > special
 > Date: Mon, 23 Sep 2024 20:19:08 +0300
 >=20
 > On Mon, Sep 23, 2024 at 17:10:02 +0000, Robert Elz via gnats wrote:
 >=20
 > > If you desire a ksh style interface
 >=20
 >=20
 > I don't, but I was touching the profile/shrc files and they have to
 > work with the ksh we ship. ksh doesn't have "tabcomplete" option, so
 >=20
 > set -o tabcomplete
 >=20
 > will cause it to exit. The usual feint of
 >=20
 > command set -o tabcomplete 2> /dev/null
 >=20
 >=20
 > doesn't work b/c of this bug, so we have instead
 >=20
 > ( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete
 >=20
 >=20
 > in /etc/shrc, a mouthful...
 >=20
 >=20
 > -uwe

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.