Bug 10461 - Uninstall leaks common directories if packages removed out-of-order
Summary: Uninstall leaks common directories if packages removed out-of-order
Status: RESOLVED FIXED
Alias: None
Product: opkg
Classification: Yocto Project Subprojects
Component: opkg (show other bugs)
Version: 0.3.3
Hardware: x86 Multiple
: Undecided normal
Target Milestone: next-minor
Assignee: Alex Stewart
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-10-19 19:06 UTC by Gabe Jones
Modified: 2022-09-09 21:12 UTC (History)
1 user (show)

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


Attachments
Packages used in the reproducing case (1.77 KB, application/zip)
2016-10-19 19:06 UTC, Gabe Jones
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabe Jones 2016-10-19 19:06:55 UTC
Created attachment 3482 [details]
Packages used in the reproducing case

What steps will reproduce the problem?

opkg install test-package-1_1.0_core2-64.ipk
opkg install test-package-2_1.0_core2-64.ipk
opkg remove test-package-1
opkg remove test-package-2
find /tmp/commondir/


What is the expected output? What do you see instead?

Expect /tmp/commondir to be removed.  It remains.

What version of the product are you using?

0.3.3
Comment 1 Alejandro del Castillo 2017-04-27 20:47:29 UTC
Looking at the .list files (/var/lib/opkg/lists):

test-package-1.list

/
/tmp
/tmp/commondir
/tmp/commondir/package1
/tmp/commondir/package1/dummy

test-package-2.list

/tmp/commondir/package2
/tmp/commondir/package2/dummy

Opkg is only tracking the new files/directories that a package is installing, not the files/directories that the package payload contains. Comparing with dpkg .lists:

test-package-1.list

/.
/tmp
/tmp/commondir
/tmp/commondir/package1
/tmp/commondir/package1/dummy

test-package-2.list

/.
/tmp
/tmp/commondir
/tmp/commondir/package2
/tmp/commondir/package2/dummy

Opkg keeps the files/directories ownership in a hash (opkg_config->file_hash), which helps detect conflicts, but doesn't make any distinction between files/directories. Seems like opkg needs to write to the .list file the info from data.tar.gz, not from opkg_config->file_hash. This change is substantial, so I am re-targeting the fix for a later version.
Comment 2 Alex Stewart 2022-09-09 21:12:17 UTC
Resolved by Shruthi Ravichandran's patch [1].

[1] https://groups.google.com/g/opkg-devel/c/tUlw8yW9tVU