RE: Pre2.0-8 & Sendmail

Robert Nader (naderr@linuxbox.nse.com.au)
Fri, 31 May 1996 17:10:02 +1000


andy@lysaker.kvaerner.no writes:
>
> John Henders wrote:
> >
> >
> > In <9605290611.AA26813@lysaker.kvaerner.no> andy@lysaker.kvaerner.no (Andrew Walker) writes:
> >
> > >Recompile your sendmail to lock with flock() (#define HASFLOCK I think).
> > >In newer kernels I disallowed mixing BSD (flock) and SYSV(lockf)/POSIX(fcntl)
> > >locks on a file. The GDBM routines use flock() to lock the alias database,
> > >and then sendmail tries to lock the same files with lockf() - hence the
> > >problem.
> >
> > You might want to reconsider your recommendation for flock() as the
> > standard. I agree that mixed locks are a bad thing, but standardizing on
> > flock means anyone wanting to try doing locking over NFS will have to
> > maintain custom versions of the system libraries. Debian has already
> > changed their gdbm to use fcntl() locking.
> >
> > Is there any particular reason to recommending flock()? My book on Posix
> > programming uses fcntl() and calls flock() a BSD'ism.
> >
> >
>
> flock() *is* a BSD'ism, and one of the better ones ;-)
>
> I'm not really advocating one style or the other, although flock() has much
> better semantics(*) with the exception of NFS locking. The problem in this case
> is that people already have GDBM libraries that use flock(), and if sendmail
> is compiled to use these libraries then sendmail must use flock() as well.
>
> Personally I'd compile with the Berkeley DB library instead of GDBM and stop
> worrying about flock() vs fcntl(). Eric Allman tried to switch over to fcntl()
> as the sendmail standard. He ended up recommending flock() as the only method
> that had sensible behaviour on all platforms that support it.
>
> -Andy
>
> (*) - especially for a program that forks a lot and wants to share locks with
> its children
>

Hmm, ages ago ( 2 months ) I compiled sendmail-8.7.5 from the Berkley
sources ( a bit of a hack: just use the Makefile.Linux ;) as the
script doesn't seem to directly work ... hmm, that is, I do _not_
know how to make "makesendmail" work as it uses the BSD make I think
it was... anyway ...

I used ....

# define the database mechanisms available for map & alias lookups:
# -DNDBM -- use new DBM
# -DNEWDB -- use new Berkeley DB
# -DNIS -- include NIS support
# The really old (V7) DBM library is no longer supported.
# See READ_ME for a description of how these flags interact.
#
DBMDEF= -DNDBM -DNEWDB -DNIS

And running 1.99.7 with no problems so far.

Cheers,

Rob