procmail
[Top] [All Lists]

Re: Mixing flock() and lockfiles

1996-07-09 22:56:00
| >Also, one of the comments about 3.11pre4 says that it allows users that
| >can't write to the system mail directory to lock their mail file.  Does
| >refer to the use of both fcntl() and lockf()?  Or is there another scheme
| >in 3.11pre4?
| 
| Neither fcntl() nor lockf() require the ability to write to the spool
| directory: only dotlocking requires that.  What you're refering to is
| the fact that if procmail is installed setuid root or setgid to
| whatever group the mail directory is owned by, then it can perform
| dotlocking with the special permissions in a secure fashion.  The
| lockfile command can do this as well, assuming it was installed with
| such permissions as well.
| 
| Philip Guenther

I may have something of a bug to report, though I'm not sure
it really is one.  Summary: procmail chooses to bypass
dotlocking on my system mailbox, even when explicitly told
to use it.

here's my .procmailrc.

    1:43am mengwong(_at_)fdemocracy:~% cat .procmailrc
    VERBOSE = on
    LOGFILE = $HOME/Mail/log.procmail

    :0:
    /var/spool/mail/mengwong

real simple, so procmail should create
/var/spool/mail/mengwong.lock, since it certainly has the
privileges to do so:

    1:43am mengwong(_at_)fdemocracy:~% ls -l /usr/bin/procmail
    -rwsr-sr-x   1 root     mail        55685 Apr 28 02:45 /usr/bin/procmail*

let's create the .lock file.  after this time procmail
should not deliver to my system mailbox, right?

    1:43am mengwong(_at_)fdemocracy:~% lockfile -ml
    1:43am mengwong(_at_)fdemocracy:~% ls -l /var/spool/mail/mengwong*
    -rw-------   1 mengwong mail         3800 Jul 10 01:43 
/var/spool/mail/mengwong
    -r--------   1 mengwong mail            1 Jul 10 01:43 
/var/spool/mail/mengwong.lock

my .procmailrc is the only game in town:

    1:43am mengwong(_at_)fdemocracy:~% cat /etc/procmailrc
    cat: /etc/procmailrc: No such file or directory

so knowing what should happen (procmail shouldn't deliver
due to the .lock), we'll email me.

    1:43am mengwong(_at_)fdemocracy:~% echo foo | elm mengwong
    Sending mail...
    Mail sent!

oh dear, it seems procmail didn't care much for my .lock ...

    1:43am mengwong(_at_)fdemocracy:~% cat Mail/log.procmail
    procmail: Bypassed locking "/var/spool/mail/mengwong.lock"
    procmail: Assigning "LASTFOLDER=/var/spool/mail/mengwong"
    procmail: Opening "/var/spool/mail/mengwong"
    procmail: Acquiring kernel-lock
    From mengwong  Wed Jul 10 01:43:35 1996
     Subject: no subject (file transmission)
      Folder: /var/spool/mail/mengwong                                          
484
    procmail: Notified comsat: "mengwong(_at_)3316:/var/spool/mail/mengwong"

so i get rid of the apparently superfluous lockfile.

    1:43am mengwong(_at_)fdemocracy:~% lockfile -mu

now, can anyone tell me what i'm doing wrong?  i'm running
on linux 2.0.0 with procmail 3.11pre4.

    1:45am mengwong(_at_)fdemocracy:~% uname -a
    Linux fdemocracy.org 2.0.0 #1 Mon Jun 10 02:04:13 EDT 1996 i586
    1:47am mengwong(_at_)fdemocracy:~% procmail -v
    procmail v3.11pre4 1995/10/29 written and created by Stephen R. van den Berg
                                                            
<srb(_at_)cuci(_dot_)nl>

    Submit questions/answers to the procmail-related mailinglist by sending to:
            <procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de>

    And of course, subscription and information requests for this list to:
            <procmail-request(_at_)informatik(_dot_)rwth-aachen(_dot_)de>

    Locking strategies:     dotlocking, fcntl(), lockf()
    Default rcfile:         $HOME/.procmailrc
    System mailbox:         /var/spool/mail/$LOGNAME

thanks
meng

<Prev in Thread] Current Thread [Next in Thread>