On Sat, Jul 16, 2011 at 5:11 PM, Dan McGee <dan@archlinux.org> wrote:
This addresses FS#25141. We shouldn't remove every empty directory we come across during the removal process unless it is truly not known to any other package. This will prevent removal of essential directories such as '/var/lock/'.
This is accomplished by first checking the empty/non-empty status of a directory, which was previously done implicitly by calling rmdir() and ignoring errors. We do this to avoid the next (new) check in most cases, which is to look at all local packages to see if the to-be-removed directory is present in another packages' filelist. If we do not find it anywhere, then we remove it, else we keep the file around.
I always thought pacman should do that, but Nagy concerns were obviously right, loading /var/lib/pacman/local/*/files takes time. This just highlights once more the poor design of the local db. pacman -R teeworlds goes from 2sec to 12sec here (after dropping caches) ... and from 0.4sec to 0.7sec when everything is cached. But only a pacman -Qo 'orphaned_file' or a previous -R operation would load all /var/lib/pacman/local/*/files Just to make myself clear, I think this patch should go in, and the local db out :) In the meantime, we have filesystem loops fortunately.