Bug 267518 - [NEW PORT] fusefs-davfs2: FUSE-Filesystem to access WebDAV servers
Summary: [NEW PORT] fusefs-davfs2: FUSE-Filesystem to access WebDAV servers
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Alexey Dokuchaev
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-11-02 11:15 UTC by Ali Abdallah
Modified: 2024-12-12 10:35 UTC (History)
8 users (show)

See Also:


Attachments
davfs2 1.7.0 ported to FreeBSD (3.55 KB, patch)
2022-11-02 11:15 UTC, Ali Abdallah
no flags Details | Diff
updated patch (4.35 KB, patch)
2022-11-04 08:06 UTC, Li-Wen Hsu
no flags Details | Diff
Updated patch with new davfs2 user and group without SUID (4.78 KB, patch)
2023-02-16 09:45 UTC, Ali Abdallah
no flags Details | Diff
Updated patch with new davfs2 user and group without SUID v2 (4.73 KB, patch)
2023-02-16 10:09 UTC, Ali Abdallah
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Abdallah 2022-11-02 11:15:53 UTC
Created attachment 237812 [details]
davfs2 1.7.0 ported to FreeBSD

Hello, I'm the current main developer of davfs2 [1]. I ported the project to work on FreeBSD, please find out the attached port diff

Please note that due to bug 263625, davfs2 works with >= 1301503 and >= 1400057, that is checked in the Makefile

[1] https://savannah.nongnu.org/projects/davfs2/
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2022-11-04 08:06:40 UTC
Created attachment 237857 [details]
updated patch

Thanks for the port, I've modified the port a little bit to follow (most of) the portlint, portfmt and portclippy suggests. Can you help check and test it?
Comment 2 Ali Abdallah 2022-11-04 08:23:39 UTC
(In reply to Li-Wen Hsu from comment #1)

Thanks! I tested it, all fine.
Comment 3 lbfoo 2022-11-25 07:45:03 UTC
Looking forward to it.
Comment 4 Alexey Dokuchaev freebsd_committer freebsd_triage 2022-12-01 14:49:11 UTC
> I ported the project to work on FreeBSD
This is great!  I've tried porting it myself back in 2018 but got tired of overcoming linuxisms.  Let's see it hits the tree sooner rather than later.
Comment 5 ev 2023-01-11 17:18:37 UTC
is there any information on the planned date of adding a new port?
Comment 6 Gleb Popov freebsd_committer freebsd_triage 2023-01-25 20:02:36 UTC
What's the reason for SUID option and defaulting to it?
Comment 7 Alexey Dokuchaev freebsd_committer freebsd_triage 2023-01-26 07:27:49 UTC
(In reply to ev from comment #5)
> is there any information on the planned date of adding a new port?
As soon as I work around those little annoying build-related gimmicks, e.g. usage of "neon-config --libs" which emits private libraries, etc.

(In reply to Gleb Popov from comment #6)
> What's the reason for SUID option and defaulting to it?
I guess the intention was to allow mounts under regular user.  I'd see if it's really needed or maybe subject to vfs.usermount=1 and will most likely remove the option and suid-bit installation.
Comment 8 Gleb Popov freebsd_committer freebsd_triage 2023-01-26 07:56:39 UTC
(In reply to Alexey Dokuchaev from comment #7)
>  I'd see if it's really needed or maybe subject to vfs.usermount=1 and will most likely remove the option and suid-bit installation.

Yes, please. No other fusefs-* ports have such option and the canonical way to allow user mounts is via sysctl. We also have bsdisks, which can serve as a mounting daemon via D-Bus.
Comment 9 Ali Abdallah 2023-02-15 08:53:15 UTC
The code checks for "vfs.usermount=1" option already, and the idea was to allows not user mount when SUID is set and vfs.usermount=1, so yes it is subject to SUID. But I can remove that if required.

Now I noticed that on a new FreeBSD installation that I didn't have davfs2 user and group (on my previous system I had added those manually), they are required. Would you be okay to add those ports/GIDs and ports/UIDs ?
Comment 10 Gleb Popov freebsd_committer freebsd_triage 2023-02-15 18:01:26 UTC
(In reply to Ali Abdallah from comment #9)
> The code checks for "vfs.usermount=1" option already, and the idea was to allows not user mount when SUID is set and vfs.usermount=1, so yes it is subject to SUID. But I can remove that if required.

I still don't quite get why bother with both vfs.usermount and SUID. Let the user deal with that if he ever wants to do mounts from non-root user.

> Would you be okay to add those ports/GIDs and ports/UIDs ?

Ah, this fusefs implementation runs a daemon. Yes, adding entries to GIDs and UIDs is a right thing to do.
Comment 11 Ali Abdallah 2023-02-16 07:46:24 UTC
(In reply to Gleb Popov from comment #10)
> Ah, this fusefs implementation runs a daemon. Yes, adding entries to GIDs and
UIDs is a right thing to do.

I will provide a new patch adding GIDs and UIDs and removing the SUID option.
Comment 12 Ali Abdallah 2023-02-16 09:45:49 UTC
Created attachment 240178 [details]
Updated patch with new davfs2 user and group without SUID
Comment 13 Gleb Popov freebsd_committer freebsd_triage 2023-02-16 09:58:23 UTC
Why does davfs2.conf file gets installed into both /etc and /share/davfs2?
Comment 14 Ali Abdallah 2023-02-16 10:09:35 UTC
Created attachment 240179 [details]
Updated patch with new davfs2 user and group without SUID v2

It was autogenerated, fixed now.
Comment 15 Alexey Dokuchaev freebsd_committer freebsd_triage 2023-02-22 08:04:17 UTC
(In reply to Gleb Popov from comment #13)
> Why does davfs2.conf file gets installed into both /etc and
> /share/davfs2?
Grepping for DAV_CONFIG in the `mount_davfs.c' suggests that DAV_SYS_CONF_DIR is used when reading/parsing configuration, but when populating missing directories in check_dirs() function, DAV_DATA_DIR is used.

There are couple of small bugs in the manpage (was written by by) <- notice double "by" and usage tells to call mount(8) like this:

    mount -t davfs <server-url> <mountpoint> [-o options]

On FreeBSD, options should precede the arguments, but that could be fixed in the later versions.  More importantly, does it really work?  What am I missing:

$ mount -t davfs -o debug=most https://wbdav.yandex.ru /mnt/yd
mount: https:/wbdav.yandex.ru: Operation not supported by device
$ _

Logs do not tell much other that reporting davfs2 version.  Where did one of the URL slashes go in the error message?  Dropping the "http://" part does not help.

When doing ``mount.davfs wbdav.yandex.ru /mnt/yd'', it asks for username and password, but later fails with ``405 Method Not Allowed'' message.  Is this expected for some servers like YandexDisk?  Cadaver works fine on it.
Comment 16 Ali Abdallah 2023-03-01 11:09:46 UTC
(In reply to Alexey Dokuchaev from comment #15)

I will fix the reported issue for the next release.

I never used mount -t davfs, don't think that will work, only mount.davfs will correctly handle the mount. 

"405 Method Not Allowed" is returned by the server, probably dav isn't enabled? I test usually against apache and nginx webdav implementation, and fuse-davfs2 works perfectly fine on Linux and FreeBSD with those servers. 

I'm planning to move the project to github soon so it will be easier to track issues.
Comment 17 ev 2023-03-05 08:56:08 UTC
typo in url?
it should be https://webdav.yandex.ru
Comment 18 Gleb Popov freebsd_committer freebsd_triage 2023-05-18 06:07:42 UTC
Ali, did you make any progress on this?
Comment 19 Ali Abdallah 2024-11-20 22:13:24 UTC
(In reply to Gleb Popov from comment #18)

The project has been migrated to github [1], and a new bugfix 1.7.1 version has been released. 

I'm using it on a FreeBSD 14.1 box against nextcloud/apache server with no problems. If you are having any issue using it on FreeBSD, please open a ticket at github. 

[1] https://github.com/alisarctl/davfs2
Comment 20 Alexey Dokuchaev freebsd_committer freebsd_triage 2024-12-10 08:38:29 UTC
(In reply to Ali Abdallah from comment #16)
> I will fix the reported issue for the next release.
"was written by by" is still greppable in the 1.7.1 sources.  Also, the NLS case looks incomplete, as I need to patch `src/Makefile.in' in the following way (no need to resubmit anything, just wanted to confirm):

@@ -268,6 +268,9 @@ VERSION = @VERSION@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+ifeq ($(USE_NLS),yes)
+LIBS += $(LIBINTL)
+endif
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@

> I never used mount -t davfs, don't think that will work
It doesn't work indeed (emits "Invalid fstype: Invalid argument" error) but nonetheless documented in the manpage under SYNOPSIS (root only), this could be confusing.

> "405 Method Not Allowed" is returned by the server, probably dav isn't
> enabled?
Could be a typo on my side as noted in comment #17.  I want to retest the new version against Yandex.Disk again, but apparently they require OAuth token these days which I'm now struggling to obtain, stand by...

  https://savannah.nongnu.org/bugs/?57589
  https://yandex.com/dev/disk/webdav
Comment 21 Alexey Dokuchaev freebsd_committer freebsd_triage 2024-12-11 06:44:08 UTC
(In reply to Alexey Dokuchaev from comment #20)
> want to retest the new version against Yandex.Disk again, but apparently
> they require OAuth token these days which I'm now struggling to obtain:
Turns out yesterday I failed to RTFM, they now require a dedicated per-app password rather than Yandex account password to access the disk via WebDAV:

  https://yandex.ru/support/disk-desktop/webdav-app-passwords.html

After generating WebDAV password, I could mount my Yandex.Disk, hooray!

I've noticed something strange, however: doing plain ls(1) on mounted share is quite fast, unlike `ls -l':

$ ls /mnt/yd
0.007u 0.007s 0:01.46 0.0%      0+0k 0+0io 0pf+0w
$ ls -l /mnt/yd
0.015u 0.046s 2:15.82 0.0%      78+141k 0+0io 0pf+0w

Well over two minutes!  Looking at the `kdump -E' output, fstatat() calls take too much time to complete.  But this issue can be addressed later, the program generally works and I'll add the port shortly.
Comment 22 Ali Abdallah 2024-12-11 07:07:21 UTC
(In reply to Alexey Dokuchaev from comment #21)
Thank you for the feedback and for queuing the program for addition to ports.

Please kindly report any issue on github to help improving davfs2 on FreeBSD!
Comment 23 commit-hook freebsd_committer freebsd_triage 2024-12-12 10:25:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ebd64e65a49ef01be669f868f32de82deead3ab3

commit ebd64e65a49ef01be669f868f32de82deead3ab3
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2024-12-12 10:23:58 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2024-12-12 10:23:58 +0000

    filesystems/davfs2: new port had been added (+)

    This is a FUSE file system driver that allows mounting a
    WebDAV server as a local file system, like a disk drive.

    PR:             267518 (heavily modified)
    Submitted by:   Ali Abdallah (current main developer)

 GIDs                                               |  2 +-
 UIDs                                               |  2 +-
 filesystems/Makefile                               |  1 +
 filesystems/davfs2/Makefile (new)                  | 38 ++++++++++++++++++++++
 filesystems/davfs2/distinfo (new)                  |  3 ++
 .../davfs2/files/patch-src_Makefile.in (new)       | 12 +++++++
 filesystems/davfs2/pkg-descr (new)                 | 13 ++++++++
 filesystems/davfs2/pkg-plist (new)                 | 24 ++++++++++++++
 8 files changed, 93 insertions(+), 2 deletions(-)
Comment 24 Alexey Dokuchaev freebsd_committer freebsd_triage 2024-12-12 10:35:49 UTC
(In reply to Ali Abdallah from comment #19)
> The project has been migrated to GitHub
Nonetheless, thanks for putting the distfile at Savannah as well.  I've taken the liberty to list both sites for the time being, as the old tells more about the project and its development history.

I've also used more elaborate and user-oriented description from my original port, hope you won't mind.  Thank you for supporting FreeBSD, and sorry it took a while to wrap it up!