[SERVER-591] Debianb packaging: Bad ordering of variables and reading of /etc/default Created: 01/Feb/10  Updated: 12/Jul/16  Resolved: 01/Feb/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.3.1
Fix Version/s: 1.3.2

Type: Bug Priority: Minor - P4
Reporter: Roger Binns Assignee: Richard Kreuter (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu


Participants:

 Description   

The file debian/init.d has some issues:

  • The name is set to "MongoDB". By convention this should be all lower case
  • DAEMONUSER is set to a hard coded value after /etc/default/$NAME has been read which makes it impossible to override the user
  • DAEMON_OPTS should be composed after /etc/default/$NAME is read (and only if $DAEMON_OPTS is not already set). That would allow default to set things like the data directory easily (the single most likely thing someone would want to set)
  • DAEMONUSER is explicitly set and is a failure if not existing. Later on there are codepaths for it being set or not. Make your mind up
  • Part of that checking sets DAEMONUID/GID but never uses them. The other tools used such as start_stop_daemon use the textual name and report errors, so leave all this user stuff up to them.
  • For reload_server, the comment says SIGHUP is sent but the code sends USR1. The comment has no value and should be removed
  • The main switch/case loop has a bunch of commented out code for reload. Delete it. Also reload_server() exists, so use it!


 Comments   
Comment by auto [ 03/Feb/10 ]

Author:

{'login': 'kreuter', 'name': 'Richard Kreuter', 'email': 'richard@10gen.com'}

Message: Prune more needless code from the debian init script. SERVER-591. MINOR
http://github.com/mongodb/mongo/commit/32f3348ed8ec936dec30886e8be4c59591aeefc2

Comment by Roger Binns [ 01/Feb/10 ]

Great improvements. BTW there is still a check looking for if the DAEMONUSER exists which is bogus. Firstly there is no need for the check - start-stop-daemon will end up doing it anyway.

But if you insist on checking then use 'getent passwd "$DAEMONUSER"'. The current code asks getent to enumerate every entry which given there could be LDAP users, NIS users etc could take a very long time! Just ask getent directly for the user of interest.

Comment by auto [ 01/Feb/10 ]

Author:

{'login': 'kreuter', 'name': 'Richard Kreuter', 'email': 'richard@10gen.com'}

Message: Address issues in SERVER-591. MINOR
http://github.com/mongodb/mongo/commit/99dc251ea9f08141ea497d6f595ca3acf214b156

Comment by Richard Kreuter (Inactive) [ 01/Feb/10 ]

I'm testing a script that addresses all your points except one:

> - The main switch/case loop has a bunch of commented out code for reload. Delete it. Also reload_server() exists, so use it!

mongodb doesn't have support for reloading its configuration in response to a signal, so instead I'm removing both the comment and the reload_server function. (We already supported a "reload" argument to the script, by printing a message telling the user to use "restart" instead.)

Thanks for the report!

Generated at Thu Feb 08 02:54:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.