Skip to contentSkip to conversation

populate_sdk: verify executable or dynamically linked library

PATCH In review yzhu1 2 participants 3 messages Nov 26, 2013

lore
Share & tools
lore

yzhu1

author
#0 lore raw

PATCH 1/1 populate_sdk: verify executable or dynamically linked library

When toolchain directory is changed to execute mode, some non-executable files or empty files are sorted. This will result in some errors. Thus when sorting executable files or dynamically linked library, additional conditions are to exclude non-executable files or empty files.

---
 meta/classes/populate_sdk_base.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/populate_sdk_base.bbclass +1 -1
index b7ea851..6b3535d 100644
@@ -253,7 +253,7 @@ if [ "$dl_path" = "" ] ; then
 	echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!"
 	exit 1
 fi
-executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111)
+executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm +111 -exec file '{}' \;| grep "\(executable\|dynamically linked\)" | cut -f 1 -d ':') 
 
 tdir=`mktemp -d`
 if [ x$tdir = x ] ; then
Signature · 1 line
1.7.9.5
author
#1 lore raw

Please ignore this mail since there is something wrong in the patch.

Quoted 21 lines · On 11/26/2013 04:24 PM, yzhu1 wrote:

When toolchain directory is changed to execute mode, some non-executable files or empty files are sorted. This will result in some errors. Thus when sorting executable files or dynamically linked library, additional conditions are to exclude non-executable files or empty files.

---
  meta/classes/populate_sdk_base.bbclass |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/populate_sdk_base.bbclass +1 -1
index b7ea851..6b3535d 100644
@@ -253,7 +253,7 @@ if [ "$dl_path" = "" ] ; then
  	echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!"
  	exit 1
  fi
-executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111)
+executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm +111 -exec file '{}' \;| grep "\(executable\|dynamically linked\)" | cut -f 1 -d ':')
 
  tdir=`mktemp -d`
  if [ x$tdir = x ] ; then
#2 lore raw
In reply to yzhu1
Quoted 13 lines · On 11/26/2013 4:24 PM, yzhu1 wrote:

When toolchain directory is changed to execute mode, some non-executable files or empty files are sorted. This will result in some errors. Thus when sorting executable files or dynamically linked library, additional conditions are to exclude non-executable files or empty files.

---
  meta/classes/populate_sdk_base.bbclass |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/populate_sdk_base.bbclass +0 -0
index b7ea851..6b3535d 100644

meta/classes/populate_sdk_base.bbclass if [ "$dl_path" = "" ] ; then · line 256

Quoted 5 lines
meta/classes/populate_sdk_base.bbclass +1 -1
@@ -253,7 +253,7 @@ if [ "$dl_path" = "" ] ; then
  	echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!"
  	exit 1
  fi
-executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111)
+executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm +111 -exec file '{}' \;| grep "\(executable\|dynamically linked\)" | cut -f 1 -d ':')

You should not change the -perm option back to use +mode, please refer to:

commit 21b079e01873e2fb4d8674541e8c5818ba73554e

Author: Stefan Stanacar <[email protected]>
Date:   Tue Jul 16 14:42:35 2013 +0300

populate_sdk_base.bbclass: use new perm option for find

Old way find -perm +mode is no longer supported in newer versions of find (Fedora 19). Man page says:
-perm +mode
This is no longer supported (and has been deprecated since 2005). Use -perm /mode instead.

[YOCTO #4853]

Thanks,
Jackie

Quoted 4 lines
meta/classes/populate_sdk_base.bbclass +0 -0
  tdir=`mktemp -d`
  if [ x$tdir = x ] ; then