Opened 13 years ago
Closed 13 years ago
Last modified 13 years ago
#4109 closed defect (invalid)
LocalHostName should not default to "my-unique-identifier-goes-here"
Reported by: | Owned by: | Isaac Richards | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | mythtv | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
When MythContextPrivate::WriteSettingsFile? writes out a settings file it includes the following comment:
# Set the following if you want to use something other than this # machine's real hostname for identifying settings in the database. # This is useful if your hostname changes often, as otherwise you # will need to reconfigure mythtv (or futz with the DB) every time. # TWO HOSTS MUST NOT USE THE SAME VALUE
However, in MythContext::GetDatabaseParams?, params.localHostName is set to "my-unique-identifier-goes-here" if LocalHostName? is not set, which is not what the comment indicates.
This breaks backwards compatibility because if somebody updates mythtv without adding a value for LocalHostName? to their FE and BE configurations then they will both break: the BE will refuse to start because there is no BackendServerIP corresponding to the hostname "my-unique-identifier-goes-here" and the FE will write duplicate entries to the mythconverg.settings table with the hostname column set to "my-unique-identifier-goes-here".
The fix is to use gethostname(2) in MythContext::GetDatabaseParams? to set params.localHostName when params.localHostName.isEmpty() is true (line 3332). This will make the comment correct and fix backwards compatibility. I can provide a patch if you want but it should be a trivial fix.
if the parameter isn't set it is not used. See MythContextPrivate::LoadDatabaseSettings?()