• Bug#864615: please update version of posix standard for scripts (sectio

    From Sean Whitton@21:1/5 to Ralf Treinen on Sat Oct 14 20:40:01 2017
    XPost: linux.debian.bugs.dist

    control: tag -1 +moreinfo

    Hello Ralf,

    On Sun, Jun 11, 2017 at 06:51:49PM +0200, Ralf Treinen wrote:
    section 10.4 says:

    Scripts may assume that /bin/sh implements the SUSv3 Shell Command
    Language ...

    This version of the standard is so outdated that it isn't even any
    longer available on the opengroup web site. The latest version of the standard is 4.2 (published in 2016), earlier versions currently
    available on the opengroup site are 4 (from 2008) and 4.1 (from 2013).
    Please consider updating the policy.

    I found the 2016 edition of version 4 of the SUS,[1] but what makes you
    think that is version 4.2? I couldn't find that version number
    anywhere. If they've changed their versioning scheme, maybe Policy
    needs to use the expression "SUSv4 (2016 edition)"?

    On Sun, Jun 25, 2017 at 04:12:42PM +0200, Guillem Jover wrote:
    On Sun, 2017-06-11 at 20:46:23 +0200, Bill Allombert wrote:
    Before doing that, we have to check whether all the relevant packages
    are compliant with this update.

    Well, I don't all of our current shell packages are even compliant with
    the current version specified in policy.

    dash is one of such packages, with several non-compliancy bugs. And given that it is our default shell…

    Concur. If we're not in compliance now, this Policy update does not immediately make packages buggy. And people will be far more motivated
    to bring their packages into compliance if they're being asked to bring
    them into compliance with the latest version of the standard.

    [1] http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm

    --
    Sean Whitton

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAlniV78ACgkQaVt65L8G YkAkSg/+L7uCAj9FJNkxaXIXxcK0fxwH9TQz3WtElhpgbC9iq1RkOewbs0ahX0Jd lXdiR1gQmGCpKEW0ToKCIEf26xCxwt0DvoQeNLqmL61uENw5EFFrB+mDXD3J/dnd M8ebzKizy+9gDLkqaJQHZxN+tfeZnIQqPc4Kw8jDcjwCY71HZE8ERmwRA5W9ss3L J4tNsN0ZMGgx8lsU3CSXZraCITpKDLofsrkQIFev4ECode1zF9ZhJfufJGv5+edx 9EcsC5Yp6/YkakOjQWQb6HmVB5lq2D2kspHfEzHo/dWWPRkzmVTUz6JMra2qVtw/ kttVXLSf93jLe3Qy5Ft0s2zoRp0p9d6vUeoLxqIYnUSyMoDXWwpqS8yYEBwTLwsJ Jllb+UZnX4xufUf14m4Sr11zLLAvziEwNLoaHQbKW/VWslLJzDEQ1wI7B1UslBoR DDVYWqM9gG8YMv9kFZ6Mo922ukEIM45tZqv2gU8R4col4en8MwwGXRvRLl/V6ALw nQJwxb6gGvE194wuU2eeu0SFj036RdtGEJ27rmuXYltidm/Z8RcDnO++xrNt3mac +htLB4SnJYgJTEgkeFcKnX79fg+8SwiV2YTLoln8MOKTCzkJugCcKC24BsWgOACP fWtAi8uz1m9hRYmz+qPMwu4TFY4uYDYRysakCG8SOOSPyd61Bpc=
    =p/c1
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adam D. Barratt@21:1/5 to Sean Whitton on Sat Oct 14 23:30:01 2017
    XPost: linux.debian.bugs.dist

    On Sat, 2017-10-14 at 11:30 -0700, Sean Whitton wrote:
    control: tag -1 +moreinfo

    Hello Ralf,

    On Sun, Jun 11, 2017 at 06:51:49PM +0200, Ralf Treinen wrote:
    section 10.4 says:

      Scripts may assume that /bin/sh implements the SUSv3 Shell
    Command
      Language ...

    This version of the standard is so outdated that it isn't even any
    longer available on the opengroup web site.

    Really? http://pubs.opengroup.org/onlinepubs/009695399/ is still there,
    and indeed referenced from https://en.wikipedia.org/wiki/Single_UNIX_Sp ecification

    The latest version of the
    standard is 4.2 (published in 2016), earlier versions currently 
    available on the opengroup site are 4 (from 2008) and 4.1 (from
    2013).
    Please consider updating the policy.

    I found the 2016 edition of version 4 of the SUS,[1] but what makes
    you think that is version 4.2?  I couldn't find that version number anywhere.  If they've changed their versioning scheme, maybe Policy
    needs to use the expression "SUSv4 (2016 edition)"?

    The 2016 edition is Technical Corrigendum 2. I'm not sure that it's conventional to use versioning such as 4.2 in such cases, however. I'd
    expect it to be referred to as SUSv4, SUSv4TC2, or SUSv4 2016 edition;
    the latter seems to be more common.

    Regards,

    Adam

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sean Whitton@21:1/5 to Adam D. Barratt on Sun Oct 15 00:40:01 2017
    XPost: linux.debian.bugs.dist

    control: tag -1 -moreinfo +patch

    Hello,

    On Sat, Oct 14 2017, Adam D. Barratt wrote:

    The 2016 edition is Technical Corrigendum 2. I'm not sure that it's conventional to use versioning such as 4.2 in such cases, however. I'd
    expect it to be referred to as SUSv4, SUSv4TC2, or SUSv4 2016 edition;
    the latter seems to be more common.

    Thank you for the clarification, Adam.

    I am seeking seconds for the following patch. It's not so readable, so
    let me summarise the changes:

    - replace the string "SUSv3" with "SUSv4 (2016 edition)" wherever it
    appears
    - reflow paragraphs where necessary

    For the reasons explained in my previous e-mail, I think it's reasonable
    to make this change now.

    diff --git a/policy/ch-files.rst b/policy/ch-files.rst
    index d4df316..dc0d152 100644
    --- a/policy/ch-files.rst
    +++ b/policy/ch-files.rst
    @@ -202,9 +202,9 @@ may instead be easier to check the exit status of commands directly. See
    Every script should use ``set -e`` or check the exit status of *every*
    command.

    -Scripts may assume that ``/bin/sh`` implements the SUSv3 Shell Command -Language [#]_ plus the following additional features not mandated by -SUSv3.. [#]_
    +Scripts may assume that ``/bin/sh`` implements the SUSv4 (2016
    +edition) Shell Command Language [#]_ plus the following additional
    +features not mandated by SUSv4 (2016 edition).. [#]_

    - ``echo -n``, if implemented as a shell built-in, must not generate a
    newline.
    @@ -237,18 +237,20 @@ SUSv3.. [#]_
    which are the same as for ``kill`` above, 13 (SIGPIPE) must be
    allowed.

    -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., ``#!/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``).
    -
    -You may wish to restrict your script to SUSv3 features plus the above
    -set when possible so that it may use ``/bin/sh`` as its interpreter. -Checking your script with ``checkbashisms`` from the devscripts package
    -or running your script with an alternate shell such as ``posh`` may help -uncover violations of the above requirements. If in doubt whether a
    -script complies with these requirements, use ``/bin/bash``.
    +If a shell script requires non-SUSv4 (2016 edition) 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.,
    +``#!/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``).
    +
    +You may wish to restrict your script to SUSv4 (2016 edition) features
    +plus the above set when possible so that it may use ``/bin/sh`` as its +interpreter. Checking your script with ``checkbashisms`` from the +devscripts package or running your script with an alternate shell such
    +as ``posh`` may help uncover violations of the above requirements. If
    +in doubt whether a script complies with these requirements, use +``/bin/bash``.

    Perl scripts should check for errors when making any system calls,
    including ``open``, ``print``, ``close``, ``rename`` and ``system``.
    diff --git a/policy/ch-opersys.rst b/policy/ch-opersys.rst
    index 7d9e20a..9574f82 100644
    --- a/policy/ch-opersys.rst
    +++ b/policy/ch-opersys.rst
    @@ -461,19 +461,19 @@ statement at the top of the script, like this:
    test -f program-executed-later-in-script || exit 0

    Often there are some variables in the ``init.d`` scripts whose values -control the behavior of the scripts, and which a system administrator is -likely to want to change. As the scripts themselves are frequently -``conffile``\ s, modifying them requires that the administrator merge in -their changes each time the package is upgraded and the ``conffile`` -changes. To ease the burden on the system administrator, such
    -configurable values should not be placed directly in the script.
    +control the behavior of the scripts, and which a system administrator
    +is likely to want to change. As the scripts themselves are frequently +``conffile``\ s, modifying them requires that the administrator merge
    +in their changes each time the package is upgraded and the
    +``conffile`` changes. To ease the burden on the system administrator,
    +such configurable values should not be placed directly in the script.
    Instead, they should be placed in a file in ``/etc/default``, which
    typically will have the same base name as the ``init.d`` script. This
    -extra file should be sourced by the script when the script runs. It must -contain only variable settings and comments in SUSv3 ``sh`` format. It
    -may either be a ``conffile`` or a configuration file maintained by the -package maintainer scripts. See :ref:`s-config-files` for
    -more details.
    +extra file should be sourced by the script when the script runs. It
    +must contain only variable settings and comments in SUSv4 (2016
    +edition) ``sh`` format. It may either be a ``conffile`` or a
    +configuration file maintained by the package maintainer scripts. See +:ref:`s-config-files` for more details.

    To ensure that vital configurable values are always available, the
    ``init.d`` script should set default values for each of the shell

    --
    Sean Whitton

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAlnij3QACgkQaVt65L8G YkBcPA//dO7NIRkB9vQlxON+nXcP9BHMef+rU26e5Fx81g1h3RAPRqIqDowOblrR NMzJ1JyW46zZRCb2x55SKhGXLXMgZz4TKMUnpmoDN41zyx9gx53jRWgvjLFyTWFu Op00ikV8kd09gVSUJi46Eomsqvic9OpVXOafVM9Xta1oOhDHk3KunAgvYiaEch2S qIqsmgjTqWH5XY/lEocnBGEpj+1guhuS8eKL+hL7wISiF+owTRuwyg12rZGMo9zP U7+WMmdgU/pw9O9iji2SzrXIWpNQpiidDu31+5d8RSewcg76TWpTtMSi2azyYNzo GQqtsCjG7p2iKK8zzJwrUs3Izi3cErGAYZ2qtf6922C7JaXpq6vvkiJI2n1dT+OK 1DB0+zteYm8hEonI+K620u03MENwQWUwhVcjoQ/nM9QVrj4/wxOrlVLg4Td+sK/0 vWQIeDk/8ppqArgXI/760qYFBCdqEfhrWS54wYaQbhfCuU085GPO9GK2Hc36ATzW aSBdEzGJVBJBPlAi8SX72bSWDTfh5JuRpJcwLIHbDCCI+/iI2zm8jZpSxLyOvNhq HyonfOufy5Yh2zNyQW448VWEzLqFnrrq8Ky1STfyTR3laGhoRqQL+uwfzGbmmXzQ oleNWp7iXECWvM42a+UlqSkrD1VYr0yLUJldPLkt5nlflmBhRz4=GCFa
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)