Bug 10407

Summary: [libsolv] opkg sometimes returns non-zero exit code but prints nothing to stderr
Product: [Yocto Project Subprojects] opkg Reporter: Sergey Kizunov <sergey.kizunov>
Component: opkgAssignee: Alejandro del Castillo <alejandro.delcastillo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided    
Version: 0.3.2   
Target Milestone: 0.3.5   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Sergey Kizunov 2016-10-10 20:43:37 UTC
Here is an example where opkg would return an exit code of 1 when trying to remove a package, but stderr is empty. The second invocation in this example redirects stdout to /dev/null so that it is clear that stderr is empty.

---

root@sergey-e8135-000:/etc/opkg# opkg remove blinky
Solver encountered 1 problem(s):
Problem 1/1:
  - package virtual-package-1.0.0-r0.0.all requires blinky, but none of the providers can be installed

Solution 1:
  - allow deinstallation of virtual-package-1.0.0-r0.0.all

Solution 2:
  - do not ask to deinstall blinky

root@sergey-e8135-000:/etc/opkg# echo $?
1
root@sergey-e8135-000:/etc/opkg# opkg remove blinky > /dev/null
root@sergey-e8135-000:/etc/opkg# echo $?
1
root@sergey-e8135-000:/etc/opkg#

---

It is useful to print error information to stderr when the exit code is non-zero because many applications use the contents of stderr to describe why an operation failed.
Comment 1 Alejandro del Castillo 2017-05-03 19:41:08 UTC
Libsolv solver errors are being reported at level NOTICE on libsolver_solver_solve:
    opkg_message(NOTICE, ......)
which is incorrect since the caller is aborting the operation if there are errors found. 

The internal solver is correctly setting solver issues as ERROR.
Comment 2 Alejandro del Castillo 2017-05-08 19:53:57 UTC
Fixed on 791d5acc4ab34296264ac26754f1773e8e1940d0