On Wed November 15 2006 18:15, Russ Allbery wrote: > Bruce Sass <[EMAIL PROTECTED]> writes: > > On Wed November 15 2006 16:45, Russ Allbery wrote: > >> No, but Policy currently requires scripts that use features not > >> available from POSIX to declare an appropriate shell, and POSIX > >> doesn't guarantee the binary -a operator. > > > > Since all sh's in Debian provide compatible binary -a operators, > > #!/bin/sh is appropriate when that operator is used and Policy is > > not being violated. Ya? > > I suppose you could read it that way, but I think that's strained. > > The standard shell interpreter /bin/sh can be a symbolic link to > any POSIX compatible shell, if echo -n does not generate a > newline.[59] Thus, shell scripts specifying /bin/sh as interpreter > must only use POSIX features. If a script requires non-POSIX features > from the shell interpreter, the appropriate shell must be specified > in the first line of the script (e.g., #!/bin/bash) and the package > must depend on the package providing the shell (unless the shell > package is marked "Essential", as in the case of bash). > > I'd rather make the situation clearer.
No doubt. I've always thought that, historically, "sh" was a Bourne shell... ignore history at your own peril. > > I don't see why scripts would need to change. I can see how mention > > of -a in Policy could be considered as cruft, but it would serve to > > identify -a as a requirement, in addition to POSIX, which any > > command interperter in Debian purporting to be "sh" needs to abide > > by... is that what you are trying to get clarified? > > Yup! I can understand Debian wanting to be POSIX compliant and dictating that /bin/sh be POSIX compliant, but it is an error to say that any POSIX compatible shell is a "sh". e.g., pdksh claims to be POSIX compatible and it may be appropriate to allow it to link to /bin/ksh, but surely it would not be proper to link pdksh to /bin/sh even though Korn claims to be Bourne compatible. AFAICT, "/bin/sh can be a symbolic link to any POSIX compatible shell" does not really convey what Debian wants, it would be better to state that, `only POSIX features should be used in Debian "sh" scripts', followed by a list of exceptions (which would presumably be a subset of those features in common use which exist in all shells allowed to be "sh".) So, maybe something like: ----- Scripts specifying /bin/sh as their command interpreter (shell) must only use SUSv3[1] features or the following exceptions: - echo -n [2] - [ x -a y ] [3] - ... [4] Thus, the only shells allowed to be /bin/sh are those which are SUSv3 compliant and implement the allowed exceptions to SUSv3. If a script requires non-SUSv3 features not explicitly excepted, the appropriate shell must be specified in the first line of the script (e.g., #!/bin/bash) and the package must depend on the package providing the shell (unless the shell package is marked "Essential", as in the case of bash). [1] http://www.opengroup.org/onlinepubs/009695399/ POSIX, XSI, whatever [2] whatever its problem is [3] why -a is allowed [4] justification as to why or why not ----- I think the above text has the advantage of being clearer about what is expected of scripts, after all, it is the scripts that are important and the shells can be anything able to properly interpret them. It also puts any exceptions to the desired conformance in a list separated from the main text, which allows for easy modification and serves as a quick reference of things which need to be eliminated for compliance to be achieved. The exceptions can be crossed off and their justification deleted as they become irrelevant without altering the text itself, eventually ending up with something like: ----- Scripts specifying /bin/sh as their command interpreter (shell) must only use SUSv3[1] features. Thus, the only shells allowed to be /bin/sh are those which are SUSv3 compliant. If a script requires non-SUSv3 features, the appropriate shell must be specified in the first line of the script (e.g., #!/bin/bash) and the package must depend on the package providing the shell (unless the shell package is marked "Essential", as in the case of bash). [1] http://www.opengroup.org/onlinepubs/009695399/ POSIX, XSI, whatever ----- Thanks for your time, and HTH. - Bruce -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]