Opened 14 years ago
Closed 14 years ago
Last modified 14 years ago
#10005 closed Patch - Bug Fix (fixed)
If $LANG isn't set, mythbackend segfaults after v0.25pre-3161-g0fd3987
Reported by: | Owned by: | beirdo | |
---|---|---|---|
Priority: | minor | Milestone: | 0.25 |
Component: | MythTV - General | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Running on Ubuntu 10.04.3 LTS, starting mythbackend from upstart, LANG is not set. 0fd3987 adds a check for it, but segfaults if it is not set.
/var/log/mythtv/mythbackend.*.PID.log size is 0.
The following patch eliminates the segfault and allows the error message to print.
diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index 960ccbb..f3ddfbc 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -194,7 +194,7 @@ bool MythCoreContext::Init(void) #ifndef _WIN32 char *lang = getenv("LANG"); - if (!strcmp(lang, "C") || (strlen(lang) == 0)) + if (lang == 0 || !strcmp(lang, "C") || (strlen(lang) == 0)) LOG(VB_GENERAL, LOG_WARNING, "This application expects to be running a UTF locale, and " "many features may behave improperly with your current LANG "
Attachments (2)
Change History (6)
Changed 14 years ago by
Attachment: | version.txt added |
---|
comment:1 Changed 14 years ago by
Owner: | set to beirdo |
---|---|
Status: | new → assigned |
comment:2 Changed 14 years ago by
Milestone: | unknown → 0.25 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Deal with a missing LANG env variable on startup
Although this really should be fixed in the startup script, we should not be crashing if someone doesn't set LANG.
Fixes #10005
Signed-off-by: Gavin Hurlbut <ghurlbut@…>
Branch: master Changeset: da6be99c9d9770424fe82056f3d8e0c9ad7af708
comment:3 follow-up: 4 Changed 14 years ago by
Bill: you really need to fix your startup script to set LANG to a UTF-8 language if you want the MythTV setup to work correctly. Thanks for the crash-prevention, though.
comment:4 Changed 14 years ago by
Replying to beirdo:
Gavin, thanks for the quick response! I tested my patch with and without the upstart script fix. Tomorrow I'll make an addition to: http://www.mythtv.org/wiki/Upstart_mythbackend_Configuration reflecting the new check.
Version