Bug 507493 - Folder custom icons are ignored on bcachefs file system
Summary: Folder custom icons are ignored on bcachefs file system
Status: ASSIGNED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 6.16.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-25 21:31 UTC by Mikhail Morozov
Modified: 2025-09-23 16:40 UTC (History)
3 users (show)

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


Attachments
Folder with and without a custom icon (4.51 KB, image/png)
2025-07-25 21:31 UTC, Mikhail Morozov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Morozov 2025-07-25 21:31:29 UTC
Created attachment 183515 [details]
Folder with and without a custom icon

SUMMARY
If a folder is situated on a bcachefs partition its icon in Dolphin will not display a custom icon set in the `.directory` file.

STEPS TO REPRODUCE
1. Setup the environment.
> $ touch fs && truncate fs --size 128M && mkfs.bcachefs fs && sudo mount fs /mnt && sudo chown $USER:$USER /mnt && mkdir /mnt/folder && printf '[Desktop Entry]\nIcon=folder-games\n' > /mnt/folder/.directory
2. Open the Dolphin file manager.
3. Open the `/mnt` directory.

OBSERVED RESULT
Icon of `/mnt/folder` keeps its stock appearance.

EXPECTED RESULT
Icon of `/mnt/folder` changes to the one set in the `.directory` file.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.15.7-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
Memory: 32 GiB of RAM (27.3 GiB usable)
Graphics Processor: AMD Radeon Graphics

ADDITIONAL INFORMATION
The cause of this bug is a file size check at https://invent.kde.org/frameworks/kio/-/blob/v6.16.0/src/core/> kfileitem.cpp?ref_type=tags#L1020
> static bool isDirectoryMounted(const QUrl &url)
> {
>     // Stating .directory files can cause long freezes when e.g. /home
>     // uses autofs for every user's home directory, i.e. opening /home
>     // in a file dialog will mount every single home directory.
>     // These non-mounted directories can be identified by having 0 size.
>     // There are also other directories with 0 size, such as /proc, that may
>     // be mounted, but those are unlikely to contain .directory (and checking
>     // this would require checking with KMountPoint).
> 
>     // TODO: maybe this could be checked with KFileSystemType instead?
>     QFileInfo info(url.toLocalFile());
>     if (info.isDir() && info.size() == 0) {
>         return false;
>     }
>     return true;
> }
It seems on bcachefs stat'ing any folder results in the reported size always being 0.
> $ stat /mnt/folder
>   File: /mnt/folder
>   Size: 0               Blocks: 0          IO Block: 4096   directory
> Device: 253,0   Inode: 74608       Links: 2
> Access: (0755/drwxr-xr-x)  Uid: ( 1000/   user)   Gid: ( 1000/   group)
> Access: 2025-07-25 XX:XX:XX.XXXXXXXXX -XXXX
> Modify: 2025-07-25 XX:XX:XX.XXXXXXXXX +XXXX
> Change: 2025-07-25 XX:XX:XX.XXXXXXXXX -XXXX
>  Birth: 2025-07-25 XX:XX:XX.XXXXXXXXX +XXXX
Replacing the above size check with `return true` makes the Dolphin file manger respect the icon set in the `.directory` file.

As the check still remains unchanged in the master branch (f60be14b9ed1b90273d1ef9e2ed145afdd3db6e9) the bug should certainly remain unresolved.

This bug may be a duplicate of Bug 406541, which was marked RESOLVED due to inactivity.
Comment 1 Bug Janitor Service 2025-09-23 16:40:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/2003