nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Dealing with missing From: header during send.

2012-01-10 15:09:36
On Tue, Jan 10, 2012 at 2:19 PM, Ken Hornstein <kenh(_at_)pobox(_dot_)com> 
wrote:
Ow.  Damn your eyes, Earl ... I now have a headache from staring at the
damn mh-format code.

I'm glad you decided to look at the code since I was not
looking forward to it myself.

But, on the upside ... I figured out the issue here.

The problem is not technically with accessing the same component
again.  It's actually accessing the same _ADDRESS_ again via
%(formataddr).  Let me explain.

There is a cache inside of replsbr.c of addresses that were seem by
the %(formataddr) function; if you try to insert the same email address
twice, it will silently stop you from doing so.  This is obviously to
prevent duplicate email addresses from appearing in To: and cc: lines.

So what is happening to you is when you try to use the "to" component
again to make the decision to construct your From: line, it doesn't
get addded to the list because formataddr considers it a duplicate.

I would assume that if I use %(lit) to clear the str buffer, it
should clear the cache.

So, possible solutions?

- Have %(putaddr) clear out the address cache via a callback to replsbr.c.
 This is a behavior change, and could result in duplicate addresses
 appearing in a cc: line (for example).

I do not like this.  I would think %(lit) should clear the cache
since it empty the str register.

- Create a new mh-format function (perhaps %(clearaddr) ?) that explicitly
 clears out the address cache.

This may be acceptable.  I'm not sure if there are components files
that depending on the caching, even after %(lit) is used.

The first one is easy, but might have unintended consequences.

Agreed.

The second
is more complicated, but not terrible and is arguably more correct.  Thoughts?

My question is: If the str buffer is zeroed, or set, via %(lit), should
the cache be automatically cleared?

--ewh

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>