Opened 8 years ago

Closed 8 years ago

#10209 closed Bug Report - General (fixed)

Mythfrontend fails to find mysql.txt when the home directory path contains non-ASCII

Reported by: Göran Uddeborg <goeran@…> Owned by: sphery
Priority: minor Milestone: 0.25
Component: MythTV - General Version: 0.24.1
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I have a standalone box running both frontend and backend. That works fine.

Now I'm trying to run mythfrontend from my regular user account on another machine. The path to my home directory is /home/göran, where the o-diaeresis is UTF-8 encoded.

I have to enter settings like language and country, database server etc. each time I start up mythfrontend. In the log it also complains that it is unable to connect to the database, trying to connect to localhost rather than the box running the mythbackend and database servers (named pluto). Using "strace" I found that mythfrontend tries to open a file under a path as if my home directory would have been encoded using ISO-8859-1 (or maybe ISO-8859-15):

5036  open("/home/g\366ran/.mythtv/mysql.txt", O_RDONLY) = -1 ENOENT (No such file or directory)

It does not have the same problem finding other files, like config.xml:

5036  open("/home/g\303\266ran/.mythtv/config.xml", O_RDONLY|O_CLOEXEC) = 12

Dong a soft link from "g\366ran" to "g\303\266ran" seems to be a workaround. I haven't tried too much, but the more basic things seem to work fine after having created it.

Attachments (3)

#version (792 bytes) - added by Göran Uddeborg <goeran@…> 8 years ago.
Output from "mythfrontend --version"
#log (1.8 KB) - added by Göran Uddeborg <goeran@…> 8 years ago.
Output from mythfrontend when running normally (without the soft link)
#trace.xz (106.8 KB) - added by Göran Uddeborg <goeran@…> 8 years ago.
"strace" style trace of mythfrontend

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Göran Uddeborg <goeran@…>

Attachment: #version added

Output from "mythfrontend --version"

Changed 8 years ago by Göran Uddeborg <goeran@…>

Attachment: #log added

Output from mythfrontend when running normally (without the soft link)

Changed 8 years ago by Göran Uddeborg <goeran@…>

Attachment: #trace.xz added

"strace" style trace of mythfrontend

comment:1 Changed 8 years ago by sphery

This is due to the line:

fstream fin(pszFile.toAscii(), ios::in);

which is used by the (old) Settings class to read the mysql.txt and settings.txt files in Settings::ReadSettings?().

There is no need to have multiple MythTV configuration files with overlapping functionality. I plan to remove mysql.txt and leave only config.xml (where config.xml allows specifying everything in mysql.txt and more), and ideally when doing so will remove all of the old Settings class. This will leave us with only one configuration file, config.xml, and in so doing will remove the (extremely) old, ASCII-only, non-Qt, low-level C++ code that's causing the failure you've noticed.

However, since config.xml provides the same information as mysql.txt, there is no need for mysql.txt if you have a config.xml file (and provide a <SecurityPin?> value that matches your "Security PIN (required)" setting, as specified in mythtv-setup). Therefore, your system can work with just config.xml (I use only config.xml on my 0.24-fixes system). If you need help getting it to work, please ask for help on the mythtv-users list.

Note that on 0.24-fixes and below, if you have no mysql.txt and you have multiple independent MythTV systems (using different databases and different master backends) on the same network--with multiple master backends running at the same time--a bug will prevent MythTV from finding the proper master backend automatically, so you would have to select the proper backend on each mythfrontend restart. This has since been fixed in unstable/development code (will be a part of 0.25).

Note, also, that for some reason, the Qt code creates a .config/Trolltech.conf file in both the ASCII-/latin-1-ized version of the HOME directory and in the UTF-8 version of the HOME directory; however, the one in the proper HOME directory is lacking the SQL driver and image format/image handler information (having only the text CODEC information--seemingly as if it uses the ASCII-ized version of the HOME directory name until it loads the text CODECs, which allow it to use the proper directory name). Therefore, you may still need to have an ASCII-ized version of your HOME directory specifically for .config/Trolltech.conf. This, however, is an upstream bug (as we don't use Trolltech.conf directly--it's only used in so far as it supports the Qt code that we use).

comment:2 Changed 8 years ago by Göran Uddeborg <goeran@…>

Thanks for the explanation. I seem to need help with using config.xml, so I just sent a question to mythtv-users.

Is the problem with the Trolltech.conf file a known and already reported issue? Or should I report it?

comment:3 Changed 8 years ago by sphery

Owner: set to sphery
Status: newaccepted

comment:4 Changed 8 years ago by Github

Milestone: unknown0.25
Resolution: fixed
Status: acceptedclosed

Use toLocal8Bit() for loading mysql.txt.

Although the reported issue is much harder to trigger after c32fcf7fd, this fixes the old code to use toLocal8Bit() in case it's triggered. While this old code will likely be removed after #10305, this small change should make it easier to use MythTV with non-ASCII characters in home directory names.

Fixes #10209

Branch: master Changeset: 53761e2cc1f17a17ed2446b8779623bd44814660

Note: See TracTickets for help on using tickets.