Bug 252055 - pkg-clean is emptying cache directory
Summary: pkg-clean is emptying cache directory
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-22 19:51 UTC by Usama Khan
Modified: 2021-08-17 15:39 UTC (History)
7 users (show)

See Also:
linimon: maintainer-feedback? (pkg)


Attachments
Fix to restore documented behaviour for pkg_clean version 16 (332 bytes, patch)
2021-08-11 21:40 UTC, garethwynroberts1
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Usama Khan 2020-12-22 19:51:42 UTC
"pkg clean" is removing everything from the cache directory.

"pkg clean" (without any option/argument) removes packages that have been superseded by newer versions, and any packages that are no longer provided. Moreover, in order to remove all the packages from the cache, "pkg clean -a" is used. However, it is observed that even without giving an "-a" option, "pkg clean" is deleting all cached packages including those, which have not been superseded by newer versions yet and are still in use.
Comment 1 Wolfgang Hukriede 2021-04-17 19:34:38 UTC
Yes, I can confirm this. "pkg clean -n" also shows the full set.
Comment 2 Trond Endrestøl 2021-07-13 08:25:13 UTC
I created https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249917 some time ago. It's a good thing more people are experiencing this odd behaviour, and hopefully it will be fixed.
Comment 3 garethwynroberts1 2021-08-11 21:40:31 UTC
Created attachment 227121 [details]
Fix to restore documented behaviour for pkg_clean version 16
Comment 4 garethwynroberts1 2021-08-11 21:43:50 UTC
This bug is fixed in pkg version 1.17.0 and 1.17.1

If you are stuck on previous versions, e.g. pkg-1.16.3, this simple one-character patch will fix the problem.