[hypermail] [PATCH]: mkdir failures

From: William R. Knox <wknox_at_mitre.org_at_hypermail-project.org>
Date: Thu, 10 Jan 2002 12:17:23 -0500 (EST)
Message-ID: <Pine.GSO.4.33.0201101156140.19805-100000_at_bear.mitre.org>


I have problem wherein I occasionally get messages that indicate that hypermail could not create a directory on the first message in a new folder. Here is what the bounced message looks like:

I suspect that it is from a race condition in the checkdir function in the lines

if (stat(dir, &sbuf)) {
if (errno != ENOENT || mkdir(dir, set_dirmode) < 0) {

The errno is filled in by a stat on the directory in the prior line - if two incoming messages arrive at close to exactly the same time, it is possible that they will arrive at this point at nearly the exact same time and will both think the directory in question does not exist - when one tries to create it, it will then fail because the other one has created in the previous instant and will then ounce the message (at least under my setup). In order to prevent this, I have a patch for file.c (I also patch check1dir, just because it could happen there, too):

     if (stat(dir, &sbuf)) {
        if (errno != ENOENT || mkdir(dir, set_dirmode) < 0) {

- sprintf(errmsg, "%s \"%s\".",
- lang[MSG_CANNOT_CREATE_DIRECTORY], dir);
- progerr(errmsg);
+ if (errno != EEXIST) { + sprintf(errmsg, "%s \"%s\".", + lang[MSG_CANNOT_CREATE_DIRECTORY], dir); + progerr(errmsg); + } return; } else if (set_showprogress) _at_@ -104,9 +106,11 @@ *p = '\0'; if (stat(dir, &sbuf)) { if (errno != ENOENT || mkdir(dir, set_dirmode) < 0) {
- sprintf(errmsg, "%s \"%s\".",
- lang[MSG_CANNOT_CREATE_DIRECTORY], dir);
- progerr(errmsg);
+ if (errno != EEXIST) { + sprintf(errmsg, "%s \"%s\".", + lang[MSG_CANNOT_CREATE_DIRECTORY], dir); + progerr(errmsg); + } return; } else if (set_showprogress)

I see this problem only rarely (every other month or so), so I can't say whether this will fix it, but I've not come up with anything better. Anyone else having this sort of trouble? Care to comment? Below is the relevant line from my config file and from my mail aliases file - if this is a terrible way to set things up, can someone let me know? Thanks in advance.

hmrc.alex



dir = /apps/webcontent/docs/mail/alex-archives/%M-%d-%y

aliases file



alexarch: "|/usr/local/bin/hypermail -u -i -c /apps/mitre/etc/hmrc.alex"
			Bill Knox
			Senior Operating Systems Programmer/Analyst
			The MITRE Corporation
Received on Thu 10 Jan 2002 07:24:12 PM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:12 AM GMT GMT