error messages of failing maintainer scripts
- Date: Tue, 28 May 2019 11:44:20 +0200
- From: Ralf Treinen <treinen@xxxxxxxxxx>
- Subject: error messages of failing maintainer scripts
do we require that a maintainer script that exits with an error gives
a useful error message? I couldn't find anything about this in policy,
but I think that we should require, or at least recommend, useful error
A concrete example that we found in our current project about
analyzing maintainer scripts (snippet from a preinst):
## create /var/lib/sgml-base
if [ ! -d /var/lib/sgml-base ]
mkdir /var/lib/sgml-base 2>/dev/null
This fails when /var/lib/sgml-base exists but is not a directory, for
instance when it is a regular file. Which is of course the right thing
to do, as expressed in Policy 3.9:
Errors which occur during the execution of an installation script must
be checked and the installation must not continue after an error.
The problem is that it fails *silently* since the stderr of the mkdir
command is redirected away. In this particular case the above stanza
should probably be replaced by
mkdir -p /var/lib/sgml-base
which does the right thing silently when it is possible, and fails with
a message otherwise.
Any thoughts? -Ralf.
Institut de Recherche en Informatique Fondamentale
Équipe Preuves, Programmes et Systèmes
Université Paris Diderot, Paris, France.