help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modifying movemail


From: Pascal Bourguignon
Subject: Re: modifying movemail
Date: 19 Jun 2004 19:39:37 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Florian von Savigny <address@hidden> writes:

> Rmail mode uses a small C program, movemail (movemail.exe on Win32),
> to move mail from a spool file in Unix mbox format to an rmail file.
> 
> The problem I've got with it is actually a feature: it uses some kind
> of file locking mechanism to prevent the spool file being accessed by
> the mail fetching program at the same time. As strace has told me,
> this seems to use some kind of link, but I don't even know if symbolic
> or hard. In any case, this seems to be the reason why the spool file
> cannot be on a FAT32 partition: movemail will get into an endless
> cycle, trying over and over again to create some link, which the
> kernel refuses with never-ending patience.
> 
> The reason why this is a problem is that I use both Emacs versions on
> a dual-boot system (GNU/Linux and Win32), making it desirable to have
> the spool files accessible under both OSes, and this is only possible
> on a FAT32 partition.
> 
> From what I said above, it seems evident that movemail.exe cannot
> possibly use the same kind of file locking system as movemail (it
> might be Win32 never permits two processes to modify the same file at
> the same time, making any further measures superfluous, but who
> knows). Since both appear to be compiled from the same source, I have
> had a look at them, hoping to "disable" the file locking mechanism in
> some way.
> 
> This seems, however, no trivial task, as so much in the emacs sources
> understandably has multiple dependencies, and I haven't been able to
> sort out the crucial difference between compiling movemail.c for Win32
> and for Linux.
> 
> Could anybody provide guidance for me here? Or is the very idea flawed
> in some way? I am well aware disabling the file locking mechanism
> means in fact creating an unsafe program (or crippling it, as some
> would probably put it), but this would pose no danger to my system as
> it is set up. But it would spare me numerous reboots.

Here's a poor man's movemail. If you don't have bash on MS-Windows,
you can always convert it to bat.

#!/bin/bash
echo $$ > "$1".lock
while [ `cat "$1".lock` -ne "$$" ] ; do
    while [ -x "$1".lock ] ; do
        sleep 5
    done
    echo $$ > "$1".lock
done
mv "$1" "$2"
rm "$1".lock
#### movemail                         -- 2003-10-27 01:10:45 -- pascal   ####

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein


reply via email to

[Prev in Thread] Current Thread [Next in Thread]