If your home directory is NFS mounted, you need to read this.  Otherwise, feel
free to skip it.

The GDBM library locks dbm files by default whenever they are opened in
write mode.  When GDBM is built, it will try to use flock (BSD-style locking)
first, if available, and if not it will fall back on fcntl (POSIX-style
locking) to lock files.  This presents a problem, because on linux, flock does
not support locking over NFS, while fcntl does.  Because of this, if your home
directory is an NFS mount, jpilot-backup may not work, depending on your
distribution, and what version of GDBM you have installed.

Some distributions (Debian, others?) change their GDBM configuration to always
use fcntl.  Others do not.  SuSE 8.1 definitely doesn't, but it would appear
that 8.0 does.  Unfortunately, there is no way that I am aware of to determine
how a given GDBM library uses locking, short of trying to lock a file over
NFS.

If jpilot-backup complains that it "Can't open dbm file /home/foo/active.dbm"
*during sync*, then your GDBM library is probably using flock for locking
(assuming, of course, that your home directory is NFS mounted; if it's not,
why are you reading this?).  If that's the case, then you have three options
to fix it:

1) Upgrade your GDBM to version 1.8 or better.  GDBM version 1.8 introduced a
no-lock flag to enable reads and writes to dbm files without locking them.
While I normally would not recommend non-synchronized writes to a file from
multiple processes, this should not be a problem for jpilot-backup:  the only
way two processes could try to write to the same dbm file would be if a single
user were running two instances of J-Pilot, and synced both of them at the
same time.

2) Rebuild your GDBM library from source.  Unfortunately, there is no
configure option in GDBM to disable flock locking, so you will have to finagle
a bit.  What you need to do is run configure, then add the following line to
autoconf.h:
  #undef HAVE_FLOCK
Then type make to build it.  Installing your custom GDBM library might be
tricky, because you will need to uninstall your current version first, and
there might be other parts of your system that depend on it.  If you use an
RPM-based system, you can edit the spec file and put this line right after the
%configure line:
  echo "#undef HAVE_FLOCK" >> autoconf.h
Then you can make a custom RPM and install it.

3) Build a local copy of GDBM and statically link it with jpilot-backup.
Doing this is really beyond the scope of this little README, but if you know a
bit about C programming it shouldn't be too difficult.  I could of course make
this easier, which is really the 4th option, so if this is what you want to do
send me a message and I'll patch jpilot-backup with a configure option to
allow static linking to gdbm.

Jason Day <jasonday@worldnet.att.net>
January 29, 2003

