Bug 10358

Summary: [libsolv] opkg leaves package in bad state if install fails due to file conflicts
Product: [Yocto Project Subprojects] opkg Reporter: Michael Hansen <michael.j.hansen>
Component: opkgAssignee: Alejandro del Castillo <alejandro.delcastillo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided    
Version: 0.3.3   
Target Milestone: 0.3.4   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Test case for issue 10358 none

Description Michael Hansen 2016-09-30 23:48:01 UTC
If packages a and b both provide the same file, the install appears to fail:

    $ opkg install b
    Collected errors:
     * check_data_file_clashes: Package b wants to install file /tmp/opkg/conflict_file
            But that file is already provided by package  * a
     * opkg_solver_install: Cannot install package b.

However, attempting to do further work after the conflict shows that 'b' was left in a partially installed or otherwise broken state:

    $ (build new version of 'b' without conflicts)
    $ opkg update
    $ opkg install b
    Collected errors:
     * pkg_get_installed_files: Failed to open /tmp/opkg///var/lib/opkg/info/b.list: No such file or directory.
     * pkg_get_installed_files: Failed to open /tmp/opkg///var/lib/opkg/info/b.list: No such file or directory.
    Installing b (1.0) on root   (Wrong: Should be 2.0)
    $ opkg list-installed b
    b - 1.0
Comment 1 Michael Hansen 2016-09-30 23:50:07 UTC
Created attachment 3447 [details]
Test case for issue 10358
Comment 2 Michael Hansen 2016-10-03 16:42:52 UTC
Upon further investigation, it looks like the failed install leaves the package status as "install ok half-installed".  The difference between libsolv and internalsolv here is that internalsolv installs the new version successfully (leaving the old version half-installed), whereas libsolv re-attempts the install of the old version, ignoring the new one.

Furthermore attempting to clean up the install with "opkg remove b" as suggested by the error message prints "No packages removed." and does not change the status of b, with either solver.  I think that is the real bug here.
Comment 3 Alejandro del Castillo 2016-10-07 18:50:06 UTC
Fixed on commit 0813a16ad394c896e5ac9599f5dcd22aeabe2820