jgoerzen / twidge

Command-line twitter/identica client [Haskell]
http://wiki.github.com/jgoerzen/twidge/
GNU General Public License v2.0
220 stars 29 forks source link

Cron error #17

Closed jasongraham closed 13 years ago

jasongraham commented 13 years ago

I'm using twidge on a debian server (v1.05 from debian unstable) to mail updates using cron, as described in the howto section. The cron script runs every half hour.

My twidge.cron script

#!/bin/sh
twidge lsrecent -asu --mailto=me@example.com
twidge lsreplies -asu --mailto=me@example.com

I've been getting the following error messages seemingly randomly as the cron script executes. It doesn't happen every time, or even every time that there is a tweet to mail.

twidge: fd:6: hClose: invalid argument (Invalid or incomplete multibyte or wide character)
sendmail: fatal: MY_USER_NAME(1000): No recipient addresses found in message header
twidge: user error (("/usr/sbin/sendmail",["-t"]): exited with code 75)

Typically, at this point, repeat mails will be sent to me (ie, the same tweet will be mailed on each executation of the cron script, as twidge won't correctly save the most recently seen tweet). To fix this, I've simply remotely logged in and run twidge lsrecent -asu from the command line, and the errors will stop temporarily.

I'm not sure if this indicates an error as twidge is parsing the tweet, or from something my mail program is doing. I'd like to know how I could set up more detailed logging so that I can either find the problem or give a more useful bug report here.

jgoerzen commented 13 years ago

Sounds to me like some sort of locale/encoding issue.

Couple of things to check. First make sure that you are using UTF-8 on your local machine. Next make sure that no tweets that those commands are fetching will have invalid characters. You might also run it outside of the mailto, manually, and try to narrow it down to an offending tweet. Hopefully it crashes (or not) the same way when not emailing.

jasongraham commented 13 years ago

Given that I haven't seen any errors while running twidge from the command line, I'm going to put my money on the locale and encoding in my mail program.

While my most of machine is set to use UTF-8, I'm using postfix with MySQL for the virtual users and domains. MySQL isn't set to UTF-8 encoding by default, so I'm going to bet this is my issue. I'll look into safely changing this weekend, and see if that solves my errors (which I suspect it will).

Thanks for the suggestion.

jgoerzen commented 13 years ago

Ah, interesting. I bet you're right then. Please do let me know what you find out.

jasongraham commented 13 years ago

Sorry for the belated reply, but I wanted to confirm that MySQL not supporting UTF-8 encoding was indeed the source of the problem.

The annoyance was not sufficient enough to bother dealing with until this last week as I was updating my home server from Debian Lenny to Squeeze, and since the Squeeze version was compiled with UTF-8 support (search for utf), the problem hasn't resurfaced since I've updated.

Since then I've seen emailed tweets with non-English characters just fine.

jgoerzen commented 13 years ago

Thanks for the update -- I appreciate it.