From ec1cec87636c8c3b29b103ca034f445af83e4154 Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 20 Dec 2002 18:25:59 +0000 Subject: [PATCH] - error on exclusive Packages fcntl lock if DB_ENV_PRIVATE is set. CVS patchset: 5953 CVS date: 2002/12/20 18:25:59 --- CHANGES | 1 + rpm.spec.in | 5 +++-- rpmdb/db3.c | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 37dff3d..79a7b2c 100644 --- a/CHANGES +++ b/CHANGES @@ -62,6 +62,7 @@ - add -I/usr/include/nptl, Conflicts: kernel < 2.4.20. - dynamically link /bin/rpm, link against good old -lpthread. - test pthread_{mutex,cond}attr_setpshared(), add DB_ENV_PRIVATE if not. + - error on exclusive Packages fcntl lock if DB_ENV_PRIVATE is set. 4.0.4 -> 4.1: - loosely wire beecrypt library into rpm. diff --git a/rpm.spec.in b/rpm.spec.in index 6c0bc3a..6606284 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -16,7 +16,7 @@ Name: rpm %define version @VERSION@ Version: %{version} %{expand: %%define rpm_version %{version}} -Release: 0.32 +Release: 0.33 Group: System Environment/Base Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz Copyright: GPL @@ -456,9 +456,10 @@ exit 0 %{__prefix}/include/popt.h %changelog -* Fri Dec 20 2002 Jeff Johnson 4.2-0.32 +* Fri Dec 20 2002 Jeff Johnson 4.2-0.33 - dynamically link /bin/rpm, link against good old -lpthread. - test pthread_{mutex,cond}attr_setpshared(), add DB_ENV_PRIVATE if not. +- error on exclusive Packages fcntl lock if DB_ENV_PRIVATE is set. * Thu Dec 19 2002 Jeff Johnson 4.2-0.31 - statically link against /usr/lib/nptl/libpthread.a, if present. diff --git a/rpmdb/db3.c b/rpmdb/db3.c index 2924149..604e635 100644 --- a/rpmdb/db3.c +++ b/rpmdb/db3.c @@ -1259,7 +1259,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) /* * Lock a file using fcntl(2). Traditionally this is Packages, - * the file used * to store metadata of installed header(s), + * the file used to store metadata of installed header(s), * as Packages is always opened, and should be opened first, * for any rpmdb access. * @@ -1271,6 +1271,9 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) * the DBENV should provide it's own locking scheme. So try to * acquire a lock, but permit failures, as some other * DBENV player may already have acquired the lock. + * + * With NPTL posix mutexes, revert to fcntl lock on non-functioning + * glibc/kernel combinations. */ if (rc == 0 && dbi->dbi_lockdbfd && (!dbi->dbi_use_dbenv || _lockdbfd++ == 0)) @@ -1291,9 +1294,10 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip) rc = fcntl(fdno, F_SETLK, (void *) &l); if (rc) { - /* Warning only if using CDB locking. */ + /* Warning iff using non-private CDB locking. */ rc = ((dbi->dbi_use_dbenv && - (dbi->dbi_eflags & DB_INIT_CDB)) + (dbi->dbi_eflags & DB_INIT_CDB) && + !(dbi->dbi_ecflags & DB_ENV_PRIVATE)) ? 0 : 1); rpmError( (rc ? RPMERR_FLOCK : RPMWARN_FLOCK), _("cannot get %s lock on %s/%s\n"), -- 2.7.4