summaryrefslogtreecommitdiff
path: root/bin/check-opcodes
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-01-21 15:51:23 +0100
committerErich Eckner <git@eckner.net>2018-01-21 15:51:23 +0100
commit322356cd803127f4eb5de2fdff309086d57a6828 (patch)
treec100febd613e77339f7b35911e7bf7b5f9faf6ad /bin/check-opcodes
parent289131e5c9f58d8f9db3d7bf77c9de5452c198ca (diff)
downloadbuilder-322356cd803127f4eb5de2fdff309086d57a6828.tar.xz
bin/opcode, bin/check-opcodes, conf/Opcode_list: fix style, so git hook does not complain
Diffstat (limited to 'bin/check-opcodes')
-rwxr-xr-xbin/check-opcodes18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/check-opcodes b/bin/check-opcodes
index fd740b1..c7ab4a9 100755
--- a/bin/check-opcodes
+++ b/bin/check-opcodes
@@ -1,5 +1,8 @@
#!/bin/sh
+# shellcheck disable=SC2086
+
+# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
usage( ) {
@@ -21,7 +24,7 @@ VERBOSE=0
EXIT_CODE=0
log( ) {
if test $VERBOSE = 1; then
- echo $*
+ echo "$@"
fi
}
@@ -31,7 +34,7 @@ err( ) {
}
tmp_dir=$(mktemp -d "${work_dir}/tmp.check-opcodes.XXXXXX")
-trap "rm -rf --one-file-system '${tmp_dir:?}'" EXIT
+trap 'rm -rf --one-file-system "${tmp_dir:?}"' EXIT
ARCH=i686
@@ -97,14 +100,15 @@ esac
log "Checking for architecture: $ARCH ($OPCODE_ARGS)"
bsdtar --no-fflags -x -C $tmp_dir -f $PACKAGE
-for absfile in `find $tmp_dir -name '*.so*' -type f`; do
- file=`basename $absfile`
+# shellcheck disable=SC2044
+for absfile in $(find $tmp_dir -name '*.so*' -type f); do
+ file=$(basename $absfile)
log "Checking shared library: $file"
readelf -a $absfile > $tmp_dir/$file.elf
objdump -f $absfile > $tmp_dir/$file.objdump
file $absfile > $tmp_dir/$file.file
- arch=`grep ^architecture $tmp_dir/$file.objdump | sed 's/^architecture: //g' | cut -f 1 -d ,`
+ arch=$(grep ^architecture $tmp_dir/$file.objdump | sed 's/^architecture: //g' | cut -f 1 -d ,)
case $arch in
i386:x86-64)
arch='x86_64'
@@ -118,7 +122,7 @@ for absfile in `find $tmp_dir -name '*.so*' -type f`; do
esac
log " Objdump architecture: $arch"
- archelf=`grep '^ \+Class' $tmp_dir/$file.elf | cut -f 2 -d : | tr -d ' '`
+ archelf=$(grep '^ \+Class' $tmp_dir/$file.elf | cut -f 2 -d : | tr -d ' ')
case $archelf in
ELF64)
archelf='x86_64'
@@ -142,7 +146,7 @@ for absfile in `find $tmp_dir -name '*.so*' -type f`; do
fi
objdump -M intel -d $absfile > $tmp_dir/$file.asm
- bad_opcodes=`cat $tmp_dir/$file.asm | ${base_dir}/bin/opcode $OPCODE_ARGS -m 1 | wc -l`
+ bad_opcodes=$(${base_dir}/bin/opcode $OPCODE_ARGS -m 1 < $tmp_dir/$file.asm | wc -l)
if test $bad_opcodes != 0; then
case $ARCH in
i486)