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

error messages of failing maintainer scripts



Hi,

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
messages.

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 ]
  then
    mkdir /var/lib/sgml-base 2>/dev/null
  fi

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.
-- 
Ralf Treinen
Institut de Recherche en Informatique Fondamentale
Équipe Preuves, Programmes et Systèmes
Université Paris Diderot, Paris, France.
http://www.irif.fr/~treinen/


Reply to: