Re: error messages of failing maintainer scripts
Ralf Treinen writes ("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
I think this is so obvious it does not need to be documented.
Programs which fail should produce error messages. Ideally, good
ones, but failing that they should at least print the vital details
(including for example any errno).
> 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 is surely a bug. The authors cannot possibly have deliberately
decided that what they wanted was for mkdir to be tried, and if it
fails to abort the script with no message whatsoever.
> 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.
I agree that that is probably what the author meant.
> Any thoughts? -Ralf.
I think you should send a patch.
Ian Jackson <ijackson@xxxxxxxxxxxxxxxxxxxxxx> These opinions are my own.
If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.