Comments (3)
I run into the same issue when preparing atuin daemon support on Gentoo.
When this variable is available, Atuin should locate its daemon socket at
$XDG_RUNTIME_DIR/atuin/atuin.sock
by default.
Not only when this variable (XDG_RUNTIME_DIR) is available. Even in the absence of XDG_RUNTIME_DIR from the processes' environment, atuin should default to that. The "XDG Base Directory Specification" is states that
If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message. Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk.
Source: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
So atuin's default for socket_path
should be, in bash variable default-value notation, ${XDG_RUNTIME_DIR:-/run/user/${UID}}/atuin.socket
.
from atuin.
When it falls back to /run/user/$UID
, one should check if that directory exists and has the correct owner and permission. Then, one can use that directory.
If the directory doesn't exist, one can next attempt to create a temporary directory in /tmp
using mkdtemp(3)
, but special care would be needed to share the directory with the other calls of Atuin. Another possibility is to manually create a directory in /tmp
, but it has pitfalls that may allow attackers to intercept, so one needs to be careful doing it.
Another thing to care is a known bug of WSL. In WSL systems, one should avoid using /run/user/...
(even when XDG_RUNTIME_DIR
specifies /run/usr/...
). These problems started to happen around the last September, but I don't see any movements to solve the issue in WSL.
from atuin.
When it falls back to /run/user/$UID, one should check if that directory exists and has the correct owner and permission. Then, one can use that directory.
Due to this additional complication in following that part of the spec, my PR doesn't fallback to it. It's also not theoretical, as we checked Alpine and it does not have this path.
If the var exists, we use it, and if it doesn't, we don't. The var is automatically set by systemd, and points to a directory that has been correctly setup. Creating and managing such a dir is very out of scope for Atuin.
Afaik we have no way of detecting WSL, and if that becomes an issue users can specify a different directory. I'm afraid "just follow XDG" is never as easy as it sounds.
from atuin.
Related Issues (20)
- Unable to build from Git on Windows HOT 1
- [Bug]: Error: pool timed out while waiting for an open connection HOT 2
- Feature Request: Fully clear input on Control-C
- [Bug]: "Error: error returned from database: (code: 4847) disk I/O error" if no space left on device HOT 3
- [Bug]: atuin status with Error: the 'year' component could not be parsed
- [Bug]: Scrolling in tmux window invokes Atuin history panel
- [Bug]: Defaults to fish and conf.d ? HOT 4
- [Feature Request]: Allow to save locally command history having secrets but have an ooption to prevent from sending it over the server HOT 1
- Unable to import structured history data from hishtory into atuin and have the atuin program search it HOT 1
- [Bug]: typing more of a string makes it a worse match HOT 3
- Feature request: sync config.toml
- [Bug]: Atuin fzf search to behave the same like my zsh fzf search
- [Bug]: atuin status with Error: unexpected trailing characters; the end of input was expected
- [Bug]: atuin + starship + zsh + accept-line override is clearing previous command? HOT 1
- [Bug]: sqlite database corruption on network filesystem AFS HOT 1
- [Bug]: Cannot install on NixOS
- [Bug]: some commands are missed by atuin for no apparent reason? HOT 3
- feature request: allow disable "/" keybind applicable when "ctrl+r" is enabled (for ble.sh compatibility)
- [Bug]: Fish shell plugin not loaded on startup
- [Feature request]: search match syntax highlight
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atuin.