Bug 39987

Summary: dbus-1.4.12 fails to compile on solaris
Product: dbus Reporter: Daniel Vergien <daniel.vergien>
Component: coreAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium CC: dam, smcv
Version: 1.4.xKeywords: patch
Hardware: All   
OS: Solaris   
URL: http://cgit.freedesktop.org/~smcv/dbus/log/?h=14-perror-39987
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=61399
Whiteboard: review+
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 36074    
Attachments: dbus-1.4.12-dbus-sysdeps-util-unix.c.patch
[1/2] Cope with Unixes that don't have LOG_PERROR, like Solaris 10
[2/2] Add a semi-automatic test for _dbus_system_log
Change #ifdef to #if

Description Daniel Vergien 2011-08-10 13:16:34 UTC
Created attachment 50103 [details] [review]
dbus-1.4.12-dbus-sysdeps-util-unix.c.patch

In the file dbus/sysdeps-util-unix.c LOG_PERROR is used which is not define on solaris 10

A workaround is in the attached patch
Comment 1 Simon McVittie 2011-08-11 02:22:56 UTC
Does Solaris have a way to achieve the same effect as LOG_PERROR? In glibc, it's documented as:

       LOG_PERROR     (Not in POSIX.1-2001.)  Print to stderr as well.

and

       The LOG_PERROR value for option is not specified
       by POSIX.1-2001, but is available in most versions of UNIX.

If there isn't such a thing, we could either use a workaround similar to yours (and just not get output to stderr), or use both vsyslog() and vfprintf() to get output to syslog and stderr at the same time if LOG_PERROR doesn't exist.

(I'd prefer to do an autoconf check rather than #ifndef, though, because LOG_PERROR might be an enum member on some platforms.)
Comment 2 Dagobert Michelsen 2011-08-19 06:43:07 UTC
There is no equivalent to LOG_PERROR on Solaris.

The error is still present in 1.5.6 and it would be nice if it would be fixed.

Best regards -- Dago
Comment 3 Simon McVittie 2011-08-23 08:15:11 UTC
Created attachment 50497 [details] [review]
[1/2] Cope with Unixes that don't have LOG_PERROR, like  Solaris 10
Comment 4 Simon McVittie 2011-08-23 08:15:58 UTC
Created attachment 50498 [details] [review]
[2/2] Add a semi-automatic test for _dbus_system_log
Comment 5 Will Thompson 2011-09-21 01:09:05 UTC
Review of attachment 50497 [details] [review]:

Looks plausible.
Comment 6 Will Thompson 2011-09-21 01:12:27 UTC
Review of attachment 50498 [details] [review]:

This patch looks fine!

g_test_trap_* is nifty: I hadn't seen it before.
Comment 7 Will Thompson 2011-09-21 01:12:30 UTC
Review of attachment 50498 [details] [review]:

This patch looks fine!

g_test_trap_* is nifty: I hadn't seen it before.
Comment 8 Simon McVittie 2011-09-21 03:41:13 UTC
Fixed in git for 1.4.16 and 1.5.8, thanks
Comment 9 Dagobert Michelsen 2013-04-03 10:40:56 UTC
In GIT HEAD I just noticed that when LOG_PERROR is not defined the definition in config.h is
  #define HAVE_DECL_LOG_PERROR 0
which means that the check with #ifdef is always true. The attached patch changing this to #if resolves the issue.
Comment 10 Dagobert Michelsen 2013-04-03 10:41:45 UTC
Created attachment 77372 [details] [review]
Change #ifdef to #if
Comment 11 Dagobert Michelsen 2013-04-03 10:59:08 UTC
The error was just recently introduced in commit 88642f6fee46a4c6d1fde8ae221494a6b3188bd4
Comment 12 Simon McVittie 2013-04-03 11:22:50 UTC
Re-fixed in git for 1.7.2, thanks. As far as I can see, this was a regression in master which never affected a release.

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.