Bug 9146

Summary: SIGSEGV in opkg_install_pkg() -> strcmp() when using install with --force-reinstall and local package
Product: [Yocto Project Subprojects] opkg Reporter: Ivan K <yocto>
Component: opkgAssignee: Alejandro del Castillo <alejandro.delcastillo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided    
Version: 1.0   
Target Milestone: ---   
Hardware: Other   
OS: mips   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ivan K 2016-02-19 19:16:35 UTC
Preconditions/Environment
-------------------------
OpenWRT mips_34kc_musl-1.1.12
opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d


Triggering Action/Cause
-----------------------
Tried to re-install package from local file:
opkg install /tmp/my-package-name_package-version_ar71xx.ipk -V2 --force-reinstall


Expectation
-----------
Expected to have package re-installed with fresher version.


Actual Result
-------------
In GDB:
Program received signal SIGSEGV, Segmentation fault.
strcmp (l=0x2f757372 <error: Cannot access memory at address 0x2f757372>, r=0x4436c0 "my-package-name") at src/string/strcmp.c:5

Stack trace:
(gdb) bt
#0  strcmp (l=0x2f757372 <error: Cannot access memory at address 0x2f757372>, r=0x4436c0 "wc-agent") at src/string/strcmp.c:5
#1  0x00404a51 in opkg_install_pkg ()
#2  0x099fdc48 in ?? ()

Without GDB:
root@OpenWrt:~# opkg install /tmp/my-package-name_package-version_ar71xx.ipk --force-reinstall
No packages removed.
Installing my-package-name (package-version) to root...
Segmentation fault
root@OpenWrt:~#

Flag -V does not affect reproducibility.
The issue is not reproduced without --force-reinstall flag.


Reproducibility
---------------
10/10
Comment 1 Alejandro del Castillo 2016-03-03 00:19:14 UTC
Open WRT is using a very old version of opkg based on an arbitrary commit (9c97d5ecd795709c8584e972bfdf3aee3a5b846d). New versions (at least since 0.2.2) doesn't show this problem.

To fix this, Open WRT should upgrade to a newer version of opkg. I would be very happy to assist if there are concerns with an upgrade.