#951208 Impossible to mount over nonempty directories

Package:
bindfs
Source:
bindfs
Description:
mirrors or overlays a local directory with altered permissions
Submitter:
Willem Mulder
Date:
2021-02-05 09:09:14 UTC
Severity:
normal
#951208#5
Date:
2020-02-12 13:49:48 UTC
From:
To:
Dear Maintainer,

Currently, it's not possible for me to mount over nonempty directories.
BindFS insists I have to use -o nonempty:

    fuse: mountpoint is not empty
    fuse: if you are sure this is safe, use the 'nonempty' mount option

But when I do, I get the following message:

    fusermount: unknown option 'nonempty'

Some quick searching suggests this might have to do with upgrading to
FUSE 3: https://github.com/rclone/rclone/issues/3562

Kind regards,

Willem Mulder

#951208#10
Date:
2020-02-12 15:17:20 UTC
From:
To:
Hi Willem,

The only reference to "nonempty" in binds code is when a directory is
mounted on itself. In that case bindfs adds `-ononempty` automatically. I
changed it so it doesn't on FUSE 3:
https://github.com/mpartel/bindfs/commit/2c2337b7c9b87744662c4b08d453bf7128444f43
(git master, not in a release yet)

If that doesn't help, maybe you're running a mixed environment where e.g.
bindfs is compiled against FUSE 2 but the system runs FUSE 3 helper
binaries? The version list at the end of your e-mail suggests this.
I added an option that may help you debug that:
https://github.com/mpartel/bindfs/commit/4b87500fef925e591b08cb8aea6bf0a21b84dd72

Let me know if I can help further.

#951208#15
Date:
2020-02-12 15:17:20 UTC
From:
To:
Hi Willem,

The only reference to "nonempty" in binds code is when a directory is
mounted on itself. In that case bindfs adds `-ononempty` automatically. I
changed it so it doesn't on FUSE 3:
https://github.com/mpartel/bindfs/commit/2c2337b7c9b87744662c4b08d453bf7128444f43
(git master, not in a release yet)

If that doesn't help, maybe you're running a mixed environment where e.g.
bindfs is compiled against FUSE 2 but the system runs FUSE 3 helper
binaries? The version list at the end of your e-mail suggests this.
I added an option that may help you debug that:
https://github.com/mpartel/bindfs/commit/4b87500fef925e591b08cb8aea6bf0a21b84dd72

Let me know if I can help further.

#951208#20
Date:
2020-02-12 16:07:45 UTC
From:
To:
Hi Martin,

I haven't used your option, but I can confirm (using `ldd
/usr/bin/bindfs` and `fusermount -V`) that bindfs was linked against
libfuse 2.9.9, and the helper binaries are version 3.7.0. I guess the
package either needs to limit the FUSE version to < 3, or link against
libfuse >= 3.

Kind regards,

Willem Mulder

#951208#25
Date:
2020-02-17 09:49:23 UTC
From:
To:
Ok, thanks. If you don't use other FUSE filesystems, you can maybe
uninstall `fuse3` and install `fuse`.

I'm unfortunately unlikely to have time to port bindfs to FUSE 3 in the
near future :(

The easiest distro-level workaround in terms of "least code required" would
probably be to patch fuse3's fusermount to allow and ignore `nonempty` (and
maybe print a deprecation warning). Or some hacks could probably be
invented to direct FUSE 2 filesystems to use FUSE 2 helpers. It's up to the
Debian maintainers whether they want the maintenance burder of either of
these workarounds.



On Wed, 12 Feb 2020 at 18:07, Willem Mulder <willemm@scintilla.utwente.nl> wrote:

#951208#30
Date:
2020-02-18 13:07:53 UTC
From:
To:
Hello,

Martin Pärtel kirjoitti 17.2.2020 klo 10.49:

CC'ing FUSE's maintainer for extra input if any.


From the discussion above I gather that bindfs is still (with limitations) usable with fuse3. If true, then I wouldn't
like to block users of fuse3 from using bindfs via strict Depends. I could add Suggests or Recommends on fuse2,
though.

How common of a use case is to use bindfs with a non-empty mount point? I never mounted filesystems like that myself, so
I don't know if it's a minor nuisance with an easy workaround, or a significant limitation making some use case
unachievable.


Regards,

#951208#35
Date:
2020-02-18 22:12:45 UTC
From:
To:
I've used non-empty mountpoints a few times, mostly when mounting a
directory onto itself, but I have no idea how popular that use case really
is.
Mounting to a new empty location is probably always possible, but it's
sometimes quite undesirable or inconvenient:
- Sometimes I want to enforce certain rules on a directory and hide the
original directory to prevent confusion and misuse.
- Sometimes I want to quickly test something on an existing directory, and
a program I want to use might be configured or even hard-coded to use that
specific directory.
So I think this is worth fixing.

Here's my current understanding (I was a bit confused in my initial
response):
- The scope: bindfs seems to work fine with libfuse2 and fuse3 EXCEPT for
`nonempty`. The test suite, which tests most other features, passes on
Debian 10 with fuse3 installed.
- The bug: libfuse2 checks that the destination is empty or `nonempty` is
given. Then it invokes fusermount (symlinked to fusermount3), which doesn't
accept `nonempty`.
- bindfs cannot be compiled against libfuse3. That would require
significant code changes.

So it seems backwards compatibility between fusermount3 and libfuse2 was
intended, and this is a bug there.
If so, here are the "easy" fixes I can think of:
1. patch fusermount3 to accept and ignore `nonempty` (perhaps only when
invoked through a symlink named fusermount?)
or
2. patch libfuse2 to stop requiring `nonempty` (or passing it to fusermount
when it's symlinked to fusermount3?)
or
3. instead of symlinking fusermount -> fusermount3, make it a wrapper
script that drops `nonempty` from any option list like `-o
option1,nonempty,option2,...`

If someone who knows FUSE better can point out something simple I can do in
bindfs code instead, I'd be happy to write a short patch.
But there may be other FUSE 2 filesystems designed to "wrap" an existing
directory that also have this bug, so I think fixing this at the FUSE layer
is better.

#951208#40
Date:
2020-02-21 09:02:30 UTC
From:
To:
Hi,

At our association we have shared home directories (over NFS), but on
one particular server, our remote desktop server, we have the XDG
config, data and cache directories on separate HDDs. We're using bindfs
to mount them onto their default locations, since not all software uses
the XDG environment variables. People can also run software on other
servers, so we do need (the ability) to mount over nonempty directories.

Kind regards,

Willem Mulder

#951208#45
Date:
2021-01-11 07:51:46 UTC
From:
To:
Package: bindfs
Version: 1.14.7-1
Followup-For: Bug #951208

I use bindfs to redirect heavy I/O away from my SSD from the Firefox cache, when visiting some specific sites, because
it does not support XDG_CACHE_HOME:

https://bugzilla.mozilla.org/show_bug.cgi?id=259356

If that can be helpful, the arch wiki has a comprehensive list of apps that do not follow the XDG spec, or follow it
in part:

https://wiki.archlinux.org/index.php/XDG_Base_Directory

#951208#50
Date:
2021-02-05 09:04:32 UTC
From:
To:
bindfs -o nonempty ... works for me after today's fuse3 update to 3.10.1-3,
which is patched per #939767 ("fuse3: Installing fuse3 breaks fuse2 applications
using -o nonempty").