Subject: Re: procmail-3.10 + emacs/rmail

From: Samuel Tardieu <[email-masked]>
Date: Wed, 12 Apr 1995 16:49:38 +0200

>>>>> "Malte" == Malte Uhl <[email-masked]> writes:

[...]
 Malte> a temporary file an truncates the inbox. Of course, the inbox
 Malte> is manipulated using a program called movemail, which
 Malte> presumably does the dot locking, it is not worked on the inbox
 Malte> itself.

"which presumably does the dot locking" ?

In the following sequence, /tmp/movemail is standard Emacs movemail:

#####

<sam@olympe>echo foo > foo                                  04/12/95 16:51
<sam@olympe>lockfile foo.lock                               04/12/95 16:51
<sam@olympe>ls -al foo*                                     04/12/95 16:51
-rw-------   1 sam      enst            4 Apr 12 16:51 foo
-r--------   1 sam      enst            1 Apr 12 16:51 foo.lock
<sam@olympe>/tmp/movemail foo bar                           04/12/95 16:51
<sam@olympe>ls -al                                          04/12/95 16:51
total 4
drwx------   2 sam      enst         1024 Apr 12 16:51 ./
drwx------  11 sam      enst         1024 Apr 12 16:51 ../
-rw-------   1 sam      enst            4 Apr 12 16:51 bar
-rw-------   1 sam      enst            0 Apr 12 16:51 foo
-r--------   1 sam      enst            1 Apr 12 16:51 foo.lock

#####

movemail doesn't use any locking.

After my signature, you will find the replacement movemail I use. I
don't remember who wrote it, but it uses dot-locking, just like
procmail does. I use Emacs to read my mail and I have never had any
trouble with it.

  Sam
--
"La cervelle des petits enfants, ca doit avoir comme un petit gout de noisette"
                                                       Charles Baudelaire

#!/bin/sh
#
# specify the mailbox file you want to read on the command line
#
MAILDIR=$HOME/Mail
cd $MAILDIR
LOCKFILE=$1.lock
if /usr/local/bin/lockfile -! -r1 $LOCKFILE
then
 while
   /usr/local/bin/lockfile -! -4 -r2 $LOCKFILE
 do
 /usr/bin/echo Mail is still arriving...
 done
fi
trap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15
#
# Call you favourite mailer here.
#
case `uname -r` in
	5.*)
		ECHO="/usr/bin/echo \c"
		;;
	*)
		ECHO="/usr/bin/echo -n"
		;;
esac
/usr/bin/cat $1 >> $2 && ${ECHO} > $1

---

From: [email-masked] (Robert W. Kerns)
Date: Wed, 12 Apr 1995 10:05:05 +0800

> movemail doesn't use any locking.

movemail most certainly *DOES* to locking!  It can use any of the
three standard locking techniques:  .lock files, flock, and lockf.
Just like procmail's lockfile.

Of course if you compile it configured to use the wrong set of
options, then it won't work right -- just like lockfile.

 > procmail does. I use Emacs to read my mail and I have never had any

Procmail is supposed to be compiled to use the same locking scheme(s)
in use on your system.  If emacs's movemail is compiled correctly
and using flock to properly lock with your mailer, and procmail is
not, then using your replacement script will CAUSE problems, not
PREVENT the.

On the other hand, if it is procmail that is compiled correctly,
and movemail which is wrong, then the script is one way to work
around the problem.  But it would be FAR better to get the problem
fixed before someone else falls into it!