Bug 446218

Summary: If mount point includes a space Partition Manager misses the space before the next column in fstab
Product: [Applications] partitionmanager Reporter: Sam Illingworth <mazz0>
Component: generalAssignee: Andrius Štikonas <andrius>
Status: RESOLVED FIXED    
Severity: critical CC: mazz0
Priority: NOR    
Version First Reported In: 21.08.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 21.12.1
Sentry Crash Report:

Description Sam Illingworth 2021-11-29 01:05:27 UTC
SUMMARY
***
If mount point includes a space KDE Partition Manager misses the space before the next column in fstab
***


STEPS TO REPRODUCE
1. In KDE Partion Manager edit the mount point for a partition
2. Include a space in the mount point, for example:
  - /dev/sdc1 (ntfs): /home/imauser/Window Library

OBSERVED RESULS
/etc/fstab contains the following:
/dev/sdc1                                   /home/imauser/Windows\040Libraryntfs    defaults                                                     0 0 
This results in an unbootable system.

EXPECTED RESULT
/etc/fstab should contain the following:
/dev/sdc1                                   /home/imauser/Windows\040Library    ntfs    defaults                                                     0 0 

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.15.5-arch1-1 (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
Also observed in other versions and distros (eg KDE Neon) going back months at least.
Comment 1 Andrius Štikonas 2021-12-04 23:23:58 UTC
This happens because width of the fstab column is calculated before space escaping happens.
Comment 2 Andrius Štikonas 2021-12-04 23:33:03 UTC
Git commit 31921c59fa50716dd7118fb7eb996c710e2f5a1b by Andrius Štikonas.
Committed on 04/12/2021 at 23:31.
Pushed by stikonas into branch 'master'.

Fix broken fstab when mount point includes space.

fstab column width was calculated before spaces were escaped which would
result in no space between mount point and file system type columns.

M  +1    -1    src/core/fstab.cpp

https://invent.kde.org/system/kpmcore/commit/31921c59fa50716dd7118fb7eb996c710e2f5a1b
Comment 3 Andrius Štikonas 2021-12-04 23:34:15 UTC
Git commit c4f8affd2f8be28f472a5862e610f3e6ad43215c by Andrius Štikonas.
Committed on 04/12/2021 at 23:33.
Pushed by stikonas into branch 'release/21.12'.

Fix broken fstab when mount point includes space.

fstab column width was calculated before spaces were escaped which would
result in no space between mount point and file system type columns.

M  +1    -1    src/core/fstab.cpp

https://invent.kde.org/system/kpmcore/commit/c4f8affd2f8be28f472a5862e610f3e6ad43215c