[ccan] ccanlint segfaults when _info file is missing

Joseph Adams joeyadams3.14159 at gmail.com
Fri Jan 7 08:32:41 EST 2011


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.

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

Usage (requires graphviz to be installed):

ccanlint --test-dep-graph | dot -Tpng > out.png && xdg-open out.png

Output:

http://tinyurl.com/2wagvlf

Where A points to B, A depends on B.  Mandatory tests are colored yellow.

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").

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");


Cheers!

Joey Adams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: info-dependency-20110106.diff
Type: text/x-patch
Size: 1513 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20110106/3d6a07f2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-dep-graph-20110106.diff
Type: text/x-patch
Size: 2119 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20110106/3d6a07f2/attachment-0001.bin>


More information about the ccan mailing list