Forums before death by AOL, social media and spammers... "We can't have nice things"
|    linux.debian.bugs.dist    |    Ohh some weird Debian bug report thing    |    28,835 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 28,795 of 28,835    |
|    Mark Hindley to Simon McVittie    |
|    Bug#1128559: dbus-turnstile-user-session    |
|    24 Feb 26 18:20:02    |
   
   From: mark@hindley.org.uk   
      
   Simon,   
      
   Thanks for this.   
      
   On Sat, Feb 21, 2026 at 03:09:41AM +0000, Simon McVittie wrote:   
   > There are three ways to wait for dbus-daemon to be ready:   
   >   
   > 1. Wait for `dbus-daemon --fork` to exit with status 0, which indicates   
   > that the long-running dbus-daemon process has finished startup,   
   > double-forked and been reparented to pid 1. This is how   
   > /etc/init.d/dbus works.   
      
   If I understand correctly, this is not suitable as it puts dbus-daemon in new   
   session group.   
      
   > 2. Use `dbus-daemon --print-address=$FD` and/or   
   > `dbus-daemon --print-pid=$FD` where $FD is the file descriptor number   
   > of the write end of a pipe, and wait for EOF on the read end of the   
   > same pipe before continuing. This is how dbus-run-session(1) works.   
      
   I believe this is implemented as attached. Initial testing is OK. It probably   
   needs a read timeout as well.   
      
   Thanks   
      
   Mark   
      
   #!/bin/sh   
      
   DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"   
      
   die() {   
    echo "$@" >&2   
    exit 1   
   }   
      
   tmp_dir=$(mktemp -d)   
   [ -d "$tmp_dir" ] || die "Failed to create ready notification directory"   
   ready_pipe="$tmp_dir/fifo"   
   mkfifo "$ready_pipe" || die "Failed to create notification pipe"   
      
   exec 3<> "$ready_pipe"   
   rm -r "$tmp_dir"   
      
   dbus-daemon --session --nofork --address=$DBUS_SESSION_BUS_ADDRESS   
   --print-address=3 &   
      
   read -r ready <&3   
      
   [ "$ready" = "$DBUS_SESSION_BUS_ADDRESS" ] || die "Failed to start user   
   session bus on $DBUS_SESSION_BUS_ADDRESS"   
      
   if [ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ]; then   
    echo export DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" >>   
   "$XDG_RUNTIME_DIR/profile"   
   fi   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca