Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4109 closed defect (invalid)

LocalHostName should not default to "my-unique-identifier-goes-here"

Reported by: dburr@… 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.

Change History (2)

comment:1 Changed 12 years ago by Janne Grunau

Resolution: invalid
Status: newclosed

if the parameter isn't set it is not used. See MythContextPrivate::LoadDatabaseSettings?()

comment:2 Changed 12 years ago by Nigel

(In [14770]) Cope with erroneously configured localhost "my-unique-identifier-goes-here", add const qualifiers in MCP methods, reminder to remove ::settings. See #4109

Note: See TracTickets for help on using tickets.