2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 18:17:09 +00:00

aa-decode, aa-remove-unknown: fix remaining shellcheck info-level violations

For details, see:

- https://www.shellcheck.net/wiki/SC2086
- https://www.shellcheck.net/wiki/SC2162
This commit is contained in:
intrigeri 2022-02-13 08:43:18 +00:00
parent e55a9b3735
commit 825f761c77
2 changed files with 6 additions and 3 deletions

View File

@ -58,7 +58,7 @@ if [ -n "$1" ]; then
exit 1 exit 1
fi fi
d=`decode $e` d=`decode "$e"`
if [ -z "$d" ]; then if [ -z "$d" ]; then
echo "Could not decode string" echo "Could not decode string"
exit 1 exit 1
@ -71,6 +71,8 @@ fi
# For now just look at 'name=...' and 'profile=...', # For now just look at 'name=...' and 'profile=...',
# so validate input against this and output based on it. # so validate input against this and output based on it.
# TODO: better handle other cases too # TODO: better handle other cases too
# shellcheck disable=SC2162
# shellcheck disable=SC2086
while read line ; do while read line ; do
# check if line contains encoded name= or profile= # check if line contains encoded name= or profile=

View File

@ -63,7 +63,7 @@ fi
# We have to do this check because error checking awk's getline() below is # We have to do this check because error checking awk's getline() below is
# tricky and, as is, results in an infinite loop when apparmorfs returns an # tricky and, as is, results in an infinite loop when apparmorfs returns an
# error from open(). # error from open().
if ! IFS= read _line < "$PROFILES" ; then if ! IFS= read -r _line < "$PROFILES" ; then
echo "ERROR: Unable to read apparmorfs profiles file" 1>&2 echo "ERROR: Unable to read apparmorfs profiles file" 1>&2
exit 1 exit 1
elif [ ! -w "$REMOVE" ] ; then elif [ ! -w "$REMOVE" ] ; then
@ -79,6 +79,7 @@ fi
# on removing the parent profile when the profile has had its # on removing the parent profile when the profile has had its
# child profile names changed. # child profile names changed.
# shellcheck disable=SC2086
LOADED_PROFILES=$("$PARSER" -N $PROFILE_DIRS) || { LOADED_PROFILES=$("$PARSER" -N $PROFILE_DIRS) || {
ret=$? ret=$?
echo 'apparmor_parser exited with failure, aborting.' >&2 echo 'apparmor_parser exited with failure, aborting.' >&2
@ -103,7 +104,7 @@ END {
} }
} }
' | LC_COLLATE=C sort -r | \ ' | LC_COLLATE=C sort -r | \
while IFS= read profile ; do while IFS= read -r profile ; do
if [ "$DRY_RUN" -ne 0 ]; then if [ "$DRY_RUN" -ne 0 ]; then
echo "Would remove '${profile}'" echo "Would remove '${profile}'"
else else