Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-1275

At the beginning of the security-admin/scripts/setup.sh file there are three logical errors.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.7.0
    • admin
    • Patch, Important

    Description

      At the beginning of the security-admin/scripts/setup.sh file there are three logical errors.
      1. The logic to judgment if the install.properties file exists is wrong . The reason for the error is that the author doesn't understand the meaning of the "$?" correctly in shell script.
      2. The "/var/run/ranger" path is very important. So the program should determine whether the directory has been created successfully.
      3. The following error occurred if the 'log "$PROPFILE file not found....!!";' could be executed.
      ./setup.sh: line 27: log: command not found
      ===========================================================
      Code error analysis is as follow:
      1. code
      PROPFILE=$PWD/install.properties
      pidFolderName='/var/run/ranger'
      mkdir -p ${pidFolderName}
      propertyValue=''
      if [ ! $? = "0" ];then
      log "$PROPFILE file not found....!!";
      exit 1;
      fi
      2. analysis
      1). The "$?" is the result value of the "propertyValue=''" in (if [ ! $? = "0" ];then). So the (! $? = "0") expression is always equal to false, the (log "$PROPFILE file not found....!!") code always can't be executed.
      2). The log function should be declared before execute. So the following error occurred when execute the (log "$PROPFILE file not found....!!") code.
      ./setup.sh: line 27: log: command not found
      ===========================================================
      Reproducible Steps´╝Ü
      -------------------------------------------------------------------------------
      1. Run "mv install.properties install.properties.bak" command.
      2. Run setup.sh.
      Result:
      The following statements will not be executed.
      log "$PROPFILE file not found....!!";
      exit 1;
      ---------------------------------------------------------------------------------------
      1. Comment out the line 26 and 29 lines and add "exit 0" at the 30 line in the security-admin/scripts/setup.sh file.
      2. Run setup.sh.
      Result.
      ./setup.sh: line 27: log: command not found

      Attachments

        Activity

          People

            zhangqiang2 Qiang Zhang
            zhangqiang2 Qiang Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: