]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
base-files: Avoid problems if DISTRO_VERSION contains undefined variable
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Fri, 18 Jan 2019 15:41:50 +0000 (16:41 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 20 Jan 2019 22:24:20 +0000 (22:24 +0000)
If DISTRO_VERSION is defined to some undefined variable, e.g.,
DISTRO_VERSION = "${FOO_VERSION}", and /bin/sh is dash, then
do_install() would fail with an error such as:

  run.do_install.2945:193: run.do_install.2945: Syntax error:
  Unterminated quoted string

This was due to unexpanded Python code making it into the shell code,
confusing the shell parser.

Reported-by: srinivasan <srinivasan.rns@gmail.com>
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/base-files/base-files_3.0.14.bb

index 6e30c149ba87b2fd46e6d9f59e4148c8b3429d55..f42a4ef7c45036585b15580383a3c6a2409c85f4 100644 (file)
@@ -150,7 +150,7 @@ do_install_basefilesissue () {
                printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
                printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
                if [ -n "${DISTRO_VERSION}" ]; then
-                       distro_version_nodate=${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}
+                       distro_version_nodate="${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}"
                        printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
                        printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
                fi