Bug 495214 - A filename whose length equals NAME_MAX cannot be moved to wastebin, because appending `.trashinfo` causes the resulting filename to exceed that value
Summary: A filename whose length equals NAME_MAX cannot be moved to wastebin, because ...
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 24.08.2
Platform: Fedora RPMs Linux
: NOR minor
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-22 22:57 UTC by Roke Julian Lockhart Beedell
Modified: 2024-11-05 18:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot of the dialog window. (18.69 KB, image/png)
2024-10-22 22:57 UTC, Roke Julian Lockhart Beedell
Details
Screenshot of the main window. (110.38 KB, image/png)
2024-10-22 22:58 UTC, Roke Julian Lockhart Beedell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roke Julian Lockhart Beedell 2024-10-22 22:57:52 UTC
Created attachment 175124 [details]
Screenshot of the dialog window.

SUMMARY
-------

Filenames at the 255-character limit (as defined by `NAME_MAX` in `file:///usr/src/linux-headers-2.6.38-10/include/linux/limits.h`) cannot be moved to the wastebin by appending `.trashinfo`, because the resultant filename exceeds `NAME_MAX`. Consequently, this situation needs to be specially handled by Dolphin, by:

1. Solely providing the "Delete" option, which is unintuitive and dangerous UX.
2. Prompting the user to manually reduce the filename before it can be moved to the wastebin. This shall be problematic for multiple filenames, because not everyone knows how to use KRename.
3. Automatically reducing the filename, and storing the original name in a sidecar file. This is the best option, because the user shouldn't be manually interacting with `$HOME/.local/share/Trash/` outside of `trash:/` anyway.

STEPS TO REPRODUCE
------------------

1. Name a file `!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`.
2. Attempt to send that file to the wastebin via Dolphin's context menu entry.

OBSERVED RESULT
---------------

It fails, with a nondescript error. See the attached screenshots.

EXPECTED RESULT
---------------

As aforementioned.

SOFTWARE/OS VERSIONS
--------------------

> ```YAML
> Operating System: Fedora Linux 40
> KDE Plasma Version: 6.2.1
> KDE Frameworks Version: 6.7.0
> Qt Version: 6.7.2
> Kernel Version: 6.11.4-201.fc40.x86_64 (64-bit)
> Graphics Platform: Wayland
> Processors: 12 × AMD Ryzen 5 7600X 6-Core Processor
> Memory: 30.4 GiB of RAM
> Graphics Processor: AMD Radeon RX 5700
> Manufacturer: ASRock
> Product Name: X670E Taichi
> ```

ADDITIONAL INFORMATION
----------------------

Obviously, it's a very, very niche situation. Noticed when filing https://github.com/darkreader/darkreader/issues/13410#issue-2606658084.
Comment 1 Roke Julian Lockhart Beedell 2024-10-22 22:58:18 UTC
Created attachment 175125 [details]
Screenshot of the main window.
Comment 2 Roke Julian Lockhart Beedell 2024-10-22 22:59:29 UTC
(In reply to Roke Julian Lockhart Beedell from comment #0)
There's some useful information about this at https://serverfault.com/revisions/306726/3#:~:text=%23define-,NAME_MAX%20%20%20%20%20%20%20%20%20255,-/*%20%23%20chars.
Comment 3 TraceyC 2024-11-05 18:52:39 UTC
Confirmed on git-master

For convenience, here's an easy way to generate a file with 255 characters
N=251 && name=`perl -e "print 'a' x $N;"`
touch ${name}.txt