[OE-core] [PATCH 4/5] lib/oe/package.py: is_elf: Disallow shell specials to be expanded

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


By using single quotes instead of double quotes, we don't have to worry
about escaping dangerous characters, other than ' itself.

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 eab94feb91..976d2ef36c 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 -b \"%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