Mon 23 May 2011 02:58:33 AM UTC, original submission:
Hi,
As previously reported at <http://bugs.debian.org/619786>, texi2dvi errors out when run using recent versions of dash from git://git.kernel.org/pub/scm/utils/dash/dash.git as shell:
| $ texi2dvi
| /usr/bin/texi2dvi: 144: /usr/bin/texi2dvi: Syntax error: Bad function name
| $ sed -ne 144p /usr/bin/texi2dvi
| ) || local () {
| $ dash -c 'true || local () { echo hi; }; echo continuing'; echo $?
| dash: 1: Syntax error: Bad function name
| 2
The cause is use of "local" as a function name --- like typeset and export, "local" is a special builtin in these versions of dash, and using it as a function name is a syntax error[*].
ksh similarly errors out when it sees an attempt to define "export" or "typeset" as a function, but it does not treat "local" as special, and perhaps future versions of dash will follow that lead. So I am reporting this not to say "this construct is invalid shell command language" but rather "this is at the edge of portability and probably worth avoiding".
Anyway, it's simple to hide this construct from the parser for such shells by wrapping the function definition in 'eval'. Shells that support "local" don't have to parse that code and shells that do not support "local" are not going to have a problem with it.
Thanks for reading, and hope that helps,
Jonathan
[*] http://austingroupbugs.net/view.php?id=383
|