nmh-workers
[Top][All Lists]
Advanced

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

Re: [Nmh-workers] Truncated Email.


From: Ralph Corderoy
Subject: Re: [Nmh-workers] Truncated Email.
Date: Sun, 06 Mar 2016 17:49:46 +0000

Hi Ken,

> The scan listing for 'inc' is being generated as it's reading the
> spool file.  So the ONLY way for you to get two scans is for you do
> actually incorporate the mail twice.  The spool is locked, yes ... but
> I see from the code it's unlocked before it gets truncated

Is it?  I didn't notice that in 1.6.

> (that seems like a bug to me, and that might be the cause of other
> problems).
> 
> But ... because the folder was read at startup both times, it thought
> that the start of new messages was at the same point.  So the second
> inc put the messages in the same files as the first inc.

Sounds plasible...  I haven't delved deep enough, but wouldn't the creat
of [9704, 9712] have failed if the files already existed?

> Fixing this might be tough ... I don't know how locking behaves when
> you truncate a file

Well, the locks are advisory only, so I don't think the kernel's locking
code cares what happens to the file, e.g. writing to it, or truncating
it.

> (although I see that it uses creat() to truncate a file, rather than
> ftruncate(); that seems weird to me?).

And it's a bug it closes creat's FD, freeing the lock.

> I'd like to point out that it has never been safe to run two inc's at
> the same time, so it's not surprising that this caused problems.

Ouch!  I've just skimmed inc(1) and see no sign of that restriction?  I
think I'll make a ~/bin/inc that uses flock(1).

Cheers, Ralph.



reply via email to

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