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

Bug#218530: Summary of options for improving conditional rune for initscript calls



On 2004-06-24 Ian Jackson <ian@davenant.greenend.org.uk> wrote:
> Thomas Hood writes ("Bug#218530: Summary of options for improving conditional rune for initscript calls"):
> > 3. Change to "if type invoke-rc.d ; then" and change policy to
> >    require that /bin/sh point to a shell that supports "type".

> Given the complexity of the tasks performed by many maintainer
> scripts, it seems to me that this is the best answer.  We should
> change policy to require that /bin/sh implements some more
> comprehensive standard, eg SUSv3.

FWIW posix suggests to use "command -v" if available, "The command -v
and -V options were added to satisfy requirements from users that are
currently accomplished by three different historical utilities: type
in the System V shell, whence in the KornShell, and which in the C
shell.[...]"

The remaining problem is that Debian's shells do not map particularily
well to the existing standards, I'll illustrate it:

* 'echo -n' is used a lot, which is "implementation-defined" in POSIX-pure
  and required to output "-n" in XSI.
* test foo -a bar is XSI.
* 'command -v' is UP.
* type: XSI
* type -p: bashism.

I am sure there is more of it, research would be required.

I think we'll have to take one of these choices:
* require POSIX + explicit list of extensions, something like
  "/bin/sh must implement a superset of POSIX functionality, including
  'command -v' as defined in the UP exptension, and (if echo is
  builtin) echo -n...."

* triplecheck what POSIX+UP includes and if dash fullfills the
  requirements just require "POSIX+UP".

* Properly document our established practice: "/bin/sh must be a
  superset of (d)ash.

* limit ourselves to POSIX.

Personally I really do not like the first alternative, it sounds like
"/bin/sh is kinda POSIX except where it is not". The second one imho
*strongly* suggests that we start discouraging use of at least echo -n
and forbid it later.

A lot of this mail is the result of a IRC discussion with David
Weinehall.
                 cu andreas
-- 
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"



Reply to: