locale is not set up before mythtv-backend start causing problems in mythvideo with accentuated chars

Bug #541042 reported by Eduard Iten
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Mythbuntu
Fix Released
Medium
Unassigned
mythtv (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Spotted that in 10.04, the locale is not set before mythtv-backend is started. This prevents mythtv-backend to find any file with non-ascii characters in the filename or the path (for example: /var/lib/mythtv/videos/Komödie/Dinner for one.avi is not found).

While starting mythbuntu-backend, the locale is POSIX. I modified "/etc/init/mythtv-backend.conf" for debug purpose:
#############################################
# MythTV Backend service

description "MythTV Backend"
author "Mario Limonciello <email address hidden>"

start on (local-filesystems and net-device-up IFACE=lo)
stop on starting shutdown

#expect fork
respawn

script
        USER=mythtv
        ARGS="--logfile /var/log/mythtv/mythbackend.log --user $USER"
        locale >/tmp/mythbackendboot.log
        test -f /etc/default/mythtv-backend && . /etc/default/mythtv-backend || true
        LANG=de_CH.utf8 /usr/bin/mythbackend $ARGS
end script
############################################

Result:
############################################
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
############################################

Adding LC_ALL=de_CH.utf8 LANG=de_CH.utf8 in front of /usr/bin/mythtv-backend does the trick, then everything works just perfect....

Where is locale supposed to be set up in this whole upstart-process?

Tags: patch
Revision history for this message
MarcRandolph (mrand) wrote :

Thank you for helping to improve Mythbuntu, not only by opening this ticket, but by suggesting a fix! I am marking this ticket as triaged because it appears to have enough information to help the developers understand the problem. It is possible I am wrong and another more experienced triager or developer may adjust the status of the ticket to "incomplete" and request additional information.

Changed in mythbuntu:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Eduard Iten (eiten) wrote :

OK, i found a way to fix it for all locales:
####################################################################
# /etc/init/mythtv-backend.conf
####################################################################
# MythTV Backend service

description "MythTV Backend"
author "Mario Limonciello <email address hidden>"

start on (local-filesystems and net-device-up IFACE=lo)
stop on starting shutdown

#expect fork
respawn

script
        USER=mythtv
        ARGS="--logfile /var/log/mythtv/mythbackend.log --user $USER"
        test -f /etc/default/mythtv-backend && . /etc/default/mythtv-backend || true
        test -f /etc/default/locale && . /etc/default/locale || true
        LANG=$LANG LC_ALL=$LANG /usr/bin/mythbackend $ARGS
end script
####################################################################

Revision history for this message
MarcRandolph (mrand) wrote :

Thank you for the update Eduard. Did you confirm with the experts in #upstart that this is the best way to do this (i.e., is not just currently supported, but is planned to be in the future)?

Revision history for this message
Eduard Iten (eiten) wrote :

Hi Marc,
sorry for my long delay. I tried to, but they also could not help me with this point. In fact, I'm not quite sure if this is an upstart issue. I rather think its a mythtv issue, as other services like samba do not have problems with utf8 without locale set...

Revision history for this message
MarcRandolph (mrand) wrote :

I couldn't get anyone to answer the question either. Could you please paste your /etc/environment file?

Thank you!

Revision history for this message
MarcRandolph (mrand) wrote :

One of the concerns was setting LC_ALL in the upstart script. Eduard or Nico, could you please try only setting LANG and leaving LC_ALL unset?

summary: - locale is not set up before mythtv-backend start
+ locale is not set up before mythtv-backend start causing problems in
+ mythvideo with accentuated chars
Revision history for this message
Nico (nico-rdo) wrote :

LC_ALL can apparently be dropped from the upstart script.

Accentuated chars are seen with just LANG being set.

Revision history for this message
Nico (nico-rdo) wrote :

Oh well, just upgraded to the 0.24 dailies, and this issue is back!

Revision history for this message
Mario Limonciello (superm1) wrote :

Just added a fix worked out with Nico on IRC to the autobuilds packaging. Should be there for the next autobuilds run.

Thanks!

Changed in mythbuntu:
status: Triaged → Fix Committed
Changed in mythtv (Ubuntu):
status: New → Fix Committed
Revision history for this message
Nico (nico-rdo) wrote :

thanks Mario!

Revision history for this message
Eduard Iten (eiten) wrote :

Hey Mario,

I can totaly confirm it works. THANKS!

Regards, Edi

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mythtv - 1:0.24.0+fixes27305-0ubuntu1

---------------
mythtv (1:0.24.0+fixes27305-0ubuntu1) natty; urgency=low

  [ Mario Limonciello ]
  * New 0.24 checkout (27305)
  * Modify the upstart script to load the LANG first. (LP: #541042)
  * Modify configure_mythplugins_without_mythtv_installed.patch to remove
    SYSROOT from the mytharchive build process for it's additional support
    files. (LP: #674626)
  * Remove unused package, mythmovies from build process.
  * Clean up the dependencies of a few packages, and harden them to the binary
    version.
  * Disable XvMC as it's causing crashes. VDPAU is better off in these
    situations anyhow (LP: #660833)
  * Remove sparc support.
  * Make sure mysql is pingable before starting the backend (LP: #609402)
  * Fixup some linitians:
    - Extra license files
    - Longer extended descriptions
    - Duplicated synopsis
    - Init.d script
  * Add a new debian/rules rule called 'update-upstream-changelog'.
    This finds all of the most recent svn commit messages and
    creates changelog entries.
  * Add a debian/README.Debian for explaining how to work with the package.
  * In the update-upstream-changelog rule, search for the word mythbuntu
    in the version string. If found, find the latest version on the PPA
    to compare against.
  * Get rid of the newest-revision rule in favor of one that will actually
    update the changelog/checkout to the new version.
  * Add a new helper script debian/do-new-release.sh that will run all of
    these common tasks in preparation for an upload to ubuntu.

  [ Thomas Mashos ]
  * Set backend to not respawn if it dies 2 times in 1 hour (LP: #654846)
  * Move metadata scripts and internetcontent to mythtv-common
  * Fixed Replaces for mythtv-common
  * Added python and perl bindings as recommends for BE/FE
  * Fixes replaces in control.in for mythtv-common (LP: #676791)
  * Added bindings as recommends to FR and BE in control.in
  * Added Breaks mythtv-backend to mythtv-common (LP: #677206)
  * Added conflicts/replaces for mythplugins-dbg to mythtv-dbg
  * Added script to find latest mythtv svn revision in PPA
 -- Mario Limonciello <email address hidden> Sat, 20 Nov 2010 13:19:58 -0600

Changed in mythtv (Ubuntu):
status: Fix Committed → Fix Released
Changed in mythbuntu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.