FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 09-14-2010, 03:54 PM
Malte Forkel
 
Default anacron mail encoding

Hi,

I'm using anacron for some tasks on a machine running Lenny. Error
output from those jobs send by email looks strange in Thunderbird.

Mails send by cron supposedly respect the locale and include a content
type header, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=405335
(cron does not send mail with good encoding) and
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410057 (cron should
send email with UTF-8 charset as it's default in Etch).

But mail from anacron seems to be lacking the proper header (something
like Content/type: text/html; charset=utf-8) and therefor looks strange
in Thunderbird until I force it to use the UTF-8 encoding?

Should my analysis be correct, how can I get anacron to add the proper
header?

Thanks, Malte


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: i6o5r9$8n6$1@dough.gmane.org">http://lists.debian.org/i6o5r9$8n6$1@dough.gmane.org
 
Old 09-15-2010, 08:51 AM
Camaleón
 
Default anacron mail encoding

On Tue, 14 Sep 2010 17:54:17 +0200, Malte Forkel wrote:

> I'm using anacron for some tasks on a machine running Lenny. Error
> output from those jobs send by email looks strange in Thunderbird.

"Anacron" or "cron"? It seems they are two different packages :-?

> Mails send by cron supposedly respect the locale and include a content
> type header, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=405335
> (cron does not send mail with good encoding) and
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410057 (cron should
> send email with UTF-8 charset as it's default in Etch).

Those bug reports are for "cron" and should be already fixed.

> But mail from anacron seems to be lacking the proper header (something
> like Content/type: text/html; charset=utf-8) and therefor looks strange
> in Thunderbird until I force it to use the UTF-8 encoding?
>
> Should my analysis be correct, how can I get anacron to add the proper
> header?

Mmm, can you upload a sample of the e-mail you are getting so we can take
a look into the header? Of course, the e-mail sample should not contain
private data :-)

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.09.15.08.51.00@gmail.com">http://lists.debian.org/pan.2010.09.15.08.51.00@gmail.com
 
Old 09-15-2010, 09:21 AM
Brad Rogers
 
Default anacron mail encoding

On Wed, 15 Sep 2010 08:51:01 +0000 (UTC)
Camaleón <noelamac@gmail.com> wrote:

Hello Camaleón,

> "Anacron" or "cron"? It seems they are two different packages :-?

They are; Anacron is recommended for machines that aren't up 24/7 so
missed cron jobs (many are run overnight by default) get run as soon a
is convenient after next boot.

--
Regards _
/ ) "The blindingly obvious is
/ _)rad never immediately apparent"
Your life is like a schedule, you run to meet the bills
Life Kills - Human League
 
Old 09-16-2010, 08:02 AM
Malte Forkel
 
Default anacron mail encoding

Am 15.09.2010 10:51, schrieb Camaleón:
>
> "Anacron" or "cron"? It seems they are two different packages :-?
>
Yes, they are. As far as I understand it, anacron makes sure that cron
jobs are run even if the machine is not up 24/7.

>
> Those bug reports are for "cron" and should be already fixed.
>
I guess they are. I wasn't sure at first whether anacron sends mail
itself or utilizes cron. When looking for answers, I stumbled across the
cron bugs mentioned. Mail from cron should have the proper content
header. Judging from the header of the mail I received (see below), I
guess that it was sent by anacron.

> Mmm, can you upload a sample of the e-mail you are getting so we can take
> a look into the header? Of course, the e-mail sample should not contain
> private data :-)
>
Sure. Here are the header and some lines from the mail I received,
somewhat edited to protect my privacy and save bandwidth:

--- snip ---
Betreff: Anacron job 'cron.daily' on server
Von: Anacron <root@server.domain.tld>
Datum: Tue, 14 Sep 2010 07:44:48 +0200
An: root@server.domain.tld

/etc/cron.daily/mirror:
aptmethod error receiving
'http://ftp.debian.org/debian/dists/lenny/Release':
'Konnte »ftp.debian.org« nicht auflösen'
aptmethod error receiving
'http://ftp.debian.org/debian/dists/lenny/Release.gpg':
...
'Konnte »security.debian.org« nicht auflösen'
There have been errors!
run-parts: /etc/cron.daily/mirror exited with return code 1
--- snap ---

Greetings,
Malte



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: i6siu6$fog$1@dough.gmane.org">http://lists.debian.org/i6siu6$fog$1@dough.gmane.org
 
Old 09-16-2010, 08:54 AM
Camaleón
 
Default anacron mail encoding

On Thu, 16 Sep 2010 10:02:14 +0200, Malte Forkel wrote:

> Am 15.09.2010 10:51, schrieb Camaleón:
>>
>> Mmm, can you upload a sample of the e-mail you are getting so we can
>> take a look into the header? Of course, the e-mail sample should not
>> contain private data :-)
>>
> Sure. Here are the header and some lines from the mail I received,
> somewhat edited to protect my privacy and save bandwidth:
>
> --- snip ---
> Betreff: Anacron job 'cron.daily' on server Von: Anacron
> <root@server.domain.tld> Datum: Tue, 14 Sep 2010 07:44:48 +0200 An:
> root@server.domain.tld

(...)

Thanks :-)

But the interesting part should be in the e-mail "header" not the "body"
of the message (I would like to see "Content-Type:" and "Content-Transfer-
Encoding:" part). Better if you send (or upload to pastebin¹) the whole
message intact, just delete delicated data.

As per the sample you sent above, the characters seem indeed badly
encoded somehow.

¹http://www.pastebin.com

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.09.16.08.54.50@gmail.com">http://lists.debian.org/pan.2010.09.16.08.54.50@gmail.com
 
Old 09-16-2010, 09:12 AM
Malte Forkel
 
Default anacron mail encoding

Am 16.09.2010 10:54, schrieb Camaleón:
>
> But the interesting part should be in the e-mail "header" not the "body"
> of the message (I would like to see "Content-Type:" and "Content-Transfer-
> Encoding:" part). Better if you send (or upload to pastebin¹) the whole
> message intact, just delete delicated data.
>
Well, I guess my problem is that there are not Content-* lines in the
header :-) The four top lines in my last post were the ones that I
considered important. Although in a translated version - sorry for that.
Here's the complete header, slightly edited to protect the innocent:

>From - Tue Sep 14 10:02:52 2010
X-Account-Key: account12
X-UIDL: UID12206-1223400677
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:

Return-path: <root@server.domain.tld>
Envelope-to: root@server.domain.tld
Delivery-date: Tue, 14 Sep 2010 07:44:48 +0200
Received: from root by server.domain.tld with local (Exim 4.69)
(envelope-from <root@server.domain.tld>)
id 1OvOK0-00051N-GV
for root@server.domain.tld; Tue, 14 Sep 2010 07:44:48 +0200
From: Anacron <root@server.domain.tld>
To: root@server.domain.tld
Subject: Anacron job 'cron.daily' on server
Message-Id: <E1OvOK0-00051N-GV@server.domain.tld>
Date: Tue, 14 Sep 2010 07:44:48 +0200

Malte




--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: i6sn21$2i4$1@dough.gmane.org">http://lists.debian.org/i6sn21$2i4$1@dough.gmane.org
 
Old 09-16-2010, 11:00 AM
Camaleón
 
Default anacron mail encoding

On Thu, 16 Sep 2010 11:12:33 +0200, Malte Forkel wrote:

> Am 16.09.2010 10:54, schrieb Camaleón:
>>
>> But the interesting part should be in the e-mail "header" not the
>> "body" of the message (I would like to see "Content-Type:" and
>> "Content-Transfer- Encoding:" part). Better if you send (or upload to
>> pastebin¹) the whole message intact, just delete delicated data.
>>
> Well, I guess my problem is that there are not Content-* lines in the
> header :-) The four top lines in my last post were the ones that I
> considered important. Although in a translated version - sorry for that.
> Here's the complete header, slightly edited to protect the innocent:
>
>>From - Tue Sep 14 10:02:52 2010
> X-Account-Key: account12
> X-UIDL: UID12206-1223400677
> X-Mozilla-Status: 0001
> X-Mozilla-Status2: 00000000
> X-Mozilla-Keys:

(...)

O.k. I see, no "Content-" headers at all :-?

As per "man 5 crontab":

***
(...)

By default, cron will send mail using the mail "Content-Type:" header
of"text/plain" with the "charset=" parameter set to the charmap /
codeset ofthe locale in which crond(8) is started up - ie. either the
default systemlocale, if no LC_* environment variables are set, or the
locale specified bythe LC_* environment variables ( see locale(7)).
You can use different character encodings for mailed cron job output
by setting the CONTENT_TYPE and CONTENT_TRANSFER_ENCODING variables in
crontabs, to the correct values of the mail headers of those names
***

Which does not comply with your e-mail (provided that there is no
"Content-Type:"). So if "anacron" is using the same routine to send e-
mails than "cron", it looks like a bug/error here to me.

Anyway, you can try the bypass suggested by the manual (define
"CONTENT_TYPE" and "CONTENT_TRANSFER_ENCODING" variables in the offending
anacron task.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.09.16.11.00.35@gmail.com">http://lists.debian.org/pan.2010.09.16.11.00.35@gmail.com
 
Old 09-16-2010, 01:11 PM
Malte Forkel
 
Default anacron mail encoding

Am 16.09.2010 13:00, schrieb Camaleón:

> As per "man 5 crontab":
>
> ***
> (...)
>
> By default, cron will send mail using the mail "Content-Type:" header
> of"text/plain" with the "charset=" parameter set to the charmap /
> codeset ofthe locale in which crond(8) is started up - ie. either the
> default systemlocale, if no LC_* environment variables are set, or the
> locale specified bythe LC_* environment variables ( see locale(7)).
> You can use different character encodings for mailed cron job output
> by setting the CONTENT_TYPE and CONTENT_TRANSFER_ENCODING variables in
> crontabs, to the correct values of the mail headers of those names
> ***
>
> Which does not comply with your e-mail (provided that there is no
> "Content-Type:"). So if "anacron" is using the same routine to send e-
> mails than "cron", it looks like a bug/error here to me.
>
> Anyway, you can try the bypass suggested by the manual (define
> "CONTENT_TYPE" and "CONTENT_TRANSFER_ENCODING" variables in the offending
> anacron task.
>

I don't think its cron's fault. My guess is this: cron runs anacron jobs
which in turn execute all the tasks cron would execute itself otherwise.
Because anacron executes multiple tasks, it does no fail just because
one of its tasks fails. As long as anacron does not fail, there is no
reason for cron to send a mail. Rather, all mail is send by anacron
itself. And anacron does not supply Content-* headers as cron would :-(

I think I have to convince anacron to use Content-* headers. But I'm not
sure I can do that with the environment variables that cron uses.

Cheers, Malte



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: i6t52n$5uf$1@dough.gmane.org">http://lists.debian.org/i6t52n$5uf$1@dough.gmane.org
 
Old 09-16-2010, 01:28 PM
Sven Joachim
 
Default anacron mail encoding

On 2010-09-16 15:11 +0200, Malte Forkel wrote:

> I think I have to convince anacron to use Content-* headers. But I'm not
> sure I can do that with the environment variables that cron uses.

Indeed you can't, you would have to write the code to insert the
Content-* headers in the first place. Look at the launch_job function
in runjob.c in the anacron source.

Sven


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87r5gtzukw.fsf@turtle.gmx.de">http://lists.debian.org/87r5gtzukw.fsf@turtle.gmx.de
 
Old 09-16-2010, 01:28 PM
Camaleón
 
Default anacron mail encoding

On Thu, 16 Sep 2010 15:11:51 +0200, Malte Forkel wrote:

> Am 16.09.2010 13:00, schrieb Camaleón:
>
>> As per "man 5 crontab":

(...)

>> Which does not comply with your e-mail (provided that there is no
>> "Content-Type:"). So if "anacron" is using the same routine to send e-
>> mails than "cron", it looks like a bug/error here to me.
>>
>> Anyway, you can try the bypass suggested by the manual (define
>> "CONTENT_TYPE" and "CONTENT_TRANSFER_ENCODING" variables in the
>> offending anacron task.
>>
>>
> I don't think its cron's fault. My guess is this: cron runs anacron jobs
> which in turn execute all the tasks cron would execute itself otherwise.
> Because anacron executes multiple tasks, it does no fail just because
> one of its tasks fails. As long as anacron does not fail, there is no
> reason for cron to send a mail. Rather, all mail is send by anacron
> itself. And anacron does not supply Content-* headers as cron would :-(

Okay, but if "anacron" shares the same blob routine for sending e-mails
to the user, the code that creates the e-mail has to add the right
headers (for both, cron and anacron jobs) which is not the case, or
that's at least my understaning :-?

> I think I have to convince anacron to use Content-* headers. But I'm not
> sure I can do that with the environment variables that cron uses.

My guess is that you have to add them in the same manner (in the same
file) you configured the "MAILTO=" variable.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.09.16.13.28.55@gmail.com">http://lists.debian.org/pan.2010.09.16.13.28.55@gmail.com
 

Thread Tools




All times are GMT. The time now is 12:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org