[OE-core] [PATCH 3/5] lib/oe/package.py: is_elf: Don't let filename influence filetype

Olof Johansson olof.johansson at axis.com
Fri Dec 1 15:50:22 UTC 2017


The is_elf function is simply looking for the substring ELF in the
output from file. But file, by default, prefixes the outut with the
filename. If the filename containts the substring ELF anywhere, is_elf
would identify it as a ELF.

The --brief (or -b) flag of GNU's file utility makes file not prepend
filename to the output.

Signed-off-by: Olof Johansson <olofjn at axis.com>
---
 meta/lib/oe/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index f1f9333e0f..eab94feb91 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -78,7 +78,7 @@ def is_elf(path, on_error=_is_elf_error):
     A return value of 0 means that the file is not an ELF file.
     """
     ret, result = oe.utils.getstatusoutput(
-        "file \"%s\"" % path.replace("\"", "\\\""))
+        "file -b \"%s\"" % path.replace("\"", "\\\""))
 
     if ret:
         error_cb('"file %s" failed')
-- 
2.11.0




More information about the Openembedded-core mailing list