From: Wenzong Fan <wenzong....@windriver.com>

'bzip2 -qt $moudle_name.pp' has different exit codes on different
distributions, for example:

* On Redhat/CentOS/Fedora, OpenSUSE:

  $ bzip2 -qt /tmp/tor.pp
  bzip2: /tmp/tor.pp: bad magic number (file not created by bzip2)
  $ echo $?
  0

This causes install errors:

  unzip2: /path/to/*.pp is not a bzip2 file.
  libsepol.module_package_read_offsets: module package header truncated
  Failed to read policy package

* Ubuntu has fixed it:

  $ bzip2 -qt /tmp/tor.pp
  bzip2: /tmp/tor.pp: bad magic number (file not created by bzip2)
  $ echo $?
  2

The difference involved by '-q' options, remove it would get the bzip2
works consistently. bzip2-native has the same issue, anyway it should
be fixed separately.

Signed-off-by: Wenzong Fan <wenzong....@windriver.com>
---
 recipes-security/refpolicy/refpolicy_common.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/recipes-security/refpolicy/refpolicy_common.inc 
b/recipes-security/refpolicy/refpolicy_common.inc
index de38dfc..5acbf3e 100644
--- a/recipes-security/refpolicy/refpolicy_common.inc
+++ b/recipes-security/refpolicy/refpolicy_common.inc
@@ -84,7 +84,7 @@ prepare_policy_store () {
                MOD_DIR=${POL_ACTIVE_MODS}/${MOD_NAME}
                mkdir -p ${MOD_DIR}
                echo -n "${HLL_TYPE}" > ${MOD_DIR}/lang_ext
-               if ! bzip2 -qt $i 2>/dev/null; then
+               if ! bzip2 -t $i >/dev/null 2>&1; then
                        ${HLL_BIN} $i | bzip2 --stdout > ${MOD_DIR}/cil
                        bzip2 -f $i && mv -f $i.bz2 $i
                else
-- 
1.9.1

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to