cdown / clipmenu

Clipboard management using dmenu
MIT License
1.14k stars 91 forks source link

OpenBSD support #92

Closed bigodel closed 6 years ago

bigodel commented 6 years ago

I love your script but unfortunately it doesn't work on OpenBSD. It starts with the fact that since bash isn't native to OpenBSD, the path to bash is actually /usr/local/bin/bash, because it installs every third party package at /usr/local/bin. I'll try, using your clipnotify (I was actully going to implement my own, but yours works very well and is pretty simple, I'll just maybe incorporate it into the same repo and try to install it system wide if possible) to implement it in strictly POSIX shell, in order for it to work on as many *nix systems as possible.

I will close this issue, I just wanted to tell you that I really love the simplicity of your approach and that unfortunately it doesn't work on my OS (and that this gave me inspiration to try and make one that works on my machine :P).

Best regards, João Pedro.

cdown commented 6 years ago

I believe both of these should allow it to work (the pledge commit is not required but is good convention on OpenBSD):

Try out these commits and let me know if they don't work on OpenBSD :-) I have no OpenBSD machine readily available to test, but they should work.

bigodel commented 6 years ago

The bash issue is fixed, but there are still some problems. On clipnotify, I need to add -I/usr/X11R6/include and -L/usr/X11R6/lib to the compiling command, because that's the default location of X11 in OpenBSD. That's something I haven't managed to fix yet, so if you find a solution to make it run on a system where X11 is installed in a different location, I'd be pleased to know.

Regarding clipmenud, timeout is a GNU coreutils program, and I couldn't find it in the ports or packages to install on OpenBSD. I did install coreutils though, and after adding the correct flags to the compiling command of clipnotify and changing timeout to gtimeout on clipmenud everything works fine!

cdown commented 6 years ago

Anything else to do? If not, I'll make new releases of both. :-)

bigodel commented 6 years ago

clipmenu and clipmenud both work fine.

clipnotify on the other hand compiles but dumps its core on execution due to the pledge("stdio rpath", NULL) call.

cdown commented 6 years ago

I probably was overzealous with the pledging. Can you try with a few other possible values? Maybe start with the following and whittle it down until it SIGABRTs again:

pledge("stdio rpath wpath proc")

That said, I'm pretty surprised existing pledge call isn't enough, maybe there is some interesting behaviour inside one of the xlib calls...

bigodel commented 6 years ago

Well, no matter what value I put in the pledge call it aborts. I tried including err.h and using the err() function instead of perror() but it made no difference. Debugging on gdb I found this:

Breakpoint 1, main () at clipnotify.c:21
21          if (MAYBE_PLEDGE("stdio rpath wpath proc", NULL) < 0) {
(gdb) s
pledge () at -:3
3       -: No such file or directory.

Hope it helps, I couldn't really understand what it meant.

bigodel commented 6 years ago

Oh, and I also added #include <unistd.h> to the true case in the #ifdef __OpenBSD__ to silence the implicit declaration of function pledge warning and -g -ggdb -O0 to the Makefile in order to debug.

bigodel commented 6 years ago

I think it might be better to open an issue on the clipnotify repository, since all issues with clipmenu are now fixed.

cdown commented 6 years ago

Yeah, sure. For now I'll just remove the pledge call and release both. Thanks for bringing this up :)

cdown commented 6 years ago

clipmenu 5.5.1 released, clipnotify 1.0.2 released.