Patchwork dbus: remove /var/run from package as it is created on startup

login
register
mail settings
Submitter Jonathan Liu
Date May 23, 2013, 4:02 a.m.
Message ID <1369281734-7989-1-git-send-email-net147@gmail.com>
Download mbox | patch
Permalink /patch/50351/
State Accepted
Commit 45bf11434061e5f78a28ce96ed4cc3cb74883953
Headers show

Comments

Jonathan Liu - May 23, 2013, 4:02 a.m.
/var/run is a tmpfs that is created on startup.
For sysvinit, /var/run/dbus is created by populate-volatiles.sh.
For systemd, /var/run/dbus is created implicitly by dbus.socket when
creating a listen stream socket at /var/run/dbus/system_bus_socket.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/recipes-core/dbus/dbus.inc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Richard Purdie - May 23, 2013, 11:38 a.m.
On Thu, 2013-05-23 at 14:02 +1000, Jonathan Liu wrote:
> /var/run is a tmpfs that is created on startup.
> For sysvinit, /var/run/dbus is created by populate-volatiles.sh.
> For systemd, /var/run/dbus is created implicitly by dbus.socket when
> creating a listen stream socket at /var/run/dbus/system_bus_socket.
> 
> Signed-off-by: Jonathan Liu <net147@gmail.com>
> ---
>  meta/recipes-core/dbus/dbus.inc | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
> index 2be5bda..8055824 100644
> --- a/meta/recipes-core/dbus/dbus.inc
> +++ b/meta/recipes-core/dbus/dbus.inc
> @@ -101,9 +101,9 @@ do_install() {
>  	     > ${D}${sysconfdir}/default/volatiles/99_dbus
>  
> 
> -	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
> +	mkdir -p ${D}${localstatedir}/lib/dbus
>  
> -	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
> +	chown messagebus:messagebus ${D}${localstatedir}/lib/dbus

Is what populate-volatiles does truly equivalent? Does this directory
need to be owned by messagebus (which is a user created by dbus) iirc?

Cheers,

Richard
Jonathan Liu - May 23, 2013, 12:31 p.m.
On 23/05/2013 9:38 PM, Richard Purdie wrote:
> On Thu, 2013-05-23 at 14:02 +1000, Jonathan Liu wrote:
>> /var/run is a tmpfs that is created on startup.
>> For sysvinit, /var/run/dbus is created by populate-volatiles.sh.
>> For systemd, /var/run/dbus is created implicitly by dbus.socket when
>> creating a listen stream socket at /var/run/dbus/system_bus_socket.
>>
>> Signed-off-by: Jonathan Liu <net147@gmail.com>
>> ---
>>   meta/recipes-core/dbus/dbus.inc | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
>> index 2be5bda..8055824 100644
>> --- a/meta/recipes-core/dbus/dbus.inc
>> +++ b/meta/recipes-core/dbus/dbus.inc
>> @@ -101,9 +101,9 @@ do_install() {
>>   	     > ${D}${sysconfdir}/default/volatiles/99_dbus
>>   
>>
>> -	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
>> +	mkdir -p ${D}${localstatedir}/lib/dbus
>>   
>> -	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
>> +	chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
> Is what populate-volatiles does truly equivalent? Does this directory
> need to be owned by messagebus (which is a user created by dbus) iirc?
>
> Cheers,
>
> Richard
The dbus recipe writes /etc/default/volatiles/99_dbus.
For sysvinit case, this will cause populate-volatiles.sh to create 
/var/run/dbus owned by messagebus:messagebus with 0755 permissions so it 
is the same.
The systemd init doesn't use populate-volatiles.sh and it's created 
implicitly so it is owned by root:root with 0755 permissions.

For distributions using sysvinit (e.g. Debian), /var/run/dbus is 
typically owned by messagebus:messagebus. There is no dbus user/group in 
/etc/passwd or /etc/group.
For distributions using systemd (e.g. Arch Linux and Fedora), 
/var/run/dbus (actually /run/dbus) is typically owned by root:root. 
There is no messagebus user/group in /etc/passwd or /etc/group, but 
there is dbus.

Regards,
Jonathan
Richard Purdie - May 23, 2013, 12:50 p.m.
On Thu, 2013-05-23 at 22:31 +1000, Jonathan Liu wrote:
> On 23/05/2013 9:38 PM, Richard Purdie wrote:
> > On Thu, 2013-05-23 at 14:02 +1000, Jonathan Liu wrote:
> >> /var/run is a tmpfs that is created on startup.
> >> For sysvinit, /var/run/dbus is created by populate-volatiles.sh.
> >> For systemd, /var/run/dbus is created implicitly by dbus.socket when
> >> creating a listen stream socket at /var/run/dbus/system_bus_socket.
> >>
> >> Signed-off-by: Jonathan Liu <net147@gmail.com>
> >> ---
> >>   meta/recipes-core/dbus/dbus.inc | 7 +++++--
> >>   1 file changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
> >> index 2be5bda..8055824 100644
> >> --- a/meta/recipes-core/dbus/dbus.inc
> >> +++ b/meta/recipes-core/dbus/dbus.inc
> >> @@ -101,9 +101,9 @@ do_install() {
> >>   	     > ${D}${sysconfdir}/default/volatiles/99_dbus
> >>   
> >>
> >> -	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
> >> +	mkdir -p ${D}${localstatedir}/lib/dbus
> >>   
> >> -	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
> >> +	chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
> > Is what populate-volatiles does truly equivalent? Does this directory
> > need to be owned by messagebus (which is a user created by dbus) iirc?
> >
> > Cheers,
> >
> > Richard
> The dbus recipe writes /etc/default/volatiles/99_dbus.

That is the piece I'd missed, thanks :).

Cheers,

Richard

Patch

diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
index 2be5bda..8055824 100644
--- a/meta/recipes-core/dbus/dbus.inc
+++ b/meta/recipes-core/dbus/dbus.inc
@@ -101,9 +101,9 @@  do_install() {
 	     > ${D}${sysconfdir}/default/volatiles/99_dbus
 
 
-	mkdir -p ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
+	mkdir -p ${D}${localstatedir}/lib/dbus
 
-	chown messagebus:messagebus ${D}${localstatedir}/run/dbus ${D}${localstatedir}/lib/dbus
+	chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
 
 	chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
 	chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
@@ -113,6 +113,9 @@  do_install() {
 
 	# Remove empty testexec directory as we don't build tests
 	rm -rf ${D}${libdir}/dbus-1.0/test
+
+	# Remove /var/run as it is created on startup
+	rm -rf ${D}${localstatedir}/run
 }
 
 do_install_class-native() {