verify_stack(): distinguish failures and a normal status of grep
Now, if something fails, the pipe (and the function, and the whole script) will fail. If the exit codes are normal, they are handled according to our logic. Previously, a failure (which is an exceptional rare case) would lead to: 1. skipping the further exe_stack check and error_strict STACK "$f" 'STACK entry not found' 2. silently skipping the exe_stack check (which was impossible anyway because of the failure)
This commit is contained in:
parent
fc56b0be97
commit
0445f481cc
@ -259,13 +259,14 @@ verify_stack()
|
||||
nsp0='[^[:space:]]*'
|
||||
sp1='[[:space:]]\+'
|
||||
hex='0x[0-9a-f]\+'
|
||||
stack="$(printf '%s\n' "$elf_segments" |grep "^${sp0}GNU_STACK${sp1}")" || {
|
||||
stack="$(printf '%s\n' "$elf_segments" | { grep "^${sp0}GNU_STACK${sp1}" || [ "$?" -eq 1 ]; } )"
|
||||
[ -n "$stack" ] || {
|
||||
error_strict STACK "$f" 'STACK entry not found'
|
||||
return
|
||||
}
|
||||
exe_reg="${sp0}GNU_STACK${sp1}${hex}${sp1}${hex}${sp1}${hex}${sp1}${hex}${sp1}${hex}${sp1}${nsp0}E${nsp0}${sp1}${hex}"
|
||||
exe_stack="$(printf '%s\n' "$stack" |grep -x "$exe_reg")" ||
|
||||
return 0
|
||||
exe_stack="$(printf '%s\n' "$stack" | { grep -x "$exe_reg" || [ "$?" -eq 1 ]; } )"
|
||||
[ -z "$exe_stack" ] ||
|
||||
error_strict STACK "$f" "found executable STACK entry: $exe_stack"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user