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

Bug#1051371: debian-policy: stop referring to legacy filesystem paths for script interpreters



Control: retitle -1 debian-policy: stop referring to specific paths in scripts shebang examples

On Thu, 7 Sep 2023 08:09:12 +0200 Helmut Grohne <helmut@subdivi.de>
wrote:
> Would you agree to repurpose this bug to propose the former change?
> While my variant is weaker, it still prevents people from using
policy
> to require supporting split-/usr.

I have rewritten the patch and the commit message. Now it simply
removes the full paths where it is not necessary, as the text simply
talks about the different types of interpreters, and in two occasions
where a shebang is specified, a note is added to mention that other
valid paths are also acceptable (without saying what they are), taking
in both your and Sam's suggestions as I've understood them.

This thus doesn't encourage nor suggest any changes, but simply removes
the ambiguity over what is and is not allowed by norm.

Does this look more amenable?

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <bluca@debian.org>
Date: Wed, 6 Sep 2023 22:41:58 +0100
Subject: [PATCH] Stop referring to specific paths in scripts shebang examples

These are being mistaken for normative languages, but they are just
examples. Remove full paths where not needed, and specify that other
valid paths (without mentioning them explicitly) are also acceptable
in other places.
---
 policy/ch-files.rst | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/policy/ch-files.rst b/policy/ch-files.rst
index b34c183..593d586 100644
--- a/policy/ch-files.rst
+++ b/policy/ch-files.rst
@@ -211,8 +211,8 @@ 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 POSIX.1-2017 Shell Command
-Language  [#]_ plus the following additional features not mandated by
+Scripts may assume that the ``sh`` executable implements the POSIX.1-2017 Shell
+Command Language  [#]_ plus the following additional features not mandated by
 POSIX.1-2017.. [#]_
 
 -  ``echo -n``, if implemented as a shell built-in, must not generate a
@@ -248,16 +248,16 @@ POSIX.1-2017.. [#]_
 
 If a shell script requires non-POSIX.1-2017 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``).
+in the first line of the script (e.g., ``#!/bin/bash`` or other valid paths)
+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 POSIX.1-2017 features plus the above
-set when possible so that it may use ``/bin/sh`` as its interpreter.
+set when possible so that it may use ``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``.
+script complies with these requirements, use ``bash``.
 
 Perl scripts should check for errors when making any system calls,
 including ``open``, ``print``, ``close``, ``rename`` and ``system``.
@@ -266,7 +266,9 @@ including ``open``, ``print``, ``close``, ``rename`` and ``system``.
 Programming Considered Harmful*, one of the ``comp.unix.*`` FAQs, which
 can be found at http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/. If
 an upstream package comes with ``csh`` scripts then you must make sure
-that they start with ``#!/bin/csh`` and make your package depend on the
+that they start with the path of a csh interpreter, such as ``#!/bin/csh`` or
+other valid paths, and make your package depend on the
+
 ``c-shell`` virtual package.
 
 Any scripts which create files in world-writeable directories (e.g., in
@@ -780,7 +782,7 @@ restricted to ASCII when it is possible to do so.
 .. [#]
    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 ``/bin/sh``.
+   users may wish to use as ``sh``.
 
 .. [#]
    This is necessary to allow top-level directories to be symlinks. If

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: