Skip to contentSkip to conversation

rpm: remove bashisms: [ x == x ] -> [ x = x ]

PATCH New Olof Johansson 1 participant 1 message Jan 19, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpm: remove bashisms: [ x == x ] -> [ x = x ]

The postinst and postrm of rpm contained a bashism, that could in some situations potentially cause ldconfig not be triggered when it should be. If you use dash on host, test would fail because of syntax errors. But on host, it should fail because of the comparison. On target, you often use busybox ash, and it supports == as an alias for =. So in practice, only if you use a shell like dash on target, you'll run into issues with this.

---
 meta/recipes-devtools/rpm/rpm_4.11.2.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-devtools/rpm/rpm_4.11.2.bb +2 -3
index a48852f..3683971 100644
@@ -101,8 +101,7 @@ do_install_append() {
 }
 
 pkg_postinst_${PN}() {
-
-    [ "x\$D" == "x" ] && ldconfig
+    [ "x\$D" = "x" ] && ldconfig
     test -f ${localstatedir}/lib/rpm/Packages || rpm --initdb
     rm -f ${localstatedir}/lib/rpm/Filemd5s \
           ${localstatedir}/lib/rpm/Filedigests \
@@ -112,7 +111,7 @@ pkg_postinst_${PN}() {
 }
 
 pkg_postrm_${PN}() {
-    [ "x\$D" == "x" ] && ldconfig
+    [ "x\$D" = "x" ] && ldconfig
 
 }
 
Signature · 1 line
2.1.4