[comp.mail.mush] Patch for ">From:" name parsing in mbox-saved news articles

tneff@bfmny0.UUCP (Tom Neff) (08/09/89)

I set my hdrs_format to show the "%n" field (the author's name) but this
doesn't work too well with some saved news articles which came with a
named "From:" field but not a "Reply-To:"  field.  For example


	From music!nashv!goldrec!ctp Mon Aug 8 1989
	Article 1234 of rec.elvis:
	Path: mybox!music!nashv!goldrec!ctp
	>From: ctp@goldrec.MUSIC.COM (Colonel Tom Parker)
	Newsgroups: rec.elvis
	Subject: Re: Sequins checking
		... etc ...


Here Mush 6.5.6 (and other versions) will use the bang-path in its
headers display, instead of the readable English name I'd prefer:


$ mush -H -f +headscratch
"+headscratch" [read only]: 4 messages, 0 new, 0 unread
   1     Rick Deckard                 Jul 10  Found another one, I think
   2   r Sarah Conner                 Aug  1  Borrow anarchists handbook?
   3     TO: crater@daniken.BERM.TRI  Aug  7  Need forwarding address
   4 >   music!nashv!goldrec!ctp      Aug  8  Re: Sequins checking


The reason is that "rn" changes "From:" to ">From:"  before saving an
article to a mailbox, so that Mush's header parser in "hdrs.c" doesn't
recognize it.

I have been able to work around this successfully with the following
patch, which adds a check for ">From:" along with the other fields Mush
already checks for.  It appears to be safe for all Mush versions
although the line number count will vary - this context diff was taken
from 6.5.6.  I hope Bart and Dan will add it officially:


*** hdrs.c.orig	Tue Aug  8 18:31:50 1989
--- hdrs.c	Tue Aug  8 18:36:11 1989
*************** char buf[]
*** 545,550 ****
--- 545,551 ----
  	    print("Warning: message contains no `reply_to_hdr' headers.\n");
      }
      if (p || (!p && ((p = header_field(n, field = "reply-to")) ||
+         (p = header_field(n, field = ">from")) ||
          (p = header_field(n, field = "return-path")) ||
          (p = header_field(n, field = "from")))))
  	skipspaces(0);

-- 
"We walked on the moon --	((	Tom Neff
	you be polite"		 )) 	tneff@bfmny0.UU.NET

lacey@batcomputer.tn.cornell.edu (John Lacey) (08/09/89)

In article <14529@bfmny0.UUCP> Tom Neff writes:
} I set my hdrs_format to show the "%n" field (the author's name) but this
} doesn't work too well with some saved news articles which came with a
} named "From:" field but not a "Reply-To:"  field.  For example
} 
} 
} 	From music!nashv!goldrec!ctp Mon Aug 8 1989
} 	Article 1234 of rec.elvis:
} 	Path: mybox!music!nashv!goldrec!ctp
} 	>From: ctp@goldrec.MUSIC.COM (Colonel Tom Parker)
} 	Newsgroups: rec.elvis
} 	Subject: Re: Sequins checking
} 		... etc ...
} 
} 
} Here Mush 6.5.6 (and other versions) will use the bang-path in its
} headers display, instead of the readable English name I'd prefer:

}    4 >   music!nashv!goldrec!ctp      Aug  8  Re: Sequins checking
} 
} The reason is that "rn" changes "From:" to ">From:"  before saving an
} article to a mailbox, so that Mush's header parser in "hdrs.c" doesn't
} recognize it.
} 
} I have been able to work around this successfully with the following
} patch, which adds a check for ">From:" along with the other fields Mush
} already checks for.  It appears to be safe for all Mush versions
} although the line number count will vary - this context diff was taken
} from 6.5.6.  I hope Bart and Dan will add it officially:
} 

I recently posted a message here with the exact same problem.  A much easier
fix (and more elegant to boot) is to fix the program that saves messages
to mail boxes (in my case, as an rn user, this is mbox.saver).

If you look at mbox.saver, there is the following piece:

	sed "s/^From/>From/"

Simply changing this to

	sed "s/^From />From /"

should solve your problem.  Of course, unless you are the news adminstrator
or somebody in good standing, you will have to make your own copy of
mbox.saver in order to make this fix.  You will then have to look at
the config.h-dist file (or the config.h file modified for your site)
to find out the value of MBOXSAVER.  It will look like this:

#define MBOXSAVER "%X/mbox.saver <long arg list>"

Simply add a similar statement to your environment (setenv or set ..; export)
replacing the leading %X/ with the path of your modified version.

It makes little sense to me to modify Mush to work around a mistake in rn.

Cheers,

-- 
John Lacey     lacey@tcgould.tn.cornell.edu    cornell!batcomputer!lacey

After August 16:  jjlacey@owucomcn.bitnet
If you have to, try  mdl@sppy00.UUCP or maybe {...}!osu-cis!sppy00!mdl

schaefer@ogccse.ogc.edu (Barton E. Schaefer) (08/10/89)

In article <8585@batcomputer.tn.cornell.edu> lacey@tcgould.tn.cornell.edu (John Lacey) writes:
} In article <14529@bfmny0.UUCP> Tom Neff writes:
} } I set my hdrs_format to show the "%n" field (the author's name) but this
} } doesn't work too well with some saved news articles which came with a
} } named "From:" field but not a "Reply-To:"  field.  For example
 [Tom describes a problem with the following RN-mbox.saver-ism]
} } 	>From: ctp@goldrec.MUSIC.COM (Colonel Tom Parker)
} } 
} } Here Mush 6.5.6 (and other versions) will use the bang-path in its
} } headers display, instead of the readable English name I'd prefer [...]
} } 
} } I have been able to work around this successfully with the following
} } patch, which adds a check for ">From:" along with the other fields Mush
} } already checks for.  It appears to be safe for all Mush versions
} 
} I recently posted a message here with the exact same problem.  A much easier
} fix (and more elegant to boot) is to fix the program that saves messages
} to mail boxes (in my case, as an rn user, this is mbox.saver).

Although I agree that mbox.saver needs some repair work, there is a much
easier solution to this problem, a solution that involves source code
changes neither to mush nor to rn.

All you have to do is

	set reply_to_hdr = "reply-to from return-path >from from_"

This is approximately equivalent to the source-code change in Tom's patch.
(He ordered the list a bit differently.)  MMDF users can of course omit
the "from_", because they have no "From " pseudo-header.

In case you're curious, the reason the above works is that mush uses the
reply_to_hdr headers as a last resort if it can't find names/addresses
in the expected places.  So you could presumably add such things as
"in-real-life" and other irregular headers to your reply_to_hdr.  Just
be sure that (1) they are listed AFTER the usual headers to be replied
through; and (2) they are listed BEFORE "from_" (if "from_" is present,
it should always be last).

Adding fields to reply_to_hdr is not foolproof.  Mush considers the
address more important than the name, and wants very much to be sure that
the name and the address refer to the same person, so if it finds an
address without a name in one of the headers listed, it won't keep
searching for a name in the others. [%]  But setting reply_to_hdr works
as often as Tom's patch does.

Given that mush can do this, I'm afraid we'll have to turn down Tom's
request that his patch be "officially" included. :-)  Sorry, Tom. :-(
____________

% There are two exceptions.  If mush got the address out of from_ or
  return-path, which should never have a name, then it will check a
  couple of other headers to try to get a name.  Sometimes it does this
  incorrectly, especially for forwarded messages.  The SunView version,
  presently in beta-testing, improves this behavior quite a bit.
-- 
Bart Schaefer           "And if you believe that, you'll believe anything."
                                                            -- DangerMouse
CSNET / Internet                schaefer@cse.ogc.edu
UUCP                            ...{sequent,tektronix,verdix}!ogccse!schaefer