Web lists-archives.com

Re: Intended MBF: maintainer scripts not using strict mode




Hello,

On Mon, Jun 26, 2017 at 10:23:56PM +0200, Ralf Treinen wrote:

> we currently have in sid 84 maintainer scripts not using strict mode.
> That is, they neither start on "#!/bin/[ba]sh -e", nor do a "set -e".

Thanks to everybody for your feedback. I guess I will stick with
severity=normal for the moment. The MBF template, list of offending
maintainer scripts, and dd-list are attached.

-Ralf.
Dear maintainer,

at least one of the maintainer scripts (preinst, postinst, prerm, postrm) of the package #PACKAGE# does not use strict mode. Policy section 10.4 says:

  Shell scripts (sh and bash) [..] should almost certainly start with set -e so that errors are detected.

  Every script should use set -e or check the exit status of every command.

Please insert a "set -e" at the beginning of your script to enable strict mode. You should not replace this by a first line "#!/bin/sh -e" as it is not effective when your script is executed by an explicit invocation of sh.

Note that this might make your script fail in cases where it did not fail before. This is the purpose of strict mode - make it fail when any unexpected error is encountered. You should make sure that you catch any error (non-zero exit codes of commands) that you decide to tolerate. Techniques to locally catch an error include using appropriate options to your command when available, adding a " || true" at the end of the command, or selectively switching off strict mode by "set +e" and switching it back on again later by "set -e". 

This bug filing has been discussed and approved in thread [1].

-Ralf.

[1] https://lists.debian.org/debian-devel/2017/06/msg00342.html
asterisk-prompt-de_2.0-1.1/preinst
authbind_2.1.2/postinst
authbind_2.1.2/prerm
bcache-tools_1.0.8-2+b1/preinst
bible-kjv_4.29+b1/postinst
bible-kjv_4.29+b1/postrm
bible-kjv_4.29+b1/prerm
bible-kjv-text_4.29/postinst
bible-kjv-text_4.29/prerm
bind9_1:9.10.3.dfsg.P4-12.3/postrm
binfmtc_0.17-2+b1/postinst
binfmtc_0.17-2+b1/postrm
bwbar_1.2.3-2.1+b2/prerm
ca-certificates-mono_4.6.2.7+dfsg-1/postinst
checksecurity_2.0.16+nmu1/preinst
clips_6.24-3.2/postinst
cxref_1.6e-2+b1/postrm
debbugs_2.4.1.1/postrm
debfoster_2.7-2.1+b1/postrm
discover_2.1.2-7.1/postrm
discover_2.1.2-7.1/preinst
dsh_0.25.10-1.3/postinst
dsh_0.25.10-1.3/postrm
dsh_0.25.10-1.3/preinst
dvifb_1:01.03-14.2/postinst
dvifb_1:01.03-14.2/postrm
geki3_1.0.3-8.1/postinst
geki3_1.0.3-8.1/postrm
gjiten_2.6-3/postinst
gnukhata-core-engine_2.6.1-3/postrm
golang-godebiancontrol-dev_0.0~git20140119-1/preinst
guidedog_1.2.0-3+b1/postrm
hyperspec_1.30+nmu2/postinst
kterm_6.2.0-46.2/postinst
kterm_6.2.0-46.2/prerm
ldp-docbook-xsl_0.0.20040321-3/preinst
ldp-docbook-xsl_0.0.20040321-3/prerm
libclips_6.24-3.2/postinst
libclips_6.24-3.2/prerm
linpac_0.24-1+b1/postrm
logtool_1.2.8-10/postrm
logtool_1.2.8-10/preinst
lpr_1:2008.05.17.2+b1/postinst
lpr_1:2008.05.17.2+b1/postrm
manpages-posix-dev_2013a-2/postinst
manpages-posix-dev_2013a-2/postrm
manpages-posix-dev_2013a-2/preinst
mgetty-docs_1.1.36-3/preinst
mgetty-fax_1.1.36-3+b1/preinst
mgetty-voice_1.1.36-3+b1/postrm
mime-support_3.60/prerm
pmw-doc_1:4.29-1/postinst
pmw-doc_1:4.29-1/preinst
python-imaging-doc-html_1.1.2-1.2/postinst
python-imaging-doc-pdf_1.1.2-1.2/postinst
python-kde4_4:4.14.3-2/postinst
remembrance-agent_2.12-7+b2/prerm
samba_2:4.6.5+dfsg-2/prerm
samba-common-bin_2:4.6.5+dfsg-2/prerm
samhain_4.1.4-2/preinst
sauce_0.9.0+nmu3/postrm
scalable-cyrfonts-tex_4.17/postinst
scalable-cyrfonts-tex_4.17/postrm
scanlogd_2.2.5-3.3/postinst
scanlogd_2.2.5-3.3/postrm
scanlogd_2.2.5-3.3/prerm
sendfile_2.1b.20080616-5.3+b3/preinst
simba_0.8.4-4.3/postrm
spacearyarya_1.0.2-7.1/postinst
spacearyarya_1.0.2-7.1/postrm
suricata_4.0.0-beta1-1~exp1/preinst
swapspace_1.10-4+b2/postinst
t1-cyrillic_4.17/postrm
t1-oldslavic_4.17/postinst
t1-oldslavic_4.17/postrm
t1-teams_4.17/postinst
t1-teams_4.17/postrm
websimba_0.8.4-4.3/postinst
websimba_0.8.4-4.3/postrm
whizzytex_1.3.2-1.3/prerm
wodim_9:1.1.11-3+b2/preinst
Adam Majer <adamm@xxxxxxxxxxx>
   lpr

Andreas Barth <aba@xxxxxxxxx>
   mgetty

Andreas Barth <aba@xxxxxxxxxxxxxxx>
   debfoster (U)

Andrew Bartlett <abartlet+debian@xxxxxxxxxxxxxxx>
   samba (U)

Anton Zinoviev <zinoviev@xxxxxxxxxx>
   scalable-cyrfonts

Antonio Cardoso Martins <digiplan.pt@xxxxxxxxx>
   guidedog

Ardo van Rangelrooij <ardo@xxxxxxxxxx>
   ldp-docbook-stylesheets (U)

Arturo Borrero Gonzalez <arturo@xxxxxxxxxx>
   suricata (U)

Balasankar C <balasankarc@xxxxxxxxxxxxx>
   gnukhata-core-engine

Botond Botyanszki <b0ti@xxxxxxxxxxxxxxxxxxxxx>
   gjiten

Camm Maguire <camm@xxxxxxxxxx>
   cxref

Charles Plessy <plessy@xxxxxxxxxx>
   mime-support (U)

Colin Tuckley <colint@xxxxxxxxxx>
   linpac (U)

Colin Watson <cjwatson@xxxxxxxxxx>
   debbugs (U)

David Mohr <david@xxxxxxxx>
   bcache-tools

David Nusinow <dnusinow@xxxxxxxxxx>
   discover (U)

Debbugs developers <debian-debbugs@xxxxxxxxxxxxxxxx>
   debbugs

debfoster Maintainer Team <pkg-debfoster@xxxxxxxxxxxxxxxx>
   debfoster

Debian Common Lisp Team <pkg-common-lisp-devel@xxxxxxxxxxxxxxxxxxxxxxx>
   hyperspec

Debian Games Team <pkg-games-devel@xxxxxxxxxxxxxxxxxxxxxxx>
   geki3
   spacearyarya

Debian Hamradio Maintainers <debian-hams@xxxxxxxxxxxxxxxx>
   linpac

Debian Install System Team <debian-boot@xxxxxxxxxxxxxxxx>
   discover

Debian Mono Group <pkg-mono-group@xxxxxxxxxxxxxxxxxxxxxxx>
   mono

Debian Qt/KDE Maintainers <debian-qt-kde@xxxxxxxxxxxxxxxx>
   pykde4

Debian Samba Maintainers <pkg-samba-maint@xxxxxxxxxxxxxxxxxxxxxxx>
   samba

Debian XML/SGML Group <debian-xml-sgml-pkgs@xxxxxxxxxxxxxxxxxxxxxxx>
   ldp-docbook-stylesheets

Don Armstrong <don@xxxxxxxxxx>
   debbugs (U)

Eduard Bloch <blade@xxxxxxxxxx>
   cdrkit (U)

Eugene V. Lyubimkin <jackyf.devel@xxxxxxxxx>
   swapspace

Florian Weimer <fw@xxxxxxxxxxxxx>
   debfoster (U)

Francesco Paolo Lovergine <frankie@xxxxxxxxxx>
   manpages-posix

Gaudenz Steinlin <gaudenz@xxxxxxxxxx>
   discover (U)

Gianfranco Costamagna <locutusofborg@xxxxxxxxxx>
   guidedog (U)

Ian Jackson <ian@xxxxxxxxxxxxxxxxxxxxxxxx>
   sauce

Ian Jackson <ijackson@xxxxxxxxxxxxxxxxxxxxxx>
   authbind

ISHIKAWA Mutsumi <ishikawa@xxxxxxxxxx>
   kterm

Ivo De Decker <ivodd@xxxxxxxxxx>
   samba (U)

Javier Fernandez-Sanguino Pen~a <jfs@xxxxxxxxxxxx>
   remem

Javier Fernandez-Sanguino Pen~a <jfs@xxxxxxxxxx>
   clips

Javier Fernández-Sanguino Peña <jfs@xxxxxxxxxxxx>
   checksecurity

Javier Fernández-Sanguino Peña <jfs@xxxxxxxxxx>
   samhain

Jelmer Vernooij <jelmer@xxxxxxxxxx>
   samba (U)

Jo Shields <directhex@xxxxxxxxxx>
   mono (U)

Joerg Jaspert <joerg@xxxxxxxxxx>
   cdrkit

Julien Danjou <acid@xxxxxxxxxx>
   bwbar

Junichi Uekawa <dancer@xxxxxxxxxx>
   binfmtc
   dsh
   whizzytex

LaMont Jones <lamont@xxxxxxxxxx>
   bind9

Laszlo Boszormenyi (GCS) <gcs@xxxxxxxxx>
   mime-support (U)

Ludovic Drolez <ldrolez@xxxxxxxxxx>
   gjiten (U)

Marc Haber <mh+debian-packages@xxxxxxxxxxxx>
   debfoster (U)

Mario Joussen <joussen@xxxxxxxxxx>
   asterisk-prompt-de

Martin Schulze <joey@xxxxxxxxxx>
   sendfile

Mathieu Parent <sathieu@xxxxxxxxxx>
   samba (U)

Matthew Vernon <matthew@xxxxxxxxxx>
   bible-kjv

Maximiliano Curia <maxy@xxxxxxxxxx>
   pykde4 (U)

Michael Gilbert <mgilbert@xxxxxxxxxx>
   bind9 (U)

Michael Meskes <meskes@xxxxxxxxxx>
   pykde4 (U)

Michael Stapelberg <stapelberg@xxxxxxxxxx>
   golang-godebiancontrol-dev

Michael Vogt <mvo@xxxxxxxxxx>
   scanlogd

Mime-Support Maintainers <mime-support@xxxxxxxxxx>
   mime-support

Mirco Bauer <meebey@xxxxxxxxxx>
   mono (U)

Modestas Vainius <modax@xxxxxxxxxx>
   pykde4 (U)

Otavio Salvador <otavio@xxxxxxxxxx>
   discover (U)

Peter Van Eynde <pvaneynd@xxxxxxxxxx>
   hyperspec (U)

Petter Reinholdtsen <pere@xxxxxxxxxx>
   discover (U)

Pierre Chifflier <pollux@xxxxxxxxxx>
   suricata

Pirate Praveen <praveen@xxxxxxxxxx>
   gnukhata-core-engine (U)

Radu Spineanu <radu@xxxxxxxxxx>
   simba

Robie Basak <robie.basak@xxxxxxxxxxxxx>
   bind9 (U)

Robie Basak <robie@xxxxxxxxxxxxxxxx>
   bcache-tools (U)

Sam Hocevar (Debian packages) <sam+deb@xxxxxxx>
   geki3 (U)
   spacearyarya (U)
   tmview

Simon Richter <sjr@xxxxxxxxxx>
   python-imaging-doc-handbook

Steve Langasek <vorlon@xxxxxxxxxx>
   samba (U)

Steve McIntyre <93sam@xxxxxxxxxx>
   cdrkit (U)

Sune Vuorela <sune@xxxxxxxxxx>
   pykde4 (U)

Wouter Verhelst <wouter@xxxxxxxxxx>
   logtool
   pmw