bindfs icon indicating copy to clipboard operation
bindfs copied to clipboard

Improve OpenBSD support

Open vl-ms opened this issue 3 years ago • 6 comments

Gives me the following error:

$ make
make  all-recursive
Making all in src
cc -DHAVE_CONFIG_H -I. -I..  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=700 -D__BSD_VISIBLE=1 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_DARWIN_BETTER_REALPATH     -std=c99 -Wall -Wpedantic -fno-common -g -O2 -MT bindfs.o -MD -MP -MF .deps/bindfs.Tpo -c -o bindfs.o bindfs.c
bindfs.c:712:9: warning: implicit declaration of function 'fuse_exit' is invalid in C99 [-Wimplicit-function-declaration]
        fuse_exit(fuse_get_context()->fuse);
        ^
bindfs.c:1666:6: error: field designator 'ioctl' does not refer to any field in type 'struct fuse_operations'
    .ioctl      = bindfs_ioctl,
     ^
bindfs.c:2830:21: error: no member named 'ioctl' in 'struct fuse_operations'
        bindfs_oper.ioctl = NULL;
        ~~~~~~~~~~~ ^
1 warning and 2 errors generated.
*** Error 1 in src (Makefile:455 'bindfs.o')
*** Error 1 in . (Makefile:427 'all-recursive': @fail=;  if (target_option=k; case ${target_option-} in  ?) ;;  *) echo "am__make_running_wi...)
*** Error 2 in /home/unix/soft/bindfs-1.17.0 (Makefile:334 'all')

Any advice on how to approach this? I'm not even close to being a C developer.

vl-ms avatar Oct 06 '22 13:10 vl-ms

It should now build with the latest git master, but I've not tested it properly yet.

mpartel avatar Oct 06 '22 21:10 mpartel

Thank you for such a fast response! Now I cloned the repo, previously tried to compile from a tarball. Since OpenBSD doesn't have bash by default, the usual bash location is in /usr/local/bin/bash. So autogen.sh should use /usr/bin/env bash instead. Anyway, compilation went fine, but after I tried to mount... Nothing happens. It doesn't exit with an error or anything, it silently returns me a shell and the files don't appear where they are supposed to be. Maybe I misunderstood something, but the basic usage seems to be

bindfs directory-to-mount path-where-to-mount

At least that's what I did.

vl-ms avatar Oct 08 '22 14:10 vl-ms

That kind of basic usage works for me in an OpenBSD 7.1 VM. You can try bindfs -d ... to have it stay in the foreground and print some debug info.

mpartel avatar Oct 08 '22 15:10 mpartel

Thanks, the issue was that I expected fuse to work without root privileges by default (the error message from the -d flag pointed me to the solution). Running with doas works fine. Other issue I noticed: manpages are missing.

vl-ms avatar Oct 08 '22 17:10 vl-ms

OpenBSD removed support for running FUSE filesystems as non-root. This surprised me too. I guess bindfs on OpenBSD could check for this and print an error. I'm surprised their FUSE library doesn't already do this.

Good to hear that it seems to mostly work with such a small change. I'll leave this issue open since clearly there are more things to look into to properly support OpenBSD. Finding time for that is another matter :(

mpartel avatar Oct 08 '22 21:10 mpartel

It's not that suprising considering that programs such as bindfs can trick other programs to read wrong config files, execute different scripts, etc. So I see how this can be dangerous and how a separate privilege level for using fuse programs should be added (a separate fuse group suffices, I think). Anyway, thanks for your hard work, once I figure out the man page issue bindfs can be packaged in OpenBSD ports!

vl-ms avatar Oct 09 '22 17:10 vl-ms