commit d0dd5a50066ecb9e4857a7795ceed67832a37dc5 Author: Robin H. Johnson Date: Thu Dec 4 23:21:51 2008 -0800 Fix up locking for packages to avoid collision when the package name, cmp, action are the same, but defines and version are different. There's a serious bug with the locking inside the packages method, that causes lock names to collide when they shouldn't. Triggered with this code: ===== packages: any:: mail-mta/postfix cmp=lt version=2.3 action=none define=has_lt_postfix23 mail-mta/postfix cmp=lt version=2.4 action=none define=has_lt_postfix24 mail-mta/postfix cmp=lt version=2.5 action=none define=has_lt_postfix25 mail-mta/postfix cmp=lt version=2.6 action=none define=has_lt_postfix26 mail-mta/postfix cmp=ge version=2.3 action=none define=has_ge_postfix23 mail-mta/postfix cmp=ge version=2.4 action=none define=has_ge_postfix24 mail-mta/postfix cmp=ge version=2.5 action=none define=has_ge_postfix25 ===== The lock is normally created in src/do.c as follows: snprintf(lock,CF_BUFSIZE-1,"%s_%d_%d",name,ptr->cmp,ptr->action); Where name is based only on the first token. The above comes down to only two locks: packages.mail_mta_postfix_2_2 packages.mail_mta_postfix_3_2 This means the other classes are never defined, and unless you look at the debug output, the locking errors are not seen either. Attached are patches for the 2.1.x and 2.2.x series that alter the lock name to include the version AND define/elsedefine blocks. Signed-off-by: Robin H. Johnson diff --git a/src/do.c b/src/do.c index 55fc552..58454f2 100644 --- a/src/do.c +++ b/src/do.c @@ -2710,7 +2710,7 @@ for (ptr = VPKG; ptr != NULL; ptr=ptr->next) ptr->done = 'y'; } - snprintf(lock,CF_BUFSIZE-1,"%s_%d_%d",ptr->name,ptr->cmp,ptr->action); + snprintf(lock,CF_BUFSIZE-1,"%s_%d_%s_%d_%s_%s", ptr->name, ptr->cmp, ptr->ver ?: "" ,ptr->action, ptr->defines ?: "", ptr->elsedef ?: ""); if (!GetLock(ASUniqueName("packages"),CanonifyName(lock),ptr->ifelapsed,ptr->expireafter,VUQNAME,CFSTARTTIME)) {