Bug 243836

Summary: Unable to delete or change files and folders on a samba share
Product: Ports & Packages Reporter: bsd-bugzilla
Component: Individual Port(s)Assignee: Gleb Popov <arrowd>
Status: Closed FIXED    
Severity: Affects Only Me CC: arrowd, grahamperrin, sunpoet
Priority: --- Keywords: pkgbase
Version: Latest   
Hardware: Any   
OS: Any   

Description bsd-bugzilla 2020-02-03 09:09:07 UTC
I am not able to delete or change files and folders on a samba share (Fritz-NAS share, mounted via fstab) neither with Dolphin nor with the KDE terminal (Konsole). Without KDE, on the shell (FreeBSD 12.1-RELEASE), it is working as well as with my smart phone. The problem is exactly reproduceable on another machine.
I also checked it out with XFCE and had no problems.
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2020-02-11 19:06:28 UTC
"mounted via fstab" isn't very clear. You mean, mounted via mount_smbfs?
Comment 2 bsd-bugzilla 2020-02-11 20:28:39 UTC
(In reply to Gleb Popov from comment #1)
Yes, I do. This is the entry in /etc/fstab:

//charles@192.168.178.1/fritz.nas /mnt/nas-hdd smbfs rw,-I=192.168.178.1 0 0

Owner group and access rights are set properly and out of KDE-Plasma on the shell (wether as root or as a normal user) there are no problems.
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2020-02-18 17:12:33 UTC
Yep, reproduced.

However, after closing Dolphin, the file can be successfully deleted from Konsole.

I think, the problem is because our implementation of QFileSystemWatcher calls open() on files being watched. In case of SMBFS this probably locks them and prevents deletion.

Not sure how to fix this, though. Make Qt see what is the type underlying filesystem is?
Comment 4 Gleb Popov freebsd_committer freebsd_triage 2020-04-20 07:40:41 UTC
The problem goes down to devel/libinotify.

Pull request pending upstream: https://github.com/libinotify-kqueue/libinotify-kqueue/pull/8
Comment 5 Gleb Popov freebsd_committer freebsd_triage 2020-04-20 13:02:00 UTC
@sunpoet, can I adjust devel/libinotify so that it pass --enable-skip-subfiles=smbfs during configure step?

See this PR and https://github.com/libinotify-kqueue/libinotify-kqueue/pull/8 fir rationale.
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2020-04-22 14:44:28 UTC
(In reply to Gleb Popov from comment #5)

I'm OK for this change. Will it affect other ports?
Comment 7 Gleb Popov freebsd_committer freebsd_triage 2020-04-22 15:19:35 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #6)
Of course it would. Pretty much every Qt port, at least.
Comment 8 commit-hook freebsd_committer freebsd_triage 2020-04-24 08:33:19 UTC
A commit references this bug:

Author: arrowd
Date: Fri Apr 24 08:33:17 UTC 2020
New revision: 532745
URL: https://svnweb.freebsd.org/changeset/ports/532745

Log:
  devel/libinotify: Do not set watches on smbfs and fusefs filesystems.

  PR:		243836
  Approved by:	sunpoet

Changes:
  head/devel/libinotify/Makefile
Comment 9 Gleb Popov freebsd_committer freebsd_triage 2020-04-24 08:34:21 UTC
Should be fixed with libinotify-20180201_2