GNOME Bugzilla – Bug 432387
[PATCH] 0.128 build failure on FreeBSD/amd64.
Last modified: 2007-05-06 16:55:33 UTC
Please describe the problem: The 0.128 doesn't build on FreeBSD/amd64, same report over at http://tinyurl.com/2zp87g .. Pav Lucistnik <pav@FreeBSD.org> has helped and created the patch that will be attach in here. It works in the runtime. gmake[4]: Entering directory `/pkg_comp/obj/pkgsrc/news/pan-devel/default/pan-0.128/pan/data' if c++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I/usr/pkg/include/gmime-2.0 -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -pthread -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -DPNG_NO_ASSEMBLER_CODE -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -MT article.o -MD -MP -MF ".deps/article.Tpo" -c -o article.o article.cc; \ then mv -f ".deps/article.Tpo" ".deps/article.Po"; else rm -f ".deps/article.Tpo"; exit 1; fi article.cc: In member function `void pan::Article::Part::set_message_id(const pan::Quark&, const pan::StringView&)': article.cc:156: error: no matching function for call to `max(int&, unsigned int )' Steps to reproduce: 1. Try to build 0.128 on FreeBSD/amd64. Actual results: Expected results: Does this happen every time? yes Other information:
Created attachment 86798 [details] [review] This patch was created by Pav Lucistnik <pav@FreeBSD.org> to fix the build/runtime.
Thanks for filing this ticket. IMO the patch at http://lists.gnu.org/archive/html/pan-users/2007-04/msg00063.html would be better, in case the message-id length goes longer than CHAR_MAX.
The patch from comment #2 makes the program segfault trying to allocate pentabytes of memory (obvious int overrun).
I didn't use this patch, because in the next two reply, Rhialto said that it doesn't work in the runtime. Crashed due to memory (looks like overrun?). http://lists.gnu.org/archive/html/pan-users/2007-04/msg00065.html Pav has tried: std::max (int(b), (int)minlen - UCHAR_MAX); = can't build std::max (b, minlen - UCHAR_MAX); = crash std::max (b, minlen - (size_t)UCHAR_MAX); = crash std::max ((char)b, (char)(minlen - UCHAR_MAX)); = no crash, it works.
You're right about that. Actually, looking at this line, I must have been on crack when I wrote it. "key.str + 1 + UCHAR_MAX" is meaningless no matter how it's cast. ke should be "key.str + 1 + b" unless that's still more than UCHAR_MAX away from the end, in which case it should be "key.str + key.len - UCHAR_MAX". How does this work for you: --- /tmp/pan-0.128/pan/data/article.cc 2007-04-21 11:26:39.000000000 -0500 +++ article.cc 2007-04-22 21:31:17.000000000 -0500 @@ -153,7 +153,8 @@ kc = &key.back(); mc = &mid.back(); - ke = key.str + 1 + std::max (int(b), (int)minlen - UCHAR_MAX); + ke = std::max (key.str + b + 1, + key.str + key.len - UCHAR_MAX); while (kc>ke) if (*kc-- != *mc--) { ++kc; break; } const size_t e (&key.back() - kc);
The patch from comment #5 works fine for me.
Thanks for your quick feedback on this. http://svn.gnome.org/viewcvs/pan2?view=revision&revision=247
*** Bug 435271 has been marked as a duplicate of this bug. ***
Created attachment 87644 [details] stacktrace with message ids
Created attachment 87645 [details] stacktrace with message ids
I have patched my 0.128 with above fix but pan still segfaults while retrieving headers. Platform is Kubuntu Feisty i386. Sorry for the duplicate attachments #9 and #10, my browser timed out on the first one, so i hit submit again.
Bernd: yep. There's a better fix in 0.129.