Historical bug tracker for the Pacman package manager.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
FS#27691 - [pacman] better locking mechanism
Attached to Project:
Pacman
Opened by Davorin Učakar (phantom) - Friday, 23 December 2011, 20:25 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 21 February 2012, 04:46 GMT
Opened by Davorin Učakar (phantom) - Friday, 23 December 2011, 20:25 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 21 February 2012, 04:46 GMT
|
DetailsInstead of creating /var/lib/pacman/db.lck before transactions and deleting it when pacman finishes, a better approach would be to make an exclusive lock on that file (db.lck would be present in the filesystem all the time). Lock is released when a process finishes (or crashes), so there would be no need to manually delete db.lck after pacman crashes or is killed.
#include <fcntl.h> #include <sys/file.h> #include <unistd.h> int fd = open( "/var/lib/pacman/db.lck", O_RDONLY | O_NONBLOCK ); if( fd == -1 ) ... /// failed int ret = flock( fd, LOCK_EX | LOCK_NB ); if( ret == -1 ) ... // failed ... DB transactions ... close( fd ); |
This task depends upon
Closed by Dave Reisner (falconindy)
Tuesday, 21 February 2012, 04:46 GMT
Reason for closing: Duplicate
Additional comments about closing: FS#23501
Tuesday, 21 February 2012, 04:46 GMT
Reason for closing: Duplicate
Additional comments about closing: FS#23501
Regardless, this isn't hard to do. I'll throw together something for a ML and we can bikeshed it there.