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

Keyword Check If Package Is Installed produces false positives #575

Open
philipandag opened this issue Nov 8, 2024 · 0 comments
Open

Keyword Check If Package Is Installed produces false positives #575

philipandag opened this issue Nov 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@philipandag
Copy link
Contributor

philipandag commented Nov 8, 2024

Device

Optiplex 7010

RTE version

OSFV version

develop

Affected component(s) or functionality

Appeared in CPT tests

Brief summary

Test fail because dpkg --list does not show no packages found matching but the package is not installed

How reproducible

It was consistent on this device with this package

How to reproduce

I am not sure how to reproduce the exact situation. In the logs we can see that dpkg knew the name of the package, but nothing more. I think installing and then purging the package produces the same output, but why it was like that before installing the package is unknown to me. Doing either apt remove or apt purge will make the keyword produce false positives.

Expected behavior

The keyword should reliably check if the program is installed and can be run. False positives cost a lot of time.

Actual behavior

The keyword produces false positives if the package was removed

Link to screenshots or logs

dasharo-performance_log.zip

root@3mdeb:/home/ubuntu# sensors
Command 'sensors' not found, but can be installed with:
apt install lm-sensors
root@3mdeb:/home/ubuntu# sudo^C
root@3mdeb:/home/ubuntu# dpkg --list lm-sensors
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
un  lm-sensors     <none>       <none>       (no description available)
root@3mdeb:/home/ubuntu# lm-sensors
lm-sensors: command not found
root@3mdeb:/home/ubuntu# sensors
Command 'sensors' not found, but can be installed with:
apt install lm-sensors
root@3mdeb:/home/ubuntu# dpkg --list lm-sensorsfdsf
dpkg-query: no packages found matching lm-sensorsfdsf

Additional context

Maybe using dpkg --get-selections would be more reliable? This way this keyword could be changed to fail by default, not pass. At this moment if dpkg --list prints anything other than nothing or no packages found matching the KW passes. Using --get-selections the keyword could only pass when the package is actually installed and fail on unforeseen situations which won't break the tests.

root@3mdeb:/home/ubuntu# dpkg --get-selections lm-sensors
root@3mdeb:/home/ubuntu# apt install lm-sensors
root@3mdeb:/home/ubuntu# dpkg --get-selections lm-sensors
lm-sensors					install
root@3mdeb:/home/ubuntu# sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +35.0°C  (high = +85.0°C, crit = +105.0°C)
Core 0:        +30.0°C  (high = +85.0°C, crit = +105.0°C)
Core 1:        +29.0°C  (high = +85.0°C, crit = +105.0°C)
Core 2:        +32.0°C  (high = +85.0°C, crit = +105.0°C)
Core 3:        +32.0°C  (high = +85.0°C, crit = +105.0°C)
root@3mdeb:/home/ubuntu# apt purge lm-sensors
root@3mdeb:/home/ubuntu# dpkg --get-selections lm-sensors
root@3mdeb:/home/ubuntu#
root@3mdeb:/home/ubuntu# apt install lm-sensors
root@3mdeb:/home/ubuntu# dpkg --get-selections lm-sensors
lm-sensors					install
root@3mdeb:/home/ubuntu# apt remove lm-sensors
root@3mdeb:/home/ubuntu# dpkg --get-selections lm-sensors
lm-sensors					deinstall

Solutions you've tried

No response

@philipandag philipandag added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant