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 670721 - global variable for signal ID should be hidden
global variable for signal ID should be hidden
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-02-24 01:23 UTC by Daiki Ueno
Modified: 2012-02-24 13:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.09 KB, patch)
2012-02-24 01:23 UTC, Daiki Ueno
committed Details | Review

Description Daiki Ueno 2012-02-24 01:23:11 UTC
Created attachment 208314 [details] [review]
patch

I got a mysterious bug for my app using gdbus on OpenBSD 5.0.  After some debugging, it turned out a possible bug of gdbus.  Try compiling the following simple program on OpenBSD:

$ cat > test-gdbus.c
#include <gio/gio.h>

guint signals[2];

int main (void)
{
  signals[0] = 123;  
  signals[1] = 456;  

  g_debug ("signals[0] = %d, signals[1] = %d", signals[0], signals[1]);

  g_type_init ();
  g_type_class_ref (G_TYPE_DBUS_PROXY);

  g_debug ("signals[0] = %d, signals[1] = %d", signals[0], signals[1]);

  return 0;
}
^D
$ gcc -o test-gdbus test-gdbus.c `pkg-config gio-2.0 --cflags --libs` 
$ ./test-gdbus                                                        
** (process:5256): DEBUG: signals[0] = 123, signals[1] = 456
** (process:5256): DEBUG: signals[0] = 2, signals[1] = 3

Expected:

The two output lines should be identical.

Actual:

The contents of signals are overwritten.

Note:

Though this does not occur on GNU/Linux and perhaps an issue of the OpenBSD dynamic linker, I'm attaching a patch.
Comment 1 Colin Walters 2012-02-24 03:18:15 UTC
Review of attachment 208314 [details] [review]:

Oh ewwww!  Patch looks correct.
Comment 2 David Zeuthen (not reading bugmail) 2012-02-24 13:05:16 UTC
Yeah, thanks for the patch, definitely worth fixing. I wonder how we got there, why didn't we get any compile-time warnings prior to the patch?