Bug 474242 - Duplicate item in Places / "Remote" for fstab-mounted NFS drive
Summary: Duplicate item in Places / "Remote" for fstab-mounted NFS drive
Status: RESOLVED FIXED
Alias: None
Product: frameworks-solid
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.109.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-06 23:52 UTC by Massimiliano L
Modified: 2023-09-12 15:29 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Massimiliano L 2023-09-06 23:52:12 UTC
SUMMARY

Having NFS shares mounted via fstab may in duplicate items under "Remote" places.

This seems similar to bug 406242 except it occurs when the path on the NFS server does not start with a '/'.

STEPS TO REPRODUCE
1. add NFS share mount to fstab in the form `nas.local:export/foo /media/net-foo nfs defaults,nofail 0 0`
2. systemctl daemon-reload && mount -a 
3. open Dolphin

OBSERVED RESULT
The share appears twice with the same name. One with the mounted and one with the unmounted icon.

EXPECTED RESULT
Share should appear only once.

SOFTWARE/OS VERSIONS
Linux: Fedora
(available in About System)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Comment 1 Massimiliano L 2023-09-07 00:23:25 UTC
Extending the fix to bug 406242 would be a bit inelegant as one would need to test 4 combinations of (non) leading / (non) trailing slashes.

Could we assume that 'mtab' device name will always have the same style (leading slash without trailing slash) and convert the fstab string to that style, before testing with 'contains'?
Comment 2 Méven Car 2023-09-10 10:02:26 UTC
Two questions:

Can you share the bookmark corresponding to your mount present in `$HOME/.local/share/user-places.xbel` ?

Can you share the result of the command `solid-hardware list` (might be `solid-hardware5 list`, you might to install a package to have it)  for the lines concerning your mount ?
Comment 3 Méven Car 2023-09-10 10:08:39 UTC
Can you share your fstab file (or at least all the nfs lines) ?
Comment 4 Massimiliano L 2023-09-10 11:59:12 UTC
(In reply to Méven Car from comment #3)
> Can you share your fstab file (or at least all the nfs lines) ?

The fstab entry is as follows:
> nas.local:export/foo /media/net-foo nfs defaults,nofail 0 0

The content of  `$HOME/.local/share/user-places.xbel` seems to hold a lot of out-of-date entries (is this a bug as well?). Since I have changed my configuration a few times I am not sure how to find the "corresponding" bookmark, but I guess it is this one:

> <separator>
>  <info>
>   <metadata owner="http://www.kde.org">
>    <UDI>/org/kde/fstab/nas.local:export/foo:/media/net-foo</UDI>
>    <isSystemItem>true</isSystemItem>
>    <IsHidden>true</IsHidden>
>   </metadata>
>  </info>
> </separator>

And here is the output from solid-hardware5 list for the concerned mount:
> udi = '/org/kde/fstab/nas.local:/export/foo:/media/net-foo'
> udi = '/org/kde/fstab/nas.local:export/foo:/media/net-foo'
Comment 5 Méven Car 2023-09-10 12:20:45 UTC
Thanks.

(In reply to Massimiliano L from comment #4)
> (In reply to Méven Car from comment #3)
> > Can you share your fstab file (or at least all the nfs lines) ?
> 
> The fstab entry is as follows:
> > nas.local:export/foo /media/net-foo nfs defaults,nofail 0 0
> 
> The content of  `$HOME/.local/share/user-places.xbel` seems to hold a lot of
> out-of-date entries (is this a bug as well?). Since I have changed my
> configuration a few times I am not sure how to find the "corresponding"
> bookmark, but I guess it is this one:
> 
> > <separator>
> >  <info>
> >   <metadata owner="http://www.kde.org">
> >    <UDI>/org/kde/fstab/nas.local:export/foo:/media/net-foo</UDI>
> >    <isSystemItem>true</isSystemItem>
> >    <IsHidden>true</IsHidden>
> >   </metadata>
> >  </info>
> > </separator>
> 
You must have one for `/org/kde/fstab/nas.local:/export/foo:/media/net-foo` too./net-foo' as well.

I am guessing the issue would be fixed if you updated your fstab line to :

From
`nas.local:export/foo /media/net-foo nfs defaults,nofail 0 0`

To
`nas.local:/export/foo /media/net-foo nfs defaults,nofail 0 0`

(note the added slash)
Comment 6 Bug Janitor Service 2023-09-10 12:28:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/solid/-/merge_requests/142
Comment 7 Massimiliano L 2023-09-10 13:04:12 UTC
(In reply to Méven Car from comment #5)
> I am guessing the issue would be fixed if you updated your fstab line to :
> 
> From
> `nas.local:export/foo /media/net-foo nfs defaults,nofail 0 0`
> 
> To
> `nas.local:/export/foo /media/net-foo nfs defaults,nofail 0 0`
> 
> (note the added slash)

Yes, thank you. I had figured this out when checking the bug report for the trailing `/` case.

It makes sense to have a full absolute path after `:` but apparently fstab does not care.

Thank you for working on this!
Comment 8 Bug Janitor Service 2023-09-11 07:51:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/solid/-/merge_requests/143
Comment 9 Méven 2023-09-12 11:57:19 UTC
Git commit eaebf4a0adc65e4765ce978da1075b2682707d4f by Méven Car.
Committed on 11/09/2023 at 19:23.
Pushed by meven into branch 'master'.

FstabHandling: ensure mountpoints starts with / for nfs

M  +18   -2    src/solid/devices/backends/fstab/fstabhandling.cpp

https://invent.kde.org/frameworks/solid/-/commit/eaebf4a0adc65e4765ce978da1075b2682707d4f