From: Matthias A. <mat...@gm...> - 2006-03-21 23:27:25
|
Voldemar <de...@it...> writes: > $ uname -a > FreeBSD netadmin.ssmu.ru 4.11-RELEASE FreeBSD 4.11-RELEASE #3: Wed Aug 17 10:31: > 07 OMSST 2005 ro...@ne...:/usr/src/sys/compile/netadmin i386 ... > $ gdb fetchmail > ...[skip]... > Program received signal SIGSEGV, Segmentation fault. > 0x8061c20 in xstrdup (s=0x0) at xmalloc.c:56 > 56 p = (char *) xmalloc(strlen(s)+1); > (gdb) backtrace > #0 0x8061c20 in xstrdup (s=0x0) at xmalloc.c:56 > #1 0x805478d in do_session (ctl=0x8081600, proto=0x80642c0, maxfetch=0) at driver.c:1030 > #2 0x8055573 in do_protocol (ctl=0x8081600, proto=0x80642c0) at driver.c:1630 [...] > It seems to me, the function getaddrinfo returns 0 (no error), > but thus res->ai_canonname == 0, that leads SIGSERV at attempt > strcpy(0) in xmalloc.c:xstrdup. Yes, that's what I'd have guessed from your backtrace, too. BTW, thanks for a detailed report. I'd wish more reports were as complete as yours was - very useful. This saved me any asking further questions. > I do not know, whether is a mistake: fetchmail or incorrect behaviour >libc. Probably unfortunate coincidence. FreeBSD probably implemented getaddrinfo() (from KAME perhaps) before IEEE Std 1003.1-2001 stipulated the final specification, and someone forgot to update it to the standard. >My variant of patch (not assured of its correctness, however fetchmail >starts to work normally): > > $ diff driver.c ../driver.c > 1030c1030,1034 > < ctl->server.truename = xstrdup(res->ai_canonname); > --- >> if (res->ai_canonname) { >> ctl->server.truename = xstrdup(res->ai_canonname); >> } else { >> ctl->server.truename = xstrdup(ctl->server.queryname); >> }; Спасибо! I had read IEEE Std 1003.1-2001, which requests that the implementation copies the nodename if no canonical name is available. FreeBSD 4.11's implementation however does not do that. Please file a bug report (use send-pr and file against "standards") for FreeBSD 4.11, too. Mention that the standard deviation causes application crashes, and ask politely that they update their getaddrinfo() for standards conformance. (And please send me the PR number, so I may add further FreeBSD versions should 6.0 also turn out to be noncompliant.) I have taken your patch (with trivial modifications, and with a comment added) for fetchmail-6.3.3. It is already committed to SVN. Thanks a lot. (I suspect other IPv6 enabled BSD implementations might suffer from the same deviation from the standard, so I'd rather work around this in fetchmail.) In the future, when sending patches, please use "diff -u" or "diff -c" to generate a "unified" or "context" patch. These work even if line numbers change, as was the case here. Finally, can I ask you for your full name (best two times: 1-in original Cyrillic, 2-with English transcription) to be mentioned in the "NEWS" file, or would you prefer to be listed as "Voldemar"? Thanks again, I've set Reply-To: to my personal address, as I think this is completely covered as far as the mailing list is concerned. -- Matthias Andree |