git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Re: CGIT 0.8.3.1 "chokes" on some bare repos
       [not found] <90e6ba53a8a0a88e46048cee6566@google.com>
@ 2010-08-03 17:49 ` Lars Hjemli
  2010-08-03 18:19   ` Eugene Sajine
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Hjemli @ 2010-08-03 17:49 UTC (permalink / raw)
  To: Euguess; +Cc: git

On Tue, Aug 3, 2010 at 19:10,  <Euguess@gmail.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: CGIT 0.8.3.1 "chokes" on some bare repos
  2010-08-03 17:49 ` Re: CGIT 0.8.3.1 "chokes" on some bare repos Lars Hjemli
@ 2010-08-03 18:19   ` Eugene Sajine
  2010-08-03 18:47     ` Lars Hjemli
  0 siblings, 1 reply; 5+ messages in thread
From: Eugene Sajine @ 2010-08-03 18:19 UTC (permalink / raw)
  To: Lars Hjemli; +Cc: git

On Tue, Aug 3, 2010 at 1:49 PM, Lars Hjemli <hjemli@gmail.com> wrote:
> On Tue, Aug 3, 2010 at 19:10,  <Euguess@gmail.com> 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
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: CGIT 0.8.3.1 "chokes" on some bare repos
  2010-08-03 18:19   ` Eugene Sajine
@ 2010-08-03 18:47     ` Lars Hjemli
  2010-08-03 19:34       ` Eugene Sajine
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Hjemli @ 2010-08-03 18:47 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

On Tue, Aug 3, 2010 at 20:19, Eugene Sajine <euguess@gmail.com> wrote:
> 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

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

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


> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: CGIT 0.8.3.1 "chokes" on some bare repos
  2010-08-03 18:47     ` Lars Hjemli
@ 2010-08-03 19:34       ` Eugene Sajine
  2010-08-03 20:20         ` Lars Hjemli
  0 siblings, 1 reply; 5+ messages in thread
From: Eugene Sajine @ 2010-08-03 19:34 UTC (permalink / raw)
  To: Lars Hjemli; +Cc: git

On Tue, Aug 3, 2010 at 2:47 PM, Lars Hjemli <hjemli@gmail.com> wrote:
> On Tue, Aug 3, 2010 at 20:19, Eugene Sajine <euguess@gmail.com> wrote:
>> 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
>
>> 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...
>
>> 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.
>
>
>> 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
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: CGIT 0.8.3.1 "chokes" on some bare repos
  2010-08-03 19:34       ` Eugene Sajine
@ 2010-08-03 20:20         ` Lars Hjemli
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Hjemli @ 2010-08-03 20:20 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]

On Tue, Aug 3, 2010 at 21:34, Eugene Sajine <euguess@gmail.com> wrote:
> 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 <hjemli@gmail.com>
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.

Noticed-by: Eugene Sajine <euguess@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 ui-refs.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ui-refs.c b/ui-refs.c
index d3b4f6e..6571cc4 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -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)
-- 
1.7.1

[-- Attachment #2: 0001-ui-refs.c-avoid-segfault-on-unparsed-ref-objects.patch --]
[-- Type: application/octet-stream, Size: 1619 bytes --]

From 3687be20bc4abf0c0c197d617afaa3a717b1ab9c Mon Sep 17 00:00:00 2001
From: Lars Hjemli <hjemli@gmail.com>
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.

Noticed-by: Eugene Sajine <euguess@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 ui-refs.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ui-refs.c b/ui-refs.c
index d3b4f6e..6571cc4 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -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)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-03 20:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <90e6ba53a8a0a88e46048cee6566@google.com>
2010-08-03 17:49 ` Re: CGIT 0.8.3.1 "chokes" on some bare repos Lars Hjemli
2010-08-03 18:19   ` Eugene Sajine
2010-08-03 18:47     ` Lars Hjemli
2010-08-03 19:34       ` Eugene Sajine
2010-08-03 20:20         ` Lars Hjemli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).