martanne / abduco

abduco provides session management i.e. it allows programs to be run independently from its controlling terminal. That is programs can be detached - run in the background - and then later reattached. Together with dvtm it provides a simpler and cleaner alternative to tmux or screen.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XDG Base Directory Specification for session information

googl opened this issue · comments

Seeing as ~/.abduco would store session information and stale sessions tend to happen, it may help to use $XDG_CACHE_HOME. Some benefits of that would be not being affected by errant $TMPDIR (used for increasing compilation code capacity etc.) and having a standard location based on the kind of user (temporary, roaming etc.). Later, cleaning scripts for $XDG_CACHE_HOME could help with removal of stale sessions across reboots. What do you think?

According to the specification $XDG_RUNTIME_DIR would probably be the best fit if not for the following:

The lifetime of the directory MUST be bound to the user being logged in. It MUST be created when the user first logs in and if the user fully logs out the directory MUST be removed. If the user logs in more than once he should get pointed to the same directory, and it is mandatory that the directory continues to exist from his first login to his last logout on the system, and not removed in between. Files in the directory MUST not survive reboot or a full logout/login cycle.

Which begs the question how being logged in is defined in the systemd world ...

With the latest commits it should be possible to give it a try by adding the relevant lines to the start of the dirs array as in:

dirs[] = {
    { getenv("XDG_RUNTIME_DIR"), true },
    ...
}

Anyway I agree that it would probably be a good idea to change the default directory from $HOME to a temporary one which does not survive a reboot.

With the latest commits the used directories can be configured through config.def.h. Furthermore there exists a special environment variable called $ABDUCO_SOCKET_DIR hence adding something like export ABDUCO_SOCKET_DIR="$XDG_CACHE_HOME" to your shell/login/PAM whatever startup scripts should have the desired effect.

Wow! It's been so long already?! I have not been active. Thanks for the good work. Will try to provide feedback going forward.