[SERVER-17389] YAML pidFilePath not handled correctly on RHEL / CentOS 6 Created: 26/Feb/15  Updated: 12/Mar/15  Resolved: 26/Feb/15

Status: Closed
Project: Core Server
Component/s: Admin, Packaging
Affects Version/s: 3.0.0-rc8, 3.0.0-rc9, 3.0.0-rc10, 3.0.0-rc11
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Matthieu Rigal Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: centos, rhel6
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS / RHEL 6 (and maybe 7)


Issue Links:
Duplicate
duplicates SERVER-17337 RPM Init script breaks with quotes in... Closed
is duplicated by SERVER-17546 RHEL init.d script does not handle pi... Closed
Operating System: Linux
Steps To Reproduce:

in mongod.conf, under RHEL 6 (maybe also 7), set (as described in the docs):
pidFilePath: "/dir/to/pid.file"

To "fix" it, one needs to define the value without the ticks, like:
pidFilePath: /dir/to/pid.file

Thus defining a string without the ticks, resulting in an invalid YAML file

Participants:

 Description   

In RHEL 6, when setting up a YAML configuration file, if you enter the expected string value for pidFilePath, as described in the docs(http://docs.mongodb.org/manual/reference/configuration-options/#processManagement.pidFilePath), mongo won't start.

the awk parsing or the subsequent 'dirname' call will cause the $PIDDIR variable to have a trailing tick

The following:
PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]](processManagement\.)?pidfilepath[[:blank:]][:=][[:blank:]]*/

{print $2}

' "$CONFIGFILE" | tr -d '[:blank:]'`
results in
$PIDFILEPATH being "/dir/to/pid.file"

PIDDIR=`dirname $PIDFILEPATH`
results in
$PIDDIR being "dir/to

which obviously causes the /etc/init.d/mongod to crash and avoids mongo to start


Generated at Thu Feb 08 03:44:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.