-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
WIP: Move Mumble Socket and Overlay to $XDG_RUNTIME_DIR/mumble/ #5961
base: master
Are you sure you want to change the base?
WIP: Move Mumble Socket and Overlay to $XDG_RUNTIME_DIR/mumble/ #5961
Conversation
I thought of using Use of QtStandardPaths::RuntimeLocation QString runtimePath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
QString mumbleRuntimePath = QDir(runtimePath).absolutePath() + QLatin1String("/mumble/");
QDir().mkpath(mumbleRuntimePath);
pipepath = QDir(mumbleRuntimePath).absoluteFilePath(QLatin1String("MumbleOverlayPipe")); |
What is that tags file that has been added in this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to create a new function for obtaining the respective path so we don't have to write the logic in multiple places (with the potential of screwing up one of the times or one version getting outdated because it was overlooked).
I would propose writing a function returning a std::string
and everything that needs something else can convert from that.
I suppose that old overlays won't work with new Mumble versions and vice versa after this PR. I guess that's fine as it seems like an unlikely scenario. However, existing IPC scripts will also stop working, if XDG_RUNTIME is not set. But then again, from your description it seemed that this special case was ill-defined anyway, so I wouldn't consider it likely that a lot of scripts exist for this special case... |
Yeah I like the idea. Where would I put this util function, tho? I'm not accustomed to Mumble's code organization, yet |
Btw: do you want me to include in this PR the fix for OverlayTest? So that it can be run again? I found it super useful to test the change of this PR in a flatpak environment |
4213b41
to
1a914d9
Compare
1a914d9
to
fe0d085
Compare
I'm afraid OverlayTest does not actually test anything, does it? CI gets stuck |
Well... how can it work if Mumble is not running? |
fe0d085
to
e90cb73
Compare
That is not even the issue. |
69d6faf
to
e55e979
Compare
e55e979
to
d7dedfe
Compare
128423c
to
fedacf0
Compare
I have not forgotten this, but I still don't have the time to look into this |
sigh... let's try to ignore that it took me half a year to take another look at this. Big sorry for that 🙈 I had another look at the current implementation and I think most of the complexity comes from the fact that doing the path-related logic in C is a bit of a PITA. namespace mumble {
namespace overlay {
std::string getIPCPath();
std::string getSocketPath();
std::string getPipePath();
std::string createSocket();
std::string createPipe();
}
}
extern "C" {
char *mumble_overlay_create_and_get_socket();
char *mumble_overlay_create_and_get_pipe();
} The respective wrappers would then simply call the C++ implementation under the hood, allocate a new char buffer of the appropriate size, copy the contents over and then return that freshly allocated buffer for use in C world. Inside the C++ implementations, we can then make use of Qt (for lack of C++17 support in Mumble) to do the filesystem operations (in particular things like querying the user's home directory) and then only do the actual creation of the pipe and socket in a platform dependent manner. That seems to save a lot of complexity that I am currently seeing in the C implementation. In order for all to work together, I think the easiest solution would be to make the overlay utils part of the
which is not terribly pretty but should get the job done, without devastating readability 🤔 This would of course mean, that we can then never build the overlay client without building the And once we make the switch to C++17, we could even create another, standalone, static library that makes uses of Thoughts? @carlocastoldi do you even still want to work on this? If not, I could totally understand. |
Alternatively, we could use cwalk. |
I rather like the idea of using a third party C library (cwalk) instead of choosing to entangle the overlay code with client's.
I sure want. It's just a matter of time. I recently started a new job so I have fewer free time to spend on this. P.S. a little reminder: I started all of this work so that it would be possible to have the overlay on flatpak steam games. The next major work I would like to work on is to move away the overlay from using shared memory, onto exclusively using local sockets (branch#socket-overlay-not-chunked and branch#socket-overlay-chunked) |
Alright - using a 3rdParty library would also be fine for me. However it seems like cwalk doesn't provide a function to query the user's home directory - unless normalizing Another option could be to create a completely separate target that implements this functionality and that the overlay and the Mumble client both link to. Then inside this function we could use even simply use C++17 (making sure to not accidentally export STL symbols). |
If I wanted to use cwalk, would it be ok for you if I used it only in
True. However this is only needed in BSD/MacOS and it's a matter of 5 easy lines. I don't see it as a deal breaker. Moreover, the process for retrieving the home not so different from retrieving the runtime directory on Linux. Also: are we sure both BSD and MacOS suggest using the home directory for storing this kind of files? Isn't there a standard similar to what we have on Linux? |
Moving MumbleSocket and MumbleOverlayPipe to a dedicated subdirectory keeps the runtime directory clean and allows flatpak applications to use the overlay by giving access only to Mumble's subdirectory. It also moves the default directory to /run/user/$UID/mumble/ when $XDG_RUNTIME_DIR is not set. Fixes mumble-voip#5951
adds a test application that connects to MumbleOverlayPipe and displays the overlay as configured. It's disabled by default as it is designed to be a check for humans
Hell. I gave it a try and included |
a421e1e
to
840cbee
Compare
2e683ff
to
b1c6089
Compare
I had an hard time figuring out whether it was possible to compile and link cwalk both in 32 and 64bits in the same build as a 3rdparty library/dependency. P.S. i marked this PR as WIP as at the moment commits and code is not merge-ready. |
f7a4466
to
4ab1b23
Compare
4ab1b23
to
98fab94
Compare
Finally, since Windows doesn't rely on an actual "path" for sockets, i didn't even have to handle platform specific separators. At this point, I'd like to request whether the code structure of this PR is roughly ok or not. Is the refactoring you asked when suggesting to write "a function returning a Thank you in advance! |
@carlocastoldi Hi, sorry that it took so long. Are you still willing to work on this? @davidebeatrici @Krzmbrzl Would you be able to look at the latest changes/questions OP stated? |
This is one of the PRs that is still on my TODO list but for which I currently don't have the necessary time to look into. |
Yups |
Moving MumbleSocket and MumbleOverlayPipe to a dedicated subdirectory keeps the runtime directory clean and allows flatpak applications to use the overlay by giving access only to Mumble's subdirectory. It also moves the default directory to
/run/user/$UID/mumble/
when$XDG_RUNTIME_DIR
is not set.Fixes #5951
See also: flathub/com.valvesoftware.Steam#273
Checks