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: 2020-08-04 17:20 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 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