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

Proposed new POSIX sh policy (was: First draft of review of policy must usage)



Russ Allbery <rra@debian.org> writes:
> Manoj Srivastava <srivasta@debian.org> writes:

>>         This flows from the Release policy. Not specifying /bin/bash
>>  in scripts is not considered a RC bug.

> I can try to propose better language for this.  I think that using pure
> bash-specific constructs not found in dash in /bin/sh scripts should
> actually be an RC bug, but using test -a or test -o should not.  I think
> we need to say that /bin/sh scripts are permitted to use POSIX shell
> capabilities plus a short list of additional capabilities that
> everything other than posh also implement.

Here's a proposed patch.  What do people think about this approach?  I
know there was an inconclusive Policy discussion a while back about how
best to deal with this issue.  As you can tell from this patch, I favor
the approach of documenting the specific features that we require and
assuming that their semantics are sufficiently clear in practice.

This patch would resolve Policy bug #294962 as well.

--- orig/policy.sgml
+++ mod/policy.sgml
@@ -6727,25 +6727,34 @@
 
 	<p>
 	  The standard shell interpreter <file>/bin/sh</file> can be a
-	  symbolic link to any POSIX compatible shell, if <tt>echo
-	  -n</tt> does not generate a newline.<footnote>
-	      Debian policy specifies POSIX behavior for
-	      <file>/bin/sh</file>, but <tt>echo -n</tt> has widespread
-	      use in the Linux community (in particular including this
-	      policy, the Linux kernel source, many Debian scripts,
-	      etc.).  This <tt>echo -n</tt> mechanism is valid but not
-	      required under POSIX, hence this explicit addition.
-	      Also, rumour has it that this shall be mandated under
-	      the LSB anyway.
-	  </footnote>
+	  symbolic link to any POSIX compatible shell provided that it
+	  supports the following additional features not mandated by
+	  POSIX:
+	  <list>
+	    <item><tt>echo -n</tt> must not generate a newline<footnote>
+		Debian policy specifies POSIX behavior for
+		<file>/bin/sh</file>, but <tt>echo -n</tt> has widespread
+		use in the Linux community (in particular including this
+		policy, the Linux kernel source, many Debian scripts,
+		etc.).	This <tt>echo -n</tt> mechanism is valid but not
+		required under POSIX, hence this explicit addition.  Also,
+		rumour has it that this shall be mandated under the LSB
+		anyway.
+	      </footnote>
+	    </item>
+	    <item>the <tt>-a</tt> and <tt>-o</tt> <tt>test</tt> operators
+	      must be supported</item>
+	    <item><tt>local</tt> to create a scoped variable must be
+	      supported</item>
+	  </list>
 	  Thus, shell scripts specifying <file>/bin/sh</file> 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., <tt>#!/bin/bash</tt>) and the package must
-	  depend on the package providing the shell (unless the shell
-	  package is marked "Essential", as in the case of
-	  <prgn>bash</prgn>).
+	  interpreter must only use POSIX features or features guaranteed
+	  by the above list. If a script requires other non-POSIX features
+	  from the shell interpreter, the appropriate shell must be
+	  specified in the first line of the script (e.g.,
+	  <tt>#!/bin/bash</tt>) and the package must depend on the package
+	  providing the shell (unless the shell package is marked
+	  "Essential", as in the case of <prgn>bash</prgn>).
 	</p>
 
 	<p>

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: