Bug 234276 - x11/rxvt-unicode: Enhance urxvtd and urxvtc integration with service managers
Summary: x11/rxvt-unicode: Enhance urxvtd and urxvtc integration with service managers
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Thierry Thomas
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2018-12-22 17:48 UTC by Jonathan de Boyne Pollard
Modified: 2021-05-14 17:33 UTC (History)
0 users

See Also:
thierry: maintainer-feedback+


Attachments
patch to enhance urxvtd and urxvtc (10.96 KB, patch)
2018-12-22 17:48 UTC, Jonathan de Boyne Pollard
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan de Boyne Pollard 2018-12-22 17:48:16 UTC
Created attachment 200370 [details]
patch to enhance urxvtd and urxvtc

This is also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=917105 .

urxvtd can be run as a per-user service under the nosh toolset's service manager and under systemd.  It does not have the problems that some X11 terminal emulators have with needing a DISPLAY environment variable in the dæmon.  But it is not perfect.  In particular, one cannot use the service managers' abilities to pass the listening socket in as an already open file descriptor, using (in the nosh toolset case for example) a service bundle with a run script along the lines of:

    #!/bin/nosh
    local-stream-socket-listen --systemd-compatibility --mode 0600 /run/user/JdeBP/urxvt/daemon
    urxvtd

What happens in practice is that urxvtd ignores the passed-in file descriptor for a listening socket and blithely opens its own, second, listening socket file descriptor.

The attached patch enhances urxvtd to interoperate with these service management subsystems, allowing it to be passed the listening socket in this way.  It also updates urxvtc and the doco keeping them in step.

I have already added automatically-made per-user service bundles to the nosh service management allowing users to manage the urxvt dæmon with system-control --user.  I developed and tested this on FreeBSD invoking the urxvtd service from the nosh per-user service manager.

Notes:

* The patch adds support for the XDG_RUNTIME_DIR environment variable from the Freedesktop Base Directory Specification, which enables using some features in systemd units and also results in automatic cleanup of socket files (as opposed to their lingering in /tmp or one's home directory) as part of the normal semantics of /run.

* Runtime directories are by definition private to individual users and machines, and so when a runtime directory is used the socket name is fixed as ${XDG_RUNTIME_DIR}/urxvt/daemon and does not vary by host name or unnecessarily repeat the software name.  (Compare the behaviour of other softwares which used to use compound names in /tmp, such as dbus-daemon using just ${XDG_RUNTIME_DIR}/bus for example.)   Per convention the urxvt subdirectory does not have a hidden name (in contrast to ${HOME}/.urxvt/).

* The manual pages are updated to reflect the additional environment variables that are recognized, and to show which takes precedence.
Comment 1 Jonathan de Boyne Pollard 2018-12-22 17:50:05 UTC
This is also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=917105 .

urxvtd can be run as a per-user service under the nosh toolset's service manager and under systemd.  It does not have the problems that some X11 terminal emulators have with needing a DISPLAY environment variable in the dæmon.  But it is not perfect.  In particular, one cannot use the service managers' abilities to pass the listening socket in as an already open file descriptor, using (in the nosh toolset case for example) a service bundle with a run script along the lines of:

    #!/bin/nosh
    local-stream-socket-listen --systemd-compatibility --mode 0600 /run/user/JdeBP/urxvt/daemon
    urxvtd

What happens in practice is that urxvtd ignores the passed-in file descriptor for a listening socket and blithely opens its own, second, listening socket file descriptor.

The attached patch enhances urxvtd to interoperate with these service management subsystems, allowing it to be passed the listening socket in this way.  It also updates urxvtc and the doco keeping them in step.

I have already added automatically-made per-user service bundles to the nosh service management allowing users to manage the urxvt dæmon with system-control --user.  I developed and tested this on FreeBSD invoking the urxvtd service from the nosh per-user service manager.

Notes:

* The patch adds support for the XDG_RUNTIME_DIR environment variable from the Freedesktop Base Directory Specification, which enables using some features in systemd units and also results in automatic cleanup of socket files (as opposed to their lingering in /tmp or one's home directory) as part of the normal semantics of /run.

* Runtime directories are by definition private to individual users and machines, and so when a runtime directory is used the socket name is fixed as ${XDG_RUNTIME_DIR}/urxvt/daemon and does not vary by host name or unnecessarily repeat the software name.  (Compare the behaviour of other softwares which used to use compound names in /tmp, such as dbus-daemon using just ${XDG_RUNTIME_DIR}/bus for example.)   Per convention the urxvt subdirectory does not have a hidden name (in contrast to ${HOME}/.urxvt/).

* The manual pages are updated to reflect the additional environment variables that are recognized, and to show which takes precedence.
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2018-12-23 10:01:05 UTC
This patch is not specific to the FreeBSD port, and I think it would be better to submit it upstream.

You could propose it to the rxvt-unicode mailing list:
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-05-14 17:33:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=34e89e40c1d7e0c5b5256d10e7dc377cc2f502e7

commit 34e89e40c1d7e0c5b5256d10e7dc377cc2f502e7
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2021-05-14 17:26:05 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2021-05-14 17:32:25 +0000

    x11/rxvt-unicode: upgrade to 9.25

    Changelog at
            <http://lists.schmorp.de/pipermail/rxvt-unicode/2021q2/002606.html>.

    PR:             234276

 x11/rxvt-unicode/Makefile                          |  4 +---
 x11/rxvt-unicode/distinfo                          |  5 ++--
 x11/rxvt-unicode/files/patch-configure             | 27 +++++++++++-----------
 x11/rxvt-unicode/files/patch-doc-Makefile.in       | 11 +++++----
 x11/rxvt-unicode/files/patch-doc-urxvtcd.1.man     |  4 ++--
 .../files/patch-doc_Makefile.in (gone)             | 10 --------
 ...tyslot-removal => patch-libptytty_src_ptytty.C} |  6 ++---
 x11/rxvt-unicode/files/patch-src-Makefile.in       | 14 +++++------
 x11/rxvt-unicode/files/patch-src-urxvtcd           |  4 ++--
 x11/rxvt-unicode/files/patch-src__command.C        |  6 ++---
 x11/rxvt-unicode/files/patch-src__gentables        |  4 ++--
 x11/rxvt-unicode/files/patch-src_perl_kuake        |  6 ++---
 .../files/patch-src_rxvtperl.xs (gone)             | 15 ------------
 x11/rxvt-unicode/pkg-plist                         |  1 +
 14 files changed, 48 insertions(+), 69 deletions(-)