Created attachment 224392 [details] v1 XDG_RUNTIME_DIR purpose is explained in https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html It holds unix(4) sockets for Wayland, DBus (user session), Emacs (server), uim, etc. ConsoleKit2 defines it by default but minimalistic setups (e.g., libseat or X11-nested session) don't. login.conf(5) provides a way to set environment variables regardless of user shell. Unfortunately, the directory needs to be created as some consumers will fail otherwise. Inspired by: https://hub.darcs.net/raichoo/hikari#setting-up-xdg_runtime_dir Fixes: "error: XDG_RUNTIME_DIR not set in the environment." Disclaimer: Mainly affects fresh FreeBSD installs and new users, so I may have missed something.
Sorry, this is only tangentially related to the idea of this PR. You bring up a problem that I think is eminently solvable in base. I often wondered why there is no option in the base system (say via an xdg capability in login.conf) to provision that directory (and maybe others) at login and export the right environment variables. It could be nicely integrated into the system based on already existing features. Anyway to document the problem we have right now in pkg-message seems like a good idea to me, so FWIW +1 from me.
(In reply to Tobias Kortkamp from comment #1) Some prior art exists for PAM e.g., https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/pam-xdg-support/trusty/view/head:/pam_xdg_support.8 https://git.sdaoden.eu/browse?p=s-toolbox.git;a=blob;f=pam_xdg.8
Created attachment 224671 [details] v2 One more PAM example - https://github.com/ifreund/rundird/ I've imported pam_xdg in ports d255158645da and trimmed pkg-message in v2 here. See also https://mail-index.netbsd.org/netbsd-users/2021/04/26/msg026951.html
Ping x11@. I need feedback or approval.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=2d487a43aa142c32eabdd8feeb4ca523d24c6a42 commit 2d487a43aa142c32eabdd8feeb4ca523d24c6a42 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2021-04-24 02:18:33 +0000 Commit: Tobias Kortkamp <tobik@FreeBSD.org> CommitDate: 2021-05-11 17:50:32 +0000 graphics/wayland: add note about XDG_RUNTIME_DIR error: XDG_RUNTIME_DIR not set in the environment. PR: 255355 Inspired by: hikari Approved by: maintainer timeout graphics/wayland/pkg-message (new) | 9 +++++++++ 1 file changed, 9 insertions(+)
A commit in branch 2021Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=b33587a4adc2dc846f129cb4e167cb6efb33fa12 commit b33587a4adc2dc846f129cb4e167cb6efb33fa12 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2021-04-24 02:18:33 +0000 Commit: Tobias Kortkamp <tobik@FreeBSD.org> CommitDate: 2021-05-11 17:54:04 +0000 graphics/wayland: add note about XDG_RUNTIME_DIR error: XDG_RUNTIME_DIR not set in the environment. PR: 255355 Inspired by: hikari Approved by: maintainer timeout (cherry picked from commit 2d487a43aa142c32eabdd8feeb4ca523d24c6a42) graphics/wayland/pkg-message (new) | 9 +++++++++ 1 file changed, 9 insertions(+)
Committed. Thanks!