Bug 205277 - device notifier, luks and partitions listed in fstab
Summary: device notifier, luks and partitions listed in fstab
Status: RESOLVED INTENTIONAL
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-devicenotifier (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-27 02:17 UTC by Xavier Gnata
Modified: 2009-10-06 22:03 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Gnata 2009-08-27 02:17:23 UTC
Version:            (using KDE 4.3.0)
OS:                Linux
Installed from:    Ubuntu Packages

cryto luks partitions listed in /etc/fstab and already mounted at boot time should not be listed as "recently plugged devices" by the widget "device notifier".

I'm note quite sure where the problem but 
/usr/share/kde4/apps/solid/actions/test-predicate-openinwindow.desktop
is a good candidate:

X-KDE-Solid-Predicate=[ [ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ] ] OR [ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ] ]
Type=Service
Actions=open;

My encrypted partition is on a sdcard *but* this sdcard is always mounted at boot time (thanks to one entry in the fstab).

The logic should be something like:
" OR [StorageVolume.usage == 'Encrypted' AND not_present_in_fstab".

Xavier.
Comment 1 Aaron J. Seigo 2009-08-27 02:31:08 UTC
as i said on the mailing list, this is something that should be handled elsewhere in the stack, in this case Solid, if at all. if an encrypted FS is mounted in a similar fashion to other non-encrypted partitions, it shouldn't show up in the pluggable devices. but evidently it is. note that StorageVolume.usage == 'FileSystem' does not result in every partition being shown.

let's ask Kevin...
Comment 2 Kevin Ottens 2009-08-28 15:39:18 UTC
Well the "not_present_in_fstab" you're looking for is covered by the very first clause of the predicate "StorageVolume.ignored == false".

ignored is true when (looking at the relevant code right now):
 - HAL tells us that the volume should be ignored (generally because an fdi file made it so)
 - and the device is not removable (card, cds... case)
 - and the device is not hotpluggable (usb disks case)
 - and the mount point starts with /media/ or /mnt/

Basically in your case it shows up because it's an sd card.

So you still have some options to get it hidden if you really want by:
 - writing an fdi file which just turn on the ignore flag on the HAL side
 - changing the mountpoint of the device

On our side we could still have the possibility to add some settings to the hotplug engine to not report specific devices (a bit like with the KFilePlaces* system where we allowed to hide given entries if the user want to). That said I'm not really hot on this approach.

Finally, checking if the device is in fstab is out of the question, simply because that'd mean spinning up the disks each time and application evaluating such a predicate would be started (for instance kio_trash). You're too much into a corner case to make that an acceptable solution IMO.
Comment 3 Xavier Gnata 2009-08-28 18:31:10 UTC
Hi,

My comment in your text.

> --- Comment #2 from Kevin Ottens <ervin kde org>  2009-08-28 15:39:18 ---
> Well the "not_present_in_fstab" you're looking for is covered by the very first
> clause of the predicate "StorageVolume.ignored == false".
>
> ignored is true when (looking at the relevant code right now):
>  - HAL tells us that the volume should be ignored (generally because an fdi
> file made it so)
>  - and the device is not removable (card, cds... case)
>  - and the device is not hotpluggable (usb disks case)
>  - and the mount point starts with /media/ or /mnt/
>
> Basically in your case it shows up because it's an sd card.
>
>   
Correct. It is a sd card.

> So you still have some options to get it hidden if you really want by:
>  - writing an fdi file which just turn on the ignore flag on the HAL side
>  - changing the mountpoint of the device
>
>   
"changing the mountpoint of the device" and a symlink does the job.
I'm going to implement this solution.
> On our side we could still have the possibility to add some settings to the
> hotplug engine to not report specific devices (a bit like with the KFilePlaces*
> system where we allowed to hide given entries if the user want to). That said
> I'm not really hot on this approach.
>   
Neither do I.

> Finally, checking if the device is in fstab is out of the question, simply
> because that'd mean spinning up the disks each time and application evaluating
> such a predicate would be started (for instance kio_trash). You're too much
> into a corner case to make that an acceptable solution IMO.
>   
Ho yes...you're right.

Conclusion:
Thanks for the answer, I'm going to move the mountpoint and please close 
this ""bug"". 
Sorry for the noise.
Comment 4 Dario Andres 2009-08-28 22:05:05 UTC
Closing as requested...
Comment 5 Xavier Gnata 2009-09-13 22:53:48 UTC
> Closing as requested...

I think we have to reopen this one.

I have tried to mount /dev/mapper/data to
/home/gnata/data
then to
/mnt/data

In both case, the corersponding encrypted sd card is listed by the kde device
notifier.

My understanding is that it should not be the case when /dev/mapper/data is mounted to /mnt/data.

Either I'm missing something either there is no easy way to prevent device
notifier to list an encrypted sd card.
Comment 6 Kevin Ottens 2009-09-15 14:22:46 UTC
Sorry my bad, I wrote:
"ignored is true when (looking at the relevant code right now):
 - HAL tells us that the volume should be ignored (generally because an fdi
file made it so)
 - and the device is not removable (card, cds... case)
 - and the device is not hotpluggable (usb disks case)
 - and the mount point starts with /media/ or /mnt/"

when I in fact meant:
"ignored is true when (looking at the relevant code right now):
 - HAL tells us that the volume should be ignored (generally because an fdi
file made it so)
*OR*
 - the device is not removable (card, cds... case)
 - and the device is not hotpluggable (usb disks case)
 - and the mount point *doesn't* start with /media/ or /mnt/

I was definitely confused and confusing back then... two mistakes in a single block. So as long as it's removable (and the sd card is) changing the mountpoint won't help (unlike what I claimed *sigh*).

Your only option left is:
" - writing an fdi file which just turn on the ignore flag on the HAL side"

That bit was right at least...
Comment 7 Xavier Gnata 2009-09-15 22:01:17 UTC
> https://bugs.kde.org/show_bug.cgi?id=205277
>
>
>
>
>
> --- Comment #6 from Kevin Ottens <ervin kde org>  2009-09-15 14:22:46 ---
> Sorry my bad, I wrote:
> "ignored is true when (looking at the relevant code right now):
>  - HAL tells us that the volume should be ignored (generally because an fdi
> file made it so)
>  - and the device is not removable (card, cds... case)
>  - and the device is not hotpluggable (usb disks case)
>  - and the mount point starts with /media/ or /mnt/"
>
> when I in fact meant:
> "ignored is true when (looking at the relevant code right now):
>  - HAL tells us that the volume should be ignored (generally because an fdi
> file made it so)
> *OR*
>  - the device is not removable (card, cds... case)
>  - and the device is not hotpluggable (usb disks case)
>  - and the mount point *doesn't* start with /media/ or /mnt/
>
> I was definitely confused and confusing back then... two mistakes in a single
> block. So as long as it's removable (and the sd card is) changing the
> mountpoint won't help (unlike what I claimed *sigh*).
>
> Your only option left is:
> " - writing an fdi file which just turn on the ignore flag on the HAL side"
>
> That bit was right at least...
>
>   
:(. Is there a clear documentation on the way to write such a file?
I understand the logic when I read the code but is it really the 
behavior your  wanted?
Looking at the mount point even if it is a removable device sounds 
reasonable, doesn't  it

If there is a good technical reason not to do so, please close the bug 
again.

Thanks for the support,
Xavier
Comment 8 Kevin Ottens 2009-10-06 22:03:38 UTC
Yes, the main reason behind this choice is because of multi-seat setups. They often have mountpoints in user specific directories, so that's why I give priority to the nature of the device (removable or hotpluggable) vs the mountpoint.