[Debconf-devel] Bug#522255: set -u vs $@, posh, bash4, mksh, …

Thorsten Glaser t.glaser at tarent.de
Mon Jul 6 13:36:54 UTC 2009


severity 522255 serious
thanks

Hi,

as some already have noticed, using mksh as /bin/sh errors out
there too – mdadm 2.6.7.2-3 is uninstallable in Lenny because
of this error, and debconf 1.5.26 from Sid still contains it.
Thus I’m tentatively raising the severity (YMMV though).


--- /usr/share/debconf/confmodule.a	2009-07-06 15:17:07.000000000 +0200
+++ /usr/share/debconf/confmodule.b	2009-07-06 15:17:01.000000000 +0200
@@ -62,7 +62,7 @@ db_title ()	{ _db_cmd "TITLE $@"; }
 db_input ()	{ _db_cmd "INPUT $@"; }
 db_beginblock () { _db_cmd "BEGINBLOCK $@"; }
 db_endblock () 	{ _db_cmd "ENDBLOCK $@"; }
-db_go ()	{ _db_cmd "GO $@"; }
+db_go ()	{ _db_cmd "GO ${1+$@}"; }
 db_get ()	{ _db_cmd "GET $@"; }
 db_register ()	{ _db_cmd "REGISTER $@"; }
 db_unregister () { _db_cmd "UNREGISTER $@"; }


This works with mksh as /bin/sh at the very least¹. As it has
already been posted, erroring out has been traditional behaviour
for Bourne, Korn and some POSIX shells for ages.

$ mksh -uc 'echo $@'
mksh: @: parameter not set


① It should probably be mechanically applied to all the “$@”
  occurences²³ in there.
② The correct change is 「"$@"」 → 「${1+"$@"}」 as explained
  by the GNU autoconf texinfo documentaion, especially for zsh,
  where “$@” has a totally different, nōn-POSIX meaning
③ What are these doing anywat, "GO $@", don’t they really mean
  to use "GO $*" instead?


I wonder if the easier thing would be to change mdadm (and others)
to not use set -u _at least_ for Lenny until a consensus has been
reached. (I hope that we can at least agree to disagree, and not
depend on having to fix all shells except dash – and, maybe, zsh,
which was mentioned but is not really a /bin/sh suitable shell.)

I personally do not like to use set -u; I could live with people
using it for debugging their own shell code, or with CGIs they
maintain for themselves, but using it in maintainer scripts that
are widely deployed and for a wide range of shells (bash2/3/4,
dash, posh, mksh, AT&T ksh93, maybe others) it’s disagreeable.
Nevertheless, maybe the debconf scripts _could_ be adapted.


Sincerely,
//mirabilos – Debian Maintainer
-- 
tarent Gesellschaft für Softwareentwicklung und IT-Beratung mbH

Heilsbachstr. 24, 53123 Bonn  |  Weigandufer 45, 12059 Berlin
fon: +49(0)228 / 52675-0      |  fon: +49(0)30 / 5682943-30
fax: +49(0)228 / 52675-25     |  fax: +49(0)228 / 52675-25

Schützenstr. 18, 10117 Berlin
fon: +49(0)30 / 27594853
fax: +49(0)30 / 78709617

Geschäftsführer: Boris Esser, Elmar Geese
HRB AG Bonn 5168 - Ust-ID: DE122264941





More information about the Debconf-devel mailing list