From: jin-gyu.kim Date: Mon, 14 May 2018 07:54:26 +0000 (+0900) Subject: Fix bugs in path check script. X-Git-Tag: submit/tizen/20180515.013950^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1e26cb021657b45f0b78b73a114e0fbd666c6b5;p=platform%2Fcore%2Fsecurity%2Fsecurity-config.git Fix bugs in path check script. - Only one script which does not define "PATH" was found before. - Also, there was problem in checking exception. - Fix these two bugs. Change-Id: I7f59bc960adcd6380aac6b938465b1553a6ebb5f --- diff --git a/test/path_check_test/path_check.sh b/test/path_check_test/path_check.sh index a695b41..52362c7 100644 --- a/test/path_check_test/path_check.sh +++ b/test/path_check_test/path_check.sh @@ -11,7 +11,7 @@ script_list_path="/opt/share/security-config/log/script_file_list" # args : $1 = file path function CHECK_EXCEPTION { - temp=$(cat $exception_file_path | grep $1) + temp=$(grep $1 <<< cat $exception_file) if [ -n "$temp" ] then return 1 @@ -38,14 +38,11 @@ function PATH_CHECK # Main Check function : find shell scripts in the system. function CHECK { - # check only for /usr /opt /etc - #find /opt /usr /etc -type f -exec $utl_path/file {} \; 2>/dev/null | grep "shell script" | cut -d ":" -f1 >> $script_list_path find / -type f -executable 2>/dev/null | xargs $utl_path/file | grep "shell script" | cut -d ":" -f1 >> $script_list_path - while read script_file_line do PATH_CHECK $script_file_line - done < <(cat $script_list_path) + done < $script_list_path } # Rename file util