[pacman-dev] [PATCH] move db lock/unlock to the transaction functions
hi 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 we should only lock the database when a transaction begins, and we should unlock the database as soon as the transaction ends 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) udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
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 -- Aurelien
On Thu, Jan 26, 2006 at 09:51:47PM +0100, Aurelien Foret <aurelien@archlinux.org> wrote:
Thanks again
wow, did i get a new mail addr? ;) (frugalware.fr) udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
VMiklos wrote:
wow, did i get a new mail addr? ;) (frugalware.fr)
Oops... I put back it to the normal one. Sorry -- Aurelien
On Thu, Jan 26, 2006 at 09:51:47PM +0100, Aurelien Foret <aurelien@archlinux.org> wrote:
Sounds good to me. I applied the patch, with a little rework (I dropped the R/W access test surrounding the lock creation/destruction).
erm if we unlock the db in trans_release(), then we should call it in pacman_remove() even there isn't any error: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=plain_commitdif...; udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
VMiklos wrote:
erm if we unlock the db in trans_release(), then we should call it in pacman_remove() even there isn't any error:
http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=plain_commitdif...;
Indeed, I noticed it right after applying your lock/unlock move patch. In fact, the trans_release call has always been missing, even before your patch (a transaction must be released, even if it happens to succeed!). Note that the same also applied to pacman_add, pacman_sync and pacman_deptest too. -- Aurelien
On Sat, Jan 28, 2006 at 10:32:11PM +0100, Aurelien Foret <aurelien@archlinux.org> wrote:
Indeed, I noticed it right after applying your lock/unlock move patch.
In fact, the trans_release call has always been missing, even before your patch (a transaction must be released, even if it happens to succeed!).
Note that the same also applied to pacman_add, pacman_sync and pacman_deptest too.
ok, but why don't you removed the unlock stuff from alpm_release()? without removing that the lockfile will be removed by pacman's cleanup() even if an anouther pacman is already running udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
VMiklos wrote:
ok, but why don't you removed the unlock stuff from alpm_release()?
without removing that the lockfile will be removed by pacman's cleanup() even if an anouther pacman is already running
My bad. Fixed now. Thanks for the head's up. -- Aurelien
On Sat, Jan 28, 2006 at 10:32:11PM +0100, Aurelien Foret <aurelien@archlinux.org> wrote:
Note that the same also applied to pacman_add, pacman_sync and pacman_deptest too.
hmm, but at pacman_deptest you should release the transaction _before_ calling pacman_sync: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=plain_commitdif...; udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
VMiklos wrote:
hmm, but at pacman_deptest you should release the transaction _before_ calling pacman_sync: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=plain_commitdif...;
Yes. I fixed it at the same time I removed the unlock code from alpm_release. -- Aurelien
participants (2)
-
Aurelien Foret
-
VMiklos