Created attachment 159925 [details] screenshot SUMMARY If a filesystem label has a space in it, partitionmanager displays it as an underscore causing confusion if trying to use the label elsewhere (e.g. in /etc/fstab or kernel parameter) STEPS TO REPRODUCE 1. Assign a label with a space in it to a filesystem 2. Display the filesystem in partitionmanager OBSERVED RESULT Label is displayed with the space replaced by an underscore EXPECTED RESULT Label is displayed unchanged SOFTWARE/OS VERSIONS KDE Plasma Version: 5.27.6 KDE Frameworks Version: 5.107.0 Qt Version: 5.15.10 Graphics Platform: Wayland ADDITIONAL INFORMATION Confirmed with btrfs and ext4
Oh, that seems to be coming from udev... I ran udevadm command manually and it returns: ID_FS_LABEL=rootfs_test ID_FS_LABEL_ENC=rootfs\x20test So we were reading ID_FS_LABEL but I guess we should read ID_FS_LABEL_ENC and decode it. https://invent.kde.org/system/kpmcore/-/blob/master/src/plugins/sfdisk/sfdiskbackend.cpp#L636
Hmm, there doesn't seem to be canonical way to decode blkid strings in Qt. Qt has a internal function to do that https://github.com/qt/qtbase/blob/9a320b037ce7b63c5f9de6fbb4e391612e857a95/src/corelib/io/qstorageinfo_unix.cpp#L456 which we could presumably "steal" it. But tt seems that it incorrectly decodes backslashes... Christian, would you happen to remember why backslashes are ignored in qstorageinfo_unix.cpp::decodeFsEncString (// but not the backslash to prevent collisions) Because of that conditional, backslash is not decoded and it does seem correct to me. For example, I created a label called rootfs test\test blkid then encodes it to rootfs\x20test\x5ctest which your function decoded to rootfs test\x5ctest
Git commit 4490081c7acc60ff9a9a158cf8af4d7ed26a57b4 by Andrius Štikonas. Committed on 03/07/2023 at 23:42. Pushed by stikonas into branch 'master'. Obtain file system label from ID_FS_LABEL_ENC. M +1 -1 src/core/operationrunner.cpp M +35 -3 src/plugins/sfdisk/sfdiskbackend.cpp https://invent.kde.org/system/kpmcore/-/commit/4490081c7acc60ff9a9a158cf8af4d7ed26a57b4