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

Re: Bug#270868: Should not implement "test" builtin



I wrote in submitting bug report #270868:
> According to Thomas Bushnell writing in #267142:
> 
> > Posix "test" is not part of the Posix shell specification. 
> 
> It follows that posh should not implement the test command as
> a builtin.  For the reasoning please see #267142.

In reply, Clint Adams wrote:
> I don't know what on earth Thomas Bushnell means by that sentence,
> especially given the context.

I think that he is saying that the test command is specified by POSIX
qua standalone program, not qua shell builtin.  As such it falls outside
the purview of policy clause 10.4 which tells script authors not to use
non-POSIX features of _shells_.  Clause 10.4 doesn't tell script authors
not to use non-POSIX features of standalone programs.  Why should it?
The purpose of 10.4 is to promote the portability of scripts across
POSIX-compliant shells, not to promote the portability of scripts to
other distributions.

The actual list of built-in utilities specified by POSIX[1] is:

    break, colon, continue, dot, eval, exec, exit, export, readonly,
    return, set, shift, times, trap, unset,

'test' is not on this list.

> posh implements "test" and "[" as a builtin expressly to provide a
> "test" that is strictly POSIX-conformant.

If the reasoning above is correct then this feature of posh imposes a
restriction on scripts that isn't warranted by policy.  If the purpose
of posh is to facilitate the testing of scripts' policy-compliance
then the "test" builtin should not be included.

> Without a compelling reason (either a policy change or the replacement
> of GNU coreutils "test" with a "test" that is strictly
> POSIX-conformant), I don't intend to drop "test" as a posh builtin.

Are you saying that policy requires that scripts refrain from using all
non-POSIX features of all programs whose minimum functionality is
specified by POSIX?

[1] http://www.opengroup.org/onlinepubs/009695399/idx/sbi.html
--
Thomas Hood



Reply to: