The Samba-Bugzilla – Bug 11011
No error shown when deleting a file from Read-Only file system
Last modified: 2015-01-07 13:28:52 UTC
Create a xfs partition.
Mount it read-write permissions and create some files on it.
Unmount it and remount with read only mode now.
Create a share in smb.conf for the xfs partition now mounted read only.
path = /mount/path
read only = no
guest ok = yes
Now access the share using Windows 7.
Delete one of the files previously created with Shift+Del.
The file disappears without any error.
The file is however not deleted in the backend and comes back again after
the Windows Cache expires.
To properly show an error message we need to do a user-space check whether we are allowed to delete a file. However, we can't tell if the file we are trying to delete is on a readonly file system. We get an error message at unlink(2) time, but for the Windows GUI that's too late. Not sure how to properly handle this.
If you can figure out a way to detect a read-only filesystem at open() call time, I'm willing to reopen this one.
You need to add code inside can_delete_file_in_directory() to detect the read-only filesystem given the path - and it has to be efficient.
Until then I'm going to close this one out, sorry.
I will work on a patch as per Jeremy's idea.
Till I get that done, I agree that we can keep this bug closed.
Thanks for the comments Volker and Jeremy.