]> git.donarmstrong.com Git - debian/debian-policy.git/commitdiff
Add test -a/-o and local to shell policy, update wording
authorRuss Allbery <rra@debian.org>
Mon, 4 Jun 2007 01:05:51 +0000 (01:05 +0000)
committerRuss Allbery <rra@debian.org>
Mon, 4 Jun 2007 01:05:51 +0000 (01:05 +0000)
Scripts may now assume that /bin/sh supports local (in a limited form)
and, if they use a built-in test, that built-in supports test -a/-o
binary logical operators.  Reword to include echo -n as another case
of additional required features.  Replace references to POSIX with
SUSv3 and add a link.

git-archimport-id: rra@debian.org--lenny/debian-policy--devel--3.7--patch-2

debian/changelog
policy.sgml
upgrading-checklist.html

index 911135c82967da469ea7a743bfc61ec66698c6d2..47c71dcef8565c37bed9243260ab05b426fe2789 100644 (file)
@@ -2,6 +2,9 @@ debian-policy (3.7.3.0) UNRELEASED; urgency=low
 
   * Bug fix: "[PROPOSAL] Document ~ behavior in version numbers", thanks
     to Nicolas François and Marc Brockschmidt                (Closes: #382612).
+  * Bug fix: "Please add 'local' to list of supra-POSIX features that
+    /bin/sh can be expected to offer". Also add test -a/-o binary logical
+    operators and change references from POSIX to SUSv3      (Closes: #294962)
 
  --
 
index 4acf40208928c56f9b8714d558e0e0e3f617f288..a17e6a3d14d2202cee32da75996a73a5eb3083fb 100644 (file)
@@ -5670,7 +5670,7 @@ test -f <var>program-executed-later-in-script</var> || exit 0
            <file>/etc/default</file>, which typically will have the same
            base name as the <file>init.d</file> script.  This extra file
            should be sourced by the script when the script runs.  It
-           must contain only variable settings and comments in POSIX
+           must contain only variable settings and comments in SUSv3
            <prgn>sh</prgn> format.  It may either be a
            <tt>conffile</tt> or a configuration file maintained by
            the package maintainer scripts.  See <ref id="config-files">
@@ -6731,34 +6731,54 @@ strip --strip-unneeded <var>your-lib</var>
        </p>
 
        <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.
+         Scripts may assume that <file>/bin/sh</file> implements the
+         SUSv3 Shell Command Language<footnote>
+           Single UNIX Specification, version 3, which is also IEEE
+           1003.1-2004 (POSIX), and is available on the World Wide Web
+           from <url id="http://www.unix.org/version3/online.html"
+                     name="The Open Group"> after free
+           registration.</footnote>
+         plus the following additional features not mandated by
+         SUSv3:<footnote>
+           These features are in widespread use in the Linux community
+           and are implemented in all of bash, dash, and ksh, the most
+           common shells users may wish to use as <file>/bin/sh</file>.
          </footnote>
-         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>).
-       </p>
-
-       <p>
-         You may wish to restrict your script to POSIX features when
-         possible so that it may use <file>/bin/sh</file> as its
-         interpreter. If your script works with <prgn>dash</prgn>
-         (originally called <prgn>ash</prgn>), it's probably POSIX
-         compliant, but if you are in doubt, use
+         <list>
+           <item><tt>echo -n</tt>, if implemented as a shell built-in,
+             must not generate a newline.</item>
+           <item><tt>test</tt>, if implemented as a shell built-in, must
+             support <tt>-a</tt> and <tt>-o</tt> as binary logical
+             operators.</item>
+           <item><tt>local</tt> to create a scoped variable must be
+             supported; however, <tt>local</tt> may or may not preserve
+             the variable value from an outer scope and may or may not
+             support arguments more complex than simple variables.  Only
+             uses such as:
+<example compact>
+fname () {
+    local a
+    a=''
+    # ... use a ...
+}
+</example>
+              must be supported.
+            </item>
+         </list>
+         If a shell script requires non-SUSv3 features from the shell
+         interpreter other than those listed above, 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>
+         You may wish to restrict your script to SUSv3 features plus the
+         above set when possible so that it may use <file>/bin/sh</file>
+         as its interpreter. If your script works with <prgn>dash</prgn>
+         (originally called <prgn>ash</prgn>), it probably complies with
+         the above requirements, but if you are in doubt, use
          <file>/bin/bash</file>.
        </p>
 
index 4fe8c7164859466344974bae08a103495f6bdd34..1748b49133b7bd5aa4b95b13f2069996a0cfd120 100644 (file)
@@ -56,6 +56,9 @@ picking your way through this list.
 3.7.3.0                        unreleased
      * Package version numbers may contain tildes, which sort before
        anything, even the end of a part.                         [5.6.12]
+     * Scripts may assume that /bin/sh supports local (at a basic level)
+       and that its test builtin (if any) supports -a and -o binary
+       logical operators.                                        [10.4]
 3.7.2.2                        Oct 2006
      * Maintainer scripts must not be world writeable (up from a
        should to a must)                                         [6.1]