Hello community,
here is the log from the commit of package dbus-1 for openSUSE:Factory checked in at 2013-03-04 17:26:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dbus-1 (Old)
and /work/SRC/openSUSE:Factory/.dbus-1.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dbus-1", Maintainer is "THoenig@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/dbus-1/dbus-1.changes 2013-02-20 09:26:35.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.dbus-1.new/dbus-1.changes 2013-03-04 17:27:35.000000000 +0100
@@ -1,0 +2,8 @@
+Fri Feb 22 17:13:02 CET 2013 - hpj@suse.com
+
+- Spec file changes moving files from /var/run to /run.
+- Add dbus-move-everything-to-run-directory.patch by rmilasan. This
+ moves everything (pid files, lock files, etc.) to /run.
+- Add dbus-fall-back-to-old-run-directory.patch (bnc#802525).
+
+-------------------------------------------------------------------
New:
----
dbus-fall-back-to-old-run-directory.patch
dbus-move-everything-to-run-directory.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ dbus-1.spec ++++++
--- /var/tmp/diff_new_pack.Pslj5t/_old 2013-03-04 17:27:37.000000000 +0100
+++ /var/tmp/diff_new_pack.Pslj5t/_new 2013-03-04 17:27:37.000000000 +0100
@@ -60,6 +60,10 @@
Patch0: dbus-log-deny.patch
# PATCH-FIX-OPENSUSE coolo@suse.de -- force a feature configure won't accept without x11 in buildrequires
Patch1: dbus-do-autolaunch.patch
+# PATCH-FIX-OPENSUSE rmilasan@suse.com - move pid and any temp files to /run
+Patch2: dbus-move-everything-to-run-directory.patch
+# PATCH-FIX-OPENSUSE hpj@suse.com bnc#802525 - Avoid clients hanging after move to /run
+Patch3: dbus-fall-back-to-old-run-directory.patch
%if 0%{?suse_version} > 1100
%bcond_without selinux
%else
@@ -135,6 +139,8 @@
%setup -n %{_name}-%{version} -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
autoreconf -fi
@@ -164,7 +170,7 @@
--enable-systemd \
%endif
--enable-libaudit \
- --with-console-auth-dir=/var/run/dbus/at_console/ \
+ --with-console-auth-dir=/run/dbus/at_console/ \
--with-systemdsystemunitdir=%{_unitdir}
make %{?_smp_mflags}
doxygen -u && doxygen
@@ -177,7 +183,7 @@
mkdir -p %{buildroot}/usr/sbin
install -m 755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/dbus
ln -sf %{_sysconfdir}/init.d/dbus %{buildroot}/%{_sbindir}/rcdbus
-install -d %{buildroot}/var/run/dbus
+install -d %{buildroot}/run/dbus
mkdir -p %{buildroot}/%{_datadir}/susehelp/meta/Development/Libraries/
install -m 0644 %SOURCE2 \
%{buildroot}/%{_datadir}/susehelp/meta/Development/Libraries/dbus-1.desktop
@@ -211,13 +217,17 @@
%pre
/usr/sbin/groupadd -r messagebus 2> /dev/null || :
-/usr/sbin/useradd -r -s /bin/false -c "User for D-Bus" -d /var/run/dbus -g messagebus messagebus 2> /dev/null || :
+/usr/sbin/useradd -r -s /bin/false -c "User for D-Bus" -d /run/dbus -g messagebus messagebus 2> /dev/null || :
%if 0%{?suse_version:1}
%preun
%{stop_on_removal dbus}
%post
+# Temporarily override the socket path systemd sees, so the running D-Bus process won't be clobbered.
+mkdir -p /run/systemd/system
+/usr/bin/sed 's#ListenStream=/run/dbus/system_bus_socket#ListenStream=/var/run/dbus/system_bus_socket#' < /usr/lib/systemd/system/dbus.socket > /run/systemd/system/dbus.socket
+
/bin/dbus-uuidgen --ensure
%{insserv_force_if_yast dbus}
/sbin/ldconfig
@@ -257,7 +267,7 @@
# See doc/system-activation.txt in source tarball for the rationale
# behind these permissions
%attr(4750,root,messagebus) %verify(not mode) /lib/%{name}/dbus-daemon-launch-helper
-%ghost /var/run/dbus
+%ghost /run/dbus
%ghost %{_localstatedir}/lib/dbus/machine-id
%if ! %{with_systemd}
%if 0%{?suse_version} < 1230
++++++ dbus-fall-back-to-old-run-directory.patch ++++++
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index fadc3a8..2c71cdb 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -421,6 +421,153 @@ _dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection *connec
_DBUS_UNLOCK (bus);
}
+static dbus_bool_t
+internal_register (DBusConnection *connection,
+ int timeout_milliseconds,
+ DBusError *error)
+{
+ DBusMessage *message, *reply;
+ char *name;
+ BusData *bd;
+ dbus_bool_t retval;
+
+ _dbus_return_val_if_fail (connection != NULL, FALSE);
+ _dbus_return_val_if_error_is_set (error, FALSE);
+
+ retval = FALSE;
+ message = NULL;
+ reply = NULL;
+
+ _DBUS_LOCK (bus_datas);
+
+ bd = ensure_bus_data (connection);
+ if (bd == NULL)
+ {
+ _DBUS_SET_OOM (error);
+ goto out;
+ }
+
+ if (bd->unique_name != NULL)
+ {
+ _dbus_verbose ("Ignoring attempt to register the same DBusConnection %s with the message bus a second time.\n",
+ bd->unique_name);
+ /* Success! */
+ retval = TRUE;
+ goto out;
+ }
+
+ message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS,
+ "Hello");
+
+ if (!message)
+ {
+ _DBUS_SET_OOM (error);
+ goto out;
+ }
+
+ reply = dbus_connection_send_with_reply_and_block (connection, message, timeout_milliseconds, error);
+
+ if (reply == NULL)
+ goto out;
+ else if (dbus_set_error_from_message (error, reply))
+ goto out;
+ else if (!dbus_message_get_args (reply, error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+ goto out;
+
+ bd->unique_name = _dbus_strdup (name);
+ if (bd->unique_name == NULL)
+ {
+ _DBUS_SET_OOM (error);
+ goto out;
+ }
+
+ retval = TRUE;
+
+ out:
+ _DBUS_UNLOCK (bus_datas);
+
+ if (message)
+ dbus_message_unref (message);
+
+ if (reply)
+ dbus_message_unref (reply);
+
+ return retval;
+}
+
+static DBusConnection *
+internal_open_and_register (const char *address, dbus_bool_t private, int timeout_milliseconds, DBusError *error)
+{
+ DBusConnection *connection;
+
+ if (private)
+ connection = dbus_connection_open_private (address, error);
+ else
+ connection = dbus_connection_open (address, error);
+
+ if (!connection)
+ {
+ goto out;
+ }
+
+ if (!internal_register (connection, timeout_milliseconds, error))
+ {
+ _dbus_connection_close_possibly_shared (connection);
+ dbus_connection_unref (connection);
+ connection = NULL;
+ goto out;
+ }
+
+out:
+ return connection;
+}
+
+/* When the D-Bus upgrade that moves /var/run/dbus/ to /run/dbus/ is applied,
+ * D-Bus cannot be restarted with the new socket in /run/, because the session
+ * wouldn't be able to cope with it. We end up with a daemon listening on
+ * /var/run/dbus/system_bus_socket, but clients will now try to register
+ * with it on /run/dbus/system_bus_socket, causing the upgrade, and eventually
+ * critical parts of the user's session, to hang.
+ *
+ * The workaround is inelegant, but probably good enough: We allow the initial
+ * attempt to time out quickly and fall back to trying the old default address.
+ * If that fails too, we go back to blocking on the initial address. */
+
+#define OLD_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
+#define INITIAL_TIMEOUT_MILLISECONDS 250
+#define INCREMENT_TIMEOUT_MILLISECONDS 250
+#define MAX_TIMEOUT_MILLISECONDS 10000
+
+static DBusConnection *
+internal_open_and_register_with_fallback (const char *address, dbus_bool_t private, DBusError *error)
+{
+ DBusConnection *connection = NULL;
+ int timeout_milliseconds;
+
+ for (timeout_milliseconds = INITIAL_TIMEOUT_MILLISECONDS;
+ connection == NULL && timeout_milliseconds < MAX_TIMEOUT_MILLISECONDS;
+ timeout_milliseconds += INCREMENT_TIMEOUT_MILLISECONDS)
+ {
+ connection = internal_open_and_register (address, private, timeout_milliseconds, NULL);
+
+ if (!connection && !strcmp (address, DBUS_SYSTEM_BUS_DEFAULT_ADDRESS))
+ connection = internal_open_and_register (OLD_SYSTEM_BUS_DEFAULT_ADDRESS, private, timeout_milliseconds, NULL);
+ }
+
+ if (!connection)
+ {
+ /* We couldn't register with any of the sockets; fall back to original behavior, blocking
+ * forever or returning an error. */
+ connection = internal_open_and_register (address, private, -1, error);
+ }
+
+ return connection;
+}
+
static DBusConnection *
internal_bus_get (DBusBusType type,
dbus_bool_t private,
@@ -474,21 +621,10 @@ internal_bus_get (DBusBusType type,
goto out;
}
- if (private)
- connection = dbus_connection_open_private (address, error);
- else
- connection = dbus_connection_open (address, error);
-
- if (!connection)
- {
- goto out;
- }
+ connection = internal_open_and_register_with_fallback (address, private, error);
- if (!dbus_bus_register (connection, error))
+ if (!connection)
{
- _dbus_connection_close_possibly_shared (connection);
- dbus_connection_unref (connection);
- connection = NULL;
goto out;
}
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index ee33b6c..b87c6f7 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -348,7 +348,7 @@ static void _dbus_connection_update_dispatch_status_and_unlock (DB
static void _dbus_connection_last_unref (DBusConnection *connection);
static void _dbus_connection_acquire_dispatch (DBusConnection *connection);
static void _dbus_connection_release_dispatch (DBusConnection *connection);
-static DBusDispatchStatus _dbus_connection_flush_unlocked (DBusConnection *connection);
+static DBusDispatchStatus _dbus_connection_flush_unlocked (DBusConnection *connection, int timeout_milliseconds);
static void _dbus_connection_close_possibly_shared_and_unlock (DBusConnection *connection);
static dbus_bool_t _dbus_connection_get_is_connected_unlocked (DBusConnection *connection);
static dbus_bool_t _dbus_connection_peek_for_reply_unlocked (DBusConnection *connection,
@@ -2367,7 +2367,7 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending)
DBusConnection *connection;
dbus_uint32_t client_serial;
DBusTimeout *timeout;
- int timeout_milliseconds, elapsed_milliseconds;
+ int timeout_milliseconds = -1, elapsed_milliseconds;
_dbus_assert (pending != NULL);
@@ -2379,7 +2379,12 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending)
connection = _dbus_pending_call_get_connection_and_lock (pending);
/* Flush message queue - note, can affect dispatch status */
- _dbus_connection_flush_unlocked (connection);
+
+ timeout = _dbus_pending_call_get_timeout_unlocked (pending);
+ if (timeout)
+ timeout_milliseconds = dbus_timeout_get_interval (timeout);
+
+ _dbus_connection_flush_unlocked (connection, timeout_milliseconds);
client_serial = _dbus_pending_call_get_reply_serial_unlocked (pending);
@@ -3555,7 +3560,7 @@ dbus_connection_send_with_reply_and_block (DBusConnection *connection,
* @param connection the connection.
*/
static DBusDispatchStatus
-_dbus_connection_flush_unlocked (DBusConnection *connection)
+_dbus_connection_flush_unlocked (DBusConnection *connection, int timeout_milliseconds)
{
/* We have to specify DBUS_ITERATION_DO_READING here because
* otherwise we could have two apps deadlock if they are both doing
@@ -3563,20 +3568,36 @@ _dbus_connection_flush_unlocked (DBusConnection *connection)
* dispatch status.
*/
DBusDispatchStatus status;
+ long start_tv_sec, start_tv_usec;
+ long tv_sec, tv_usec;
+ int elapsed_milliseconds = 0;
HAVE_LOCK_CHECK (connection);
+
+ _dbus_get_monotonic_time (&start_tv_sec, &start_tv_usec);
while (connection->n_outgoing > 0 &&
_dbus_connection_get_is_connected_unlocked (connection))
{
_dbus_verbose ("doing iteration in\n");
+
+ if (timeout_milliseconds >= 0)
+ {
+ _dbus_get_monotonic_time (&tv_sec, &tv_usec);
+ elapsed_milliseconds = (tv_sec - start_tv_sec) * 1000 +
+ (tv_usec - start_tv_usec) / 1000;
+
+ if (elapsed_milliseconds >= timeout_milliseconds)
+ break;
+ }
+
HAVE_LOCK_CHECK (connection);
_dbus_connection_do_iteration_unlocked (connection,
NULL,
DBUS_ITERATION_DO_READING |
DBUS_ITERATION_DO_WRITING |
DBUS_ITERATION_BLOCK,
- -1);
+ timeout_milliseconds - elapsed_milliseconds);
}
HAVE_LOCK_CHECK (connection);
@@ -3606,7 +3627,7 @@ dbus_connection_flush (DBusConnection *connection)
CONNECTION_LOCK (connection);
- status = _dbus_connection_flush_unlocked (connection);
+ status = _dbus_connection_flush_unlocked (connection, -1);
HAVE_LOCK_CHECK (connection);
/* Unlocks and calls out to user code */
++++++ dbus-move-everything-to-run-directory.patch ++++++
Index: dbus-1.6.8/configure
===================================================================
--- dbus-1.6.8.orig/configure
+++ dbus-1.6.8/configure
@@ -22254,7 +22254,7 @@ fi
if ! test -z "$with_system_socket"; then
DBUS_SYSTEM_SOCKET=$with_system_socket
else
- DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
+ DBUS_SYSTEM_SOCKET=/run/dbus/system_bus_socket
fi
@@ -22278,9 +22278,9 @@ _ACEOF
if ! test -z "$with_system_pid_file"; then
DBUS_SYSTEM_PID_FILE=$with_system_pid_file
elif test x$with_init_scripts = xredhat ; then
- DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
+ DBUS_SYSTEM_PID_FILE=/run/messagebus.pid
else
- DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
+ DBUS_SYSTEM_PID_FILE=/run/dbus/pid
fi
@@ -22289,7 +22289,7 @@ fi
if ! test -z "$with_console_auth_dir"; then
DBUS_CONSOLE_AUTH_DIR=$with_console_auth_dir
else
- DBUS_CONSOLE_AUTH_DIR=/var/run/console/
+ DBUS_CONSOLE_AUTH_DIR=/run/console/
fi
Index: dbus-1.6.8/configure.ac
===================================================================
--- dbus-1.6.8.orig/configure.ac
+++ dbus-1.6.8/configure.ac
@@ -1517,7 +1517,7 @@ AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$
if ! test -z "$with_system_socket"; then
DBUS_SYSTEM_SOCKET=$with_system_socket
else
- DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
+ DBUS_SYSTEM_SOCKET=/run/dbus/system_bus_socket
fi
AC_SUBST(DBUS_SYSTEM_SOCKET)
@@ -1533,9 +1533,9 @@ AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAU
if ! test -z "$with_system_pid_file"; then
DBUS_SYSTEM_PID_FILE=$with_system_pid_file
elif test x$with_init_scripts = xredhat ; then
- DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
+ DBUS_SYSTEM_PID_FILE=/run/messagebus.pid
else
- DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
+ DBUS_SYSTEM_PID_FILE=/run/dbus/pid
fi
AC_SUBST(DBUS_SYSTEM_PID_FILE)
@@ -1544,7 +1544,7 @@ AC_SUBST(DBUS_SYSTEM_PID_FILE)
if ! test -z "$with_console_auth_dir"; then
DBUS_CONSOLE_AUTH_DIR=$with_console_auth_dir
else
- DBUS_CONSOLE_AUTH_DIR=/var/run/console/
+ DBUS_CONSOLE_AUTH_DIR=/run/console/
fi
AC_SUBST(DBUS_CONSOLE_AUTH_DIR)
Index: dbus-1.6.8/doc/dbus-specification.html
===================================================================
--- dbus-1.6.8.orig/doc/dbus-specification.html
+++ dbus-1.6.8/doc/dbus-specification.html
@@ -2599,7 +2599,7 @@
in the <code class="literal">DBUS_SYSTEM_BUS_ADDRESS</code> environment
variable. If that variable is not set, applications should try
to connect to the well-known address
- <code class="literal">unix:path=/var/run/dbus/system_bus_socket</code>.
+ <code class="literal">unix:path=/run/dbus/system_bus_socket</code>.
<sup>[<a name="idp5733888" href="#ftn.idp5733888" class="footnote">2</a>]</sup>
</p><p>
On Unix systems, the system bus should default to searching
Index: dbus-1.6.8/doc/dbus-specification.xml
===================================================================
--- dbus-1.6.8.orig/doc/dbus-specification.xml
+++ dbus-1.6.8/doc/dbus-specification.xml
@@ -4717,7 +4717,7 @@
in the <literal>DBUS_SYSTEM_BUS_ADDRESS</literal> environment
variable. If that variable is not set, applications should try
to connect to the well-known address
- <literal>unix:path=/var/run/dbus/system_bus_socket</literal>.
+ <literal>unix:path=/run/dbus/system_bus_socket</literal>.
<footnote>
<para>
The D-Bus reference implementation actually honors the
Index: dbus-1.6.8/cmake/CMakeLists.txt
===================================================================
--- dbus-1.6.8.orig/cmake/CMakeLists.txt
+++ dbus-1.6.8/cmake/CMakeLists.txt
@@ -414,7 +414,7 @@ if (WIN32)
# bus-test expects a non empty string
set (DBUS_SYSTEM_PID_FILE "/dbus-pid")
else (WIN32)
- set (DBUS_SYSTEM_PID_FILE ${EXPANDED_LOCALSTATEDIR}/run/dbus/pid)
+ set (DBUS_SYSTEM_PID_FILE "/run/dbus/pid")
endif (WIN32)
#AC_ARG_WITH(system-socket, AS_HELP_STRING([--with-system-socket=[filename]],[UNIX domain socket for systemwide daemon]))
@@ -424,7 +424,7 @@ endif (WIN32)
if (WIN32)
set (DBUS_CONSOLE_AUTH_DIR "")
else (WIN32)
- set (DBUS_CONSOLE_AUTH_DIR "/var/run/console/")
+ set (DBUS_CONSOLE_AUTH_DIR "/run/console/")
endif (WIN32)
#AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
Index: dbus-1.6.8/dbus/dbus-sysdeps-win.h
===================================================================
--- dbus-1.6.8.orig/dbus/dbus-sysdeps-win.h
+++ dbus-1.6.8/dbus/dbus-sysdeps-win.h
@@ -36,7 +36,7 @@ extern void *_dbus_win_get_dll_hmodule (
#include