On Mon, Aug 06, 2001 at 07:04:42PM +0200, Peter van Dijk wrote:
> On Mon, Aug 06, 2001 at 11:00:09AM -0400, Rudy Zung wrote:
> [snip]
> > I changed the link() in qmail-local.c to rename() and my mail delivery
> > now works. Anyone want to put in some input as to whether a rename() would
> > fail in some cases where a link() might not?
>
> Using rename() instead of link() takes away the reliability of
> Maildir. If for some reason, two processes generate the same filename for
> a message, no matter within what timespan, you lose the first of these
> two.
>
> Greetz, Peter
Hmmm. I hadn't thought of that possibility; however, I am hoping that I
wouldn't "casually" lose an email message because the file name is
constructed by the combination of the system time and the process ID, which
should be sufficiently unique, except possibly when the system clock is
reset, and the PIDs recycle. The tmp file name is given to stat() which
makes sure that the filename does not yet exist where the tmp directory has
AFS ACL system:anyuser lidk (so, this allows anybody to delete the file, but
should that happen, then the rename would fail, and qmail should notice that
error and defer delivery (I hope)).
The next part is that I am now using rename() to "move" the file from tmp to
new. For the new directory, I have AFS ACL system:anyuser ik. The
system:anyuser has no permission to delete files, and this is what I am
using to hope that the rename() will not be able to overwrite an existing
file because that would mean a delete would have to be done, or the file
would have to be rewritten, which are not permissible with ik ACLs.
I guess what I can do is to modify qmail-local.c's maildir_child() and make
it always generate the same file name as a test case and see how it behaves.
That's just what I'm surmising; certainly glad for any input so that I don't
totally mangle my email and start losing all sorts of email.
Nevertheless, thank you for the rename() unsafe warning.
--
...Ru (a low-cost superhero)
On, on! Blue skies. Think snow.
1740484I 998300172 076662 82968/A17215 045124P E286/184435
975-203608 11859 DS1160