[debhelper-devel] Bug#815158: debhelper: dpkg-maintscript-helper is not portable among recent shell releases

Carsten Hey carsten at debian.org
Fri Feb 19 14:51:03 UTC 2016


I don't know which real world problems, if any, are caused by the
different ways the shells parses those lines. Figuring this out and
discussing it would require more effort than doing the requested code
cleanup, i.e., replacing `` with $().

* Carsten Hey [2016-02-19 15:36 +0100]:
> Package: debhelper
> Serverity: minor
>
> Hi,
>
> recent releases of yash and mksh follow POSIX' wording regarding
> backslashes in backquotes, the other shells follow POSIX' presumable
> intention and the historically correct behaviour, for example (run on
> Debian stable):
>
>     $ bash -c 'echo "`echo \"x\"`"'; yash -c 'echo "`echo \"x\"`"'
>     x
>     "x"
>
> In debhelper's git repository, these lines, using the above-mentioned
> non-portable pattern, can be found:
>
>     autoscripts/preinst-moveconffile:               if [ "`md5sum \"#OLD#\" | sed -e \"s/ .*//\"`" = \
>     autoscripts/preinst-moveconffile:                    "`dpkg-query -W -f='${Conffiles}' #PACKAGE# | sed -n -e \"\\\\' #OLD# '{s/ obsolete$//;s/.* //p}\"`" ]
>
> Given that Debian does not care about shells from about 1970, the most
> obvious fix is to use $() instead of ``. This would also improve the
> code's readability.
>
>
> Regards
> Carsten




More information about the debhelper-devel mailing list