Bug 382979 - KInfoCenter will exit when switching to PCI page on devices without PCI
Summary: KInfoCenter will exit when switching to PCI page on devices without PCI
Status: RESOLVED FIXED
Alias: None
Product: kinfocenter
Classification: Applications
Component: PCI (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Hubner
URL:
Keywords:
: 343491 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-08-01 05:15 UTC by Icenowy Zheng
Modified: 2020-02-03 11:37 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.18.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Icenowy Zheng 2017-08-01 05:15:09 UTC
I'm testing KInfoCenter on an ARM64 device (Orange Pi Prime, Allwinner H5) which doesn't have any PCI bus, and the Linux kernel also doesn't have PCI support.

When switching to the PCI page of KInfoCenter, the program exits with status code 1, and printed the following string on the terminal:
```
pcilib: Cannot open /proc/bus/pci
pcilib: Cannot find any working access method.
```
Comment 1 Christoph Feck 2017-08-01 18:45:57 UTC
If the pcilib only works on systems that actually have a PCI bus, then you should compile KInfoCenter without pcilib/pciutils dependency.
Comment 2 Icenowy Zheng 2017-08-02 04:16:36 UTC
(In reply to Christoph Feck from comment #1)
> If the pcilib only works on systems that actually have a PCI bus, then you
> should compile KInfoCenter without pcilib/pciutils dependency.

However, some ARM devices also come with PCI(e), and for these devices PCI info is needed.

I think KInfoCenter should give a empty page on devices without PCI, like other not-so-usual buses (e.g. IEEE1394); directly exit is not a good behavior.
Comment 3 Christoph Feck 2017-08-02 13:15:43 UTC
I have not investigated properly, but it is possible the exit() is caused by pcilib, not KInfoCenter.
Comment 4 Icenowy Zheng 2017-08-02 23:20:27 UTC
(In reply to Christoph Feck from comment #3)
> I have not investigated properly, but it is possible the exit() is caused by
> pcilib, not KInfoCenter.

Yes, but the behavior can be overrided by the program that calls pcilib.

See https://github.com/pciutils/pciutils/blob/master/lib/init.c, the function that calls exit() is pci_generic_error(), which is just a fallback implementation of the error function pointer in struct pci_access populated in pci_init_v35() (which is exported as pci_init() in the shared library).

KInfoCenter should add overrided functions for at least the error function pointer, and if possible, also override the warning function pointer.
Comment 5 Harald Sitter 2020-01-22 17:17:02 UTC
Git commit e677d2cc1b57ae081b1add1a820d61c35448cf9f by Harald Sitter.
Committed on 22/01/2020 at 17:14.
Pushed by sitter into branch 'Plasma/5.18'.

override picutils' error logger; it has an exit() call

Summary:
instead simply run the output through qwarning as a cheap
solution.

FIXED-IN: 5.18.0

Test Plan: builds, dont have a device without pci

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

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

M  +12   -0    Modules/pci/kpci.cpp

https://commits.kde.org/kinfocenter/e677d2cc1b57ae081b1add1a820d61c35448cf9f
Comment 6 Harald Sitter 2020-02-03 11:37:14 UTC
*** Bug 343491 has been marked as a duplicate of this bug. ***