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

Bug#747320: Mandate "type" in /bin/sh



Control: retitle -1 Mandate "type" and/or "command -v" in /bin/sh

On Sat, 07 Jun 2014 at 21:52:34 +0200, Jakub Wilk wrote:
> * Ian Jackson <ijackson@chiark.greenend.org.uk>, 2014-05-07, 14:32:
> > It seems to me that given that dash and bash both provide `type', and
> > the underlying functionality necessarily exists in the shell, it would
> > be better to mandate that the shell expose it.
> 
> Alternatively, we could bless "command -v", which is a nicer interface IMO,
> and it's also supported by bash, dash and mksh.

command -v appears to be supported by bash, dash, busybox sh, zsh (not
otherwise a fully-POSIX shell), ksh, mksh and yash. It is not supported
by posh or sash. Are there other shells that should be considered to be
supported as /bin/sh?

command -v is also in the Single Unix Specification, version 3 (aka
POSIX:2001), as part of the User Portability Utilities section (which
Policy doesn't currently say scripts may assume, but perhaps it should).

It's also in SUSv4 (aka POSIX:2008) without any such qualifiers, so if
#864615 is resolved with the suggested patch, command -v will implicitly
be mandated by Policy (which would incidentally make sash a
non-Policy-compliant choice for /bin/sh).

For completeness, type is supported by all of those shells except posh,
and is standardized in SUSv3 and SUSv4 as an optional XSI extension.
Policy doesn't mandate XSI extensions in general, although a couple of
specific XSI extensions to the kill and trap commands are called out
as mandatory.

    smcv


Reply to: