NetBSD Problem Report #50075

From www@NetBSD.org  Wed Jul 22 01:03:00 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5A565A6562
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 22 Jul 2015 01:03:00 +0000 (UTC)
Message-Id: <20150722010258.0CF5EA6562@mollari.NetBSD.org>
Date: Wed, 22 Jul 2015 01:02:58 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Making dbus actually work on FreeBSD, DragonFly, and probably more
X-Send-Pr-Version: www-1.0

>Number:         50075
>Category:       pkg
>Synopsis:       Making dbus actually work on FreeBSD, DragonFly, and probably more
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gdt
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 22 01:05:00 +0000 2015
>Last-Modified:  Wed Mar 09 10:35:00 +0000 2016
>Originator:     David Shao
>Release:        pkgsrc current
>Organization:
>Environment:
DragonFly  4.3-DEVELOPMENT DragonFly v4.2.2.81.g7432b-DEVELOPMENT #4: Tue Jul 21 13:55:40 PDT 2015     xxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64

>Description:
I have found the following patches to be essential for getting dbus to finally work on DragonFly, FreeBSD, and possibly other OSes.  The functionality has been verified on DragonFly 4.3 DEVELOPMENT and FreeBSD 10.1 release to enable the latest Xfce4 desktop to start and be usable.  As my experience has been dbus as it is builds but does not function even on NetBSD, I argue the following patches should be committed so that dbus works on something and enables an up-to-date desktop on DragonFly and FreeBSD.

That being said I acknowledge it is possible I have made an error and broken working dbus on Darwin or in the smf code, so please reply with corrections.

The following changes are to mk/defaults/mk.conf.

1) The pid file for dbus in /var/run/dbus can have different names, anything from messagebus.pid to dbus.pid on DragonFly and FreeBSD to the default name of pid.  DBUS_SYSTEM_PID_FILE allows the installer to customize this pid file name.

2) The new mk.conf also notes that in practice DBUS_USER and DBUS_GROUP are the same value.

The script dbus that starts the dbus daemon is generated using FILE_SUBST from files/dbus.sh and from smf/files/dbus.sh. 

3) For newer DragonFly and FreeBSD the rcvar name used to invoke dbus in /etc/rc.conf has incorrect default of dbus, whereas it should be dbus_enable.  Therefore @DBUS_RCVAR@ is introduced to pass the correct name.  

4) The pid file name is passed through @DBUS_SYSTEM_PID_FILE_SH@.  I did not want to use FILE_SUBST directly on variables such as DBUS_SYSTEM_PID_FILE because the source code for dbus seems to originally have its own @DBUS_USER@ patterns. Thus the _SH extension for DBUS_SYSTEM_PID_FILE_SH.

5) The original dbus.sh neither removes the pid file when dbus is stopped nor checks if a stale one exists before it starts.  I added a check for both, including adding a dbus_poststop() command similar to the one that DragonFly dports uses.

6) Older dbus seems to have expected the /var/run/dbus directory to have ownership ${DBUS_USER}:${DBUS_GROUP}.  That is no longer the case for current dbus that happily accepts defaults from /var/run such as root:root or root:wheel on newer Linux, DragonFly, or FreeBSD.  I therefore commented out the code setting ownership and permissions for /var/run/dbus but at least left it behind as a hint.

7) The code now checks for the existence of both /var/run/dbus and /var/db/dbus and creates them if they do not exist. 

8) I added the _SH extension to the FILE_SUBST variables in files/smf/dbus.sh for the new line:

		@CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir

Now for the changes to sysutils/dbus/Makefile

9) I added DBUS_USER, DBUS_GROUP, and DBUS_SYSTEM_PID_FILE to BUILD_DEFS to at least give installers a hint what to set in their etc/mk.conf if they want other than the defaults.  And as mentioned above, I changed the FILE_SUBST to variables with a _SH extension so that there was no chance of a clash with source code patterns of the same form.

10) I commented out the setting of a home directory for the DBUS_USER as it is nonexistent on newer systems.  I also added a call to create DBUS_USER and DBUS_GROUP before configure but that may not have been necessary.

11) I got rid of a construct playing with CONFIGURE_ARGS.var that grepping seemed to indicate exists nowhere else in pkgsrc.   Instead I rewrote everything to the usual
CONFIGURE_ARGS+=
format.

Finally I patched options.mk.

12) I added the option enable_in_rcvar so that dbus_enable could be set as the correct rcvar in dbus.sh.  It is the suggested option for newer DragonFly and FreeBSD, yet the flexibility is there to choose otherwise for older versions.

13) I again removed the unique CONFIGURE_ARGS.var constructs.


>How-To-Repeat:

>Fix:

--- mk/defaults/mk.conf.orig	2015-07-07 02:03:40.000000000 -0700
+++ mk/defaults/mk.conf	2015-07-21 16:32:47.084413000 -0700
@@ -787,16 +787,21 @@
 # Possible: any user name
 # Default: cyrus

-DBUS_GROUP?=	dbus
-# Used in the dbus package to specify the group to run dbus as
-# Possible: any group name
-# Default: dbus
-
 DBUS_USER?=	dbus
 # Used in the dbus package to specify the user to run dbus as
 # Possible: any user name
 # Default: dbus

+DBUS_GROUP?=	dbus
+# Used in the dbus package to specify the group to run dbus as
+# Possible: any group name but in practice equals ${DBUS_USER}
+# Default: dbus
+
+DBUS_SYSTEM_PID_FILE?=	pid	
+# Used in the dbus package to specify the name of the pid file 
+# Possible: any pid file name such as pid, messagebus.pid, or dbus.pid
+# Default: pid 
+
 DEFANG_GROUP?=	defang
 # Used in the mimedefang package to specify the group to run commands as
 # Possible: any group name

The remaining patches are to sysutils/dbus.

--- files/dbus.sh.orig	2015-07-20 22:18:07.000000000 -0700
+++ files/dbus.sh	2015-07-21 10:52:31.000000000 -0700
@@ -9,21 +9,33 @@
 . /etc/rc.subr

 name="dbus"
-rcvar=$name
+rcvar="@DBUS_RCVAR@"
 command="@PREFIX@/bin/dbus-daemon"
 command_args="--system"
-pidfile="@VARBASE@/run/dbus/pid"
-start_precmd=dbus_prestart
+pidfile="@VARBASE@/run/dbus/@DBUS_SYSTEM_PID_FILE_SH@"
+start_precmd="dbus_prestart"
+stop_postcmd="dbus_poststop"

 dbus_prestart() {
+	dbdir="@VARBASE@/db/dbus"
+	if @TEST@ ! -d $dbdir; then
+		@MKDIR@ $dbdir
+	fi
 	dir="@VARBASE@/run/dbus"
 	if @TEST@ ! -d $dir; then
 		@MKDIR@ $dir
-		@CHMOD@ 0755 $dir
-		@CHOWN@ @DBUS_USER@:@DBUS_GROUP@ $dir
+# On other systems /var/run/dbus root:wheel works fine
+#		@CHMOD@ 0755 $dir
+#		@CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
+	elif @TEST@ -f $pidfile; then
+		@RM@ -f $pidfile
 	fi
 	@PREFIX@/bin/dbus-uuidgen --ensure
 }

+dbus_poststop() {
+	@RM@ -f $pidfile
+}
+
 load_rc_config $name
 run_rc_command "$1"

--- Makefile.orig	2015-07-20 22:38:16.000000000 -0700
+++ Makefile	2015-07-21 12:21:44.000000000 -0700
@@ -19,7 +19,7 @@

 PKGCONFIG_OVERRIDE=	dbus-1.pc.in

-BUILD_DEFS+=		VARBASE
+BUILD_DEFS+=		VARBASE DBUS_USER DBUS_GROUP DBUS_SYSTEM_PID_FILE

 OWN_DIRS_PERMS+=	${VARBASE}/db/dbus ${DBUS_USER} ${DBUS_GROUP} 0755
 SPECIAL_PERMS+=		libexec/dbus-daemon-launch-helper ${REAL_ROOT_USER} ${DBUS_GROUP} 4511
@@ -34,21 +34,19 @@
 CONFIGURE_ARGS+=	--localstatedir=${VARBASE:Q}
 CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR:Q}

-CONFIGURE_ARGS_GROUPS=	enable disable with without
-
-.if ${OPSYS} == "Darwin"
+.if ${OPSYS} == "Darwin" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
 # Prevent the configure script from picking up a per-user tmp
 # directory. See the commit message on revision 1.35
-CONFIGURE_ARGS.with+=	session-socket-dir=/tmp
+CONFIGURE_ARGS+=	--with-session-socket-dir=/tmp
 .endif

-CONFIGURE_ARGS.Linux=	abstract-sockets selinux
+CONFIGURE_ARGS+=	--without-init-scripts
+CONFIGURE_ARGS+=	--disable-ansi
+CONFIGURE_ARGS+=	--disable-console-owner-file
+CONFIGURE_ARGS+=	--disable-doxygen-docs
+CONFIGURE_ARGS+=	--enable-checks
+CONFIGURE_ARGS+=	--enable-static

-CONFIGURE_ARGS.without+=	init-scripts
-CONFIGURE_ARGS.disable+=	ansi
-CONFIGURE_ARGS.disable+=	console-owner-file
-CONFIGURE_ARGS.disable+=	doxygen-docs
-CONFIGURE_ARGS.enable+=		checks static
 ###
 ### XXX the spawn test hangs, and some of these tests may be bogus
 ###
@@ -57,27 +55,21 @@
 #TEST_TARGET=			check
 #.endif

-CONFIGURE_ARGS.with+=	dbus-user=${DBUS_USER}
-CONFIGURE_ARGS.with+=	test-socket-dir=${WRKDIR:Q}
+CONFIGURE_ARGS+=	--with-dbus-user=${DBUS_USER}
+CONFIGURE_ARGS+=	--with-test-socket-dir=${WRKDIR:Q}
+CONFIGURE_ARGS+=	--with-system-pid-file=${VARBASE}/run/dbus/${DBUS_SYSTEM_PID_FILE}

 PTHREAD_AUTO_VARS=	yes

 .if ${OPSYS} == "Linux"
 PLIST.linux=		yes
 .else
-CONFIGURE_ARGS.disable+=\
-			${CONFIGURE_ARGS.Linux}
+CONFIGURE_ARGS+=	--disable-abstract-sockets
+CONFIGURE_ARGS+=	--disable-selinux
 .endif

 PLIST_VARS+=    	linux launchd

-CONFIGURE_ARGS+=\
-	${CONFIGURE_ARGS_GROUPS:@.g.@			\
-		${CONFIGURE_ARGS.${.g.}:@.a.@		\
-			--${.g.}-${.a.}			\
-		@}					\
-	@:M*}
-
 MAKE_DIRS=		${PKG_SYSCONFDIR}/dbus-1/event.d
 MAKE_DIRS+=		${PKG_SYSCONFDIR}/dbus-1/system.d
 MAKE_DIRS+=		${PKG_SYSCONFDIR}/dbus-1/session.d
@@ -94,10 +86,14 @@
 PKG_GROUPS=		${DBUS_GROUP}
 PKG_USERS=		${DBUS_USER}:${DBUS_GROUP}
 PKG_GECOS.${DBUS_USER}=	System message bus
-PKG_HOME.${DBUS_USER}=	${VARBASE}/run/dbus
+# Modern dbus does not need a home directory for its user
+# PKG_HOME.${DBUS_USER}=	${VARBASE}/run/dbus
+
+USERGROUP_PHASE=	configure

-FILES_SUBST+=		DBUS_USER=${DBUS_USER}
-FILES_SUBST+=		DBUS_GROUP=${DBUS_GROUP}
+FILES_SUBST+=		DBUS_USER_SH=${DBUS_USER}
+FILES_SUBST+=		DBUS_GROUP_SH=${DBUS_GROUP}
+FILES_SUBST+=		DBUS_SYSTEM_PID_FILE_SH=${DBUS_SYSTEM_PID_FILE}

 BUILDLINK_TRANSFORM+=	rm:-Wl,--gc-sections
 # Package tries to use these if gcc accepts them, but that doesn't

Finally option.mk:

--- options.mk.orig	2015-07-20 22:45:00.000000000 -0700
+++ options.mk	2015-07-21 09:11:37.000000000 -0700
@@ -1,9 +1,13 @@
 # $NetBSD: options.mk,v 1.8 2015/01/21 13:45:18 pho Exp $

 PKG_OPTIONS_VAR=	PKG_OPTIONS.dbus
-PKG_SUPPORTED_OPTIONS+=	debug x11
+PKG_SUPPORTED_OPTIONS+=	debug x11 enable_in_rcvar
 PKG_SUGGESTED_OPTIONS=	x11

+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= enable_in_rcvar	
+.endif
+
 .if (${OPSYS} == "NetBSD"  ||	\
      ${OPSYS} == "FreeBSD" ||	\
      ${OPSYS} == "OpenBSD" ||	\
@@ -22,31 +26,41 @@
 .include "../../mk/bsd.options.mk"

 .if !empty(PKG_OPTIONS:Mdebug)
-CONFIGURE_ARGS.enable+=	asserts verbose-mode
+CONFIGURE_ARGS+=	--enable-asserts
+CONFIGURE_ARGS+=	--enable-verbose-mode
 .else
-CONFIGURE_ARGS.disable+= asserts verbose-mode
+CONFIGURE_ARGS+=	--disable-asserts
+CONFIGURE_ARGS+=	--disable-verbose-mode
 .endif

 .if !empty(PKG_OPTIONS:Mkqueue)
-CONFIGURE_ARGS.enable+= 	kqueue
+CONFIGURE_ARGS+= 	--enable-kqueue
 .else
-CONFIGURE_ARGS.disable+=	kqueue
+CONFIGURE_ARGS+=	--disable-kqueue
 .endif

 .if !empty(PKG_OPTIONS:Mx11)
-CONFIGURE_ARGS.with+=	x
+CONFIGURE_ARGS+=	--with-x
 .  include "../../x11/libX11/buildlink3.mk"
 BUILDLINK_DEPMETHOD.libXt=	build
 .  include "../../x11/libXt/buildlink3.mk"
 .else
-CONFIGURE_ARGS.without=	x
+CONFIGURE_ARGS=		--without-x
 .endif

 .if !empty(PKG_OPTIONS:Mlaunchd)
 MESSAGE_SRC+=			MESSAGE.launchd
 PLIST.launchd=			yes
-CONFIGURE_ARGS.enable+=		launchd
-CONFIGURE_ARGS.with+=		launchd-agent-dir=${PREFIX}/Library/LaunchAgents
+CONFIGURE_ARGS+=		--enable-launchd
+CONFIGURE_ARGS+=		--with-launchd-agent-dir=${PREFIX}/Library/LaunchAgents
+.else
+CONFIGURE_ARGS+=		--disable-launchd
+.endif
+
+.if !empty(PKG_OPTIONS:Menable_in_rcvar)
+DBUS_RCVAR=		dbus_enable
 .else
-CONFIGURE_ARGS.disable+=	launchd
+DBUS_RCVAR=		dbus
 .endif
+
+FILES_SUBST+=		DBUS_RCVAR=${DBUS_RCVAR}


>Release-Note:

>Audit-Trail:
From: Richard PALO <richard@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/50075: Making dbus actually work on FreeBSD, DragonFly, and
 probably more
Date: Wed, 22 Jul 2015 09:55:54 +0200

 Le 22/07/15 03:05, davshao@gmail.com a écrit :
 >> Number:         50075
 >> Category:       pkg
 >> Synopsis:       Making dbus actually work on FreeBSD, DragonFly, and probably more
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       medium
 >> Responsible:    pkg-manager
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Wed Jul 22 01:05:00 +0000 2015
 >> Originator:     David Shao
 >> Release:        pkgsrc current
 >> Organization:
 >> Environment:
 > DragonFly  4.3-DEVELOPMENT DragonFly v4.2.2.81.g7432b-DEVELOPMENT #4: Tue Jul 21 13:55:40 PDT 2015     xxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64
 > 
 >> Description:
 > I have found the following patches to be essential for getting dbus to finally work on DragonFly, FreeBSD, and possibly other OSes.  The functionality has been verified on DragonFly 4.3 DEVELOPMENT and FreeBSD 10.1 release to enable the latest Xfce4 desktop to start and be usable.  As my experience has been dbus as it is builds but does not function even on NetBSD, I argue the following patches should be committed so that dbus works on something and enables an up-to-date desktop on DragonFly and FreeBSD.
 > 
 > That being said I acknowledge it is possible I have made an error and broken working dbus on Darwin or in the smf code, so please reply with corrections.
 > 
 > The following changes are to mk/defaults/mk.conf.
 > 
 > 1) The pid file for dbus in /var/run/dbus can have different names, anything from messagebus.pid to dbus.pid on DragonFly and FreeBSD to the default name of pid.  DBUS_SYSTEM_PID_FILE allows the installer to customize this pid file name.
 > 
 > 2) The new mk.conf also notes that in practice DBUS_USER and DBUS_GROUP are the same value.
 > 
 > The script dbus that starts the dbus daemon is generated using FILE_SUBST from files/dbus.sh and from smf/files/dbus.sh. 
 > 
 > 3) For newer DragonFly and FreeBSD the rcvar name used to invoke dbus in /etc/rc.conf has incorrect default of dbus, whereas it should be dbus_enable.  Therefore @DBUS_RCVAR@ is introduced to pass the correct name.  
 > 
 > 4) The pid file name is passed through @DBUS_SYSTEM_PID_FILE_SH@.  I did not want to use FILE_SUBST directly on variables such as DBUS_SYSTEM_PID_FILE because the source code for dbus seems to originally have its own @DBUS_USER@ patterns. Thus the _SH extension for DBUS_SYSTEM_PID_FILE_SH.
 > 
 > 5) The original dbus.sh neither removes the pid file when dbus is stopped nor checks if a stale one exists before it starts.  I added a check for both, including adding a dbus_poststop() command similar to the one that DragonFly dports uses.
 > 
 > 6) Older dbus seems to have expected the /var/run/dbus directory to have ownership ${DBUS_USER}:${DBUS_GROUP}.  That is no longer the case for current dbus that happily accepts defaults from /var/run such as root:root or root:wheel on newer Linux, DragonFly, or FreeBSD.  I therefore commented out the code setting ownership and permissions for /var/run/dbus but at least left it behind as a hint.
 > 
 > 7) The code now checks for the existence of both /var/run/dbus and /var/db/dbus and creates them if they do not exist. 
 > 
 > 8) I added the _SH extension to the FILE_SUBST variables in files/smf/dbus.sh for the new line:
 > 
 > 		@CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
 > 
 > Now for the changes to sysutils/dbus/Makefile
 > 
 > 9) I added DBUS_USER, DBUS_GROUP, and DBUS_SYSTEM_PID_FILE to BUILD_DEFS to at least give installers a hint what to set in their etc/mk.conf if they want other than the defaults.  And as mentioned above, I changed the FILE_SUBST to variables with a _SH extension so that there was no chance of a clash with source code patterns of the same form.
 > 
 > 10) I commented out the setting of a home directory for the DBUS_USER as it is nonexistent on newer systems.  I also added a call to create DBUS_USER and DBUS_GROUP before configure but that may not have been necessary.
 > 
 > 11) I got rid of a construct playing with CONFIGURE_ARGS.var that grepping seemed to indicate exists nowhere else in pkgsrc.   Instead I rewrote everything to the usual
 > CONFIGURE_ARGS+=
 > format.
 > 
 > Finally I patched options.mk.
 > 
 > 12) I added the option enable_in_rcvar so that dbus_enable could be set as the correct rcvar in dbus.sh.  It is the suggested option for newer DragonFly and FreeBSD, yet the flexibility is there to choose otherwise for older versions.
 > 
 > 13) I again removed the unique CONFIGURE_ARGS.var constructs.
 > 
 > 
 >> How-To-Repeat:
 > 
 >> Fix:
 > 
 > --- mk/defaults/mk.conf.orig	2015-07-07 02:03:40.000000000 -0700
 > +++ mk/defaults/mk.conf	2015-07-21 16:32:47.084413000 -0700
 > @@ -787,16 +787,21 @@
 >  # Possible: any user name
 >  # Default: cyrus
 >  
 > -DBUS_GROUP?=	dbus
 > -# Used in the dbus package to specify the group to run dbus as
 > -# Possible: any group name
 > -# Default: dbus
 > -
 >  DBUS_USER?=	dbus
 >  # Used in the dbus package to specify the user to run dbus as
 >  # Possible: any user name
 >  # Default: dbus
 >  
 > +DBUS_GROUP?=	dbus
 > +# Used in the dbus package to specify the group to run dbus as
 > +# Possible: any group name but in practice equals ${DBUS_USER}
 > +# Default: dbus
 > +
 > +DBUS_SYSTEM_PID_FILE?=	pid	
 > +# Used in the dbus package to specify the name of the pid file 
 > +# Possible: any pid file name such as pid, messagebus.pid, or dbus.pid
 > +# Default: pid 
 > +
 >  DEFANG_GROUP?=	defang
 >  # Used in the mimedefang package to specify the group to run commands as
 >  # Possible: any group name
 > 
 > The remaining patches are to sysutils/dbus.
 > 
 > --- files/dbus.sh.orig	2015-07-20 22:18:07.000000000 -0700
 > +++ files/dbus.sh	2015-07-21 10:52:31.000000000 -0700
 > @@ -9,21 +9,33 @@
 >  . /etc/rc.subr
 >  
 >  name="dbus"
 > -rcvar=$name
 > +rcvar="@DBUS_RCVAR@"
 >  command="@PREFIX@/bin/dbus-daemon"
 >  command_args="--system"
 > -pidfile="@VARBASE@/run/dbus/pid"
 > -start_precmd=dbus_prestart
 > +pidfile="@VARBASE@/run/dbus/@DBUS_SYSTEM_PID_FILE_SH@"
 > +start_precmd="dbus_prestart"
 > +stop_postcmd="dbus_poststop"
 >  
 >  dbus_prestart() {
 > +	dbdir="@VARBASE@/db/dbus"
 > +	if @TEST@ ! -d $dbdir; then
 > +		@MKDIR@ $dbdir
 > +	fi
 >  	dir="@VARBASE@/run/dbus"
 >  	if @TEST@ ! -d $dir; then
 >  		@MKDIR@ $dir
 > -		@CHMOD@ 0755 $dir
 > -		@CHOWN@ @DBUS_USER@:@DBUS_GROUP@ $dir
 > +# On other systems /var/run/dbus root:wheel works fine
 > +#		@CHMOD@ 0755 $dir
 > +#		@CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
 > +	elif @TEST@ -f $pidfile; then
 > +		@RM@ -f $pidfile
 >  	fi
 >  	@PREFIX@/bin/dbus-uuidgen --ensure
 >  }
 >  
 > +dbus_poststop() {
 > +	@RM@ -f $pidfile
 > +}
 > +
 >  load_rc_config $name
 >  run_rc_command "$1"
 > 
 > --- Makefile.orig	2015-07-20 22:38:16.000000000 -0700
 > +++ Makefile	2015-07-21 12:21:44.000000000 -0700
 > @@ -19,7 +19,7 @@
 >  
 >  PKGCONFIG_OVERRIDE=	dbus-1.pc.in
 >  
 > -BUILD_DEFS+=		VARBASE
 > +BUILD_DEFS+=		VARBASE DBUS_USER DBUS_GROUP DBUS_SYSTEM_PID_FILE
 >  
 >  OWN_DIRS_PERMS+=	${VARBASE}/db/dbus ${DBUS_USER} ${DBUS_GROUP} 0755
 >  SPECIAL_PERMS+=		libexec/dbus-daemon-launch-helper ${REAL_ROOT_USER} ${DBUS_GROUP} 4511
 > @@ -34,21 +34,19 @@
 >  CONFIGURE_ARGS+=	--localstatedir=${VARBASE:Q}
 >  CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR:Q}
 >  
 > -CONFIGURE_ARGS_GROUPS=	enable disable with without
 > -
 > -.if ${OPSYS} == "Darwin"
 > +.if ${OPSYS} == "Darwin" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
 >  # Prevent the configure script from picking up a per-user tmp
 >  # directory. See the commit message on revision 1.35
 > -CONFIGURE_ARGS.with+=	session-socket-dir=/tmp
 > +CONFIGURE_ARGS+=	--with-session-socket-dir=/tmp
 >  .endif
 >  
 > -CONFIGURE_ARGS.Linux=	abstract-sockets selinux
 > +CONFIGURE_ARGS+=	--without-init-scripts
 > +CONFIGURE_ARGS+=	--disable-ansi
 > +CONFIGURE_ARGS+=	--disable-console-owner-file
 > +CONFIGURE_ARGS+=	--disable-doxygen-docs
 > +CONFIGURE_ARGS+=	--enable-checks
 > +CONFIGURE_ARGS+=	--enable-static
 >  
 > -CONFIGURE_ARGS.without+=	init-scripts
 > -CONFIGURE_ARGS.disable+=	ansi
 > -CONFIGURE_ARGS.disable+=	console-owner-file
 > -CONFIGURE_ARGS.disable+=	doxygen-docs
 > -CONFIGURE_ARGS.enable+=		checks static
 >  ###
 >  ### XXX the spawn test hangs, and some of these tests may be bogus
 >  ###
 > @@ -57,27 +55,21 @@
 >  #TEST_TARGET=			check
 >  #.endif
 >  
 > -CONFIGURE_ARGS.with+=	dbus-user=${DBUS_USER}
 > -CONFIGURE_ARGS.with+=	test-socket-dir=${WRKDIR:Q}
 > +CONFIGURE_ARGS+=	--with-dbus-user=${DBUS_USER}
 > +CONFIGURE_ARGS+=	--with-test-socket-dir=${WRKDIR:Q}
 > +CONFIGURE_ARGS+=	--with-system-pid-file=${VARBASE}/run/dbus/${DBUS_SYSTEM_PID_FILE}
 >  
 >  PTHREAD_AUTO_VARS=	yes
 >  
 >  .if ${OPSYS} == "Linux"
 >  PLIST.linux=		yes
 >  .else
 > -CONFIGURE_ARGS.disable+=\
 > -			${CONFIGURE_ARGS.Linux}
 > +CONFIGURE_ARGS+=	--disable-abstract-sockets
 > +CONFIGURE_ARGS+=	--disable-selinux
 >  .endif
 >  
 >  PLIST_VARS+=    	linux launchd
 >  
 > -CONFIGURE_ARGS+=\
 > -	${CONFIGURE_ARGS_GROUPS:@.g.@			\
 > -		${CONFIGURE_ARGS.${.g.}:@.a.@		\
 > -			--${.g.}-${.a.}			\
 > -		@}					\
 > -	@:M*}
 > -
 >  MAKE_DIRS=		${PKG_SYSCONFDIR}/dbus-1/event.d
 >  MAKE_DIRS+=		${PKG_SYSCONFDIR}/dbus-1/system.d
 >  MAKE_DIRS+=		${PKG_SYSCONFDIR}/dbus-1/session.d
 > @@ -94,10 +86,14 @@
 >  PKG_GROUPS=		${DBUS_GROUP}
 >  PKG_USERS=		${DBUS_USER}:${DBUS_GROUP}
 >  PKG_GECOS.${DBUS_USER}=	System message bus
 > -PKG_HOME.${DBUS_USER}=	${VARBASE}/run/dbus
 > +# Modern dbus does not need a home directory for its user
 > +# PKG_HOME.${DBUS_USER}=	${VARBASE}/run/dbus
 > +
 > +USERGROUP_PHASE=	configure
 >  
 > -FILES_SUBST+=		DBUS_USER=${DBUS_USER}
 > -FILES_SUBST+=		DBUS_GROUP=${DBUS_GROUP}
 > +FILES_SUBST+=		DBUS_USER_SH=${DBUS_USER}
 > +FILES_SUBST+=		DBUS_GROUP_SH=${DBUS_GROUP}
 > +FILES_SUBST+=		DBUS_SYSTEM_PID_FILE_SH=${DBUS_SYSTEM_PID_FILE}
 >  
 >  BUILDLINK_TRANSFORM+=	rm:-Wl,--gc-sections
 >  # Package tries to use these if gcc accepts them, but that doesn't
 > 
 > Finally option.mk:
 > 
 > --- options.mk.orig	2015-07-20 22:45:00.000000000 -0700
 > +++ options.mk	2015-07-21 09:11:37.000000000 -0700
 > @@ -1,9 +1,13 @@
 >  # $NetBSD: options.mk,v 1.8 2015/01/21 13:45:18 pho Exp $
 >  
 >  PKG_OPTIONS_VAR=	PKG_OPTIONS.dbus
 > -PKG_SUPPORTED_OPTIONS+=	debug x11
 > +PKG_SUPPORTED_OPTIONS+=	debug x11 enable_in_rcvar
 >  PKG_SUGGESTED_OPTIONS=	x11
 >  
 > +.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
 > +PKG_SUGGESTED_OPTIONS+= enable_in_rcvar	
 > +.endif
 > +
 >  .if (${OPSYS} == "NetBSD"  ||	\
 >       ${OPSYS} == "FreeBSD" ||	\
 >       ${OPSYS} == "OpenBSD" ||	\
 > @@ -22,31 +26,41 @@
 >  .include "../../mk/bsd.options.mk"
 >  
 >  .if !empty(PKG_OPTIONS:Mdebug)
 > -CONFIGURE_ARGS.enable+=	asserts verbose-mode
 > +CONFIGURE_ARGS+=	--enable-asserts
 > +CONFIGURE_ARGS+=	--enable-verbose-mode
 >  .else
 > -CONFIGURE_ARGS.disable+= asserts verbose-mode
 > +CONFIGURE_ARGS+=	--disable-asserts
 > +CONFIGURE_ARGS+=	--disable-verbose-mode
 >  .endif
 >  
 >  .if !empty(PKG_OPTIONS:Mkqueue)
 > -CONFIGURE_ARGS.enable+= 	kqueue
 > +CONFIGURE_ARGS+= 	--enable-kqueue
 >  .else
 > -CONFIGURE_ARGS.disable+=	kqueue
 > +CONFIGURE_ARGS+=	--disable-kqueue
 >  .endif
 >  
 >  .if !empty(PKG_OPTIONS:Mx11)
 > -CONFIGURE_ARGS.with+=	x
 > +CONFIGURE_ARGS+=	--with-x
 >  .  include "../../x11/libX11/buildlink3.mk"
 >  BUILDLINK_DEPMETHOD.libXt=	build
 >  .  include "../../x11/libXt/buildlink3.mk"
 >  .else
 > -CONFIGURE_ARGS.without=	x
 > +CONFIGURE_ARGS=		--without-x
 >  .endif
 >  
 >  .if !empty(PKG_OPTIONS:Mlaunchd)
 >  MESSAGE_SRC+=			MESSAGE.launchd
 >  PLIST.launchd=			yes
 > -CONFIGURE_ARGS.enable+=		launchd
 > -CONFIGURE_ARGS.with+=		launchd-agent-dir=${PREFIX}/Library/LaunchAgents
 > +CONFIGURE_ARGS+=		--enable-launchd
 > +CONFIGURE_ARGS+=		--with-launchd-agent-dir=${PREFIX}/Library/LaunchAgents
 > +.else
 > +CONFIGURE_ARGS+=		--disable-launchd
 > +.endif
 > +
 > +.if !empty(PKG_OPTIONS:Menable_in_rcvar)
 > +DBUS_RCVAR=		dbus_enable
 >  .else
 > -CONFIGURE_ARGS.disable+=	launchd
 > +DBUS_RCVAR=		dbus
 >  .endif
 > +
 > +FILES_SUBST+=		DBUS_RCVAR=${DBUS_RCVAR}
 > 
 > 
 > 

 see discussion "DBUS home fouled up" from 14/09/2014 on pkgsrc-users@

 -- 
 Richard PALO

From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50075: Making dbus actually work on FreeBSD, DragonFly, and
 probably more
Date: Thu, 23 Jul 2015 21:09:36 -0700

 On Wed, Jul 22, 2015 at 1:05 AM, Richard PALO <richard@netbsd.org> wrote:
 > The following reply was made to PR pkg/50075; it has been noted by GNATS.
 >
 > From: Richard PALO <richard@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: pkg/50075: Making dbus actually work on FreeBSD, DragonFly, and
 >  probably more
 > Date: Wed, 22 Jul 2015 09:55:54 +0200

 >
 >  see discussion "DBUS home fouled up" from 14/09/2014 on pkgsrc-users@
 >
 >  --
 >  Richard PALO

 These days I do not think that systems using /var/run/dbus and
 /var/db/dbus versus those that wish to have these directories in user
 space can share the same dbus shell script to manage the dbus daemon,
 which is just as well since there are already two dbus.sh files.  As
 opposed to old days when one would see instructions to set the user
 and group ownership of /var/run/dbus, these days systems are happy
 with the default root:root or root:wheel.  Thus for these use cases
 the code to set ownership and permissions needs to be commented out.
 But there is another smf/dbus.sh file to retain this flexibility if
 needed.

 But to summarize the big picture from my perspective, without
 something similar to these patches, which at least don't further touch
 the original dbus source code, there is no Xfce4 functionality on
 either FreeBSD 10.1 or DragonFly using pkgsrc.  Actually there is an
 inaccurate error message complaining about ConsoleKit when all that is
 really needed is a functioning dbus.

Responsible-Changed-From-To: pkg-manager->gdt
Responsible-Changed-By: gdt@NetBSD.org
Responsible-Changed-When: Tue, 25 Aug 2015 13:17:28 +0000
Responsible-Changed-Why:
Because the responsible field changed....


From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and
 probably more)
Date: Mon, 7 Sep 2015 16:10:50 -0700

 As requested I am breaking the proposed changes to dbus into separate
 more easy to understand pieces.  The following patch changes the
 CONFIGURE_ARGS format to a more usual one.  There should be no
 functional changes.

 I have only verified this builds but have not installed it because
 without further patches dbus won't actually start as a daemon on
 DragonFly or FreeBSD.

 diff -Nurb dbus.orig/Makefile dbus.configure/Makefile
 --- dbus.orig/Makefile    2015-08-30 08:08:00.000000000 -0700
 +++ dbus.configure/Makefile    2015-09-07 15:42:01.358482000 -0700
 @@ -37,16 +37,16 @@
  .if ${OPSYS} == "Darwin"
  # Prevent the configure script from picking up a per-user tmp
  # directory. See the commit message on revision 1.35
 -CONFIGURE_ARGS.with+=    session-socket-dir=/tmp
 +CONFIGURE_ARGS+=    --with-session-socket-dir=/tmp
  .endif

 -CONFIGURE_ARGS.Linux=    abstract-sockets selinux
 +CONFIGURE_ARGS+=    --without-init-scripts
 +CONFIGURE_ARGS+=    --disable-ansi
 +CONFIGURE_ARGS+=    --disable-console-owner-file
 +CONFIGURE_ARGS+=    --disable-doxygen-docs
 +CONFIGURE_ARGS+=    --enable-checks
 +CONFIGURE_ARGS+=    --enable-static

 -CONFIGURE_ARGS.without+=    init-scripts
 -CONFIGURE_ARGS.disable+=    ansi
 -CONFIGURE_ARGS.disable+=    console-owner-file
 -CONFIGURE_ARGS.disable+=    doxygen-docs
 -CONFIGURE_ARGS.enable+=        checks static
  ###
  ### XXX the spawn test hangs, and some of these tests may be bogus
  ###
 @@ -55,27 +55,20 @@
  #TEST_TARGET=            check
  #.endif

 -CONFIGURE_ARGS.with+=    dbus-user=${DBUS_USER}
 -CONFIGURE_ARGS.with+=    test-socket-dir=${WRKDIR:Q}
 +CONFIGURE_ARGS+=    --with-dbus-user=${DBUS_USER}
 +CONFIGURE_ARGS+=    --with-test-socket-dir=${WRKDIR:Q}

  PTHREAD_AUTO_VARS=    yes

  .if ${OPSYS} == "Linux"
  PLIST.linux=        yes
  .else
 -CONFIGURE_ARGS.disable+=\
 -            ${CONFIGURE_ARGS.Linux}
 +CONFIGURE_ARGS+=    --disable-abstract-sockets
 +CONFIGURE_ARGS+=    --disable-selinux
  .endif

  PLIST_VARS+=        linux launchd

 -CONFIGURE_ARGS+=\
 -    ${CONFIGURE_ARGS_GROUPS:@.g.@            \
 -        ${CONFIGURE_ARGS.${.g.}:@.a.@        \
 -            --${.g.}-${.a.}            \
 -        @}                    \
 -    @:M*}
 -
  RCD_SCRIPTS=        dbus

  PKG_GROUPS_VARS+=    DBUS_GROUP
 diff -Nurb dbus.orig/options.mk dbus.configure/options.mk
 --- dbus.orig/options.mk    2015-01-21 05:45:18.000000000 -0800
 +++ dbus.configure/options.mk    2015-09-07 15:57:18.857258000 -0700
 @@ -22,31 +22,33 @@
  .include "../../mk/bsd.options.mk"

  .if !empty(PKG_OPTIONS:Mdebug)
 -CONFIGURE_ARGS.enable+=    asserts verbose-mode
 +CONFIGURE_ARGS+=    --enable-asserts
 +CONFIGURE_ARGS+=    --enable-verbose-mode
  .else
 -CONFIGURE_ARGS.disable+= asserts verbose-mode
 +CONFIGURE_ARGS+=    --disable-asserts
 +CONFIGURE_ARGS+=    --disable-verbose-mode
  .endif

  .if !empty(PKG_OPTIONS:Mkqueue)
 -CONFIGURE_ARGS.enable+=     kqueue
 +CONFIGURE_ARGS+=     --enable-kqueue
  .else
 -CONFIGURE_ARGS.disable+=    kqueue
 +CONFIGURE_ARGS+=    --disable-kqueue
  .endif

  .if !empty(PKG_OPTIONS:Mx11)
 -CONFIGURE_ARGS.with+=    x
 +CONFIGURE_ARGS+=    --with-x
  .  include "../../x11/libX11/buildlink3.mk"
  BUILDLINK_DEPMETHOD.libXt=    build
  .  include "../../x11/libXt/buildlink3.mk"
  .else
 -CONFIGURE_ARGS.without=    x
 +CONFIGURE_ARGS=        --without-x
  .endif

  .if !empty(PKG_OPTIONS:Mlaunchd)
  MESSAGE_SRC+=            MESSAGE.launchd
  PLIST.launchd=            yes
 -CONFIGURE_ARGS.enable+=        launchd
 -CONFIGURE_ARGS.with+=        launchd-agent-dir=${PREFIX}/Library/LaunchAgents
 +CONFIGURE_ARGS+=        --enable-launchd
 +CONFIGURE_ARGS+=        --with-launchd-agent-dir=${PREFIX}/Library/LaunchAgents
  .else
 -CONFIGURE_ARGS.disable+=    launchd
 +CONFIGURE_ARGS+=        --disable-launchd
  .endif

From: "Greg Troxel" <gdt@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50075 CVS commit: pkgsrc/sysutils/dbus
Date: Mon, 7 Sep 2015 23:24:46 +0000

 Module Name:	pkgsrc
 Committed By:	gdt
 Date:		Mon Sep  7 23:24:46 UTC 2015

 Modified Files:
 	pkgsrc/sysutils/dbus: Makefile options.mk

 Log Message:
 Remove CONFIGURE_ARGS.enable scheme, in favor of normal
 CONFIGURE_ARGS.  No functional change intended, so no PKGREVISION++.
 From David Shao via PR pkg/50075 and private followup.


 To generate a diff of this commit:
 cvs rdiff -u -r1.86 -r1.87 pkgsrc/sysutils/dbus/Makefile
 cvs rdiff -u -r1.8 -r1.9 pkgsrc/sysutils/dbus/options.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and
 probably more)
Date: Mon, 7 Sep 2015 18:07:00 -0700

 The following patches enable the dbus daemon to even be started from
 /etc/rc.conf on DragonFly 4.3-DEVELOPMENT and at least recent FreeBSD,
 because the daemon is started using

 dbus_enable="YES"

 and not

 dbus="YES"

 An option enable-in-rcvar may be useful for other daemons on DragonFly
 and FreeBSD.


 diff -Nurb dbus.configure/files/dbus.sh dbus.rcvar/files/dbus.sh
 --- dbus.configure/files/dbus.sh    2008-10-11 12:58:24.000000000 -0700
 +++ dbus.rcvar/files/dbus.sh    2015-09-07 16:39:16.527612000 -0700
 @@ -9,7 +9,7 @@
  . /etc/rc.subr

  name="dbus"
 -rcvar=$name
 +rcvar="@DBUS_RCVAR@"
  command="@PREFIX@/bin/dbus-daemon"
  command_args="--system"
  pidfile="@VARBASE@/run/dbus/pid"
 diff -Nurb dbus.configure/options.mk dbus.rcvar/options.mk
 --- dbus.configure/options.mk    2015-09-07 15:57:18.857258000 -0700
 +++ dbus.rcvar/options.mk    2015-09-07 17:16:36.756745000 -0700
 @@ -1,9 +1,13 @@
  # $NetBSD: options.mk,v 1.8 2015/01/21 13:45:18 pho Exp $

  PKG_OPTIONS_VAR=    PKG_OPTIONS.dbus
 -PKG_SUPPORTED_OPTIONS+=    debug x11
 +PKG_SUPPORTED_OPTIONS+=    debug x11 enable-in-rcvar
  PKG_SUGGESTED_OPTIONS=    x11

 +.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
 +PKG_SUGGESTED_OPTIONS+= enable-in-rcvar
 +.endif
 +
  .if (${OPSYS} == "NetBSD"  ||    \
       ${OPSYS} == "FreeBSD" ||    \
       ${OPSYS} == "OpenBSD" ||    \
 @@ -52,3 +56,12 @@
  .else
  CONFIGURE_ARGS+=        --disable-launchd
  .endif
 +
 +
 +.if !empty(PKG_OPTIONS:Menable-in-rcvar)
 +DBUS_RCVAR=        dbus_enable
 +.else
 +DBUS_RCVAR=        dbus
 +.endif
 +
 +FILES_SUBST+=        DBUS_RCVAR=${DBUS_RCVAR}

 --- options.description.orig    2015-09-07 06:15:43.524230000 -0700
 +++ options.description    2015-09-07 17:13:09.809320000 -0700
 @@ -156,6 +156,7 @@
  elinks-root-exec    Allow elinks to run as root.
  emacs-w3m        W3m browser extention.
  embedded-server        Enable embedded server support for MySQL.
 +enable-in-rcvar        Daemon started in rc.conf by ${daemon}_enable="YES"
  enchant            Add spell checking support using enchant.
  enchant-zemberek    Add spell checking support for Turkish.
  epoll            Enable support for epoll I/O event notification facility.

From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and
 probably more)
Date: Mon, 7 Sep 2015 20:40:56 -0700

 The following patches allow the user in mk.conf to specify using
 DBUS_USER
 DBUS_GROUP
 DBUS_SYSTEM_PID_FILE
 the value of all of these for dbus.  Dbus needs this flexibility
 because for example on various systems DBUS_SYSTEM_PID_FILE can be any
 of pid, dbus.pid, or messagebus.pid.

 I found myself forced to make two controversial decisions.  One was to
 replace the substitution variables for files in subdirectory /files by
 adding a _SH suffix to them to produce

 DBUS_USER_SH
 DBUS_GROUP_SH
 DBUS_SYSTEM_PID_FILE_SH

 The reason I did this was to leave no chance of conflicting with
 dbus's own substitution variables, @DBUS_USER@ and
 @DBUS_SYSTEM_PID_FILE@, and dbus has its own configure options
 allowing them to be set.

 Unfortunately replacing these file substitution variables required
 making two changes to files under subdirectory /files/smf.

 diff -Nurb dbus.rcvar/Makefile dbus.user/Makefile
 --- dbus.rcvar/Makefile    2015-09-07 15:42:01.358482000 -0700
 +++ dbus.user/Makefile    2015-09-07 18:52:16.625900000 -0700
 @@ -18,7 +18,7 @@

  PKGCONFIG_OVERRIDE=    dbus-1.pc.in

 -BUILD_DEFS+=        VARBASE
 +BUILD_DEFS+=        VARBASE DBUS_USER DBUS_GROUP DBUS_SYSTEM_PID_FILE

  OWN_DIRS_PERMS+=    ${VARBASE}/db/dbus ${DBUS_USER} ${DBUS_GROUP} 0755
  SPECIAL_PERMS+=        libexec/dbus-daemon-launch-helper
 ${REAL_ROOT_USER} ${DBUS_GROUP} 4511
 @@ -57,6 +57,7 @@

  CONFIGURE_ARGS+=    --with-dbus-user=${DBUS_USER}
  CONFIGURE_ARGS+=    --with-test-socket-dir=${WRKDIR:Q}
 +CONFIGURE_ARGS+=
 --with-system-pid-file=${VARBASE}/run/dbus/${DBUS_SYSTEM_PID_FILE}

  PTHREAD_AUTO_VARS=    yes

 @@ -79,8 +80,9 @@
  PKG_GECOS.${DBUS_USER}=    System message bus
  PKG_HOME.${DBUS_USER}=    ${VARBASE}/run/dbus

 -FILES_SUBST+=        DBUS_USER=${DBUS_USER}
 -FILES_SUBST+=        DBUS_GROUP=${DBUS_GROUP}
 +FILES_SUBST+=        DBUS_USER_SH=${DBUS_USER}
 +FILES_SUBST+=        DBUS_GROUP_SH=${DBUS_GROUP}
 +FILES_SUBST+=        DBUS_SYSTEM_PID_FILE_SH=${DBUS_SYSTEM_PID_FILE}

  BUILDLINK_TRANSFORM+=    rm:-Wl,--gc-sections
  # Package tries to use these if gcc accepts them, but that doesn't
 diff -Nurb dbus.rcvar/files/dbus.sh dbus.user/files/dbus.sh
 --- dbus.rcvar/files/dbus.sh    2015-09-07 16:39:16.527612000 -0700
 +++ dbus.user/files/dbus.sh    2015-09-07 19:10:12.806257000 -0700
 @@ -12,7 +12,7 @@
  rcvar="@DBUS_RCVAR@"
  command="@PREFIX@/bin/dbus-daemon"
  command_args="--system"
 -pidfile="@VARBASE@/run/dbus/pid"
 +pidfile="@VARBASE@/run/dbus/@DBUS_SYSTEM_PID_FILE_SH@"
  start_precmd=dbus_prestart

  dbus_prestart() {
 @@ -20,7 +20,7 @@
      if @TEST@ ! -d $dir; then
          @MKDIR@ $dir
          @CHMOD@ 0755 $dir
 -        @CHOWN@ @DBUS_USER@:@DBUS_GROUP@ $dir
 +        @CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
      fi
      @PREFIX@/bin/dbus-uuidgen --ensure
  }
 diff -Nurb dbus.rcvar/files/smf/dbus.sh dbus.user/files/smf/dbus.sh
 --- dbus.rcvar/files/smf/dbus.sh    2015-07-05 08:21:50.000000000 -0700
 +++ dbus.user/files/smf/dbus.sh    2015-09-07 18:40:30.704480000 -0700
 @@ -20,7 +20,7 @@
      if ! [ -d $dir ]; then
          @MKDIR@ $dir
          @CHMOD@ 0755 $dir
 -        @CHOWN@ @DBUS_USER@:@DBUS_GROUP@ $dir
 +        @CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
      elif [ -f $pidfile ]; then
          rm -f $pidfile
      fi
 diff -Nurb dbus.rcvar/files/smf/manifest.xml dbus.user/files/smf/manifest.xml
 --- dbus.rcvar/files/smf/manifest.xml    2015-07-05 08:21:50.000000000 -0700
 +++ dbus.user/files/smf/manifest.xml    2015-09-07 19:10:57.715712000 -0700
 @@ -19,7 +19,7 @@
          exec='@PREFIX@/@SMF_METHOD_FILE.dbus@ start'
          timeout_seconds='30'>
          <method_context>
 -            <method_credential user='root' group='@DBUS_GROUP@' />
 +            <method_credential user='root' group='@DBUS_GROUP_SH@' />
          </method_context>
      </exec_method>
      <exec_method

 --- mk.conf.orig    2015-09-07 16:58:33.690220000 -0700
 +++ mk.conf    2015-09-07 20:12:57.900641000 -0700
 @@ -803,16 +803,21 @@
  # Possible: any user name
  # Default: cyrus

 -DBUS_GROUP?=    dbus
 -# Used in the dbus package to specify the group to run dbus as
 -# Possible: any group name
 -# Default: dbus
 -
  DBUS_USER?=    dbus
  # Used in the dbus package to specify the user to run dbus as
  # Possible: any user name
  # Default: dbus

 +DBUS_GROUP?=    dbus
 +# Used in the dbus package to specify the group to run dbus as
 +# Possible: any group name, but in practice set equal to ${DBUS_USER}
 +# Default: dbus
 +
 +DBUS_SYSTEM_PID_FILE?=    pid
 +# Used in the dbus package to specify the name of the pid file
 +# Possible: any pid file name such as pid, messagebus.pid, or dbus.pid
 +# Default: pid
 +
  DEFANG_GROUP?=    defang
  # Used in the mimedefang package to specify the group to run commands as
  # Possible: any group name

From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and
 probably more)
Date: Mon, 7 Sep 2015 22:23:15 -0700

 These are the final patches whose goal is to support my perhaps
 unhealthy practice of switching between dports and pkgsrc in DragonFly
 on the same machine.

 Crashes are not unknown so I like to have checks to clean out dbus's
 pidfile both when the daemon is stopped and before it starts.  Also
 when switching between dports and pkgsrc, I delete the /var/db/dbus
 directory as it has ownership with different dbus owners depending on
 dports vs pkgsrc; therefore, I need to check whether it needs to be
 re-created before the dbus daemon starts.

 There might have to be an option in options.mk so that both non-root
 installs of dbus and installs using /var can properly configure dbus's
 user and group, in particular, the need or no need for the dbus user
 home directory.

 diff -Nurb dbus.user/CVS/Entries dbus/CVS/Entries
 --- dbus.user/CVS/Entries    2015-09-07 14:20:29.747373000 -0700
 +++ dbus/CVS/Entries    2015-09-07 20:47:02.315968000 -0700
 @@ -3,11 +3,10 @@
  /INSTALL/1.1/Wed Sep 24 11:37:31 2008//
  /MESSAGE/1.2/Tue Dec  2 05:20:24 2014//
  /MESSAGE.launchd/1.1/Wed Jan 21 05:38:59 2015//
 -/Makefile/1.86/Sun Aug 30 15:08:00 2015//
 +/Makefile/1.87/Mon Sep  7 23:24:46 2015//
 +/PLIST/1.20/Sun Aug 30 15:08:00 2015//
  /buildlink3.mk/1.16/Wed Jan 29 13:01:53 2014//
  /distinfo/1.66/Sun Aug 30 15:08:00 2015//
  /hacks.mk/1.3/Tue Feb  5 22:03:57 2008//
 -/options.mk/1.8/Wed Jan 21 13:45:18 2015//
 -D/files////
 -D/patches////
 -/PLIST/1.20/Mon Sep  7 21:20:29 2015//
 +/options.mk/1.9/Mon Sep  7 23:24:46 2015//
 +D
 diff -Nurb dbus.user/CVS/Entries.Log dbus/CVS/Entries.Log
 --- dbus.user/CVS/Entries.Log    1969-12-31 16:00:00.000000000 -0800
 +++ dbus/CVS/Entries.Log    2015-09-07 20:47:02.355968000 -0700
 @@ -0,0 +1,2 @@
 +A D/files////
 +A D/patches////
 diff -Nurb dbus.user/Makefile dbus/Makefile
 --- dbus.user/Makefile    2015-09-07 18:52:16.625900000 -0700
 +++ dbus/Makefile    2015-09-07 21:42:06.923074000 -0700
 @@ -32,9 +32,7 @@

  CONFIGURE_ARGS+=    --localstatedir=${VARBASE:Q}

 -CONFIGURE_ARGS_GROUPS=    enable disable with without
 -
 -.if ${OPSYS} == "Darwin"
 +.if ${OPSYS} == "Darwin" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
  # Prevent the configure script from picking up a per-user tmp
  # directory. See the commit message on revision 1.35
  CONFIGURE_ARGS+=    --with-session-socket-dir=/tmp
 @@ -78,7 +76,9 @@
  PKG_GROUPS=        ${DBUS_GROUP}
  PKG_USERS=        ${DBUS_USER}:${DBUS_GROUP}
  PKG_GECOS.${DBUS_USER}=    System message bus
 -PKG_HOME.${DBUS_USER}=    ${VARBASE}/run/dbus
 +# Modern dbus does not need a home directory for its user
 +# Or should this be moved to being an option?
 +# PKG_HOME.${DBUS_USER}=    ${VARBASE}/run/dbus

  FILES_SUBST+=        DBUS_USER_SH=${DBUS_USER}
  FILES_SUBST+=        DBUS_GROUP_SH=${DBUS_GROUP}
 diff -Nurb dbus.user/files/dbus.sh dbus/files/dbus.sh
 --- dbus.user/files/dbus.sh    2015-09-07 19:10:12.806257000 -0700
 +++ dbus/files/dbus.sh    2015-09-07 21:04:21.423462000 -0700
 @@ -13,17 +13,29 @@
  command="@PREFIX@/bin/dbus-daemon"
  command_args="--system"
  pidfile="@VARBASE@/run/dbus/@DBUS_SYSTEM_PID_FILE_SH@"
 -start_precmd=dbus_prestart
 +start_precmd="dbus_prestart"
 +stop_postcmd="dbus_poststop"

  dbus_prestart() {
 +    dbdir="@VARBASE@/db/dbus"
 +    if @TEST@ ! -d $dbdir; then
 +        @MKDIR@ $dbdir
 +    fi
      dir="@VARBASE@/run/dbus"
      if @TEST@ ! -d $dir; then
          @MKDIR@ $dir
 -        @CHMOD@ 0755 $dir
 -        @CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
 +# On other systems /var/run/dbus root:wheel works fine
 +#        @CHMOD@ 0755 $dir
 +#        @CHOWN@ @DBUS_USER_SH@:@DBUS_GROUP_SH@ $dir
 +    elif @TEST@ -f $pidfile; then
 +        @RM@ -f $pidfile
      fi
      @PREFIX@/bin/dbus-uuidgen --ensure
  }

 +dbus_poststop() {
 +    @RM@ -f $pidfile
 +}
 +
  load_rc_config $name
  run_rc_command "$1"

From: Aleksej Saushev <asau@inbox.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and probably more)
Date: Tue, 29 Sep 2015 09:01:01 +0300

 David Shao <davshao@gmail.com> writes:

 > The following reply was made to PR pkg/50075; it has been noted by GNATS.
 >
 > From: David Shao <davshao@gmail.com>
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: pkg/50075 (Making dbus actually work on FreeBSD, DragonFly, and
 >  probably more)
 > Date: Mon, 7 Sep 2015 18:07:00 -0700
 >
 >  The following patches enable the dbus daemon to even be started from
 >  /etc/rc.conf on DragonFly 4.3-DEVELOPMENT and at least recent FreeBSD,
 >  because the daemon is started using
 >  
 >  dbus_enable="YES"
 >  
 >  and not
 >  
 >  dbus="YES"
 >  
 >  An option enable-in-rcvar may be useful for other daemons on DragonFly
 >  and FreeBSD.

 >  diff -Nurb dbus.configure/files/dbus.sh dbus.rcvar/files/dbus.sh
 >  --- dbus.configure/files/dbus.sh    2008-10-11 12:58:24.000000000 -0700
 >  +++ dbus.rcvar/files/dbus.sh    2015-09-07 16:39:16.527612000 -0700
 >  @@ -9,7 +9,7 @@
 >   . /etc/rc.subr
 >  
 >   name="dbus"
 >  -rcvar=$name
 >  +rcvar="@DBUS_RCVAR@"
 >   command="@PREFIX@/bin/dbus-daemon"
 >   command_args="--system"
 >   pidfile="@VARBASE@/run/dbus/pid"

 I strongly object to this change. It makes behaviour of pkgsrc-installed
 daemons highly inconsistent across systems and on FreeBSD in particular.


 -- 
 HE CE3OH...

From: "Patrick Welche" <prlw1@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50075 CVS commit: pkgsrc/sysutils/dbus
Date: Wed, 9 Mar 2016 10:34:53 +0000

 Module Name:	pkgsrc
 Committed By:	prlw1
 Date:		Wed Mar  9 10:34:53 UTC 2016

 Modified Files:
 	pkgsrc/sysutils/dbus: Makefile distinfo

 Log Message:
 Update dbus to 1.10.8

 g/c CONFIGURE_ARGS_GROUPS (Unused since PR pkg/50075 point 13) )

 D-Bus 1.10.8 (2016-03-07)
 ==

 The "digestive biscuits" release.

 Fixes:

 * Enable "large file support" on systems where it exists: dbus-daemon
   is not expected to open large files, but it might need to stat files
   that happen to have large inode numbers (fd.o #93545, Hongxu Jia)

 * Eliminate padding inside DBusMessageIter on 64-bit platforms,
   which might result in a pedantic C compiler not copying the entire contents
   of a DBusMessageIter; statically assert that this is not an ABI change
   in practice (fd.o #94136, Simon McVittie)

 * Document dbus-test-tool echo --sleep-ms=N instead of incorrect --sleep=N
   (fd.o #94244, Dmitri Iouchtchenko)

 * Correctly report test failures in C tests from run-test.sh
   (fd.o #93379; amit tewari, Simon McVittie)

 * When tests are enabled, run all the marshal-validate tests, not just
   the even-numbered ones (fd.o #93908, Nick Lewycky)

 * Correct the expected error from one marshal-validate test, which was
   previously not run due to the above bug (fd.o #93908, Simon McVittie)


 To generate a diff of this commit:
 cvs rdiff -u -r1.98 -r1.99 pkgsrc/sysutils/dbus/Makefile
 cvs rdiff -u -r1.73 -r1.74 pkgsrc/sysutils/dbus/distinfo

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

 I have two questions/concerns about the patch:

 Why is the _SH suffixe needed?  That seems like a bug, and there
 aren't comments explaining it.  (This is of course minor.)

 Why is there an option for changing the rc.conf variable?  I can see
 it being set by conditionals in the Makefile, but it seems that there
 is a single right answer for every OS, so the options framework seems
 excessive.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.