Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21209

PIDFILEPATH computation in init scripts fails to handle comments after values

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 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)

      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@mongodb.com Ernie Hershey (Inactive)
            Reporter:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: