Fix bugs in path check script. 38/178838/1
authorjin-gyu.kim <jin-gyu.kim@samsung.com>
Mon, 14 May 2018 07:54:26 +0000 (16:54 +0900)
committerjin-gyu.kim <jin-gyu.kim@samsung.com>
Mon, 14 May 2018 07:54:31 +0000 (16:54 +0900)
- 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

test/path_check_test/path_check.sh

index a695b41caac281006e39d3726d4d8872ab0aa308..52362c7269614ce8066f42dcfe9a08f433eb4f74 100644 (file)
@@ -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