On Tue, Feb 19, 2008 at 05:26:00PM +0100, Nagy Gabor wrote:
Hi! 1. I don't really understand why this /tmp/* stuff is needed (and tmpfile shouldn't be PACMAN specific). We could write the pid to the lockfile directly.
There is an explanation in the comments : "Also, I was wondering why good locking systems create symlinks to temporary files. I found why: the pid that pacman had when the db.lck file was created can be assigned to another process after a reboot, so the workaround for this is to create db.lck in /tmp and symlink it to /var/lib/pacman. This way nonroot users still can't lock pacman db, but after a reboot the lock file is gone."
2. Just for safety we could compare our current pid and the lock-pid on lockfile removal.
Maybe (patches always welcome :)).