Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] PCIMapper pci.ids file location bug #60

Open
ZanderFoster opened this issue Oct 19, 2023 · 1 comment
Open

[Linux] PCIMapper pci.ids file location bug #60

ZanderFoster opened this issue Oct 19, 2023 · 1 comment
Labels
bug Something isn't working linux Issues related do linux

Comments

@ZanderFoster
Copy link

ZanderFoster commented Oct 19, 2023

I found a bug using the GPU module.

When compiled as user PCIMapper looks for the id files at /home/${user}/.hwinfo/pci.ids
However if the program is ran as sudo or root the getenv("HOME"); function will return /root/.hwinfo/pci.ids

I propose this line be changed to store the pci.ids file to the same location as the applications binary.
https://github.com/lfreist/hwinfo/blob/b4adfd795aa2aa25b8dff6dd8116725f72b187dd/CMakeLists.txt#L39C67-L39C67

I'm trying to get into some open-source coding so if you would let me know your opinions I would be happy to implement them.

@lfreist
Copy link
Owner

lfreist commented Oct 20, 2023

Hi, Thanks for reporting this Bug!
The pci.ids file brings some more issues: HWinfo is a library that can be build shared and static. For a shared library, it is relatively easy to place the pci.ids file along the binaries. For static builds it becomes more difficult. I am currently working on a PCIMapper that does not parse the pci.ids file but builds a dictionary like structure in compile time from the file. This way, static and shared builds become much easier.

@lfreist lfreist added bug Something isn't working linux Issues related do linux labels Oct 20, 2023
lfreist pushed a commit that referenced this issue Mar 15, 2024
…id reading the file in runtime #60 (#81)

* Add a new header pci.ids.h with the content of scripts/pcs.ids to avoid reading the file in runtime

* Fix clang format errors

* Fix get_pci_ids function name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux Issues related do linux
Projects
None yet
Development

No branches or pull requests

2 participants