[comp.windows.x] SUMMARY: XMH: Extra numbers keep appearing in msg numbers

thakur@ZERKALO.HARVARD.EDU ("Manavendra K. Thakur") (11/04/90)

I originally wrote:

> Apparently, xmh likes to add extra numbers in front of the message ID
> numbers every now and then.  When the user tries to click on that
> message (to read it, etc), either xmh crashes or it displays the wrong
> message.
> 
> One reported fix to this problem was to apply a patch to
> mit/clients/xmh/tocutil.c.  The patch rewrites a for loop to count
> down rather than up.  This work arounds a bug in gcc 1.37.1.
> 
> However, applying this patch did not solve the problem for us.  To
> confirm this, I compiled xmh with Sun's C compiler (on a Sun 3 running
> SunOS 4.0.3), and still the problem persisted.  So it does not seem
> like a gcc vs cc issue.

On Mon, 29 Oct 90 10:23:41 -0500, converse@expo.lcs.mit.edu replied:

> After recompiling xmh with cc, every xmh user should regenerate the
> message listing in each affected folder by selecting Rescan Folder
> from the Table of Contents menu.  If it still happens after that,
> I'll eat my hat.

This has indeed cleared up our problems.  We're now using a
gcc-compiled xmh with the patch (appended below for anyone else who
needs it), and we've not seen the problem since.

I take my hat off to Donna Converse.  (And she doesn't have to eat it! :-)

Also, Joe Wells <jbw@bu.edu> suggested that one could "delete all
files named .xmhcache to force mh to regenerate them correctly."  I
didn't try this solution, but apparently rescanning folders is
equivalent to deleting and recreating the .xmhcache files, so I expect
that Joe's solution should work as well.

I'm much obliged to all on the net for their help.

Here is the one-line patch we've applied to get around a bug in gcc
1.37.1:

*** tocutil.c.pl0       Thu Dec 14 21:20:04 1989
--- tocutil.c   Wed Oct 31 14:24:47 1990
***************
*** 577,581 ****
      msg->buf = XtNewString(ptr);
      (void)sprintf(str, "%4d", msgid);
!     for (i=0; i<4 ; i++) msg->buf[i] = str[i];
      msg->buf[MARKPOS] = ' ';
      msg->msgid = msgid;
--- 577,582 ----
      msg->buf = XtNewString(ptr);
      (void)sprintf(str, "%4d", msgid);
! /* Count down rather than up in for loop to avoid bug in gcc 1.37.1 */
!     for (i=4; i-- > 0 ;) msg->buf[i] = str[i];
      msg->buf[MARKPOS] = ' ';
      msg->msgid = msgid;



Manavendra K. Thakur			Internet: thakur@zerkalo.harvard.edu
System Manager,	High Energy Division	BITNET:	  thakur@cfa.BITNET
Harvard-Smithsonian Center for		DECNET:	  CFA::thakur
Astrophysics				UUCP:	  ...!uunet!mit-eddie!thakur