[comp.soft-sys.andrew] AMS Loses mail

nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (07/13/90)

Given Bill Janssen's belated bug report that he actually lost mail once
with AMS back in version 6.XX, I've gone to the code to see how it could
happen.  It does in fact appear possible that if you're running without
AMS delivery and your home directory is full, you could lose mail.  The
problem is that in ams/libs/ms/cvtold.c, there are a couple of calls to
writeall() which DO NOT CHECK THEIR RETURN VALUE!!!    (These are at
lines 251 and 257 in my version.)

The fix is simple and essential, since this is what I'd consider a very
major bug.   The fix is to make sure that writeall is returning an
integer that is the same as its third argument.  If it isn't, we should
error out with code something like this:

if (writeall(...) != ...) {
	errsave = errno;
	fclose(fp);
	close(wfd);
	if (AMS_StrictStandaloneLocking) rmlock(CurLock, LockFD);
	AMS_RETURN_ERRCODE(errsave, EIN_WRITE, EVIA_CONVERTINCOMING);
}

I hope you'll make this fix in an upcoming patch.  Thanks.  -- Nathaniel

PS -- Bill, as far as the other problem is concerned (where several
messages were appended together), there are three possibilities.  One is
that you've got AMS configured wrong -- there are several ways to tell
AMS how to find the boundaries between messages in /usr/spool/mail,
because there are several known formats for different UNIX variants. 
Another is that you had a particularly pathological case, for which we'd
need to see the messages in question.  Another, of course, is that there
is an AMS bug.  I'd encourage you to send us the appended-together
mesages if you still have them, or if this ever happens to you again. 
-- Nathaniel