When I run "make check" on Solaris, I see this output - note failed test: make[3]: Entering directory `/export/home/jds/packages/BUILD/dbus-test/dbus-0.62/dbus' Test data in ../test/data dbus-test: running string tests dbus-test: checking for memleaks dbus-test: running sysdeps tests Failed to parse 0xff correctly, got: 0.000000 The problem seems to be with the strtod call that we see in the dbus/dbus-sysdeps.c code. I created a small test program containing a call to strtod. If it is compiled with c99 compiler then strtod recognizes a hex string as a float but if cc is used strtod recognizes a hex string as an integer. I tried compiling dbus with c99 compiler. This worked except for the source file dbus-sysdeps-utils.c which I had to compile by hand with cc compiler. Then make check ran successfully. I am not sure what we want to do about this or if it is Solaris specific. Perhaps this is compiler (or compiler option) specific? The code that calls strtod for this failed test is ascii_strtod function in the dbus/dbus-sysdeps.c code and this is only built with --enable-tests is specified (note #ifdef DBUS_BUILD_TESTS) and is not part of the delivered dbus code. However, I also notice that dbus-send calls strtod () in the append_arg function, so perhaps this test is highlighting a bug that could appear there? When I comment out this failing test and build with cc then make check pases. Perhaps we should be using a different function than strtod that doesn't have compiler issues like this? Or should we use special compiler options when building certain files in D-BUS, do you think?
For reference: http://www.opensolaris.org/jive/thread.jspa?threadID=12383
is there another function we could use? Looks like a Solaris issue so we could have a workaround on Solaris but I much rather find a function that would work on all platforms. According to the man page hex is legal and there are no notes to the contrary. What does the man page say on Solaris?
I think that this bug should be closed. If we compile dbus with -xc99 option of compiler then the problem does not occur.
Perhaps we should include a patch witch detects the sun compiler and adds the -xc99 flag before closing this
I think it's only necessary to add this flag when compiling with the Sun Studio compiler. Here is how you would construct a configure test for this compiler. And should be a simple matter of adding -xc99 to the CFLAGS if the test returns true (if g_have_sunstudio_visibility=yes). AC_MSG_CHECKING([whether using Sun Studio C compiler]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) #else # include "error: this is not Sun Studio." #endif ]], [[]])], [ g_have_sunstudio_visibility=yes ], [ g_have_sunstudio_visibility=no ]) AC_MSG_RESULT($g_have_sunstudio_visibility)
If parsing hex is really c99-only, as someone on the list says also, then there are other compilers besides Sun that will give problems. Maybe we should try and figure out if we really need to parse hex or it's just in the test suite for no good reason.
Perhaps the documentation just needs to mention that building with C99 enabled (e.g. -xc99 when using the Sun Studio compiler) is needed. Perhaps this "make check" test should be moved into configure so that configure fails if the user isn't building with C99 options?
Again, I don't think we want to require c99. Either we should confirm that we don't need to support hex parsing, or we should add a way to parse hex that's portable.
We've the same problem on windows ... I also found a workaround for non c99 compliant systems -> http://www.netlib.org/fp/dtoa.c
maintaining that is some serious overkill if we don't need to parse hex anyhow, though, as I believe we don't...
Bugzilla Upgrade Mass Bug Change NEEDSINFO state was removed in Bugzilla 3.x, reopening any bugs previously listed as NEEDSINFO. - benjsc fd.o Wrangler
committed. thanks
woops, ignore the above as I did not commit this. I mistakenly added the comment to the wrong bug.
Fixed back in 2007 (between 1.1.0 and 1.1.2), while this bug was in NEEDINFO state: commit ed57b9c663db89370055c5196e7e0b537647e9ef Author: Havoc Pennington <hp@redhat.com> Date: 2007-07-12 22:18:05 +0000 2007-07-12 Havoc Pennington <hp@redhat.com> * dbus/dbus-sysdeps-util.c (_dbus_sysdeps_test): invert the test for parsing hex as double to be sure it fails to work * dbus/dbus-sysdeps.c (_dbus_string_parse_double): don't allow hex numbers.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.