DeBortoliWines / kde-solid

Patch development repository for the kde/solid package
0 stars 0 forks source link

Remove inaccessible SMB mounts from solid/dolphin list #2

Open cleary opened 4 years ago

cleary commented 4 years ago

The Problem: Now that the unique mounts are being returned to dolphin (ref #1) we have a secondary issue.

Dolphin is now listing large numbers of mounts, most of which are not accessible by the dolphin user.

What I see: This is how it looks with 3 people logged in: 81242630-fa56d700-9050-11ea-812f-5d39fcc535d2

What I expect to see: The shares mounted in my home directory. I should not see mounts in other users home directories

What are your thoughts on the best way to resolve this?

cleary commented 4 years ago

Hi @faichele Here's the next problem I'd like you to take a look at (if you are interested)

Can you give me a summary of a proposed plan before committing to any changes please?

Thanks, Bernie

faichele commented 4 years ago

Hello @cleary!

Do you want to remove duplicates that now arise from "uniquifying" the SMB/network share mounts in SOLID's fstab backend which follow a specific pattern? E. g. just remove the home directories of other users? Or based on common network share paths?

Or do you want to remove (potential) duplicate entries by some other, more generic means?

cleary commented 4 years ago

Hi @faichele, Thanks for continuing on!

That's a good question -

If we base on common network share paths, I see a problem: how do you choose which item gets priority (eg if common share paths are not in home directories)?

Do you know, does solid already do something about filtering out mounts in /media/<username>/ ?

faichele commented 4 years ago

Hello, Bernard!

Solid has abstractions for different kinds of storage-related interfaces: Local drives (fstab), network shares, media players, cameras, CD/DVD. Concerning the management of duplicate mount points there are lots of possibilities how you can mount any of these devices multiple times under different directories. So identifying duplicate mounts is one part of the issue, to keep them from being listed in Dolphin's folder view is another.

Identification is solvable, depending on if you want to only cover network shares (#1 is applied directly to the relevant location) or if you also want to address this for devices physically connected to a machine will mean varying degrees of effort.

Selection of which "copy" of a "multiple mount" is indeed a different issue. The selection for home directories is the only "easy" choice in that hiding mounts of home directories that are not those of the currently logged-in user is a feasible criterion.

For non-home network shares, I'd suggest at least one of

cleary commented 4 years ago

Hi Fabian, Apologies for my late reply, I've had a busy couple of days -

I think we'll go with the simple option which affects us directly for now:

Interestingly, I noticed the other day that GNOME/nautilus handles it as expected - I wonder if it's worth having a look at their logic?

image

faichele commented 4 years ago

Hello, Bernard!

While looking for similar problem reports I also encountered mentions that Nautilus doesn't display duplicate entries for network mounts like Dolphin does, so a comparison between how the two file managers query and list non-local mountpoints is indeed a promising lead for me to follow.´ Focusing on duplicate user home directories (only/at first) is a good starting point to apply a fix on the presentation/directory view side because it makes URI filtering easier.

I'll get started with finding the cause for the duplicate entries in Dolphin then.

cleary commented 4 years ago

From: Bernard Gray bernard_gray@debortoli.com.au Date: Thu, 4 Jun 2020 at 10:04 Subject: Re: Fwd: Invoice from Zykl. io UG (R-002-2020); filtering out duplicate mounts in Dolphin To: Fabian Aichele faichele@t-online.de

Hi Fabian,

Answers inline below:

On Tue, 2 Jun 2020 at 19:55, faichele@t-online.de wrote:

Hello, Bernard!

Thank you, that was almost instant :)

No problem, I'm not a fan of the awkward gap between sending the invoice and receiving payment - the longer it is, the more things you start worrying about. I may not be as instant every time, but at the very least I won't make you wait too long ;)  

As for the follow-up job: I've dug a bit deeper into Solid (KDE's hardware abstraction layer) and found the to date most promising location to intercept queries for storage-type mount points, and filter out potential duplicates before forwarding results to client applications like Dolphin.

A few questions:

How are you mounting home directory shares on the client side? You're using SMB shares for user home directories; if not, which protocol (NFS)?

Yes, we use SMB - it's currently initiated via the pam_mount module, I've attached /etc/security/pam_mount.conf.xml which is the controlling file  

The target distribution for the duplicate filtering is still Ubuntu 18.04 LTS? If not, please let me know - even so, this extension is a very good candidate for a direct pull request against upstream Solid and/or Dolphin.

Yes. For us, we require 18.04 (but will want to apply to 20.04 as well, since that will be our upgrade path)  

If it is OK for you, I'd like to ask you for a list of mount points/shares to compare with, since my home LAN setup is made for supporting me as a single user. The expression used to populate Dolphin's "Places" list would be perfect, namely the output of: solid-hardware query "[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]] OR [ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]] OR OpticalDisc.availableContent & 'Audio' ] OR StorageAccess.ignored == false ]"

$ solid-hardware query "[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]] OR [ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]] OR OpticalDisc.availableContent & 'Audio' ] OR StorageAccess.ignored == false ]" udi = '/org/freedesktop/UDisks2/block_devices/sdb1' udi = '/org/freedesktop/UDisks2/block_devices/loop0' udi = '/org/kde/fstab///3tales/dedwards' udi = '/org/kde/fstab///3tales/hr3_project' udi = '/org/kde/fstab///3tales/scratch' udi = '/org/kde/fstab///3tales/promo' udi = '/org/kde/fstab///3tales/marketing' udi = '/org/kde/fstab///3tales/brss' udi = '/org/kde/fstab///3tales/software' udi = '/org/kde/fstab///3tales/it' udi = '/org/kde/fstab///3tales/it_scratch'

Thanks!

Thank you very much! With best regards, Fabian

cleary commented 4 years ago

excerpt from pam_mount.conf.xml:

</pam_mount>
...
        <volume fstype="cifs" mountpoint="/home/%(USER)/network/3tales/planning_spec_images" options="file_mode=0700,dir_mode=0700,vers=1.0" path="planning_spec_images" server="3tales" sgrp=" planning_spec_images"/>                                                                                                                                                                 
        <volume fstype="cifs" mountpoint="/home/%(USER)/network/3tales/planning_spec_pdfs" options="file_mode=0700,dir_mode=0700,vers=1.0" path="planning_spec_pdfs" server="3tales" sgrp="planning"/>                                                                                                                                                                                  
        <volume fstype="cifs" mountpoint="/home/%(USER)/network/3tales/workers_comp" options="file_mode=0700,dir_mode=0700,vers=1.0" path="workers_comp" server="3tales" sgrp="workers_comp"/>                                                                                                                                                                                          
        <mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other"/>                                                                                      
        <mntoptions require="iocharset=utf8,nosuid,nodev"/>                                                                                                                                 
        <mkmountpoint enable="1" remove="true"/>
...
</pam_mount>
cleary commented 4 years ago

Hi @faichele - how's progress?