GNOME Bugzilla – Bug 656186
Trash backend becomes unsuable when there are non-UTF-8 filenames.
Last modified: 2013-11-08 05:00:24 UTC
I noted that trash backend stops working after I trashed some files with non-UTF-8 filenames. It's unable to do dir listing, but this is only the case when display-name attribute is involved. How to reproduce the bug: 1. Trash several files and folders with non-UTF-8 filenames. 2. Execute `gvfs-ls -l -a "standard:display-name" trash:///` or with `-a "standard::*"`. 3. You will notice that nothing are listed. 4. Execute `gvfs-ls -l trash:///` instead without "display-name" and compare the result with previous one. This one should work. How to reproduce the bug, part 2: 1. Run nautilus 2. Go to trash can 3. Nothing will be shown, but there are actually several trashed files and folders. How to reproduce the bug, part 3: 1. Try to gvfs-rm one of the files listed under trash:/// with non-UTF-8 filename. 2. The delete operation fails sometimes and the error message indicates "file not found". I consider this a serious bug since you are not able to recover trashed files with non-UTF-8 filenames. For users who doesn't know xdg trash spec and ~/.local/share/Trash, this means "data loss" and a broken trash can. Please fix this issue. Thanks a lot.
Created attachment 258991 [details] [review] trash: Support enumerating non-UTF-8 filenames Before when enumerating, display names were set directly from the filenames which can be a problem if the filename is not UTF-8. Instead, don't set the display name at all since it is set correctly via trash_backend_add_info().
Created attachment 258992 [details] [review] trash: Add " (invalid encoding)" to files with invalid encoding Set the display name using the same method as for sftp and local files.
How can I make non-utf-8 filename? I have tried: $ touch `echo -e "\x80\x81\x82"` ...which produces invalid filename, however it doesn't cause any mentioned problems. Nautilus shows "[Invalid UTF-8]" and gvfs-ls trash:// shows "???" and erasing is possible.
Review of attachment 258992 [details] [review]: It looks good, however untested. It would be better to use existing function for it: gvfs_file_info_populate_names_as_local from gvfsdaemonutils.c
Review of attachment 258991 [details] [review]: Looks good, however untested as the previous one.
This broke it for me: echo test > `echo -e "\x80\x81\x82\x83\x84\x85"` I will update the second patch using gvfs_file_info_populate_names_as_local().
Created attachment 259199 [details] [review] trash: Add " (invalid encoding)" to files with invalid encoding
Review of attachment 259199 [details] [review]: Looks good.
Pushed to master as 15d5da3f13f9325cab8d32316304ce49d0ff83fb. Thanks!