From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Vivien Kraus <vivien@planete-kraus.eu>,
Maxim Cournoyer <maxim.cournoyer@gmail.com>,
66339@debbugs.gnu.org
Cc: rg@raghavgururajan.name
Subject: bug#66339: [PATCH gnome-team v6] gnu: dbus-service: make the session available under /run/dbus
Date: Sun, 08 Oct 2023 16:53:23 +0200 [thread overview]
Message-ID: <59169352e8b09119c850fd2b5e80cb668ccd47fb.camel@gmail.com> (raw)
In-Reply-To: <178db70e715f9e3c6a25e42034d90d672e893349.1696761183.git.vivien@planete-kraus.eu>
Am Mittwoch, dem 04.10.2023 um 12:47 +0200 schrieb Vivien Kraus:
> According to
> https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3101, glib
> now searches for the session bus socket in runstatedir. The dbus
> service must thus have its socket in /run/dbus.
>
> For interoperability with the dbus standard, /run/dbus is also
> symlinked to
> /var/run/dbus.
>
> * gnu/services/dbus.scm (dbus-activation): Symlink /run/dbus to
> /var/run/dbus.
> (%dbus-accounts): Run dbus in /run/dbus.
> (dbus-root-service-type): Save the pid file in /run/dbus.
> ---
>
> Hello,
>
> I changed my mind back to a previous mind change, so: the socket
> should be
> installed in /run. I believe that the code moves the content of the
> existing
> /var/run/dbus to /run/dbus before trying the symlink again, if
> /var/run/dbus
> exists and is not a symlink to /run/dbus. I don’t really have a way
> to check
> the interesting case where existing files need to be moved. However,
> the
> gnome-team-configured VM works.
>
> Best regards,
>
> Vivien
>
> gnu/services/dbus.scm | 39 ++++++++++++++++++++++++++++++++++++---
> 1 file changed, 36 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
> index 5a0c634393..aa9ce0720c 100644
> --- a/gnu/services/dbus.scm
> +++ b/gnu/services/dbus.scm
> @@ -163,7 +163,7 @@ (define %dbus-accounts
> (group "messagebus")
> (system? #t)
> (comment "D-Bus system bus user")
> - (home-directory "/var/run/dbus")
> + (home-directory "/run/dbus")
> (shell (file-append shadow "/sbin/nologin")))))
>
> (define dbus-setuid-programs
> @@ -186,7 +186,40 @@ (define (dbus-activation config)
> (let ((user (getpwnam "messagebus")))
> ;; This directory contains the daemon's socket so it must
> be
> ;; world-readable.
> - (mkdir-p/perms "/var/run/dbus" user #o755))
> + (mkdir-p/perms "/run/dbus" user #o755))
> +
> + (catch 'system-error
> + (lambda ()
> + (symlink "/run/dbus" "/var/run/dbus"))
> + (lambda args
> + (let ((errno (system-error-errno args)))
> + (cond
> + ((= errno EEXIST)
> + (let ((existing-name
> + (false-if-exception
> + (readlink "/var/run/dbus"))))
> + (unless (equal? existing-name "/run/dbus")
> + ;; Move the content of /var/run/dbus to
> /run/dbus, and
> + ;; retry.
> + (let ((dir (opendir "/var/run/dbus")))
> + (let move-to-/run/dbus ((next (readdir dir)))
> + (cond
> + ((eof-object? next)
> + (closedir dir))
> + ((member next '("." ".."))
> + (move-to-/run/dbus (readdir dir)))
> + (else
> + (begin
> + (rename-file (string-append
> "/var/run/dbus/" next)
> + (string-append "/run/dbus/"
> next))
> + (move-to-/run/dbus (readdir dir))))))))
I'd rename "move-to-/run/dbus" to the boring but more idiomatic "loop".
This saves us some horizontal real-estate that'd allow us to squash
some lines.
> + (rmdir "/var/run/dbus")
> + (symlink "/run/dbus" "/var/run/dbus")))
> + (else
> + (format (current-error-port)
> + "Failed to symlink /run/dbus to
> /var/run/dbus: ~s~%"
> + (strerror errno))
> + (error "cannot create /var/run/dbus"))))))
>
> (unless (file-exists? "/etc/machine-id")
> (format #t "creating /etc/machine-id...~%")
> @@ -210,7 +243,7 @@ (define dbus-shepherd-service
> '(#:environment-variables
> '("DBUS_VERBOSE=1")
> #:log-file "/var/log/dbus-
> daemon.log")
> '())
> - #:pid-file "/var/run/dbus/pid"))
> + #:pid-file "/run/dbus/pid"))
> (stop #~(make-kill-destructor)))))))
>
> (define dbus-root-service-type
>
> base-commit: b18b2d13488f2a92331ccad2dc8cbb54ee15582f
Otherwise LGTM. I'd commit it, but my machine is currently busy
building half of core-updates for no reason.
Cheers
next prev parent reply other threads:[~2023-10-08 14:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3121a39dc569ff872afe74a8871ef71456ea5451.camel@univ-reims.fr>
2023-10-04 10:47 ` bug#66339: [WIP PATCH gnome-team] gnu: dbus-service: make the session available under /run/dbus Vivien Kraus via Bug reports for GNU Guix
2023-10-04 18:30 ` Liliana Marie Prikler
2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v2] " Vivien Kraus via Bug reports for GNU Guix
2023-10-05 4:41 ` Liliana Marie Prikler
2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v3] " Vivien Kraus via Bug reports for GNU Guix
2023-10-06 18:50 ` Liliana Marie Prikler
2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v4] " Vivien Kraus via Bug reports for GNU Guix
2023-10-06 21:41 ` Liliana Marie Prikler
2023-10-04 10:47 ` bug#66339: [PATCH gnome-team v6] " Vivien Kraus via Bug reports for GNU Guix
2023-10-08 14:53 ` Liliana Marie Prikler [this message]
2023-10-09 20:36 ` Liliana Marie Prikler
2023-10-06 21:12 ` bug#66339: [PATCH gnome-team v5] gnu: glib: Set runstatedir Vivien Kraus via Bug reports for GNU Guix
2023-10-07 14:39 ` bug#66339: Gnome-team dbus socket in /var/run/dbus, not /run/dbus Maxim Cournoyer
2023-10-08 15:40 ` Bruno Victal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59169352e8b09119c850fd2b5e80cb668ccd47fb.camel@gmail.com \
--to=liliana.prikler@gmail.com \
--cc=66339@debbugs.gnu.org \
--cc=maxim.cournoyer@gmail.com \
--cc=rg@raghavgururajan.name \
--cc=vivien@planete-kraus.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).