datri@convex.com (Anthony A. Datri) (09/07/90)
I wrote a program in the vein of nsb's eatmail to safely move mail
from /usr/spool/mail into ~/Mailbox, but I've discovered that
AMS_MailCollectionCommand gets run *after* /usr/spool/mail/joeuser
is checked and collected. Am I missing something? I would think
that if AMS_MailCollectionCommand (and apparently PersonalMailCollectionCommand
as well) is set, that the system shouldn't collect from /usr/spool/mail/joeuser
*at all*. In ams/libs/ms/mungenew.c, I find:
if (homeUsesAMSDelivery < 0) {
char SpoolFileName[1 + MAXPATHLEN], *HomeBox, *SpoolFile;
int numfound;
/* Only convert /usr/spool/mail-type stuff if we're checking our person$
HomeBox = GetPersonalMailbox();
sprintf(SpoolFileName, "%s/Mailbox", home);
if (strcmp(HomeBox, SourceDir) == 0 || strcmp(SpoolFileName, SourceDir)$
SpoolFile = getenv("MAIL");
if (SpoolFile == NULL || *SpoolFile == '\0') SpoolFile = getprofile$
if (SpoolFile == NULL || *SpoolFile == '\0') {
sprintf(SpoolFileName, "%s/%s", AMS_MailBoxPrefix, Me);
} else {
strcpy(SpoolFileName, SpoolFile);
}
mserrcode = ConvertIncomingMail(SpoolFileName, SourceDir, &numfound$
if (mserrcode) return (mserrcode);
}
}
if (PersonalMailCollectionCommand) {
int syscode;
syscode = system(PersonalMailCollectionCommand);
if (syscode) {
char ErrorText[100+MAXPATHLEN];
sprintf(ErrorText, "Personal mail collection command %s failed with$
NonfatalBizarreError(ErrorText);
AMS_RETURN_ERRCODE(EMSBOGUS, EIN_SYSTEM, EVIA_PROCNEWMSGS);
}
}
if (AMS_MailCollectionCommand) {
int syscode;
syscode = system(AMS_MailCollectionCommand);
if (syscode) {
char ErrorText[100+MAXPATHLEN];
sprintf(ErrorText, "System mail collection command %s failed with c$
NonfatalBizarreError(ErrorText);
AMS_RETURN_ERRCODE(EMSBOGUS, EIN_SYSTEM, EVIA_PROCNEWMSGS);
}
}
Shouldn't the initial conditional change from
if (homeUsesAMSDelivery < 0) {
to
if (homeUsesAMSDelivery < 0 &&
( ! (PersonalMailCollectionCommand || AMS_MailCollectionCommand) )) {
Also, just what is "PersonalMailCollectionCommand" anyway? It seems to
be redundant given AMS_MailCollectionCommand, and I haven't seen mention of
it in any docs.
The scenario is that I run Messages on my diskless workstation, and mail
physically resides on another machine. I want to safely collect mail
from my mailbox there into ~/Mailbox, rather than take the chance of
AMS on my workstation and binmail on the server stomping on each other.
The server's /usr/spool/mail is mounted on my workstation because I've just
been taking the chance, and also so that I can use "from" and any of a variety
of xbiffy programs. But even when I specify AMS_MailCollectionCommand,
/usr/spool/mail/datri gets read and truncated before my MailCollectionCommand
gets run, so the latter never actually gets to do its thing.
The only way I see to work around this without changing the source and
rebuilding (ugggh) is to not have /usr/spool/mail from the server
pointed to by the local /usr/spool/mail, but that's ugly, and it really
should work as I've described.
Comments?
--
beak is beak is notnsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (09/10/90)
Well, I can see arguments for having it either way. But certainly your desire to not have it read from /usr/spool/mail/xxx is reasonable in the circumstances, and there should at least be a way to do it. Is there anyone out there who would be unhappy if the existence of a configured mail collection command meant that the automatic checking of /usr/spool/mail/xxx was turned off? BTW, the reason there's a personal mail collection command is that sometimes it makes sense for individuals to be able to customize this behavior. AMS_MailCollectionCommand, set in AndrewSetup, affects the whole site, while PersonalMailCollectionCommand is user-specific. The latter turns out to have been useful for some people at Bellcore who receive mail on one machine and read it on a workstation, because this is not the "universal" situation at Bellcore. (There is NO universal situation at Bellcore; we have the most fragmented system I've ever imagined...) Anyway, at the very least there should be an option to NOT check /usr/spool/mail/XXX to improve your situation, and possibly it should never be checked when one of the two mail collection commands is set. I have no strong opinion on that one, but other people might. -- Nathaniel
Craig_Everhart@TRANSARC.COM (09/11/90)
One way you can turn off AMS"s processing of /usr/spool/mail/datri without recompiling is to redefine AMS_MailBoxPrefix in your ...../AndrewSetup to be something other than /usr/spool/mail. If you define it as, say, /tmp/dogs, then AMS's efforts to incorporate the messages in /tmp/dogs/datri will come to nothing. (Or, for that matter, change the MAIL environment variable to be other than /usr/spool/mail/datri--but if that env vbl is used elsewhere and you set it elsewhere, you might screw up some other program like xbiff.) You can do a lot with AndrewSetup. But yes, I'd agree that a personal (or site-wide) mail-collection command should probably override the /usr/spool/mail conversion thingy. In addition, if the current stuff that reads from /usr/spool/mail/userid can be improved, wouldn't that be a good idea too? Craig