[Github-comments] [geany/geany] Domain socket error: Not working via sudo is a geany bug, not a feature or bug in sudo (#1150)

doublemeat notifications at xxxxx
Wed Aug 31 18:11:55 UTC 2016


Interesting. Grateful that you took the time to explain, and hopefully it will help others understand as well.

It also helped that you pointed out that this needed to work across distros and platforms. I didn't even know Geany ran on Windows. And I do get the "domain socket" communication endpoint concept now, and why it must be known before any one instance of Geany even starts.

Ultimately, it boils down to a single feature or requirement, and how it relates to a second, more fundamental requirement: 1) Open new files _not_ in a new Geany instance, but in a new tab in the same instance. And 2) Work the same way across distros and platforms.

If you ditched the first requirement, the problem could disappear. (Not that it's a bad requirement. It's a good requirement I think. And not that there aren't other ways to mitigate the problem while keeping both feature/requirements. But for me, personally - and I'm sure I'm in the minority on this specific point - I'd rather it work with sudo and not sudo at the same time, and open single-file multiple instances. If that was the only choice.)

So, to make Geany work as designed but also accommodate the sudo bug, I could update my scripts - really just one - to detect when user id = 0, and use one of the flags to point it to a unique or just different pre-known instance.

I could even just write a wrapper script called "geany" and put it first in path. For *nix (presumably Windows doesn't have this problem):

`#!/bin/bash`
`if [ "$EUID" == "0" ]; then`
`    /usr/bin/geany -c /tmp/geany_root_socket $@`
`else`
`    /usr/bin/geany $@`
`fi`

But if I can do it that succinctly in a script, could it be nearly as simple in code? (I mean, I know it _could_ be exactly that simple, but in reality probably isn't due to related code existing in different places, and also cross-platform concerns - I'm only worried about two, and a third environment [Windows] doesn't have the problem.)

[Here](http://stackoverflow.com/a/27776822)'s a way to conditionally check for OS in makefile. But again, it doesn't have to be that complex - just two of those tests ("linux" and "darwin") would cover an overwhelming swath, and almost all the rest would be Windows (already OK without anything extra). Anything else not covered, would just experience the bug, but would solve the problem for, perhaps, 99.9% of your users.

Perhaps much more simply, the install script could test for the existence of "bash" in the path (and that we're running on a unix-like machine, such as checking for the existence of $MACHTYPE being populated with anything), and if so, name the binary /usr/bin/geany-bin and the bash script above to /usr/bin/geany. (Or create a symlink in /usr/bin to the script instead of binary, etc.)

Just some thoughts.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1150#issuecomment-243851597
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160831/cf067a63/attachment.html>


More information about the Github-comments mailing list