CGIT 0.8.3.1 "chokes" on some bare repos
Quoted 5 lines · On Tue, Aug 3, 2010 at 19:10, <[email protected]> wrote:
The command you provided is not giving any error messages in one of the repositories which shows incorrectly.
As for URL - unfortunately it cannot be done as all the code is on closed LAN
Ok. Try the following:
1) make sure caching is disabled in /etc/cgitrc (nocache=1)
2) find the repo.url setting for the troublesome repo in /etc/cgitrc
3) run PATH_INFO=$BAD_REPO_URL /path/to/cgit.cgi 1>cgit.html 2>cgit.log
4) check if cgit.html is ok - if so, your problem is probably due to stale cache entries which could be caused by permission problems or stale *.lock files in /var/cache/cgit
5) check cgit.log for any errormessage - if there's errors but they don't make any sense to you, try repeating step 3 but run cgit under either strace or gdb.
6) please report the results of this experiment ;)
--
larsh
Quoted 20 lines · Lars Hjemli
Quoted 5 lines · On Tue, Aug 3, 2010 at 19:10, <[email protected]> wrote:
The command you provided is not giving any error messages in one of the repositories which shows incorrectly.
As for URL - unfortunately it cannot be done as all the code is on closed LAN
Ok. Try the following:
1) make sure caching is disabled in
/etc/cgitrc(nocache=1)
2) find the repo.url setting for the troublesome repo in/etc/cgitrc
3) runPATH_INFO=$BAD_REPO_URL /path/to/cgit.cgi 1>cgit.html 2>cgit.log
4) check if cgit.html is ok - if so, your problem is probably due to stale cache entries which could be caused by permission problems or stale *.lock files in/var/cache/cgit
5) check cgit.log for any errormessage - if there's errors but they don't make any sense to you, try repeating step 3 but run cgit under either strace or gdb.
6) please report the results of this experiment ;)
Quoted 3 lines
--
larsh
I have disabled cache: i have nocache=1 (we are working without cache yet, cache-size set to 0, but for the experiment i commented this out)
We are using scan mode as we have central folder to store our repos. So I switched off the scanmode by commenting the scan-url out from cgitrc
Now when i'm trying to generate the html for the repo in question i get html where it says "no repositories found". It is obviously not picking up the PATH_INFO
The command is like this:
$ PATH_INFO=/home/users/gitrepouser/repos/subfolder/repo.git ./cgit.cgi 1>cgit.html 2>cgit.log
Usually, we are scanning the folder /home/users/gitrepouser/repos/ cgit.log is empty so far
Thanks,
Eugene
Quoted 3 lines · Eugene Sajine
I have disabled cache: i have nocache=1 (we are working without cache yet, cache-size set to 0, but for the experiment i commented this out)
Good
Quoted 3 lines
We are using scan mode as we have central folder to store our repos. So I switched off the scanmode by commenting the scan-url out from cgitrc
Then you'll have to add the repo.* settings to cgitrc by hand, or else...
Quoted 2 lines
Now when i'm trying to generate the html for the repo in question i get html where it says "no repositories found".
This is expected.
Quoted 3 lines
The command is like this:
$ PATH_INFO=/home/users/gitrepouser/repos/subfolder/repo.git ./cgit.cgi 1>cgit.html 2>cgit.log
Add this to your cgitrc:
repo.url=foo repo.path=/home/users/gitrepouser/repos/subfolder/repo.git
Then run PATH_INFO=foo ./cgit.cgi 1>cgit.html 2>cgit.log
--
larsh
Quoted 25 lines · Lars Hjemli
Quoted 3 lines · Eugene Sajine
I have disabled cache: i have nocache=1 (we are working without cache yet, cache-size set to 0, but for the experiment i commented this out)
Good
Quoted 3 lines
We are using scan mode as we have central folder to store our repos. So I switched off the scanmode by commenting the scan-url out from cgitrc
Then you'll have to add the repo.* settings to cgitrc by hand, or else...
Quoted 2 lines
Now when i'm trying to generate the html for the repo in question i get html where it says "no repositories found".
This is expected.
Quoted 3 lines
The command is like this:
$ PATH_INFO=/home/users/gitrepouser/repos/subfolder/repo.git ./cgit.cgi 1>cgit.html 2>cgit.logAdd this to your cgitrc:
Quoted 8 lines
repo.url=foo repo.path=/home/users/gitrepouser/repos/subfolder/repo.git
Then run
PATH_INFO=foo ./cgit.cgi 1>cgit.html 2>cgit.log--
larsh
Touchdown!;)
It segfaults:
GNU gdb Red Hat Linux (6.3.0.0-1.159.el4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".
Core was generated by `./cgit.cgi'.
Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/libcrypto.so.4...done.
Loaded symbols for /lib/libcrypto.so.4
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /usr/lib/libgssapi_krb5.so.2...done. Loaded symbols for /usr/lib/libgssapi_krb5.so.2
Reading symbols from /usr/lib/libkrb5.so.3...done.
Loaded symbols for /usr/lib/libkrb5.so.3
Reading symbols from /lib/libcom_err.so.2...done.
Loaded symbols for /lib/libcom_err.so.2
Reading symbols from /usr/lib/libk5crypto.so.3...done. Loaded symbols for /usr/lib/libk5crypto.so.3
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0 0x080538fa in cmp_tag_age (a=0x8bcc760, b=0x8bcc764) at ui-refs.c:52
52 ui-refs.c: No such file or directory.
in ui-refs.c
(gdb) where
#0 0x080538fa in cmp_tag_age (a=0x8bcc760, b=0x8bcc764) at ui-refs.c:52 #1 0x0040eb45 in msort_with_tmp () from /lib/tls/libc.so.6 #2 0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6 #3 0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6 #4 0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6 #5 0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6 #6 0x0040ecdc in qsort () from /lib/tls/libc.so.6 #7 0x08053f8b in cgit_print_tags (maxcount=10) at ui-refs.c:217 #8 0x08058189 in cgit_print_summary () at ui-summary.c:56 #9 0x0804da70 in summary_fn (ctx=0x80e44a0) at cmd.c:119
#10 0x0804cc6d in process_request (cbdata=0x80e44a0) at cgit.c:431 #11 0x0804ae31 in cache_process (size=0, path=0x80a2e24 "../cgit/cache", key=0x8ba6028 "foo", ttl=5, fn=0x804cb28 <process_request>, cbdata=0x80e44a0) at cache.c:322
#12 0x0804d81e in main (argc=1, argv=0xbfffa2b4) at cgit.c:712
Thanks,
Eugene
Quoted 3 lines · Eugene Sajine
It segfaults:
#0 0x080538fa in
cmp_tag_age(a=0x8bcc760, b=0x8bcc764) at ui-refs.c:52
Great, thanks for pinpointing the bug. Could you test if the following patch fixes the problem? I've also attached it since gmail tend to damage patches...
---snip---
From: Lars Hjemli <[email protected]>
Date: Tue, 3 Aug 2010 22:06:21 +0200
Subject: [PATCH] ui-refs.c: avoid segfault on unparsed ref objects
When a ref refers to something other then a commit or tag object, cgit could segfault when trying to display the ref info.
--- ui-refs.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-)
ui-refs.c +14 -12
@@ -42,23 +42,25 @@ static int cmp_branch_age(const void *a, const void *b)return cmp_age (r1->commit->committer_date, r2->commit->committer_date); } +static int get_ref_age (struct refinfo *ref) +{ +if (!ref->object) +return 0 ; +switch (ref->object->type) { +case OBJ_TAG : +return ref->tag ? ref->tag->tagger_date :0 ; +case OBJ_COMMIT : +return ref->commit ? ref->commit->committer_date :0 ; + } +return 0 ; +} +static int cmp_tag_age (const void *a,const void *b) {struct refinfo *r1 = *(struct refinfo **)a;struct refinfo *r2 = *(struct refinfo **)b; -int r1date, r2date; - -if (r1->object->type !=OBJ_COMMIT ) - r1date = r1->tag->tagger_date; -else - r1date = r1->commit->committer_date; - -if (r2->object->type !=OBJ_COMMIT ) - r2date = r2->tag->tagger_date; -else - r2date = r2->commit->committer_date; -return cmp_age (r1date, r2date); +return cmp_age (get_ref_age (r1),get_ref_age (r2)); }static int print_branch (struct refinfo *ref)
Signature · 1 line
1.7.1
From 3687be20bc4abf0c0c197d617afaa3a717b1ab9c Mon Sep 17 00:00:00 2001
From: Lars Hjemli <[email protected]>
Date: Tue, 3 Aug 2010 22:06:21 +0200
Subject: [PATCH] ui-refs.c: avoid segfault on unparsed ref objects
When a ref refers to something other then a commit or tag object, cgit could segfault when trying to display the ref info.
--- ui-refs.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-)
ui-refs.c +14 -12
@@ -42,23 +42,25 @@ static int cmp_branch_age(const void *a, const void *b)return cmp_age (r1->commit->committer_date, r2->commit->committer_date); } +static int get_ref_age (struct refinfo *ref) +{ +if (!ref->object) +return 0 ; +switch (ref->object->type) { +case OBJ_TAG : +return ref->tag ? ref->tag->tagger_date :0 ; +case OBJ_COMMIT : +return ref->commit ? ref->commit->committer_date :0 ; + } +return 0 ; +} +static int cmp_tag_age (const void *a,const void *b) {struct refinfo *r1 = *(struct refinfo **)a;struct refinfo *r2 = *(struct refinfo **)b; -int r1date, r2date; - -if (r1->object->type !=OBJ_COMMIT ) - r1date = r1->tag->tagger_date; -else - r1date = r1->commit->committer_date; - -if (r2->object->type !=OBJ_COMMIT ) - r2date = r2->tag->tagger_date; -else - r2date = r2->commit->committer_date; -return cmp_age (r1date, r2date); +return cmp_age (get_ref_age (r1),get_ref_age (r2)); }static int print_branch (struct refinfo *ref)
Signature · 1 line
1.7.1