Bug 8354

Summary: [libsolv] conflicts+replaces+provides causes untracked files (old issue #156)
Product: [Yocto Project Subprojects] opkg Reporter: Alejandro del Castillo <alejandro.delcastillo>
Component: opkgAssignee: Alejandro del Castillo <alejandro.delcastillo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided    
Version: 0.2.4   
Target Milestone: 0.3.2   
Hardware: x86   
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 package (A)
none
test package (B) none

Description Alejandro del Castillo 2015-09-21 01:10:08 UTC
Created attachment 2751 [details]
test package (A)

What steps will reproduce the problem?
1.Create package A that have files /x1 /x2
  install it.
2.Create package B that have files /x2 /x3
  Replaces:  A
  Provides:  A
  Conflicts: A
install it

What do you see? What is the expected output? 
A is removed, B is installed as expected, BUT
opkg files B shows only file /x3 and /x2 stays in filesystem untracked

I expect that package B must own file /x2.

What version of the product are you using? On what operating system?
opkg v0.2.4
it maybe important that I use opkg in offline root mode

Originally reported by alexeytech, Dec 26, 2014
-----------------------------------------------------------------------------

#1 paul.betafive (Mar 9, 2015)
Could you retry this and pass the '-V4' argument to opkg during the install of package B to print debugging info at the highest verbosity level and post the output here? That should help to track down the cause of the error.

Sorry for the late response to this issue, I've had to step back from maintainership of opkg due to other commitments but I'll see what I can do to get this resolved.

I think this issue can be fixed in a bugfix release after v0.3.0 if necessary.

#2 alexeytech (Mar 10, 2015)
I am glad to recieve your repost. I'will post debug A.S.A.P.

#3 alexeytech (Mar 10, 2015)
~/test/opkg-test$ cat opkg.conf 
dest root /
arch all 1


~/test/opkg-test$ ./opkg -o ~/test/opkg-test/root -f opkg.conf -V4 -v
opkg version 0.2.4


~/test/opkg-test$ ./opkg -o ~/test/opkg-test/root -f opkg.conf --force-postinstall -V4 install a_1_all.ipk 
opkg_conf_parse_file: Loading conf file opkg.conf.
opkg_conf_parse_file: Supported arch all priority (1)
pkg_hash_load_feeds: 
pkg_hash_load_status_files: 
opkg_install_cmd: a_1_all.ipk
opkg_prepare_url_for_install: Package a provided by hand (a_1_all.ipk).
pkg_vec_insert_merge: Adding new pkg=a version=1 arch=all.
pkg_info_preinstall_check: Updating file owner list.
pkg_hash_fetch_best_installation_candidate: Best installation candidate for a:
pkg_hash_fetch_best_installation_candidate: Adding a to providers.
pkg_hash_fetch_best_installation_candidate: a arch=all arch_priority=1 version=1.
pkg_hash_fetch_best_installation_candidate: Candidate: a 1.
opkg_prepare_install_by_name: Versions from pkg_hash_fetch: new 1
opkg_install_by_name: Calling opkg_install_pkg for a 1.
opkg_install_pkg: Calling pkg_arch_supported.
pkg_arch_supported: Arch all (priority 1) supported for pkg a.
Installing a (1) on root.
update_file_ownership: update_file_ownership: new_pkg=a wants file /home/tech/test/opkg-test/root/, from owner=<NULL>
update_file_ownership: update_file_ownership: new_pkg=a wants file /home/tech/test/opkg-test/root/x2, from owner=<NULL>
update_file_ownership: update_file_ownership: new_pkg=a wants file /home/tech/test/opkg-test/root/x1, from owner=<NULL>
pkg_hash_fetch_unsatisfied_dependencies: Checking dependencies for 'a'.
pkg_run_script: Running script /tmp/opkg-cjBRZ4/a-oQJzRp/preinst.
opkg_install_pkg: Installing maintainer scripts.
opkg_install_pkg: Installing data files for a.
install_data_files: Extracting data files to /home/tech/test/opkg-test/root/.
install_data_files: Calling pkg_write_filelist.
pkg_write_filelist: Creating /home/tech/test/opkg-test/root//usr/lib/opkg/info/a.list file for pkg a.
opkg_install_pkg: Resolving conf files for a
opkg_install_pkg: pkg=a old_state_flag=110 state_flag=100
opkg_configure_packages: Configuring unpacked packages.
opkg_configure_packages: Reordering packages before configuring them...
opkg_recurse_pkgs_in_order: pkg a.
Configuring a.
pkg_run_script: Running script /home/tech/test/opkg-test/root//usr/lib/opkg/info/a.postinst.
write_status_files_if_changed: Writing status file.
pkg_write_changed_filelists: Saving changed filelists.
hash_table: pkg-hash, 12288 bytes
        n_buckets=1024, n_elements=1, n_collisions=0
        max_bucket_len=0, n_used_buckets=1, ave_bucket_len=1.00
        n_hits=3, n_misses=1
hash_table: file-hash, 12288 bytes
        n_buckets=1024, n_elements=3, n_collisions=0
        max_bucket_len=0, n_used_buckets=3, ave_bucket_len=1.00
        n_hits=0, n_misses=6
hash_table: obs-file-hash, 768 bytes
        n_buckets=64, n_elements=0, n_collisions=0
        max_bucket_len=0, n_used_buckets=0, ave_bucket_len=0.00
        n_hits=0, n_misses=3


~/test/opkg-test$ ./opkg -o ~/test/opkg-test/root -f opkg.conf --force-postinstall -V4 files a
opkg_conf_parse_file: Loading conf file opkg.conf.
opkg_conf_parse_file: Supported arch all priority (1)
pkg_hash_load_status_files: 
pkg_vec_insert_merge: Adding new pkg=a version=1 arch=all.
Package a (1) is installed on root and has the following files:
/home/tech/test/opkg-test/root/
/home/tech/test/opkg-test/root/x1
/home/tech/test/opkg-test/root/x2
hash_table: pkg-hash, 12288 bytes
        n_buckets=1024, n_elements=1, n_collisions=0
        max_bucket_len=0, n_used_buckets=1, ave_bucket_len=1.00
        n_hits=1, n_misses=1
hash_table: file-hash, 12288 bytes
        n_buckets=1024, n_elements=0, n_collisions=0
        max_bucket_len=0, n_used_buckets=0, ave_bucket_len=0.00
        n_hits=0, n_misses=0
hash_table: obs-file-hash, 768 bytes
        n_buckets=64, n_elements=0, n_collisions=0
        max_bucket_len=0, n_used_buckets=0, ave_bucket_len=0.00
        n_hits=0, n_misses=0


~/test/opkg-test$ ./opkg -o ~/test/opkg-test/root -f opkg.conf --force-postinstall -V4 install b_1_all.ipk 
opkg_conf_parse_file: Loading conf file opkg.conf.
opkg_conf_parse_file: Supported arch all priority (1)
pkg_hash_load_feeds: 
pkg_hash_load_status_files: 
pkg_vec_insert_merge: Adding new pkg=a version=1 arch=all.
opkg_install_cmd: b_1_all.ipk
opkg_prepare_url_for_install: Package b provided by hand (b_1_all.ipk).
pkg_vec_insert_merge: Adding new pkg=b version=1 arch=all.
pkg_info_preinstall_check: Updating file owner list.
pkg_hash_fetch_best_installation_candidate: Best installation candidate for b:
pkg_hash_fetch_best_installation_candidate: Adding b to providers.
pkg_hash_fetch_best_installation_candidate: b arch=all arch_priority=1 version=1.
pkg_hash_fetch_best_installation_candidate: Candidate: b 1.
opkg_prepare_install_by_name: Versions from pkg_hash_fetch: new 1
opkg_install_by_name: Calling opkg_install_pkg for b 1.
opkg_install_pkg: Calling pkg_arch_supported.
pkg_arch_supported: Arch all (priority 1) supported for pkg b.
Installing b (1) on root.
is_pkg_a_replaces: Seems I've found a replace a a
update_file_ownership: update_file_ownership: new_pkg=b wants file /home/tech/test/opkg-test/root/, from owner=a
update_file_ownership: update_file_ownership: new_pkg=b wants file /home/tech/test/opkg-test/root/x2, from owner=a
update_file_ownership: update_file_ownership: new_pkg=b wants file /home/tech/test/opkg-test/root/x3, from owner=<NULL>
pkg_hash_fetch_unsatisfied_dependencies: Checking dependencies for 'b'.
Removing package a from root...
pkg_run_script: Running script /home/tech/test/opkg-test/root//usr/lib/opkg/info/a.prerm.
remove_data_files_and_list: Deleting /home/tech/test/opkg-test/root/x1.
remove_data_files_and_list: Deleting /home/tech/test/opkg-test/root/x2.
pkg_run_script: Running script /home/tech/test/opkg-test/root//usr/lib/opkg/info/a.postrm.
remove_maintainer_scripts: Deleting /home/tech/test/opkg-test/root//usr/lib/opkg/info/a.control.
pkg_run_script: Running script /tmp/opkg-1wOu4T/b-XzCcSb/preinst.
opkg_install_pkg: Installing maintainer scripts.
opkg_install_pkg: Installing data files for b.
install_data_files: Extracting data files to /home/tech/test/opkg-test/root/.
install_data_files: Calling pkg_write_filelist.
pkg_write_filelist: Creating /home/tech/test/opkg-test/root//usr/lib/opkg/info/b.list file for pkg b.
opkg_install_pkg: Resolving conf files for b
opkg_install_pkg: pkg=b old_state_flag=110 state_flag=100
opkg_configure_packages: Configuring unpacked packages.
opkg_configure_packages: Reordering packages before configuring them...
opkg_recurse_pkgs_in_order: pkg b.
Configuring b.
pkg_run_script: Running script /home/tech/test/opkg-test/root//usr/lib/opkg/info/b.postinst.
write_status_files_if_changed: Writing status file.
pkg_write_changed_filelists: Saving changed filelists.
hash_table: pkg-hash, 12288 bytes
        n_buckets=1024, n_elements=2, n_collisions=0
        max_bucket_len=0, n_used_buckets=2, ave_bucket_len=1.00
        n_hits=6, n_misses=2
hash_table: file-hash, 12288 bytes
        n_buckets=1024, n_elements=4, n_collisions=0
        max_bucket_len=0, n_used_buckets=4, ave_bucket_len=1.00
        n_hits=6, n_misses=5
hash_table: obs-file-hash, 768 bytes
        n_buckets=64, n_elements=0, n_collisions=0
        max_bucket_len=0, n_used_buckets=0, ave_bucket_len=0.00
        n_hits=0, n_misses=3


~/test/opkg-test$ ./opkg -o ~/test/opkg-test/root -f opkg.conf --force-postinstall -V4 files b
opkg_conf_parse_file: Loading conf file opkg.conf.
opkg_conf_parse_file: Supported arch all priority (1)
pkg_hash_load_status_files: 
pkg_vec_insert_merge: Adding new pkg=b version=1 arch=all.
Package b (1) is installed on root and has the following files:
/home/tech/test/opkg-test/root/x3
hash_table: pkg-hash, 12288 bytes
        n_buckets=1024, n_elements=2, n_collisions=0
        max_bucket_len=0, n_used_buckets=2, ave_bucket_len=1.00
        n_hits=3, n_misses=2
hash_table: file-hash, 12288 bytes
        n_buckets=1024, n_elements=0, n_collisions=0
        max_bucket_len=0, n_used_buckets=0, ave_bucket_len=0.00
        n_hits=0, n_misses=0
hash_table: obs-file-hash, 768 bytes
        n_buckets=64, n_elements=0, n_collisions=0
        max_bucket_len=0, n_used_buckets=0, ave_bucket_len=0.00
        n_hits=0, n_misses=0


~/test/opkg-test$ find root/
root/
root/x2
root/x3
root/usr
root/usr/lib
root/usr/lib/opkg
root/usr/lib/opkg/lists
root/usr/lib/opkg/info
root/usr/lib/opkg/info/b.list
root/usr/lib/opkg/info/b.control
root/usr/lib/opkg/status
Comment 1 Alejandro del Castillo 2015-09-21 01:10:50 UTC
Created attachment 2752 [details]
test package (B)
Comment 2 Alejandro del Castillo 2016-01-19 00:00:17 UTC
On the libsolv backed, this test exposed a bug on the transaction steps ordering libsolv algorithm (https://github.com/openSUSE/libsolv/issues/120). Instead of ordering the operations as 1) remove A, 2) install B, the order is reversed.

Other than fixing libsolv, an alternate solution is to use the flags SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE | SOLVER_TRANSACTION_SHOW_OBSOLETES, which would treat the operation as an upgrade from A to B. This will require additional work as upgrade operations are not currently design to work across packages.
Comment 3 Alejandro del Castillo 2016-03-29 21:32:33 UTC
commit 9f02bbe5e3ccaeca7e30a38557733126acd96010

Fix duplicated offline root in in path in function check_data_file_clashes_change