[mythtv] Ticket #8215: Myth should interprate hostnames case-insensitivly

Michael T. Dean mtdean at thirdcontact.com
Wed Mar 24 17:49:18 UTC 2010


On 03/24/2010 01:01 PM, ryan patterson wrote:
> On Wed, Mar 24, 2010 at 12:46 PM, MythTV wrote:
>    
>> #8215: Myth should interprate hostnames case-insensitivly
>>
>> Comment:
>>
>>   I am closing this as a feature request. If you come up with a patch,
>>   please comment on this ticket and it will be reopened.
>>      
> Seriously?  Respecting the defined Internet standard is a feature request?
>
> Host names are case-insensitive.  See RFC952 which defined the host
> name specification all the way back in 1985.
> http://tools.ietf.org/html/rfc952  MythTV interpreting "HTPC" and
> "htpc" as different is wrong.
>
> Whatever.  I fixed the issue on my machine.
>    

Hostname resolution in MythTV isn't supported (though it kind of works 
with Qt4, there has been basically no testing of its robustness or what 
effects it has on MythTV).  So, where we ask for "IP address," users 
really should provide "IP address."

The collation for every single hostname (or host) field in the database 
is utf8_general_ci, where "ci" stands for case-insensitive, so it's 
impossible for any in-database comparison to fail due to case 
differences (assuming a proper, unmodified, schema).

The issue is complicated by the fact that MythTV uses hostnames as 
unique identifiers (which is completely outside the bounds of the RFC).  
Because of the above, it has to be some C++ comparison that's failing.  
TTBOMK, the only places C++ comparisons of hostname are done is where 
we've co-opted the hostname for use as a unique identifier.

Unfortunately, a quick look through the code didn't show any obvious 
places where there's an issue.

And:

$ PROJECT=mythtv svngrep 'hostname' | wc -l
941

(where svngrep is basically the wcgrep script (so it ignores the .svn 
dirs) that ships as a contrib in subversion, but with some "mythtv" 
project ignores--for the i18n, docs, etc.) shows that there's a /lot/ of 
code to check--spread throughout:

$ PROJECT=mythtv svngrep -HnIl 'hostname' | wc -l
111

files just in mythtv (ignoring plugins).

That said, if you can actually figure out where the comparison is being 
done, we can change it.  If nothing else, it would require a bit more 
detail on what actually failed.

But since, "This caused some minor issues with old recordings that still 
had the old hostname in the database," and since (now that you've 
identified the issue with your database) it would have been easy enough 
to fix with:

mythconverg_restore.pl --change_hostname \
                        --old_hostname="htpc" \
                        --new_hostname="htpc"

or, if you prefer

mythconverg_restore.pl --change_hostname \
                        --old_hostname="HTPC" \
                        --new_hostname="htpc"

(which would both do the same thing--since in-database comparisons are 
case-insensitive), it's a lot of looking for little gain.

Or, better, someone can create a patch that separates the hostname and 
the unique identifier roles in MythTV (and, in the process, prevent a 
lot of user confusion and setup issues).  This would probably be a much 
better use of time than trying to track down the failure in the current 
design.

Mike


More information about the mythtv-dev mailing list