This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Crash in g_file_monitor on 32-bit Cygwin

On 6/27/2014 1:52 PM, Yaakov Selkowitz wrote:
On 2014-06-27 12:11, Ken Brown wrote:
On 6/25/2014 10:17 PM, Ken Brown wrote:
This is a followup to, from which I
extracted the following test case:

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

gfile_add_watch (const char *file)
   GFile *gfile = g_file_new_for_path (file);
   GFileMonitor *monitor;
   GFileMonitorFlags gflags = G_FILE_MONITOR_NONE;
   monitor = g_file_monitor (gfile, gflags, NULL, NULL);
   if (! monitor)
     printf ("Can't watch file %s\n", file);
     printf ("Watching file %s\n", file);

main ()
   const char *file = "gfile-test.c";
   gfile_add_watch (file);

$ gcc -g -O0 -o gfile-test $(pkg-config --cflags gio-2.0) gfile-test.c
$(pkg-config --libs gio-2.0)

In the 64-bit case, this behaves as expected:

$ ./gfile-test.exe
Watching file gfile-test.c

In the 32-bit case, however, it crashes.  Running it under gdb shows
that the call to g_file_monitor leads to a SEGV, but I can't tell
exactly where; when I try to single step through the Glib code, I
eventually hit an assertion violation in gdb.  strace shows lots of
exceptions, but I can't make much sense out of it otherwise.

I rebuilt glib and gamin without optimization so that I could step
through the code in gdb.  But stepping through the code turned out to be
unnecessary, because the bug was gone after the rebuilds.  I don't know
if optimization was really the issue or whether just rebuilding with the
latest tools is what fixed it.

My builds can be obtained from

if anyone else wants to try to reproduce this without rebuilding the
packages themselves.

Yaakov, could you take a look?

Sure.  Are you narrow this down to only one of glib or gamin?

The culprit is gamin, and optimization *is* relevant. What's strange, though, is that when I rebuild it with optimization, my test case hangs instead of crashing. Summary:

- With gamin-0.1.10-14 (and its subpackages), my test case crashes. The outward symptom is that there's no output, but running the test case under gdb shows the SEGV.

- If I rebuild gamin without optimization, I don't see any bug. More precisely, I build it using your gamin.cygport with the following line added:

  CFLAGS+=" -O0 -g3"

- If I rebuild gamin with optimization (i.e., just using your gamin.cygport with no changes), my test case hangs.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]