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 356667 - g-p-m segfaults on startup unless '--debug' option set
g-p-m segfaults on startup unless '--debug' option set
Status: RESOLVED FIXED
Product: gnome-power-manager
Classification: Deprecated
Component: general
2.17.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2006-09-19 02:24 UTC by Joseph Sacco
Modified: 2006-09-19 12:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16



Description Joseph Sacco 2006-09-19 02:24:28 UTC
System: PPC running YDL-4.1 [FC4 clone], GARNOME-2.16.x, gcc-4.02

====================================================================
g-p-m did not compile because of spurious compiler warnings. There were complaints about a dummy variable name, index, in the signature of function declarations in bus-gtype-specialized.h overshadowing a function name in <strings.h>


I worked around this by removing the mandatory '-Werror' flag configure:

--- gnome-power-manager-2.17.1/configure-       2006-09-18 21:48:48.000000000 -0400
+++ gnome-power-manager-2.17.1/configure        2006-09-18 21:50:10.000000000 -0400
@@ -19508,7 +19508,7 @@
 fi


-CPPFLAGS="$CPPFLAGS -Werror -Wall -Wshadow -Wcast-align -Wno-uninitialized"
+CPPFLAGS="$CPPFLAGS -Wall -Wshadow -Wcast-align -Wno-uninitialized"
 #CPPFLAGS="$CPPFLAGS -Wall"

 CPPFLAGS="$CPPFLAGS -g"

Once built and installed, g-p-m segfaults upon startup unless a '--debug' command line option is set. The segfault is the result of deferencing a NULL pointer in ./src/gpm-main.c at line 186:

        /* Add all of the options specified on the --debug line */
        for (i = 0; debugoptions[i]; i++) {
                gpm_add_debug_option (debugoptions[i]);
        }


-Joseph
Comment 1 Richard Hughes 2006-09-19 07:32:12 UTC
>The segfault is the result of deferencing a NULL
>pointer in ./src/gpm-main.c at line 186:

Good catch.

2006-09-19  Richard Hughes  <richard@hughsie.com>

	* src/gpm-main.c:
	Remove a potential null-dereference, spotted by Joseph Sacco.
	This fixes #356667 where g-p-m would crash on startup.

>I worked around this by removing the mandatory '-Werror' flag configure:

Instead of removing -Werror does removing -Wshadow also get rid of the compilation fail? I tend to run -Werror for development releases and not for stable ones.
Comment 2 Joseph Sacco 2006-09-19 11:59:28 UTC
Richard,

I have verified that removing '-Wshadow' from CPPFLAGS instead of '-Werror' also gets rid of the compilation failure, as expected.  

Looking at the source, I see that g-p-m supports two configure arguments

   --enable-compile-warnings=[no/minimum/yes/maximum/error]
   --enable-more-warnings  Maximum compiler warnings

that control the level/actions of compiler options. Would it suffice to use these flags rather than using different definitions for CPPFLAGS for development and stable releases?

-Joseph
Comment 3 Richard Hughes 2006-09-19 12:47:21 UTC
2006-09-19  Richard Hughes  <richard@hughsie.com>

	* configure.in:
	Remove -Wshadow as it causes compilation failure on YDL-4.1.
	Fixes #356667.

I'll have to look more about enable-compile-warnings and enable-compile-warnings for a more suitable long-term fix. Do have any ideas?