Thomas E. Kammeyer | 17 Feb 21:33 2009

Bug w.r.t. ORGANIZATION value, possible related issues

Folks,

First:  argh!  I goofed and sent this to -request the first time!
So here we go again.

In nail 11.25 I noticed a bug when I tried to install and run under Gentoo
Linux.  I downloaded the Heirloom mailx-12.4 source, compiled, and
confirmed the bug there as well.

I've been able to track down and address the issue, which makes me
glad, because I really like running this mail client.  Parts of my .mailrc
that had been sitting there inactive (askbcc, setting the prompt for examples)
suddenly worked because I was running a decent command line mailer again.
And the filtering and attachment mechanisms are very nice.

So I'm motivated to try to help.  On to the issue.

I've seen reported in various places around the net instances of mail simply
not being sent with no apparent error message or with confusing
error messages (this case).

If you look in sendout.c at line 1222, you'll see:

      if ((addr = hp->h_organization) != NULL ||
            (addr = value("ORGANIZATION")) != NULL) {
         fwrite("Organization: ", sizeof (char), 14, fo);
         if (mime_write(addr, strlen(addr), fo,
               action == SEND_TODISP ?
               CONV_NONE:CONV_TOHDR,
               action == SEND_TODISP ?
(Continue reading)

Yedidyah Bar-David | 1 Mar 16:01 2009
Picon

Small patch for mime.c

Hi all,

Following is a small patch to mime.c. Without it, under certain
conditions, mailx "eats" the last letter of words in headers lines.
I found the solution by looking at the sources of the iconv command line
utility.

The bug is, according to a comment in iconv,
"All the input test is processed.  For state-dependent character sets we
have to flush the state now.", and heirloom-mailx does not do that.

Best regards,
--

-- 
Didi

--- mime.c.2009-03-01-didi	2008-06-29 18:57:27.000000000 +0300
+++ mime.c	2009-03-01 17:01:39.000000000 +0200
 <at>  <at>  -441,6 +441,7  <at>  <at> 
 iconv_ft(iconv_t cd, char **inb, size_t *inbleft, char **outb, size_t *outbleft)
 {
 	size_t sz = 0;
+	size_t sz2 = 0;

 	while ((sz = iconv(cd, inb, inbleft, outb, outbleft)) == (size_t)-1
 			&& (errno == EILSEQ || errno == EINVAL)) {
 <at>  <at>  -459,6 +460,11  <at>  <at> 
 			break;
 		}
 	}
+	/* For state-dependent character sets we have to flush the state now. */
(Continue reading)

Gunnar Ritter | 1 Mar 21:34 2009
Picon

Re: Small patch for mime.c

Yedidyah Bar-David <didi@...> wrote:

> Following is a small patch to mime.c. Without it, under certain
> conditions, mailx "eats" the last letter of words in headers lines.
> I found the solution by looking at the sources of the iconv command line
> utility.
>
> The bug is, according to a comment in iconv,
> "All the input test is processed.  For state-dependent character sets we
> have to flush the state now.", and heirloom-mailx does not do that.

Thanks, but I don't think this fix is entirely correct, as
it would flush the state every time mime_write() is called,
even if the input consists of parts of a continuous text.
For the problem you describe, the correct solution should be
to flush the state after the call to out() in line 376 of
send.c, but only if convert == CONV_FROMHDR. Can you verify
that this works?

Gunnar

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
Gunnar Ritter | 1 Mar 21:26 2009
Picon

Re: Bug w.r.t. ORGANIZATION value, possible related issues

"Thomas E. Kammeyer" <kemosabi@...> wrote:

> In my configuration, I pick up the organization name from an environment
> variable.  A long time ago, when I finished graduate school, I did this in
> my .login:
>
>    setenv ORGANIZATION ""
>
> Since for personal mail, I didn't want to report an affiliation of any kind.
>
> This leads mime_write to return 0 immediately, which leads to executing
> the "return 1;" statement.  puthead() is the enclosing function, so
> puthead() returns 1.

Thanks. I've changed the code to not generate an "organization"
header field under these circumstances.

Gunnar

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

Gmane