Bug 388071 - KMountPoint doesn't handle bind mounts correctly, breaks Trash
Summary: KMountPoint doesn't handle bind mounts correctly, breaks Trash
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-20 13:47 UTC by bugreporter42
Modified: 2022-12-10 05:17 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugreporter42 2017-12-20 13:47:42 UTC
KMountPoint doesn't determine the correct mount point, if there are bind mounts. This breaks the Trash handling, files from other devices are moved to the home directory trash folder instead of the trash folder on the other device.

dd if=/dev/zero of=/tmp/test-disk1 bs=1024 count=10000
dd if=/dev/zero of=/tmp/test-disk2 bs=1024 count=10000
mkfs.ext4 /tmp/test-disk1
mkfs.ext4 /tmp/test-disk2
mkdir /mnt/test-disk1
mkdir /mnt/test-disk2
mount -o loop /tmp/test-disk1 /mnt/test-disk1
mount -o loop /tmp/test-disk2 /mnt/test-disk2
mkdir -p /mnt/test-disk1/aaa
mkdir -p /mnt/test-disk2/aaa/bbb
touch /mnt/test-disk2/aaa/bbb/file
mount --bind /mnt/test-disk2/aaa/bbb /mnt/test-disk1/aaa



Stat:

# stat /mnt/test-disk1
  File: /mnt/test-disk1
  Size: 1024            Blocks: 2          IO Block: 1024   directory
Device: 701h/1793d      Inode: 2           Links: 4

# stat /mnt/test-disk2
  File: /mnt/test-disk2
  Size: 1024            Blocks: 2          IO Block: 1024   directory
Device: 702h/1794d      Inode: 2           Links: 4

# stat /mnt/test-disk1/aaa/file
  File: /mnt/test-disk1/aaa/file
  Size: 0               Blocks: 0          IO Block: 1024   regular empty file
Device: 702h/1794d      Inode: 13          Links: 1


------------------------------------------------------
KMountPoint::currentMountPoints():

#include <QDebug>
#include <KMountPoint>

int main() {
    const QString origPath = "/mnt/test-disk1/aaa/file";
    KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath(origPath);
    qDebug() << mp->mountPoint();
}
-------------------------------------------------------

Which returns: "/mnt/test-disk1/aaa", while the file resides on test-disk2.

People complaining about Trash not working correctly:
https://www.reddit.com/r/kde/comments/59cefq/are_there_options_to_manage_how_the_trash_is/
Comment 1 bugreporter42 2017-12-20 14:23:50 UTC
Bug 349617 is related. If Solid was able to report the correct mount point for devices, it might make sense to take the device id from the file and use Solid to determine the mount paths based on the device id.
Comment 2 Justin Zobel 2022-11-10 22:32:33 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 3 Bug Janitor Service 2022-11-25 05:20:39 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2022-12-10 05:17:21 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!