Discussion:
tin problem: Error: From: line missing.
Urs Janßen
2013-01-04 16:34:20 UTC
Permalink
It may be a FreeBSD-specific bug
as it seems to be locale related it might be a somewhat broken isacii() or
the like.
It also seems to work with LANG=ru_RU.UTF-8. Only KOI8-R is somehow
problematic.
Looks like I traced it down:

if the locale charset is the same as the network charset (in your case both
were KOI8-R) tin tries to convert the string in the local charset to the
network charset (waste of cpu cycles, but sould work!). But FreeBSDs
iconv(3) seems to have a problem with that, the mapage states:

[...]
| After calling iconv(), the values pointed to by src,
| srcleft, dst, and dstleft are updated as follows:
[...]
| *dst Pointer to the byte just after the last character stored.
[...]

but this is not the case, right befor the conversion
(misc.c:buffer_to_network()):

(gdb) print inbuf
$2 = 0x80163d200 "From: Urs Janssen <***@tin.org>"
(gdb) print &outbuf
$3 = (char **) 0x7fffffffa5e0
(gdb) print outbuf
$4 = 0x80144d6c0 "G"

right after the conversin:
(gdb) print *&outbuf
$11 = 0x80144d6c0 "From: Urs Janssen <***@tin.org>l"
(gdb) print **&outbuf
$17 = 70 'F'

but it should point right behind the '>' to the tailing gargabe ('l').

(gdb) next
2560 **&outbuf = '\0';

now the entire converted string get's erased instead of being propperly
terminated at the end.

-> From (and everything else) is empty.

attached is a patch which prevents tin from trying to convert local to
network charset if both are the same. this should solve your problem (but
the real bug seems to be in FreeBSDs iconv(3)).

The binarie /home/urs/tin should behave like the one in
/usr/local/bin/ and can be copied to any location. the already patched
source is in /home/urs/tin-2.1.3.tar.gz if you like to recompile on your
own.

Thanks for the access to the machine,
urs
--
"Only whimps use tape backup: _real_ men just upload their important stuff
on ftp, and let the rest of the world mirror it ;)" - Linus
Loading...