[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

broken database locking (at least in rpm 4.0.4)



The attached test program demonstrates -- once you've opened the rpm
database once, and then closed it, successive openings (with O_RDWR)
will not lock the database.

To compile the attached program, run

gcc -o testcase -I/usr/include/rpm -lrpm -lrpmdb -lrpmio -lpopt
testcase.c

To test, you'll need two terminals.  In one, as root, run:

# ./testcase

In the other, run

$ rpm -qa

You should get a locking error.

Now, ^C the testcase, and run it again, as:

# ./testcase 1

In the other, run

$ rpm -qa

It will work, which is bad, I think.  Note that instead of that being a
-qa, it could be a -i.  Even if the other process were in the middle of
a transaction.  Which will corrupt the rpm database.

Is this known and/or intentional?  I've worked around it by using fcntl
to manually lock /var/lib/rpm/Packages after rpmdbOpen, but... should I
file a bug?

Ian

-- 
Ian Peters <itp@ximian.com>
Ximian, Inc.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []