[kde-freebsd] net-im/psi: a gcc46 issue?

Andriy Gapon avg at FreeBSD.org
Fri Oct 12 10:08:36 UTC 2012


on 11/10/2012 22:45 Andriy Gapon said the following:
> on 11/10/2012 22:21 Andriy Gapon said the following:
>>
>> Build of version 0.15 fails for me like this:
>> --------------------------------------------------
>> Verifying Qt 4 build environment ...
>> Warning: /usr/local/bin/qmake-qt4 not for Qt 4
> 
> Hm, looks like something in configure env causes qmake-qt4 to crash with
> SIGSEGV.  That doesn't happen in normal shell environment.
> 
> Hmm, interesting:
> $ env QMAKEFLAGS='QMAKE_CC="cc" QMAKE_CXX="c++"  QMAKE_LINK="c++"
> QMAKE_LINK_SHLIB="c++"  QMAKE_LINK_C="cc" QMAKE_LINK_C_SHLIB="cc"
> QMAKE_CFLAGS="-O2 -pipe -O2 -fno-strict-aliasing -pipe -march=k8-sse3"
> QMAKE_CXXFLAGS="-O2 -pipe -O2 -fno-strict-aliasing -pipe -march=k8-sse3 -O2
> -fno-strict-aliasing -pipe"  QMAKE_CFLAGS_THREAD=""
> QMAKE_LFLAGS_THREAD="-pthread" QMAKE_LFLAGS=""' /usr/local/bin/qmake-qt4 -v
> zsh: segmentation fault (core dumped)
> 
> But funny that if I remove _any_ of the QMAKE_XXX flags from the above
> QMAKEFLAGS, then the command runs fine.
> I wonder if it's the number of parameters that triggers the crash.

Indeed, it seems that qmake allocates space for options in batches of 10 items and
I have exactly 11 items above.  Additionally qmake has a classic off-by-one error
when checking whether to allocate an addition batch.

Obviously, a patch follows :-)

--- option.cpp.orig	2012-10-12 12:51:54.706678449 +0300
+++ option.cpp	2012-10-12 12:52:33.219678158 +0300
@@ -482,7 +482,7 @@ Option::init(int argc, char **argv)
                     env_argc++;
                 }
             } else {
-                if(!env_argv || env_argc > env_size) {
+                if(!env_argv || env_argc >= env_size) {
                     env_argv = (char **)realloc(env_argv, sizeof(char
*)*(env_size+=10));
                     for(int i2 = env_argc; i2 < env_size; i2++)
                         env_argv[i2] = NULL;


I think that this is upstreamable.
-- 
Andriy Gapon


More information about the kde-freebsd mailing list