Debugging cgit

Posted on 4th August 2011 in Linux

flattr this!

For my git repositories I use cgit as the web frontend. The package I used had a problem displaying the treeview. Looking at /var/log/messages I saw that it segfaults. I’ve already fixed a segfault in cgit some time ago. I wondered how I was able to get gdb attached to it. It took me some time to figure it out so this is the way to document it for the future. Maybe someone else will find this useful.

The command to display the html on the commandline is:

CGIT_CONFIG="/srv/www/vhosts/libssh/cgitrc" /srv/www/cgi-bin/cgit/cgit.cgi 1>cgit.html 2>cgit.log

This will write the html output to cgit.html and the errors to cgit.log. So if you want to display a tree of the project, the url to it would be for example: http://git.libssh.org/projects/libssh.git/

So on the commandline this is:

QUERY_STRING="url=projects/libssh.git" CGIT_CONFIG="/srv/www/vhosts/libssh/cgitrc" /srv/www/cgi-bin/cgit/cgit.cgi 1>cgit.html 2>cgit.log

and if you need gdb to get a segfault you can simply use:

QUERY_STRING="url=projects/libssh.git/tree" CGIT_CONFIG="/path/to/libssh/cgitrc" gdb /srv/www/cgi-bin/cgit/cgit.cgi

It segfaulted cause the current version doesn’t support git 1.7.6 and a NULL pointer was passed to a function instead of the right values.

comments: 2 »

2 Responses to “Debugging cgit”

  1. Ferry says:

    So we can expect a patch for cgit, fixing the segfault?

  2. I’ve sent the patch upstream

    http://hjemli.net/pipermail/cgit/2011-August/000295.html

    The last two hunks fix the segfault …



Pings responses to this post

Leave a Reply

Your email address will not be published. Required fields are marked *


*

Comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What is Persona?