-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix!: create IPC socket in user runtime directory #1313
Conversation
3e98fc3
to
23326d3
Compare
Unfortunately this does not apply to all the platforms, i.e. the BSDs or macOS. |
Oh, didn't know that. I'll make sure to install a BSD VM to test these things in the future. I just think that it would be nice to switch to |
I'm okay with this. I think we could probably use |
I'll change the PR when I have some more time as I still have to properly set up GhostBSD for testing. |
I think that is indeed a better solution than manually specifying the path. I don't know whether The importance of the permissions is also something that is mentioned by the XDG Base Directory Specification. I think if it will be changed, it should be done correctly the first time, so as not to put files all over the user's system after a while. That's why I spent some time looking up all the platform conventions.
(I'm going deeper and deeper down the rabbit hole of temporary directories... 😵💫) |
23d0f48
to
075d2e8
Compare
I've marked this as ready for review as it now works like in the suggestion:
In all these cases, the permissions are set correctly to avoid unauthorized access to the runtime files. This has been tested on both Arch Linux and FreeBSD. If a runtime directory can't be found, the code does panic in this version. I don't expect this to ever happen as every UNIX system should at least have a I hope this isn't too complicated for end users. It should work like expected on every platform so users who are used to the platform they work with should easily find the runtime files. I also documented the change in the README. I understand if this PR isn't merged, since it's only a suggestion to try and conform to platform conventions, but it is also a breaking change after all. |
075d2e8
to
0813a73
Compare
4c6ec86
to
c4e3121
Compare
Thanks, looks good to me. You brought up one good point, though:
I didn't do enough research when I suggested that, sorry. I think |
I'd argue that using a directory inside
The only reason why I would keep it there would be to keep the user experience the same, since it has been like this for a while now. On the other hand, IF it were to change, this would be the time to do it, before One small problem with the current implementation (and a really hard one to solve correctly) is that the application runtime directory ( A final thought about this PR would be that it could be interesting to provide a CLI command to obtain all the used paths (cache, config, runtime...). Some other programs do that as well, and it would make the documentation nicer. It could just say 'run Sorry for the walls of text, I just want to get this right the first time as it's not nice for users to change it many times 😄 |
Temporary file library just for referenceJust discovered this which might clean up the code (no need for manual cleanup logic for temporary files/directories). It also mentions the difficulty of doing this manually, which probably is related to the possible bugs mentioned in the previous comment. It's already an indirect dependency of |
Sounds good! I'd be fine with merging this for now. Are you OK with this?
From what I can tell that seems like a negligible problem, as ncspot is only create a file socket and I have created a ticket for the CLI command idea which I really liked. |
Yes, I think it's fine for now. I'll maybe try to find a fix for clearing the directory in the future. I'll also have a look at the CLI feature soon. |
Let me just update the changelog... |
Each user has their own runtime directory at `/run/user/<uid>`. Creating the IPC socket in there makes sure it is cleaned up regardless of whether `ncspot` exits normally. BREAKING CHANGE: move IPC socket location
0813a73
to
2b6a616
Compare
Each user has their own runtime directory at
/run/user/<uid>
. Creating the IPC socket in there makes sure it is cleaned up regardless of whetherncspot
exits normally.BREAKING CHANGE: move IPC socket location