User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; fr-FR; rv:1.8.1) Gecko/20061228 Firefox/2.0 Build Identifier: When running panel from command line in debug mode (compiled with --enable-debug), it crashes because of a segmentation fault. The error comes from an partially uninitialized structure sent to the _DBG macro. Somes strings are output by the macro but memory is not allocated, causing the SEGV. Reproducible: Always Actual Results: DBG[panel-item-manager.c:202] ??(): Plugin .desktop file: /opt/csw/share/xfce4/panel-plugins/separator.desktopDBG[panel-item-manager.c:241] ??(): Internal plugin: /opt/csw/lib/xfce4/panel-plugins/libseparator.so DBG[panel-item-manager.c:348] ??(): + class "separator": name=Séparation ou espaceur, comment=Ajoute un espace ou une ligne entre les éléments du panneau, icon=signal SEGV (no mapping at the fault address) in strlen at 0xfe2b0d70 0xfe2b0d70: strlen+0x0050: ld [%o2], %o1 Patch is provided. Severity set a Major, even if panel cannot be run, it "only" happens in debug mode.
Created attachment 1006 This patch solve the problem by initializing all the structure members When a string is not read from the file, is is initialized to "". Thus it can be used safely with _DBG. The patch i propose also add some "test and output debugs" line code by testing for NULL pointers.
Hi William, Thanks for working on this. I have a couple of questions about the patch. I always assumed that it is valid to pass a NULL pointer for %s, I guess this is not true for Solaris :( I'd rather check for this in the DBG macro than add otherwise useless allocations of empty strings, though. About the other checks, did you ever encounter a situation where these functions returned NULL? The checks look fine to me (apart from the obvious cut an paste error 'dirs == NULL' for everything ;-), but I'm curious to know if this every happened to you. I guess I'll have to check all debug or warning messages for possible NULL pointers. Thanks again for working on this.
Hi Jasper > Thanks for working on this. You're welcome ;) > I always assumed that it is valid to pass a NULL pointer for %s, I guess this > is not true for Solaris :( I'd rather check for this in the DBG macro than add > otherwise useless allocations of empty strings, though. I have tried to initialize the string to NULL before using g_strdup ("") and i had the same segfault. I tried with setting a empty string ("") and it worked. I haven't looked what is behind the call to DBG and g_strdup (but i suppose it is a strdup call and some fprintf call ?) I guess i can answer that yes it is different since it works this way, or maybe there is a problem elsewhere in the macro ? > About the other checks, did you ever encounter a situation where these > functions returned NULL? No it did not happened. I was looking for the origin or the segfault and i added some extra traces to the different segment of code that could generate a NULL pointer problem. I prefered to add trace everywhere and compile once, instead of adding traces one by one :) > The checks look fine to me (apart from the obvious cut > an paste error 'dirs == NULL' for everything ;-), oops sorry :) > I guess I'll have to check all debug or warning messages for possible NULL > pointers. Thanks again for working on this. No problem. I am still searching for the origin of a few other problem under Solaris (which works fine on my xubuntu...).
Created attachment 1007 check for NULL string values in DBG messages William, could you try this patch instead of the one you created? The solution is a bit different and I didn't add all checks from your patch, but it should work now.
Hi Jasper > William, could you try this patch instead of the one you created? It works fine thanks
Ok, thanks for testing. I have committed it to SVN, so it will be available in the next release of Xfce.