Return to BSD News archive
Xref: sserve comp.unix.bsd:12660 comp.os.386bsd.bugs:1468 Newsgroups: comp.unix.bsd,comp.os.386bsd.bugs Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!swrinde!gatech!concert!sas!mozart.unx.sas.com!torpid.unx.sas.com!sastdr From: sastdr@torpid.unx.sas.com (Thomas David Rivers) Subject: Bug in BSD mail (and suggested fix) Summary: problems in processing .mailrc Sender: news@unx.sas.com (Noter of Newsworthy Events) Message-ID: <CDpH17.IoM@unx.sas.com> Date: Tue, 21 Sep 1993 13:19:54 GMT Nntp-Posting-Host: torpid.unx.sas.com Organization: SAS Institute Inc. Keywords: Mail mail Lines: 87 I encountered a user with the following in her .mailrc if r preserve * endif With the current NET/2 version of mail; this consistently reported: Illegal use of "message list" when she read her mail. The reason is the msgvec (which contains the list of messages currently being processed) has not yet been generated when the .mailrc is loaded. Thus, the reference to '*' isn't meaningful (how can you have a message list when you haven't loaded anything?) This isn't very nice behaviour, as one of the most meaningful places to put preserve/hold commands is in your .mailrc. I suggest the following change to main.c; which loads the message list in question *before* processing the .mailrc (if in read mode, not send mode.) This solved the problem for me; but introduced a new message (which may, in fact, be meaningful) if you use a folder (i.e. mail -f ~/mbox) you get: Cannot "preserve" in edit mode Here's my changes, which basically move the load of .mailrc in rcvmode to after loading the messages. - Dave Rivers - (rivers@ponds.uucp (home)) (sastdr@unx.sas.com (work)) p.s. According to my user, this is how the Sys-V clone of BSD mail (mailx) behaves; which is where she originally had her .mailrc ---------------------------------------------------------- *** main.c.ori Sat Jun 12 10:50:12 1993 --- main.c Mon Sep 20 21:23:48 1993 *************** *** 212,219 **** * Expand returns a savestr, but load only uses the file name * for fopen, so it's safe to do this. */ - load(expand("~/.mailrc")); if (!rcvmode) { mail(to, cc, bcc, smopts, subject); /* * why wait? --- 212,219 ---- * Expand returns a savestr, but load only uses the file name * for fopen, so it's safe to do this. */ if (!rcvmode) { + load(expand("~/.mailrc")); /* To get any aliases, etc...*/ mail(to, cc, bcc, smopts, subject); /* * why wait? *************** *** 229,234 **** --- 229,245 ---- ef = "%"; if (setfile(ef) < 0) exit(1); /* error already reported */ + + /* + * We wait until here to load the user's .mailrc + * because the .mailrc file may have references to + * the messages in the loaded mail file. (i.e. "hold *") + * If we don't wait, such message list references are considered + * invalid, because we haven't read any messages to make + * a list of... + */ + load(expand("~/.mailrc")); /* To get any aliases, etc...*/ + if (setjmp(hdrjmp) == 0) { extern char *version; -- Imagine Whirled Peas.