Bug 136305

Summary: gdbm prefers flock over fcntl when being built
Product: Red Hat Enterprise Linux 3 Reporter: Ralph Angenendt <ralph+rh-bugzilla>
Component: gdbmAssignee: Jeff Johnson <jbj>
Status: CLOSED WONTFIX QA Contact: Jay Turner <jturner>
Severity: low Docs Contact:
Priority: medium    
Version: 3.0CC: redhat, srevivo, tao
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-29 20:56:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
Patch for systems.h which checks for fcntl first
patch to allow gdbm to use fcntl even if flock is present
Fixed version of patch for systems.h which checks for fcntl first none

Description Ralph Angenendt 2004-10-19 09:50:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20040808 Lightninganemone/0.9.3 (Firefox/0.9.3 gotcha)

Description of problem:
With gdbm it is not possible to lock files via nfs, as gdbm has been
built against flock, which "the sourcecode" prefers over fcntl (in
systems.h HAVE_FLOCK is tested, if - and only then - this fails,
locking gets defined for fcntl).

As no Posix locking is available, using gdbm via NFS fails with "No
locks available".

When being built, availability of fcntl should be checked first, only
if it is not available do a fallback on flock.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. install gdbm
2. try dbm_open() on a file exported via NFS

Actual Results:  The program fails with "No locks available"

Expected Results:  It should have opened the database.

Additional info:

Comment 1 Ralph Angenendt 2004-10-19 09:51:43 UTC
Created attachment 105433 [details]
Patch for systems.h which checks for fcntl first

When being rebuild with this patch, gdbm uses fcntl over flock, so that posix
locking is possible

Comment 2 Adam Spiers 2004-12-17 12:31:31 UTC
See also bug #123415

Comment 3 Neil Horman 2004-12-17 17:46:48 UTC
Created attachment 108815 [details]
patch to allow gdbm to use fcntl even if flock is present

This patch adds a configure script option to gdbm so that even if flock is
detected during configuration, fcntl will be used to lock files.  This will
allow the package to be rebuilt to work over NFS by adding a
--enable-force-fcntl flag on the %configure line of the gdbm spec file.

Comment 4 Adam Spiers 2004-12-20 11:10:24 UTC
Is there any reason ever to prefer flock to fcntl if both are available?

If not, I would prefer the first approach - it's better to
automatically always make the right decision rather requiring the
person building the package to override the wrong decision via
--enable-force-fcntl.  Unless you have some other reasons I haven't
thought of for taking this latter approach?

Comment 5 Adam Spiers 2004-12-20 11:13:16 UTC
Created attachment 108884 [details]
Fixed version of patch for systems.h which checks for fcntl first

The first patch didn't apply to 1.8.0 cleanly for me.  Attaching a version
which does; should be identical in functionality.