Re: [LAU] [Jack-Devel] jack2 turned verbose

From: Brendan Jones <brendan.jones.it@email-addr-hidden>
Date: Mon Jun 04 2012 - 01:14:49 EEST

On 06/03/2012 10:52 PM, Brendan Jones wrote:
> On 06/01/2012 03:48 PM, David Adler wrote:
>> On Fri, Jun 1, 2012 at 2:52 PM, Robin Gareus wrote:
>>>
>>> It might have to do with Arch's compiler[-flags] and how jack2 uses
>>> unions .. or scoping: JackGlobals vs Engine-Parameters.. although I
>>> don't have an explanation.. all seems good.
>>
>> Compiler flags (for 32bit) are, (from unaltered /etc/makepkg.conf):
>> CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector
>> --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
>>
>>> A hunch: it could be caused by using 'server_ptr->verbose.b' (a union)
>>> as boolean. The sever only checks "if (server_ptr->verbose.b)". The
>>> union itself comprises other uninitialized values that could make it
>>> evaluate to true (though it shouldn't, but maybe some compiler
>>> optimization casts it to (int) instead of (bool) )
>>>
>>>
>>> I know this is the '-users' list (I'm ccing jack-devel), but could
>>> someone who experiences the problem try to track it down?
>>>
>>> Basically just add a few printf()'s. Start at: common/JackControlAPI.cpp
>>> - line 926 - before the call to "new JackServer(..)" add
>>>
>>> printf("DEBUG verbose: %s\n",(server_ptr->verbose.b)?"on":"off");
>>>
>>> recompile, launch jackd. If it prints "verbose: on", sth is wrong with
>>> parameter initialization in main() or with using unions. If it's "off"
>>> the problem sits deeper:
>>
>> DEBUG verbose: on
>>
>>> add a line just after common/JackServer.cpp line 66
>>> printf("DEBUG verbose2: %s\n",(JackGlobals::fVerbose)?"on":"off");
>>> ...
>>
>> above, your line number didn't match exactly, so we seem to have
>> different versions (1.9.7 here). Thus, I wasn't exactly sure where to
>> add the prinf() and did the following:
>>
>> ...
>> JackServerGlobals::fUserCount = 1; // One user
>> printf("DEBUG verbose2: %s\n",(JackGlobals::fVerbose)?"on":"off");
>> JackGlobals::fVerbose = verbose;
>> printf("DEBUG verbose3: %s\n",(JackGlobals::fVerbose)?"on":"off");
>> }
>>
>> which prints:
>> DEBUG verbose2: off
>> DEBUG verbose3: on
>>
>>> A crude test for the union() hunch would be to change
>>> common/JackControlAPI.h line 53:
>>> replace
>>> "union jackctl_parameter_value"
>>> with
>>> "struct jackctl_parameter_value"
>>> and compile with '-fpermissive' like this:
>>>
>>> CXXFLAGS="-fpermissive" ./waf configure
>>> ./waf
>>>
>>
>> Again, mismatching line numbers. I assume you meant the line:
>> union jackctl_parameter_value verbose;
>>
>> Changing that to struct fixes both issues I reported,
>> the verbose output and exit on last client close.
>>
>> So we seem to be getting somewhere. Nice.
>>
>>
>> thanks Robin,
>> d
>
> I've come a cross a jackdbus error which seems related. Basically
> jackbus receives a SIGSEGV via the dbus-daemon on account of a bool
> value not being 1 or 0.
>
> The crude workaround below does nothing to explain the issue. Using a
> struct in this instance is also not possible:
>
> diff -Nurp jack-1.9.8.orig/dbus/jackdbus.c jack-1.9.8/dbus/jackdbus.c
> --- jack-1.9.8.orig/dbus/jackdbus.c 2011-12-19 12:54:24.000000000 +0100
> +++ jack-1.9.8/dbus/jackdbus.c 2012-06-03 22:06:16.148799580 +0200
> @@ -418,6 +418,7 @@ jack_dbus_message_append_variant(
> }
>
> /* Append the supplied value. */
> + if (type == DBUS_TYPE_BOOLEAN) *arg = (message_arg_t) ((int*)arg>0);
> if (!dbus_message_iter_append_basic (&sub_iter, type, (const void *) arg))
> {
> dbus_message_iter_close_container (iter, &sub_iter);
>
> Where arg is a pointer to (dbus/jackdbus.h)
> typedef union
> {
> unsigned char byte;
> dbus_bool_t boolean;
> dbus_int16_t int16;
> dbus_uint16_t uint16;
> dbus_int32_t int32;
> dbus_uint32_t uint32;
> dbus_int64_t int64;
> dbus_uint64_t uint64;
> double doubl;
> const char *string;
> } message_arg_t;
>
>
>
In fact this is not a work around at all, it just prevents crashing. The
value is still being cast incorrectly.

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Mon Jun 4 04:15:01 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 04 2012 - 04:15:02 EEST