[ccan] ccanlint segfaults when _info file is missing

Rusty Russell rusty at rustcorp.com.au
Fri Jan 7 15:19:22 EST 2011


On Fri, 7 Jan 2011 08:02:41 am Joseph Adams wrote:
> I tried to run ccanlint on Fedora 14, but I got a segfault:
> 
> (gdb) run
> Starting program: /home/joey/ccan/tools/ccanlint/ccanlint
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0804d104 in get_one_deps (ctx=0x8064798, dir=0x8064740 "/home/joey/ccan",
>     num=0xbffff078, infofile=0x28) at tools/depends.c:76
> 76		if (!*infofile) {
> Missing separate debuginfos, use: debuginfo-install glibc-2.12.90-19.i686
> (gdb)
> 
> m->info_file was NULL because the _info file was missing.
> 
> The first patch adds the "info" dependency to two tests, ensuring that
> m->info_file will be non-NULL when it is used.

Thanks!

> The second patch adds a --test-dep-graph flag to ccanlint, which
> creates a dependency graph of ccanlint's tests in Graphviz .dot
> format.

Oh, that is sweet!  Nice work!

> In tools/ccanlint/tests/examples_compile.c , the `if (m->info_file)`
> should probably be taken out, as m->info_file should not be NULL when
> this test is run ("examples-compile" indirectly depends on "info").

Ah, m is actually a submodule there, so no tests have been run on it:

	m = get_manifest(*deps, talloc_asprintf(*deps, "%s/ccan/%s",
						ccan_dir, basename));
	...
	if (m->info_file) {

> Also, it'd be nice if the C file of each test was named consistently
> with its key.  For example, examples-compile should be in
> "test/examples-compile.c" .  Also, to avoid naming issues with structs
> as well (you can't say `struct ccanlint has-info`), perhaps
> REGISTER_TEST should take strings instead of pointers, like so:
> 
> REGISTER_TEST(test, "build", "depends-built");

Really good idea.

I should rename all the short names (and descroptions) to be consistent,
and print the short names on test failure (esp. useful for --target).

Currently the names are all over the place: some are positive (has_tests),
some are negative (trailing-whitespace), some don't have verbs (info),
etc.

I'll look at this tonight.  Meanwhile, your patches applied and pushed,
thanks!

Cheers,
Rusty.


More information about the ccan mailing list