[oe-commits] [openembedded-core] 01/42: insane.bbclass: make the checking stricter for unsafe references in scripts

git at git.openembedded.org git at git.openembedded.org
Tue Mar 1 08:39:43 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 412d2e0bf54fc34dfcae3bc31b0dac7174cc97ca
Author: Chen Qi <qi.chen at windriver.com>
AuthorDate: Fri Feb 19 10:38:39 2016 +0800

    insane.bbclass: make the checking stricter for unsafe references in scripts
    
    Previously, the checking for unsafe references is not strict enough. It
    only checks whether '/usr/' is in the script. As a result, any script
    containing statements like below will match this check.
    
    	   PATH="/bin:/sbin:/usr/bin:/usr/sbin"
    
    However, as we can see, this is actually not an unsafe reference. What
    we really want to check is something like '/usr/bin/tail', so we should
    make the checking stricter.
    
    This patch solves the QA warning in gzip and nfs-utils.
    
    Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/insane.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b9adea7..ebf92ac 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -428,7 +428,7 @@ def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages):
         if bool(statinfo.st_mode & stat.S_IXUSR):
             # grep shell scripts for possible references to /exec_prefix/
             exec_prefix = d.getVar('exec_prefix', True)
-            statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path)
+            statement = "grep -e '%s/[^ :]\{1,\}/[^ :]\{1,\}' %s > /dev/null" % (exec_prefix, path)
             if subprocess.call(statement, shell=True) == 0:
                 error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path)
                 package_qa_handle_error("unsafe-references-in-scripts", error_msg, d)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list