Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 272876 - x11-libs/gtk+ (GtkCalendar) and xfce-base/xfce4-panel segfault when opening xfce4-datetime with LC_TIME specified
Summary: x11-libs/gtk+ (GtkCalendar) and xfce-base/xfce4-panel segfault when opening x...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: XFCE Team
URL: http://bugzilla.gnome.org/show_bug.cg...
Whiteboard: Upstream
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-06 11:22 UTC by mephinet
Modified: 2009-09-30 20:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output of emerge --info (emerge.info,3.98 KB, text/plain)
2009-06-06 11:22 UTC, mephinet
Details
gdb backtrace of segfault (backtrace.out,3.19 KB, text/plain)
2009-06-06 11:25 UTC, mephinet
Details
glade backtrace (glade.backtrace,5.16 KB, text/plain)
2009-09-07 18:15 UTC, mephinet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mephinet 2009-06-06 11:22:01 UTC
Hi xfce folks,
it took me quite some time to figure our why this only happens on one of my boxes:

When clicking on the xfce datetime plugin in the xfce panel, xfce4-panel dies with a segmentation fault. Attaching GDB to the process reveals that the segfault comes from libpango.

an emerge --emptytree xfce4-panel didn't help. What does help, however, is setting LC_TIME back to "C". My locale setup looks like this (in order to have an english desktop but german date/time/number/currency formatting):

LANG=C
LC_CTYPE="C"
LC_NUMERIC=de_AT@euro
LC_TIME=de_AT@euro
LC_COLLATE="C"
LC_MONETARY=de_AT@euro
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

de_AT@euro is in my /etc/locate.gen list. Other locale-aware programs are not affected.
Comment 1 mephinet 2009-06-06 11:22:46 UTC
Created attachment 193699 [details]
output of emerge --info
Comment 2 mephinet 2009-06-06 11:25:32 UTC
Created attachment 193701 [details]
gdb backtrace of segfault
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-06-07 18:34:27 UTC
Interesting, xfce4-panel-4.6.1 will be stabled soon. Maybe that will fix this issue? Otherwise it will need to be filed upstream at http://bugs.xfce.org
Comment 4 mephinet 2009-06-08 18:32:38 UTC
(In reply to comment #3)
> Interesting, xfce4-panel-4.6.1 will be stabled soon. Maybe that will fix this
> issue? Otherwise it will need to be filed upstream at http://bugs.xfce.org

No, upgrading to 4.6.1 did not help here. I rebuilt xfce-panel, the plugin, gtk+ and friends with debugging symbols turned on, so now I know that 
pango_layout_set_text is called from gtk_calendar_size_request with text=0x0, length=-1 as parameters.
I'll report upstream.
Comment 5 mephinet 2009-06-12 16:57:39 UTC
This is also reproducible with glade, so it's definitely not a xfce-datetime bug, but one of GtkCalendar.

Bug report created upstream: <http://bugzilla.gnome.org/show_bug.cgi?id=585589>
Comment 6 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-06-13 02:58:58 UTC
thanks.
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2009-09-04 07:18:22 UTC
Adding gtk+ maintainers (see URL).
Comment 8 Romain Perier (RETIRED) gentoo-dev 2009-09-04 09:34:47 UTC
Could you have a look to http://www.gentoo.org/proj/en/qa/backtraces.xml, then recompile glib and gtk+, and then re-attach a more detailed backtrace ? (missing symbols)

Thanks in advance.
Comment 9 mephinet 2009-09-07 18:14:27 UTC
(In reply to comment #8)
> Could you have a look to http://www.gentoo.org/proj/en/qa/backtraces.xml, then
> recompile glib and gtk+, and then re-attach a more detailed backtrace ?
> (missing symbols)

Sure, I recompiled glib and gtk+ with 
CFLAGS="-O2 -pipe -march=core2 -ggdb"
and splitdebug turned on, and reproduced the bug with glade, by creating a toplevel and adding the calendar widget to it.
Comment 10 mephinet 2009-09-07 18:15:30 UTC
Created attachment 203387 [details]
glade backtrace

improved backtrace attached.
Comment 11 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-09-07 19:01:58 UTC
So a null size string is passed to pango which calls strlen which goes crazy because it's null. The selected locale might have a problem, does it fail if you select another locale for your LC_TIME ?
Comment 12 mephinet 2009-09-07 19:17:02 UTC
(In reply to comment #11)
> The selected locale might have a problem, does it fail if
> you select another locale for your LC_TIME ?

Segfault also occurs with LC_TIME=fr_FR and es_ES, with the rest of the LC_* variables left unchanged (as listed in the bug description).
If I also set LC_ALL to es_ES or fr_FR, no segfault happens.
This might indicate that the bug is only triggered if multiple locales are mixed.

Comment 13 mephinet 2009-09-07 19:21:50 UTC
Further examination shows:
if LC_TIME is set to a non-C value, then LC_CTYPE must not be set to C.
E.g.:

This one segfaults:
LC_CTYPE=C
LC_TIME=fr_FR
(all other) = C

This one does not:
LC_CTYPE=de_AT
LC_TIME=fr_FR
(all other) = C
Comment 14 Mart Raudsepp gentoo-dev 2009-09-28 14:19:28 UTC
As I commented on upstream bug as well:

I believe it crashes because we had a packaging bug in some versions of pango
(passing of --disable-debug instead of --enable-debug=minimal) and the
g_return_val_if_fail (length == 0 || text != NULL) code wasn't included
therefore, and it got to go forward and then crash on strlen.

However, g_return_val_if_fail is used to catch bad API usage and with
--enable-debug=minimal (the default) it will signal a critical warning instead.
This still is a problem that warrants fixing


What version of pango were you using at the time it crashed? The packaging bug of pango existed in the 1.24 series up to version 1.24.3. pango-1.24.4 and later should downgrade this crash to a critical warning
Comment 15 mephinet 2009-09-30 20:18:16 UTC
(In reply to comment #14)

> I believe it crashes because we had a packaging bug in some versions of pango
> (passing of --disable-debug instead of --enable-debug=minimal) and the
> g_return_val_if_fail (length == 0 || text != NULL) code wasn't included
> therefore, and it got to go forward and then crash on strlen.

Dear Mart,

you're right, I just re-emerged pango, and now glade-3 no longer segfaults, but shows me the predicted:
(glade-3:28484): Pango-CRITICAL **: pango_layout_set_text: assertion `length == 0 || text != NULL' failed

> What version of pango were you using at the time it crashed? The packaging bug
> of pango existed in the 1.24 series up to version 1.24.3. pango-1.24.4 and
> later should downgrade this crash to a critical warning

At that time I was using x11-libs/pango-1.24.2.
Now that I've upgraded to 1.24.5-r1, which no longer has the $(use_enable debug) , the issue is gone.
Thanks for the hint!