Bug 410576 - Dolphin can not delete files with weird character encoding in file name
Summary: Dolphin can not delete files with weird character encoding in file name
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 19.07.80
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-04 14:27 UTC by postix
Modified: 2020-11-19 07:01 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of the issue. (158.16 KB, image/png)
2019-08-04 14:27 UTC, postix
Details
Example file with invalid encoding (3.81 KB, image/png)
2019-08-05 09:43 UTC, postix
Details
Minimal example project (562 bytes, application/zip)
2019-08-05 10:26 UTC, postix
Details
Video which demonstrates the issue. (3.28 MB, video/mp4)
2019-11-03 13:17 UTC, postix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2019-08-04 14:27:02 UTC
Created attachment 121929 [details]
Screenshot of the issue.

SUMMARY

If a file contains weird character encodings like:

$ls -l *
''$'\360\302\342''A'$'\374\177'
'output'$'\221\314\034''_'$'\026\177''.png

Dolphin cannot delete those, but says they do not exist.
They can be deleted by opening a terminal though.

OBSERVED RESULT

See screenshot.

EXPECTED RESULT

Dolphin does not complain.


SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.0
Kernel Version: 5.2.4-1-MANJARO
Comment 1 Julian Steinmann 2019-08-04 15:46:08 UTC
Can confirm with Dolphin 19.11.70 on KDE Neon Git Unstable.
Comment 2 Christoph Feck 2019-08-05 00:54:21 UTC
Could you please create a tar.gz archive with a file named this way and add it here?
Comment 3 postix 2019-08-05 09:43:49 UTC
Created attachment 121937 [details]
Example file with invalid encoding

The file can be deleted via its inode:
> find . -inum ${inode} -delete
Comment 4 postix 2019-08-05 10:26:41 UTC
Created attachment 121938 [details]
Minimal example project

It seems that the faulty encoding vanishes when I download the attachment with the FireFox.
That's why I created a minimal C++ example project. However it requires the ROOT framework to be installed.

The "Form" function used is the following:
https://root.cern.ch/doc/master/classTString.html#aeb44d6183d8b1f1b7090dbd3c93f5e39

I am sorry that I cannot deliver any other samples right now.
Comment 5 postix 2019-08-05 10:32:57 UTC
I found a workaround: 

In Dolphin do:

* Create a new folder
* Move the weird files to this new folder with Dolphin
* Delete the folder, ie the folder moves to trash
* Delete the folder in the trash

Just deleting the files directly does not work.
Comment 6 Christoph Feck 2019-08-05 11:11:08 UTC
> It seems that the faulty encoding vanishes when I download the attachment with the FireFox.

That's the reason I requested a tar.gz file which contains a file using a not working name.
Comment 7 postix 2019-08-05 11:31:33 UTC
I should have mentioned that I tried to this but failed:
> tar -czf test.tar "\'\'$\'\020\365\226\377\177\'\'_Encoding.root\'"
as tar will rename the file making the sample useless.

However you can do this:

> touch testfile
> mv testfile ''$'\020\365\226\377\177''.test'

:-)
Comment 8 Christoph Feck 2019-08-05 11:41:16 UTC
> mv testfile ''$'\020\365\226\377\177''.test'

I could delete the file using Dolphin. Need more information how to reproduce.
Comment 9 postix 2019-08-05 11:52:16 UTC
The minimal sample I found, which I cannot delete, is
> touch $'\300'
or any number greater than 300. Below it will create an ASCII, for example
> touch $'\100'
will create a file named "@"

I am not sure why you are able to delete it. Maby you use a filesystem other than ext4?
Which additional information could I give you?
Comment 10 Christoph Feck 2019-08-05 11:54:32 UTC
I am also using ext4. Are you using a UTF-8 locale?
Comment 11 Christoph Feck 2019-08-05 11:56:41 UTC
set | grep ^L[AC]
Comment 12 postix 2019-08-05 11:58:03 UTC
> set | grep ^L[AC]

> LANG=de_DE.UTF-8
> LANGUAGE=
> LC_ALL=de_DE.UTF-8
> LC_NAME=de_DE.UTF-8
Comment 13 Christoph Feck 2019-08-05 12:06:24 UTC
If you say that you are able to delete a directory that contains such a file, the bug isn't in kio. Needs someone to further investigate.
Comment 14 postix 2019-11-03 13:17:17 UTC
Created attachment 123697 [details]
Video which demonstrates the issue.

I tried it again and I can no longer delete the folder with the weird file within Dolphin but with the "rm" command in a terminal. So it is likely related to KIO.

I made a video for you: 

* Create a weird file
* Rename it
* Undo renaming
* Try to delete it
* Move it to a folder
* Delete the folder, ie move it to the trash
* Try to empty the trash
* Try to remove the folder in the trash
* Remove the folder with rm -rf
* Press F5 to update the cache so Dolphin notices that the Folder and file are actually gone


System update:

Operating System: Manjaro Linux 
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.1
Comment 15 postix 2019-11-03 13:20:28 UTC
For the video I used a freshly created user account.

However, a friend of mine, who is on Manjaro KDE as well, could not reproduce it unfortunately. Maybe I should try to reinstall my system or test it with a live version?
Comment 16 Christoph Feck 2019-11-03 13:46:55 UTC
I haven't investigated properly, but if you are trying to delete files inside trash:// KIO slave instead of using the file:// slave, then it probably cannot work because the encoding hack to support broken file names was only added for the file:// slave.
Comment 17 postix 2019-11-03 14:24:04 UTC
(In reply to Christoph Feck from comment #16)
> if you are trying to delete files
> inside trash:// KIO slave instead of using the file:// slave, then it
> probably cannot work because the encoding hack to support broken file names
> was only added for the file:// slave.

That's why the file in the folder is not displayed in Dolphin for trash:// but only for file:// 

Displays the file:
> /home/user/.local/share/Trash/files/foo/

Does not display the file:
> trash:/0-foo/
Comment 18 Justin Zobel 2020-11-19 07:01:03 UTC
Moving to confirmed as it seems Christoph and Postix have confirmed where the issue lies.