Date: Monday, November 18, 2013 @ 12:25:15 Author: jgc Revision: 199899
archrelease: copy trunk to testing-i686, testing-x86_64 Added: dbus/repos/testing-i686/ dbus/repos/testing-i686/30-dbus (from rev 199898, dbus/trunk/30-dbus) dbus/repos/testing-i686/PKGBUILD (from rev 199898, dbus/trunk/PKGBUILD) dbus/repos/testing-i686/memleak.patch (from rev 199898, dbus/trunk/memleak.patch) dbus/repos/testing-i686/systemd-user-session.patch (from rev 199898, dbus/trunk/systemd-user-session.patch) dbus/repos/testing-x86_64/ dbus/repos/testing-x86_64/30-dbus (from rev 199898, dbus/trunk/30-dbus) dbus/repos/testing-x86_64/PKGBUILD (from rev 199898, dbus/trunk/PKGBUILD) dbus/repos/testing-x86_64/memleak.patch (from rev 199898, dbus/trunk/memleak.patch) dbus/repos/testing-x86_64/systemd-user-session.patch (from rev 199898, dbus/trunk/systemd-user-session.patch) -------------------------------------------+ testing-i686/30-dbus | 6 testing-i686/PKGBUILD | 56 ++++++++ testing-i686/memleak.patch | 37 +++++ testing-i686/systemd-user-session.patch | 183 ++++++++++++++++++++++++++++ testing-x86_64/30-dbus | 6 testing-x86_64/PKGBUILD | 56 ++++++++ testing-x86_64/memleak.patch | 37 +++++ testing-x86_64/systemd-user-session.patch | 183 ++++++++++++++++++++++++++++ 8 files changed, 564 insertions(+) Copied: dbus/repos/testing-i686/30-dbus (from rev 199898, dbus/trunk/30-dbus) =================================================================== --- testing-i686/30-dbus (rev 0) +++ testing-i686/30-dbus 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,6 @@ +#!/bin/bash + +# launches a session dbus instance +if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && type dbus-launch >/dev/null; then + eval $(dbus-launch --sh-syntax --exit-with-session) +fi Copied: dbus/repos/testing-i686/PKGBUILD (from rev 199898, dbus/trunk/PKGBUILD) =================================================================== --- testing-i686/PKGBUILD (rev 0) +++ testing-i686/PKGBUILD 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,56 @@ +# $Id$ +# Maintainer: Tom Gundersen <t...@jklm.no> +# Maintainer: Jan de Groot <j...@archlinux.org> +# Contributor: Link Dupont <l...@subpop.net> +# +pkgname=dbus +pkgver=1.6.18 +pkgrel=1 +pkgdesc="Freedesktop.org message bus system" +url="http://www.freedesktop.org/Software/dbus" +arch=(i686 x86_64) +license=('GPL' 'custom') +depends=('expat' 'coreutils' 'filesystem') +makedepends=('libx11' 'systemd') +optdepends=('libx11: dbus-launch support') +provides=('dbus-core') +conflicts=('dbus-core') +replaces=('dbus-core') +source=(http://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz + 30-dbus systemd-user-session.patch memleak.patch) +md5sums=('b02e9c95027a416987b81f9893831061' + '3314d727fa57fc443fce25b5cbeebbcc' + 'd8a1bd529b3ddca671ee1a695a143db9' + 'cf86d68e39d975cec1e9f0342eb9b142') + +prepare() { + cd dbus-$pkgver + patch -Np1 -i ../systemd-user-session.patch + patch -Np1 -i ../memleak.patch +} + +build() { + cd dbus-$pkgver + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --libexecdir=/usr/lib/dbus-1.0 --with-dbus-user=dbus \ + --with-system-pid-file=/run/dbus/pid \ + --with-system-socket=/run/dbus/system_bus_socket \ + --with-console-auth-dir=/run/console/ \ + --enable-inotify --disable-dnotify \ + --disable-verbose-mode --disable-static \ + --disable-tests --disable-asserts \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ + --enable-systemd + make +} + +package(){ + cd dbus-$pkgver + make DESTDIR="$pkgdir" install + + rm -rf "$pkgdir/var/run" + + install -Dm755 ../30-dbus "$pkgdir/etc/X11/xinit/xinitrc.d/30-dbus" + + install -Dm644 COPYING "$pkgdir/usr/share/licenses/dbus/COPYING" +} Copied: dbus/repos/testing-i686/memleak.patch (from rev 199898, dbus/trunk/memleak.patch) =================================================================== --- testing-i686/memleak.patch (rev 0) +++ testing-i686/memleak.patch 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,37 @@ +From 03aeaccbffa97c9237b57ca067e3da7388862129 Mon Sep 17 00:00:00 2001 +From: Radoslaw Pajak <r.pa...@samsung.com> +Date: Fri, 08 Nov 2013 12:51:32 +0000 +Subject: fixed memory freeing if error during listing services + +Signed-off-by: Radoslaw Pajak <r.pa...@samsung.com> +Reviewed-by: Simon McVittie <simon.mcvit...@collabora.co.uk> +Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71526 +--- +diff --git a/bus/activation.c b/bus/activation.c +index fcb7133..ea48a26 100644 +--- a/bus/activation.c ++++ b/bus/activation.c +@@ -2179,7 +2179,7 @@ bus_activation_list_services (BusActivation *activation, + + error: + for (j = 0; j < i; j++) +- dbus_free (retval[i]); ++ dbus_free (retval[j]); + dbus_free (retval); + + return FALSE; +diff --git a/bus/services.c b/bus/services.c +index 6f380fa..01a720e 100644 +--- a/bus/services.c ++++ b/bus/services.c +@@ -368,7 +368,7 @@ bus_registry_list_services (BusRegistry *registry, + + error: + for (j = 0; j < i; j++) +- dbus_free (retval[i]); ++ dbus_free (retval[j]); + dbus_free (retval); + + return FALSE; +-- +cgit v0.9.0.2-2-gbebe Copied: dbus/repos/testing-i686/systemd-user-session.patch (from rev 199898, dbus/trunk/systemd-user-session.patch) =================================================================== --- testing-i686/systemd-user-session.patch (rev 0) +++ testing-i686/systemd-user-session.patch 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,183 @@ +commit d728fdc655f17031da3bb129ab2fd17dadf0fe3a +Author: Simon Peeters <peeters.si...@gmail.com> +Date: 8 weeks ago + + Set correct address when using --address=systemd: + + When dbus gets launched through systemd, we need to create an address + string based on the sockets passed. + + The _dbus_append_addres_from_socket() function is responsible for + extracting the address information from the file-descriptor and + formatting it in a dbus friendly way. + + This fixes bus activation when running dbus under a systemd session. + + https://bugs.freedesktop.org/show_bug.cgi?id=50962 + + Signed-off-by: Simon Peeters <peeters.si...@gmail.com> + +diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c +index 130f66e..d995240 100644 +--- a/dbus/dbus-server-unix.c ++++ b/dbus/dbus-server-unix.c +@@ -149,7 +149,7 @@ _dbus_server_listen_platform_specific (DBusAddressEntry *entry, + } + else if (strcmp (method, "systemd") == 0) + { +- int n, *fds; ++ int i, n, *fds; + DBusString address; + + n = _dbus_listen_systemd_sockets (&fds, error); +@@ -159,27 +159,39 @@ _dbus_server_listen_platform_specific (DBusAddressEntry *entry, + return DBUS_SERVER_LISTEN_DID_NOT_CONNECT; + } + +- _dbus_string_init_const (&address, "systemd:"); ++ if (!_dbus_string_init (&address)) ++ goto systemd_oom; + +- *server_p = _dbus_server_new_for_socket (fds, n, &address, NULL); +- if (*server_p == NULL) ++ for (i = 0; i < n; i++) + { +- int i; +- +- for (i = 0; i < n; i++) ++ if (i > 0) + { +- _dbus_close_socket (fds[i], NULL); ++ if (!_dbus_string_append (&address, ";")) ++ goto systemd_oom; + } +- dbus_free (fds); +- +- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); +- return DBUS_SERVER_LISTEN_DID_NOT_CONNECT; ++ if (!_dbus_append_address_from_socket (fds[i], &address, error)) ++ goto systemd_err; + } + ++ *server_p = _dbus_server_new_for_socket (fds, n, &address, NULL); ++ if (*server_p == NULL) ++ goto systemd_oom; ++ + dbus_free (fds); + + return DBUS_SERVER_LISTEN_OK; +- } ++ systemd_oom: ++ _DBUS_SET_OOM (error); ++ systemd_err: ++ for (i = 0; i < n; i++) ++ { ++ _dbus_close_socket (fds[i], NULL); ++ } ++ dbus_free (fds); ++ _dbus_string_free (&address); ++ ++ return DBUS_SERVER_LISTEN_DID_NOT_CONNECT; ++ } + #ifdef DBUS_ENABLE_LAUNCHD + else if (strcmp (method, "launchd") == 0) + { +diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c +index b4ecc96..55743b1 100644 +--- a/dbus/dbus-sysdeps-unix.c ++++ b/dbus/dbus-sysdeps-unix.c +@@ -55,6 +55,7 @@ + #include <netinet/in.h> + #include <netdb.h> + #include <grp.h> ++#include <arpa/inet.h> + + #ifdef HAVE_ERRNO_H + #include <errno.h> +@@ -4160,4 +4161,71 @@ _dbus_check_setuid (void) + #endif + } + ++/** ++ * Read the address from the socket and append it to the string ++ * ++ * @param fd the socket ++ * @param address ++ * @param error return location for error code ++ */ ++dbus_bool_t ++_dbus_append_address_from_socket (int fd, ++ DBusString *address, ++ DBusError *error) ++{ ++ union { ++ struct sockaddr sa; ++ struct sockaddr_storage storage; ++ struct sockaddr_un un; ++ struct sockaddr_in ipv4; ++ struct sockaddr_in6 ipv6; ++ } socket; ++ char hostip[INET6_ADDRSTRLEN]; ++ int size = sizeof (socket); ++ ++ if (getsockname (fd, &socket.sa, &size)) ++ goto err; ++ ++ switch (socket.sa.sa_family) ++ { ++ case AF_UNIX: ++ if (socket.un.sun_path[0]=='\0') ++ { ++ if (_dbus_string_append_printf (address, "unix:abstract=%s", &(socket.un.sun_path[1]))) ++ return TRUE; ++ } ++ else ++ { ++ if (_dbus_string_append_printf (address, "unix:path=%s", socket.un.sun_path)) ++ return TRUE; ++ } ++ break; ++ case AF_INET: ++ if (inet_ntop (AF_INET, &socket.ipv4.sin_addr, hostip, sizeof (hostip))) ++ if (_dbus_string_append_printf (address, "tcp:family=ipv4,host=%s,port=%u", ++ hostip, ntohs (socket.ipv4.sin_port))) ++ return TRUE; ++ break; ++#ifdef AF_INET6 ++ case AF_INET6: ++ if (inet_ntop (AF_INET6, &socket.ipv6.sin6_addr, hostip, sizeof (hostip))) ++ if (_dbus_string_append_printf (address, "tcp:family=ipv6,host=%s,port=%u", ++ hostip, ntohs (socket.ipv6.sin6_port))) ++ return TRUE; ++ break; ++#endif ++ default: ++ dbus_set_error (error, ++ _dbus_error_from_errno (EINVAL), ++ "Failed to read address from socket: Unknown socket type."); ++ return FALSE; ++ } ++ err: ++ dbus_set_error (error, ++ _dbus_error_from_errno (errno), ++ "Failed to open socket: %s", ++ _dbus_strerror (errno)); ++ return FALSE; ++} ++ + /* tests in dbus-sysdeps-util.c */ +diff --git a/dbus/dbus-sysdeps-unix.h b/dbus/dbus-sysdeps-unix.h +index 9b70896..a265b33 100644 +--- a/dbus/dbus-sysdeps-unix.h ++++ b/dbus/dbus-sysdeps-unix.h +@@ -138,6 +138,10 @@ dbus_bool_t _dbus_parse_uid (const DBusString *uid_str, + + void _dbus_close_all (void); + ++dbus_bool_t _dbus_append_address_from_socket (int fd, ++ DBusString *address, ++ DBusError *error); ++ + /** @} */ + + DBUS_END_DECLS Copied: dbus/repos/testing-x86_64/30-dbus (from rev 199898, dbus/trunk/30-dbus) =================================================================== --- testing-x86_64/30-dbus (rev 0) +++ testing-x86_64/30-dbus 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,6 @@ +#!/bin/bash + +# launches a session dbus instance +if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && type dbus-launch >/dev/null; then + eval $(dbus-launch --sh-syntax --exit-with-session) +fi Copied: dbus/repos/testing-x86_64/PKGBUILD (from rev 199898, dbus/trunk/PKGBUILD) =================================================================== --- testing-x86_64/PKGBUILD (rev 0) +++ testing-x86_64/PKGBUILD 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,56 @@ +# $Id$ +# Maintainer: Tom Gundersen <t...@jklm.no> +# Maintainer: Jan de Groot <j...@archlinux.org> +# Contributor: Link Dupont <l...@subpop.net> +# +pkgname=dbus +pkgver=1.6.18 +pkgrel=1 +pkgdesc="Freedesktop.org message bus system" +url="http://www.freedesktop.org/Software/dbus" +arch=(i686 x86_64) +license=('GPL' 'custom') +depends=('expat' 'coreutils' 'filesystem') +makedepends=('libx11' 'systemd') +optdepends=('libx11: dbus-launch support') +provides=('dbus-core') +conflicts=('dbus-core') +replaces=('dbus-core') +source=(http://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz + 30-dbus systemd-user-session.patch memleak.patch) +md5sums=('b02e9c95027a416987b81f9893831061' + '3314d727fa57fc443fce25b5cbeebbcc' + 'd8a1bd529b3ddca671ee1a695a143db9' + 'cf86d68e39d975cec1e9f0342eb9b142') + +prepare() { + cd dbus-$pkgver + patch -Np1 -i ../systemd-user-session.patch + patch -Np1 -i ../memleak.patch +} + +build() { + cd dbus-$pkgver + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --libexecdir=/usr/lib/dbus-1.0 --with-dbus-user=dbus \ + --with-system-pid-file=/run/dbus/pid \ + --with-system-socket=/run/dbus/system_bus_socket \ + --with-console-auth-dir=/run/console/ \ + --enable-inotify --disable-dnotify \ + --disable-verbose-mode --disable-static \ + --disable-tests --disable-asserts \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ + --enable-systemd + make +} + +package(){ + cd dbus-$pkgver + make DESTDIR="$pkgdir" install + + rm -rf "$pkgdir/var/run" + + install -Dm755 ../30-dbus "$pkgdir/etc/X11/xinit/xinitrc.d/30-dbus" + + install -Dm644 COPYING "$pkgdir/usr/share/licenses/dbus/COPYING" +} Copied: dbus/repos/testing-x86_64/memleak.patch (from rev 199898, dbus/trunk/memleak.patch) =================================================================== --- testing-x86_64/memleak.patch (rev 0) +++ testing-x86_64/memleak.patch 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,37 @@ +From 03aeaccbffa97c9237b57ca067e3da7388862129 Mon Sep 17 00:00:00 2001 +From: Radoslaw Pajak <r.pa...@samsung.com> +Date: Fri, 08 Nov 2013 12:51:32 +0000 +Subject: fixed memory freeing if error during listing services + +Signed-off-by: Radoslaw Pajak <r.pa...@samsung.com> +Reviewed-by: Simon McVittie <simon.mcvit...@collabora.co.uk> +Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71526 +--- +diff --git a/bus/activation.c b/bus/activation.c +index fcb7133..ea48a26 100644 +--- a/bus/activation.c ++++ b/bus/activation.c +@@ -2179,7 +2179,7 @@ bus_activation_list_services (BusActivation *activation, + + error: + for (j = 0; j < i; j++) +- dbus_free (retval[i]); ++ dbus_free (retval[j]); + dbus_free (retval); + + return FALSE; +diff --git a/bus/services.c b/bus/services.c +index 6f380fa..01a720e 100644 +--- a/bus/services.c ++++ b/bus/services.c +@@ -368,7 +368,7 @@ bus_registry_list_services (BusRegistry *registry, + + error: + for (j = 0; j < i; j++) +- dbus_free (retval[i]); ++ dbus_free (retval[j]); + dbus_free (retval); + + return FALSE; +-- +cgit v0.9.0.2-2-gbebe Copied: dbus/repos/testing-x86_64/systemd-user-session.patch (from rev 199898, dbus/trunk/systemd-user-session.patch) =================================================================== --- testing-x86_64/systemd-user-session.patch (rev 0) +++ testing-x86_64/systemd-user-session.patch 2013-11-18 11:25:15 UTC (rev 199899) @@ -0,0 +1,183 @@ +commit d728fdc655f17031da3bb129ab2fd17dadf0fe3a +Author: Simon Peeters <peeters.si...@gmail.com> +Date: 8 weeks ago + + Set correct address when using --address=systemd: + + When dbus gets launched through systemd, we need to create an address + string based on the sockets passed. + + The _dbus_append_addres_from_socket() function is responsible for + extracting the address information from the file-descriptor and + formatting it in a dbus friendly way. + + This fixes bus activation when running dbus under a systemd session. + + https://bugs.freedesktop.org/show_bug.cgi?id=50962 + + Signed-off-by: Simon Peeters <peeters.si...@gmail.com> + +diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c +index 130f66e..d995240 100644 +--- a/dbus/dbus-server-unix.c ++++ b/dbus/dbus-server-unix.c +@@ -149,7 +149,7 @@ _dbus_server_listen_platform_specific (DBusAddressEntry *entry, + } + else if (strcmp (method, "systemd") == 0) + { +- int n, *fds; ++ int i, n, *fds; + DBusString address; + + n = _dbus_listen_systemd_sockets (&fds, error); +@@ -159,27 +159,39 @@ _dbus_server_listen_platform_specific (DBusAddressEntry *entry, + return DBUS_SERVER_LISTEN_DID_NOT_CONNECT; + } + +- _dbus_string_init_const (&address, "systemd:"); ++ if (!_dbus_string_init (&address)) ++ goto systemd_oom; + +- *server_p = _dbus_server_new_for_socket (fds, n, &address, NULL); +- if (*server_p == NULL) ++ for (i = 0; i < n; i++) + { +- int i; +- +- for (i = 0; i < n; i++) ++ if (i > 0) + { +- _dbus_close_socket (fds[i], NULL); ++ if (!_dbus_string_append (&address, ";")) ++ goto systemd_oom; + } +- dbus_free (fds); +- +- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); +- return DBUS_SERVER_LISTEN_DID_NOT_CONNECT; ++ if (!_dbus_append_address_from_socket (fds[i], &address, error)) ++ goto systemd_err; + } + ++ *server_p = _dbus_server_new_for_socket (fds, n, &address, NULL); ++ if (*server_p == NULL) ++ goto systemd_oom; ++ + dbus_free (fds); + + return DBUS_SERVER_LISTEN_OK; +- } ++ systemd_oom: ++ _DBUS_SET_OOM (error); ++ systemd_err: ++ for (i = 0; i < n; i++) ++ { ++ _dbus_close_socket (fds[i], NULL); ++ } ++ dbus_free (fds); ++ _dbus_string_free (&address); ++ ++ return DBUS_SERVER_LISTEN_DID_NOT_CONNECT; ++ } + #ifdef DBUS_ENABLE_LAUNCHD + else if (strcmp (method, "launchd") == 0) + { +diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c +index b4ecc96..55743b1 100644 +--- a/dbus/dbus-sysdeps-unix.c ++++ b/dbus/dbus-sysdeps-unix.c +@@ -55,6 +55,7 @@ + #include <netinet/in.h> + #include <netdb.h> + #include <grp.h> ++#include <arpa/inet.h> + + #ifdef HAVE_ERRNO_H + #include <errno.h> +@@ -4160,4 +4161,71 @@ _dbus_check_setuid (void) + #endif + } + ++/** ++ * Read the address from the socket and append it to the string ++ * ++ * @param fd the socket ++ * @param address ++ * @param error return location for error code ++ */ ++dbus_bool_t ++_dbus_append_address_from_socket (int fd, ++ DBusString *address, ++ DBusError *error) ++{ ++ union { ++ struct sockaddr sa; ++ struct sockaddr_storage storage; ++ struct sockaddr_un un; ++ struct sockaddr_in ipv4; ++ struct sockaddr_in6 ipv6; ++ } socket; ++ char hostip[INET6_ADDRSTRLEN]; ++ int size = sizeof (socket); ++ ++ if (getsockname (fd, &socket.sa, &size)) ++ goto err; ++ ++ switch (socket.sa.sa_family) ++ { ++ case AF_UNIX: ++ if (socket.un.sun_path[0]=='\0') ++ { ++ if (_dbus_string_append_printf (address, "unix:abstract=%s", &(socket.un.sun_path[1]))) ++ return TRUE; ++ } ++ else ++ { ++ if (_dbus_string_append_printf (address, "unix:path=%s", socket.un.sun_path)) ++ return TRUE; ++ } ++ break; ++ case AF_INET: ++ if (inet_ntop (AF_INET, &socket.ipv4.sin_addr, hostip, sizeof (hostip))) ++ if (_dbus_string_append_printf (address, "tcp:family=ipv4,host=%s,port=%u", ++ hostip, ntohs (socket.ipv4.sin_port))) ++ return TRUE; ++ break; ++#ifdef AF_INET6 ++ case AF_INET6: ++ if (inet_ntop (AF_INET6, &socket.ipv6.sin6_addr, hostip, sizeof (hostip))) ++ if (_dbus_string_append_printf (address, "tcp:family=ipv6,host=%s,port=%u", ++ hostip, ntohs (socket.ipv6.sin6_port))) ++ return TRUE; ++ break; ++#endif ++ default: ++ dbus_set_error (error, ++ _dbus_error_from_errno (EINVAL), ++ "Failed to read address from socket: Unknown socket type."); ++ return FALSE; ++ } ++ err: ++ dbus_set_error (error, ++ _dbus_error_from_errno (errno), ++ "Failed to open socket: %s", ++ _dbus_strerror (errno)); ++ return FALSE; ++} ++ + /* tests in dbus-sysdeps-util.c */ +diff --git a/dbus/dbus-sysdeps-unix.h b/dbus/dbus-sysdeps-unix.h +index 9b70896..a265b33 100644 +--- a/dbus/dbus-sysdeps-unix.h ++++ b/dbus/dbus-sysdeps-unix.h +@@ -138,6 +138,10 @@ dbus_bool_t _dbus_parse_uid (const DBusString *uid_str, + + void _dbus_close_all (void); + ++dbus_bool_t _dbus_append_address_from_socket (int fd, ++ DBusString *address, ++ DBusError *error); ++ + /** @} */ + + DBUS_END_DECLS