thompson@dalcs.UUCP (Michael Thompson) (05/11/88)
We are running MH 6.5 on a SUN 4/280S running Sys4-3.2_EXPORT (output from "repl -help" follows at the end of the article) and we have encountered an annoying bug in repl: if you try to reply to a message that is not your current message then garbage gets inserted at the end of your reply (sample output follows, Note: although for this demonstration I have used the -build option the same thing happens without it.) If you have found and fixed this bug please let me know. If you can reproduce the bug and your system is different please let me know. If your system is similar to ours and you cannot reproduce the bug please let me know. If you have any suggestions please let me know. -------------------------------- Start Demo ----------------------------- % show 20 <output deleted> % repl -build % cat Mail/reply To: pchua@dalac (Poh Chua, Academic Computing Serv., Dalhousie Univ.) Fcc: inbox Subject: Re: Evaluations In-reply-to: Your message of Mon, 09 May 88 13:32:04 D. <8805091632.AA06900@STARS.local> -------- % repl -build 20 % cat Mail/reply <output deleted, same as previous cat> % show 19 <output deleted> % cat Mail/reply To: pchua@dalac (Poh Chua, Academic Computing Serv., Dalhousie Univ.) Fcc: inbox Subject: Re: Evaluations In-reply-to: Your message of Mon, 09 May 88 13:32:04 D. <8805091632.AA06900@STARS.local> -------- ck: ----------------------------- End Demo ----------------------------------- ----------------------------- repl -help --------------------------------- syntax: repl: [+folder] [msg] [switches] switches are: -[no]annotate -[no]cc type -draftfolder +folder -draftmessage msg -nodraftfolder -editor editor -noedit -fcc folder -filter filterfile -form formfile -([no]forma)t -[no]inplace -[no]query -whatnowproc program -nowhatnowproc -width columns -(help) version: MH 6.5 #11[UCI] (plus5) of Thu Apr 23 18:14:00 CDT 1987 options: [ATHENA] [BERK] [BSD42] [DUMB] [FOLDPROT='"0711"'] [LINK='"@"'] [MHE] [MHRC] [MORE='"/usr/ucb/more"'] [MSGPROT='"0644"'] [NOMHSEQ] [OVERHEAD] [RPATHS] [SBACKUP='"#"'] [TTYD] [WHATNOW] [SENDMTS] [SMTP] ------------------------------------------------------------------------------- -- <<<<<<******>>>>>> Michael A. Thompson, Dept. Math, Stats, & C.S., Dalhousie U., Halifax, N.S. thompson@dalcs.uucp | thompson@cs.dal.cdn | thompson@dalac.bitnet (902)424-6501
davy@ea.ecn.purdue.edu (Dave Curry) (05/14/88)
In article <2846@dalcs.UUCP> thompson@dalcs.UUCP (Michael Thompson) writes: > > we have encountered an annoying bug in repl: if you try to reply to > a message that is not your current message then garbage gets > inserted at the end of your reply [deleted] > If you can reproduce the bug and your system is different > please let me know. It did it for me on Sun-3 (3.4) or Sun-4 (3.2) machines, and did it whether you replied to the current message or any other one. Since I finally just upgraded to MH6.5 yesterday (so I procrastinated a little bit...), I just now encountered this. The following is what I sent to Bug-MH. By the way, the document that says "if you want to hack MH, my advice is don't" is quite correct... it took me 3.5 hours to find this bug, and then 30 seconds to fix it. Yuck. ----- There is a bug in sbr/formatsbr.c in MH6.5 which causes extraneous characters to appear after the headers in a "repl" or "forw" when on a Sun machine. The problem is due to alloc'ing a buffer exactly the size of the components file and reading into it, with no terminating null character. Curiously, this is the same code that is in MH6.4 and we never had this problem before. Must be differences in where the compiler sticks its data. Ah well. The following context diffs solve the problem. --Dave Curry Purdue University Engineering Computer Network davy@intrepid.ecn.purdue.edu ------------------------------ cut here ------------------------------ *** /tmp/,RCSt1a01291 Fri May 13 12:23:33 1988 --- formatsbr.c Fri May 13 11:11:14 1988 *************** *** 47,53 if (fstat (fileno (fp), &st) == NOTOK) adios (form, "unable to stat format file"); ! if ((formats = malloc ((unsigned) st.st_size)) == NULLCP) adios (form, "unable to allocate space for format"); if (read (fileno(fp), formats, st.st_size) != st.st_size) --- 47,53 ----- if (fstat (fileno (fp), &st) == NOTOK) adios (form, "unable to stat format file"); ! if ((formats = malloc ((unsigned) st.st_size + 1)) == NULLCP) adios (form, "unable to allocate space for format"); if (read (fileno(fp), formats, st.st_size) != st.st_size) *************** *** 53,58 if (read (fileno(fp), formats, st.st_size) != st.st_size) adios (form, "error reading format file"); (void) fclose (fp); } else { --- 53,59 ----- if (read (fileno(fp), formats, st.st_size) != st.st_size) adios (form, "error reading format file"); + formats[(unsigned) st.st_size] = '\0'; (void) fclose (fp); } else { ------------------------------ cut here ------------------------------