Bug 434617

Summary: It's possible to mount the same ISO image multiple times
Product: [Applications] dolphin Reporter: popov895 <popov895>
Component: plugins: ISO mountingAssignee: Kwon-Young Choi <kwon-young.choi>
Status: RESOLVED FIXED    
Severity: normal CC: elvis.angelaccio, kfm-devel, nate, popov895
Priority: NOR    
Version: 20.12.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 21.04
Sentry Crash Report:
Attachments: ISO image mounted multiple times
`udisksctl dump` output
`solid-hardware5` output

Description popov895 2021-03-19 09:59:46 UTC
Created attachment 136841 [details]
ISO image mounted multiple times

SUMMARY

After the ISO is mounted, it still contains the "Mount" action in its context menu, although it should contain the "Unmount" action. As a result, you can mount the same ISO image multiple times.

OBSERVED RESULT

The mounted ISO image still contains the "Mount" action

EXPECTED RESULT

The mounted ISO image contains the "Unmount" action

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: openSUSE Tumbleweed 20210317 / X11
KDE Plasma Version: 5.21.2
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Comment 1 Kwon-Young Choi 2021-03-19 10:04:28 UTC
Hello,

It seems the detection of the mounting of the iso is not working.
Could you provide the output of `udiskctl dump` when you have mounted the iso multiple times?
Comment 2 popov895 2021-03-19 12:03:34 UTC
Created attachment 136843 [details]
`udisksctl dump` output
Comment 3 Kwon-Young Choi 2021-03-19 13:21:11 UTC
Ok, so just to be sure, what is the output of:

* `solid-hardware5 nonportableinfo /org/freedesktop/UDisks2/block_devices/loop0`
* `solid-hardware5 nonportableinfo /org/freedesktop/UDisks2/block_devices/loop1`
* `solid-hardware5 nonportableinfo /org/freedesktop/UDisks2/block_devices/loop2`

If all the `BackingFile` properties are the same, I don't know what is happening, and I'm going to need your iso so that I can try to reproduce this issue.
Comment 4 popov895 2021-03-19 13:42:49 UTC
Created attachment 136846 [details]
`solid-hardware5` output

I put the output in one file. As you can see, all the "BackingFile" properties are the same. You can download this ISO image from here: https://drive.google.com/file/d/1xNMkFOCui8OSjOlS_nzip63uQpnRCgHt/view?usp=sharing
Comment 5 popov895 2021-03-19 13:56:14 UTC
Just checked the latest neon ISO image, same result. Does this feature work well on your system?
Comment 6 Kwon-Young Choi 2021-03-19 13:58:08 UTC
Well, until now with the iso I tested with, it worked.

But I can reproduce your issue, so let me debug this.
Comment 7 popov895 2021-03-19 14:28:06 UTC
And just a question: should the mounted ISO images be shown in the "Disk & Devices" widget as well?
Comment 8 Bug Janitor Service 2021-03-19 16:22:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/sdk/dolphin-plugins/-/merge_requests/28
Comment 9 Kwon-Young Choi 2021-03-19 16:26:38 UTC
So I believed I know what is wrong, I've created a merge request https://invent.kde.org/sdk/dolphin-plugins/-/merge_requests/28 which should solve this.

(In reply to popov895 from comment #7)
> And just a question: should the mounted ISO images be shown in the "Disk &
> Devices" widget as well?

It's shown in the non-removable devices which by default is not visible.
You can change the view in the hamburger menu.
Comment 10 Nate Graham 2021-03-19 16:42:20 UTC
Not fixed yet since that merge request hasn't been merged. :)
Comment 11 Kwon-Young Choi 2021-03-19 16:58:59 UTC
(In reply to Nate Graham from comment #10)
> Not fixed yet since that merge request hasn't been merged. :)

Yes, my bad...
Comment 12 Kwon-Young Choi 2021-03-28 22:42:42 UTC
Git commit f136702d2adc8643ea12f1b6e3bf97925f1b33f0 by Kwon-Young Choi.
Committed on 28/03/2021 at 07:03.
Pushed by elvisangelaccio into branch 'release/21.04'.

BackingFile property should be use with StorageVolume instead of StorageAccess

When mounting an iso with `udisksctl`, first a loop device is created
`/dev/loop0` then a second device `/dev/loop0p1` is used to mount it on
a filesystem location.

Querying for StorageAccess devices sometimes only returns the `/dev/loop0p1`
device without the `/dev/loop0` device and the BackingFile property does not
work on `/dev/loop0p1`.

Solution: query for StorageVolume instead which returns all loop devices:
`/dev/loop0` and `/dev/loop1`.

Warning: Because StorageVolume returns more devices, the function
`getDeviceFromBackingFile` could be a little bit slower.

M  +1    -1    mountiso/mountisoaction.cpp

https://invent.kde.org/sdk/dolphin-plugins/commit/f136702d2adc8643ea12f1b6e3bf97925f1b33f0