[pacman-dev] [PATCH] move db lock/unlock to the transaction functions

Aurelien Foret aurelien at archlinux.org
Thu Jan 26 15:51:47 EST 2006

VMiklos wrote:
> http://frugalware.org/~vmiklos/patches/libpacman-proposed/lock_move.diff
> $ sudo touch /tmp/pacman.lck
> $ sudo pacman -Sg
> error: failed to initilize alpm library (unable to lock database)
> error: library not initialized
> is this normal? of course not

You're right: the current lock handling needed to be tuned.

> we should only lock the database when a transaction begins, and
> we should unlock the database as soon as the transaction ends

Sounds good to me. I applied the patch, with a little rework (I dropped 
the R/W access test surrounding the lock creation/destruction).

> also move the PM_LOCK define to the public header so that fronends
> can print out a more usable error message (ie. like pacman2 did)

Good idea. Applied too.
Accordingly, I've restored the pacman 2.x error message saying the lock 
can be removed upon trans_init calls failures on the frontend side.

Thanks again

More information about the pacman-dev mailing list