Bug 10407 - [libsolv] opkg sometimes returns non-zero exit code but prints nothing to stderr
Summary: [libsolv] opkg sometimes returns non-zero exit code but prints nothing to stderr
Status: RESOLVED FIXED
Alias: None
Product: opkg
Classification: Yocto Project Subprojects
Component: opkg (show other bugs)
Version: 0.3.2
Hardware: x86 x86_64
: Undecided normal
Target Milestone: 0.3.5
Assignee: Alejandro del Castillo
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-10-10 20:43 UTC by Sergey Kizunov
Modified: 2017-05-08 19:53 UTC (History)
0 users

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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