[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:36:23 UTC 2016


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