After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 153331 - Crash in gweather when trying to open prefs
Crash in gweather when trying to open prefs
Status: RESOLVED FIXED
Product: gnome-applets
Classification: Other
Component: gweather
unspecified
Other other
: High normal
: ---
Assigned To: gnome-applets Maintainers
gnome-applets Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-09-21 21:00 UTC by Peter O'Shea
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
quick fix (770 bytes, patch)
2004-09-22 02:24 UTC, Danielle Madeley
none Details | Review
Proposed patch. (618 bytes, patch)
2004-09-23 13:04 UTC, Frank Anderson
none Details | Review
Quick and Dirty Test Suite (1.45 KB, text/plain)
2004-09-23 18:53 UTC, Danielle Madeley
  Details
patch (950 bytes, patch)
2004-10-07 17:50 UTC, Mark McLoughlin
accepted-commit_now Details | Review
stack trace showing the problem more clearly (1.79 KB, text/plain)
2004-10-07 17:51 UTC, Mark McLoughlin
  Details

Description Peter O'Shea 2004-09-21 21:01:11 UTC
Distribution:                        Solaris 8 2/02 s28s_u7wos_08a SPARC
Package: gnome-applets
Severity: normal
Version: GNOME2.8.0 unspecified
Gnome-Distributor: GNOME.Org
Synopsis: Crash in gweather when trying to open prefs
Bugzilla-Product: gnome-applets
Bugzilla-Component: gweather
Bugzilla-Version: unspecified
BugBuddy-GnomeVersion: 2.0 (2.8.0)
Description:
Description of the crash:
Gweather crashes when trying to open its preferences.

Steps to reproduce the crash:
1. Right-click on a running gweather.
2. Select "Preferences".
3. Crash.

Expected Results:
Should get prefs dialog.

How often does this happen?
Every time.

Additional Information:



Debugging Information:

Backtrace was generated from
'/home/poshea/usr/libexec/gweather-applet-2'

(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...0xfe21f598 in _waitid ()
  • #0 _waitid
  • #1 _libc_waitpid
  • #2 _ti_waitpid
  • #3 __sighndlr
  • #4 <signal handler called>
  • #5 strcmp
  • #6 weather_location_equal
  • #7 gweather_xml_parse_location
  • #8 gweather_xml_parse_node
  • #9 gweather_xml_parse_node
  • #10 gweather_xml_parse_node
  • #11 gweather_xml_load_locations
  • #12 gweather_pref_run
  • #13 marshal_VOID__USER_DATA_STRING
  • #14 g_closure_invoke
  • #15 bonobo_closure_invoke_va_list
  • #16 bonobo_closure_invoke
  • #17 impl_Bonobo_UIComponent_execVerb
  • #18 _ORBIT_skel_small_Bonobo_UIComponent_execVerb
  • #19 ORBit_c_stub_invoke
    at poa.c line 2627
  • #20 Bonobo_UIComponent_execVerb
  • #21 impl_emit_verb_on
  • #22 g_cclosure_marshal_VOID__POINTER
  • #23 g_type_class_meta_marshal
  • #24 g_closure_invoke
  • #25 signal_emit_unlocked_R
  • #26 g_signal_emit_valist
  • #27 g_signal_emit
  • #28 exec_verb_cb
  • #29 g_cclosure_marshal_VOID__VOID
  • #30 g_closure_invoke
  • #31 signal_emit_unlocked_R
  • #32 g_signal_emit_valist
  • #33 g_signal_emit
  • #34 gtk_widget_activate
  • #35 gtk_menu_shell_activate_item
  • #36 gtk_menu_shell_button_release
  • #37 gtk_menu_button_release
  • #38 _gtk_marshal_BOOLEAN__BOXED
  • #39 g_type_class_meta_marshal
  • #40 g_closure_invoke
  • #41 signal_emit_unlocked_R
  • #42 g_signal_emit_valist
  • #43 g_signal_emit
  • #44 gtk_widget_event_internal
  • #45 gtk_propagate_event
  • #46 gtk_main_do_event
  • #47 gdk_event_dispatch
  • #48 g_main_context_dispatch
  • #49 g_main_context_iterate
  • #50 g_main_loop_run
  • #51 bonobo_main
  • #52 bonobo_generic_factory_main_timeout
  • #53 panel_applet_factory_main_closure




------- Bug moved to this database by unknown@bugzilla.gnome.org 2004-09-21 17:01 -------


Unknown platform unknown. Setting to default platform "Other".
Unknown milestone "unknown" in product "gnome-applets".
   Setting to default milestone for this product, '---'
Setting to default status "UNCONFIRMED".
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.

Comment 1 Danielle Madeley 2004-09-22 02:07:08 UTC
This seems liks a fairly good stack trace. We could be passing NULL to strcmp(),
however looking at weather_location_compare(), this could only be possible if
one of the untranslated names is NULL.

I suspect this is some sort of whacky old Solaris bug, but I think it should be
easy enough to fix.
Comment 2 Danielle Madeley 2004-09-22 02:24:17 UTC
Created attachment 31804 [details] [review]
quick fix

Try this.
Comment 3 Peter O'Shea 2004-09-22 17:50:13 UTC
Thanks for the patch.  I applied it, recompiled, reinstalled, killed the panel
and let it restart, added a new weather applet, tried prefs...still the crash. 
The stack trace is the same.
Comment 4 Danielle Madeley 2004-09-23 07:31:52 UTC
Interesting. I suppose we should start with all the obvious questions.

You are using Solaris 8, correct? Did you build with gcc, or the Sun Studio
compiler, or something else? I assume you're using the Solaris libc.
Comment 5 Frank Anderson 2004-09-23 13:03:32 UTC
If i am not missing something here, i think weather_location_equal() should be
returning FALSE  i.e 
0 if the pointers are NULL. but we seem to be returning 1 when code/untrans
pointers are NULL.

does the patch below work ??
Comment 6 Frank Anderson 2004-09-23 13:04:28 UTC
Created attachment 31871 [details] [review]
Proposed patch.
Comment 7 Danielle Madeley 2004-09-23 13:43:25 UTC
Frank,

From the strcmp manual:
       The strcmp() and strncmp() functions return an integer less than, equal
       to, or greater than zero if s1 (or the first n bytes thereof) is found,
       respectively, to be less than, to match, or be greater than s2.

So we return 1 to say it's not equal (sane enough). The crash is in strcmp(),
which is still going to get executed because the condition you impose is the
same as the one which we've already trialled.

What I suspect the problem is, is that we're seeing some strange solaris
specific bug, to do with their implementation of strcmp, or somewhere in the
compiler. Otherwise more people would notice this bug.
Comment 8 Peter O'Shea 2004-09-23 16:34:31 UTC
I tried Frank's patch, and unfortunately, no change.  Yes, I'm on sparc solaris
8, compiling with gcc-3.4.2 and solaris libc.


Just in case there's a difference, here's the relevant bits from the Solaris 8
man pages for strcmp:


     int strcmp(const char *s1, const char *s2);

     int strncmp(const char *s1, const char *s2, size_t n);

 strcmp(), strncmp()
     The strcmp() function  compares  two  strings  byte-by-byte,
     according  to  the ordering of your machine's character set.
     The function returns an integer greater than, equal  to,  or
     less  than  0,  if   the  string pointed to by s1 is greater
     than, equal to, or less than the string  pointed  to  by  s2
     respectively.  The sign of a non-zero return value is deter-
     mined  by the sign of the difference between the  values  of
     the  first  pair  of  bytes that differ in the strings being
     compared. The strncmp() function makes the  same  comparison
     but  looks  at  a maximum of n bytes. Bytes following a null
     byte are not compared.
Comment 9 Danielle Madeley 2004-09-23 18:38:51 UTC
Good, at least that's expected with the results I had predicted (I dislike
non-deterministic errors). I'm really unsure what the problem could be.

I'm going to write up a little program just to test some things. Unfortunately I
only have access to Solaris 9. Stay tuned...
Comment 10 Danielle Madeley 2004-09-23 18:53:44 UTC
Created attachment 31882 [details]
Quick and Dirty Test Suite

Assuming we're not barking up the wrong tree with where the crash really is.
Here is a quick and dirty test suite to run.

It should produce results similar to:
[madeld01@sun23 solaris_tests]$ uname -a
SunOS sun23.ee.uwa.edu.au 5.9 Generic_112233-11 sun4u sparc SUNW,Ultra-5_10
[madeld01@sun23 solaris_tests]$ ./test
String 1: 12345
String 2: Undefined
String 3: 12345
String 4: 123456
String1 == String2: Uncomparable, NULL string
String1 == String3: True
String1 == String4: False
String2 == String4: Uncomparable, NULL string

I also confirmed, passing NULL to strcmp will core dump it.
Assuming this works like I think it should, we're probably thinking about this
all wrong.
Comment 11 Peter O'Shea 2004-09-23 19:44:54 UTC
Ok, tried out the test suite on Solaris 8.  It needed an additional 
#include <strings.h>
to compile.

The output was identical to yours above.
Comment 12 Andrew R Takahashi 2004-09-25 02:45:15 UTC
(My system is a perpetually broken box but the symptoms here looked familiar)

Don't know if it's related but I was running into a similar problem on a rickety
old RH7.3 box.  Turned out to be a problem with my perl modules. Updating
perl-HTML-Parser from the fedora development SRPM got gnome-weather preferences
working again.
Comment 13 Danielle Madeley 2004-09-25 11:30:03 UTC
Interesting. Since I didn't think we used any perl, I'm not sure how this will
help, perhaps it's something to do with merging the translations at build time.
It's worth looking into.
Comment 14 Mark McLoughlin 2004-10-07 17:50:07 UTC
This was really obvious in Fedora Core 3 test2 in en_US, for some bizarre
reason. See:

  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=134572

The problem is that we pass the current WeatherLocation to the XML parsing
thing, and later set the current selection in the treeview which causes us to
free that structure and then we try and use the original structure and boom.

Attaching a patch and a stack trace which shows the problem more clearly.
Comment 15 Mark McLoughlin 2004-10-07 17:50:46 UTC
Created attachment 32353 [details] [review]
patch
Comment 16 Mark McLoughlin 2004-10-07 17:51:52 UTC
Created attachment 32354 [details]
stack trace showing the problem more clearly
Comment 17 Mark McLoughlin 2004-10-07 17:53:20 UTC
Davyd: what do you think?
Comment 18 Danielle Madeley 2004-10-07 23:38:44 UTC
Very tired... answers may not make sense.

Mark, you're definitely sure this is the same crash? Of course it will be, how
many crashes are we going to have in the preferences... it's just the traces
seem different (although he doesn't have full symbols, so anything could happen
I guess).

I feel like there is something I'm missing, but if the patch works, commit it
and close this bug.

Peter, if this bug still persists, even with what Mark's done, please reopen.
Comment 19 Peter O'Shea 2004-10-08 13:09:44 UTC
I tried Mark's patch, and it works.  Thanks!  I can look at my own weather, and
not Pittsburgh's, again.
Comment 20 Danielle Madeley 2004-10-10 15:07:44 UTC
Comment on attachment 32353 [details] [review]
patch

Mark, you can commit this.
Comment 21 Mark McLoughlin 2004-10-12 14:03:39 UTC
Davyd, the stack trace is supposed to illustrate where we re-read the location
configuration causing us to free WeatherLocation we're passing around the place.

Committed to HEAD and gnome-2-8

2004-10-12  Mark McLoughlin  <mark@skynet.ie>

        Fixes crash when opening preferences dialog - bug #153331

        * gweather-pref.c: (load_locations): pass in a copy of the
        current location since we re-compute the current location
        when we select it in the treeview.