PIDFILEPATH computation in init scripts fails to handle comments after values

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.0.8, 3.2.0-rc3
    • Affects Version/s: None
    • Component/s: Packaging
    • None
    • Fully Compatible
    • ALL
    • Build C (11/20/15)
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Found by Paschalis Korosoglou and reported via githib:

      I noticed (CentOS 6) that the init script fails to parse the contents of the configuration file as expected resulting in failure to stop the service when asked.

      The error steps in from this line in the init script:

      PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d "[:blank:]\"'"`
      

      What happens is that the PIDFILEPATH variable gets populated with all contents following the variable pidFilePath in the configuration file with spaces omitted. Hence using the default configuration file the bash variable gets the value:

      # echo $PIDFILEPATH
      /var/run/mongodb/mongod.pid#locationofpidfile
      

              Assignee:
              Ernie Hershey (Inactive)
              Reporter:
              Ramon Fernandez Marina
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: