patch for command line arguments in activation
John (J5) Palmieri
johnp at redhat.com
Fri Jul 1 23:13:35 PDT 2005
Ok, I spent some time looking at your code. A couple of things:
- you need to include the dbus-shell.h headers where you use the
functions.
- you need to return 0 from your main of your test
- the code does not handle OOM errors, it needs to:
/* Now try to spawn the process */
if (!_dbus_shell_parse_argv (entry->exec, &argc, &argv))
{
_dbus_verbose ("Failed to parse command line: %s\n", entry->exec);
/* this will assert every time because _dbus_shell_parse_argv
does not return a DBusError. If a FALSE return can only
happen because OOM then you need to set the error to OOM
*/
_DBUS_ASSERT_ERROR_IS_SET (error);
return FALSE;
}
- the tests failed with this:
check_segfault_service_no_auto_start:2701 received message interface
"(unset)" member "(unset)" error name
"org.freedesktop.DBus.Error.Spawn.ExecFailed" on 0x9141e58, expecting
not this error
segfault_service_no_auto_start failed during oom
File "dispatch.c" line 3086 process 4401 should not have been reached:
test failed
/bin/sh: line 1: 4401 Aborted
DBUS_TEST_DATA=../test/data DBUS_TEST_HOMEDIR=../dbus ${dir}$tst
FAIL: bus-test
===================
1 of 1 tests failed
===================
A well placed printf loop over your parsed argv:
/* Now try to spawn the process */
if (!_dbus_shell_parse_argv (entry->exec, &argc, &argv))
{
_dbus_verbose ("Failed to parse command line: %s\n", entry->exec);
_DBUS_ASSERT_ERROR_IS_SET (error);
return FALSE;
}
{
int i;
for (i = 0; argv[i] != NULL; ++i)
printf ("element: %s\n", argv[i]);
}
reveled this:
element: /home/boston/johnp/devel-local/dbus/test/test-segfaul
should be:
element: /home/boston/johnp/devel-local/dbus/test/test-segfault
You have an off by one error or memory corruption in your parsing code.
You need to expand your test case to not just count the number of
elements returned but compare them to expected strings. Also I noticed
it got things right during the OOM tests which means you need to run the
tests multiple times in succession, perhaps with random data.
Can you fix up these issues and resubmit? Thanks.
On Fri, 2005-06-24 at 12:33 +0200, Rodrigo Moya wrote:
> On Tue, 2005-06-21 at 20:56 -0400, Havoc Pennington wrote:
> > On Tue, 2005-06-21 at 18:33 +0200, Rodrigo Moya wrote:
> > >
> > > So, it seems to work, but I'm getting an error when running bus-test:
> > >
> >
> > I'd suggest using DBUS_VERBOSE=1 or strace to diagnose what happens.
> >
> ok, did some more tests, and I can't really find how my code affects the
> test program. I've even added a shell-test.c program to test dbus-shell
> new functions, and it works great. Also, running with DBUS_VERBOSE shows
> (after a few fixed on the new code) none of the error messages I added
> to that new code, so seems it's working correctly.
>
> Also, none of the D-BUS applications, apart from bus-test that I've been
> testing with are able to connect to the message bus. Even with an
> unmodified dbus that happens, so might be something in my setup
> (separate user with all of GNOME from jhbuild).
>
> Find updated patch, new added files and output and backtrace of the
> bus-test program.
>
> Backtrace:
> check_segfault_service_no_auto_start:2699 received message interface
> "(unset)" member "(unset)" error name
> "org.freedesktop.DBus.Error.Spawn.ExecFailed" on 0x80d0f30, expecting
> not this error
> segfault_service_no_auto_start failed during oom
> File "dispatch.c" line 3084 process 24085 should not have been reached:
> test failed
>
> Program received signal SIGABRT, Aborted.
> 0xffffe410 in ?? ()
> (gdb) bt
> #0 0xffffe410 in ?? ()
> #1 0xbfffe548 in ?? ()
> #2 0x00000006 in ?? ()
> #3 0x00005e15 in ?? ()
> #4 0x400872c1 in raise () from /lib/tls/libc.so.6
> #5 0x40088b75 in abort () from /lib/tls/libc.so.6
> #6 0x0809cd80 in _dbus_abort () at dbus-sysdeps.c:87
> #7 0x08089e99 in _dbus_real_assert_not_reached (
> explanation=0x80b2274 "test failed", file=0x80b5d5f "dispatch.c",
> line=3084) at dbus-internals.c:498
> #8 0x080574b4 in check2_try_iterations (context=<value optimized out>,
> connection=<value optimized out>, description=<value optimized out>,
> func=0x5e15) at dispatch.c:3084
> #9 0x08058501 in bus_dispatch_test (test_data_dir=0xbfffe7f0)
> at dispatch.c:3170
> #10 0x080624c1 in main (argc=2, argv=0xbfffe8a4) at test-main.c:134
--
John (J5) Palmieri <johnp at redhat.com>
More information about the dbus
mailing list