Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 375287 - sys-process/fcron-3.0.6-r1 and sys-process/fcron-3.0.6-r2 mailing
Summary: sys-process/fcron-3.0.6-r1 and sys-process/fcron-3.0.6-r2 mailing
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Wolfram Schlich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-15 13:41 UTC by Vadim Petryaev
Modified: 2012-12-23 12:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Add content-transfer-encoding and content-type tags in message header (content_msg_header.patch,1.07 KB, text/plain)
2011-07-15 13:44 UTC, Vadim Petryaev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim Petryaev 2011-07-15 13:41:49 UTC
sys-process/fcron don't add "content-transfer-encoding" and "content-type" tags in mail header. As result, international characters in e-mail from fcron become unreadable, in case of default encoding in e-mail client not the same, as fcron system local encoding.
For example, my system local encoding is UTF-8, but e-mail client in mobile phone use CP1251 as default encoding.

Reproducible: Always

Steps to Reproduce:
1. Schedule any job in fcron with mailing output. For example: echo Здравствуй, мир!
2. Check received e-mail. 
3. "content-transfer-encoding" and "content-type" tags in mail header missed.



I wrote patch, for fixing this problem in same way, as in another cron clones. in case of fcron found environment variables CONTENT_TYPE or CONTENT_TRANSFER_ENCODING, it use they values for corresponding e-mail header tags.
For example:
CONTENT_TYPE="text/plain; charset=utf-8"
CONTENT_TRANSFER_ENCODING="8bit"
===

diff -urN fcron-3.0.6/job.c fcron-3.0.6.patch/job.c
--- fcron-3.0.6/job.c   2010-03-03 00:47:03.000000000 +0300
+++ fcron-3.0.6.patch/job.c     2011-07-05 14:08:58.000000000 +0400
@@ -232,11 +232,23 @@
     /* is this a complete mail address ? (ie. with a "@", not only a username) */
     char complete_adr = 0;
     int i;
+    env_t *env;
+    char *env_string;

     if ( mailf == NULL )
        die_e("Could not fdopen() mailfd");

     /* write mail header */
+    for ( env = line->cl_file->cf_env_base; env; env = env->e_next) {
+       if ( strncmp(env->e_val,"CONTENT_TYPE=",strlen("CONTENT_TYPE="))==0 ) {
+           env_string=strchr(env->e_val,'=')+1;
+           fprintf(mailf, "Content-Type: %s\n", env_string);
+       } else
+       if ( strncmp(env->e_val,"CONTENT_TRANSFER_ENCODING=",strlen("CONTENT_TRANSFER_ENCODING="))==0 ) {
+           env_string=strchr(env->e_val,'=')+1;
+           fprintf(mailf, "Content-Transfer-Encoding: %s\n", env_string);
+       }
+    }
     fprintf(mailf, "To: %s", line->cl_mailto);

 #ifdef HAVE_GETHOSTNAME

--
Comment 1 Vadim Petryaev 2011-07-15 13:44:15 UTC
Created attachment 280129 [details]
Add content-transfer-encoding and content-type tags in message header
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-08-29 17:47:00 UTC
Can you please send this to the upstream author? Thanks
Comment 3 Vadim Petryaev 2012-08-30 01:25:27 UTC
I sent this patch to Thibault Godouet <fcron@free.fr> at 14/07/2011 21:12 MSK (UTC+3)
He accept it at 22/08/2011 1:16 MSK (UTC+3)

But last version of fcron from 04/05/2010 and next version isn't scheduled.

Have you any other idea?
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-08-30 01:27:58 UTC
Good enough for me — let me make sure that the current ebuild works fine then I'll merge it.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-12-23 12:49:36 UTC
Heh, I forgot about this but it's now fixed as 3.1.0 is in tree and includes a variation of this.