GNOME Bugzilla – Bug 350976
Renaming a SMB file should give better error for illegal characters
Last modified: 2018-09-21 16:15:44 UTC
When you rename a file in a SMB share to "hel\lo.txt" (note the backslash), Nautilus simply tells you that it couldn't rename the file. It should give a better explanation. The attached patch fixes this [we get EINVAL from libsmbclient, which gets translated to GNOME_VFS_ERROR_BAD_PARAMETERS].
Created attachment 70754 [details] [review] nautilus-350976-rename-bad-parameters-message.diff
Confirming and modifying fields. I think this will require patching GVfs too, as we should get the G_IO_ERROR_INVALID_FILENAME error, not G_IO_ERROR_INVALID_ARGUMENT as it happens now.
This bug was assigned to Nautilus during the gnome-vfs days. I'm reassigning this to gvfs now; I don't really know if the SMB backend works as described now.
We're not handing this right in gvfs ATM. I guess its EINVAL we need to convert to G_IO_ERROR_INVALID_FILENAME.
Created attachment 130435 [details] [review] gvfs-bgo350976-translate-einval-to-invalid-filename.diff Untested patch, but it handles all the calls to libsmbclient from the SMB backend that are related to filenames. For those calls that are not filename-related (like smbc_read), we don't modify EINVAL.
Ping? Any news on a review for this patch? :-)
Created attachment 193879 [details] [review] gvfs-bgo350976-translate-einval-to-invalid-filename.diff Attaching rebased patch with minor compilation fixes. Patch looks good to me, however my libsmbclient-3.5.8 is getting me ENOENT istead of EINVAL on file rename. This results in no change of error message in Nautilus. I wonder if getting ENOENT is consistent across various libsmbclient versions. ENOENT is rather general error code and I would rather keep it specific to renaming. It's also hard to distinguish between bad source or target URI.
Recent libsmbclient does seem to give ENOENT for an invalid filename so I guess the patch wouldn't make any difference. Would it be possible to accurately map ENOENT to G_IO_ERROR_INVALID_FILENAME, at least for rename()?
*** Bug 741135 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/27.