Bug 419220 - Device::listFromType can return incorrect types
Summary: Device::listFromType can return incorrect types
Status: CONFIRMED
Alias: None
Product: frameworks-solid
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.68.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Lukáš Tinkl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-25 10:33 UTC by masonbee
Modified: 2020-03-25 16:23 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Backtrace (6.91 KB, text/plain)
2020-03-25 10:48 UTC, masonbee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description masonbee 2020-03-25 10:33:55 UTC
SUMMARY
Kinfo crashes when clicking on samba status with samba not installed

STEPS TO REPRODUCE
1. Open Kinfo with samba not installed
2. Go to Network Information
3. Click on Samba Status

OBSERVED RESULT
Program crashes

EXPECTED RESULT
Notification that samba is not installed

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
5.18.3
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Kubuntu image in virtual box
Comment 1 Harald Sitter 2020-03-25 10:39:27 UTC
What's the backtrace?
Comment 2 masonbee 2020-03-25 10:48:53 UTC
Created attachment 126999 [details]
Backtrace
Comment 3 Harald Sitter 2020-03-25 11:09:55 UTC
Seems solid is giving out non-NetworkShares when we explicit asked for NetworkShares.
Comment 4 Harald Sitter 2020-03-25 16:11:44 UTC
Git commit 4847c9e2fed215f8d2bfe8bfd5a58c0f62d5d3a9 by Harald Sitter.
Committed on 25/03/2020 at 16:10.
Pushed by sitter into branch 'Plasma/5.18'.

skip over supposed network shares that aren't

Summary:
we explicitly request listFromType(Solid::DeviceInterface::NetworkShare)
but apparently still can get devices that aren't actually of that type.
add an explicit type check to guard against bogus shares coming out of
listFromType.

Test Plan: mount an overlay (I am guessing that's what the problem with kubuntu is), observe no crash on init

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28275

M  +5    -0    Modules/samba/smbmountmodel.cpp

https://commits.kde.org/kinfocenter/4847c9e2fed215f8d2bfe8bfd5a58c0f62d5d3a9
Comment 5 Harald Sitter 2020-03-25 16:14:00 UTC
Bouncing bug to solid. Definitely reproducible with live ISOs where the overlayfs is returned from Device::listFromType(NetworkShare) but in fact doesn't ->is() cast to NetworkShare (it also is no network share of course).
Comment 6 Kai Uwe Broulik 2020-03-25 16:23:36 UTC
FstabManager::devicesFromQuery just returns all devices for NetworkShare type. The logic for determining if something is a network share or encrypted storage access is done in the Device and not accessible here.