Cleanup action removes packages still in use
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
charm-apt-mirror |
Won't Fix
|
High
|
Robert Gildein |
Bug Description
We found that the automatically-run cleanup action on a synchronise can remove packages that are still referenced by existing `Packages` lists. This was observed by deb files in all repositories except for "main" being removed, after running the synchronize action.
I believe it is due to [1] in the `locate_
On a related note, this destroyed the snapshots as well as the main mirror because they symlink to the pool directory. This was very surprising! I guess the symlink is to avoid the snapshots taking up unnecessary space. Can I suggest an alternative to use hardlinks for the deb files in the snapshots? This way an unexpected deletion wouldn't happen, and no unnecessary disk space would be used.
tags: | added: bseng-1865 |
Changed in charm-apt-mirror: | |
status: | New → Triaged |
importance: | Undecided → Medium |
importance: | Medium → High |
Changed in charm-apt-mirror: | |
status: | Triaged → In Progress |
assignee: | nobody → Robert Gildein (rgildein) |
Changed in charm-apt-mirror: | |
status: | In Progress → Fix Committed |
I've also reviewed this. I agree with Danny's findings. The code was likely written the way it was because there are often Packages, Packages.bz2 and Packages.gz files (maybe even Packages.xz as well?), and these all have the same real content, thus it makes sense to only parse one copy. However, the code in question is not actually looking just at the packages files in the same immediate directory, but across multiple directories within the same mirrored repository subfolder - thus the code unfortunately ends up discarding far more than it should.