{"thread":{"id":"24620","subject":"Re: Re: CGIT 0.8.3.1 \"chokes\" on some bare repos","startedAt":"2010-08-03T17:49:34Z","lastAt":"2010-08-03T20:20:12Z","messageCount":5,"participants":["Lars Hjemli","Eugene Sajine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"147063","messageId":"AANLkTinDPa7ngcTEfYC8k2O3hwkYszEUsb3pZqnuOSo2@mail.gmail.com","threadId":"24620","inReplyTo":"90e6ba53a8a0a88e46048cee6566@google.com","subject":"Re: Re: CGIT 0.8.3.1 \"chokes\" on some bare repos","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2010-08-03T17:49:34Z","receivedAt":"2010-08-03T17:49:34Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Tue, Aug 3, 2010 at 19:10,  <Euguess@gmail.com> wrote:\n> The command you provided is not giving any error messages in one of the\n> repositories which shows incorrectly.\n>\n> As for URL - unfortunately it cannot be done as all the code is on closed\n> LAN\n\nOk. Try the following:\n\n1) make sure caching is disabled in /etc/cgitrc (nocache=1)\n2) find the repo.url setting for the troublesome repo in /etc/cgitrc\n3) run `PATH_INFO=$BAD_REPO_URL /path/to/cgit.cgi 1>cgit.html 2>cgit.log`\n4) check if cgit.html is ok - if so, your problem is probably due to\nstale cache entries which could be caused by permission problems or\nstale *.lock files in /var/cache/cgit\n5) check cgit.log for any errormessage - if there's errors but they\ndon't make any sense to you, try repeating step 3 but run cgit under\neither strace or gdb.\n6) please report the results of this experiment ;)\n\n--\nlarsh\n"},{"id":"147064","messageId":"AANLkTindiOoy-4W5DJ9AGa8q29Tsm9P8K_4TEgRfmJW=@mail.gmail.com","threadId":"24620","inReplyTo":"AANLkTinDPa7ngcTEfYC8k2O3hwkYszEUsb3pZqnuOSo2@mail.gmail.com","subject":"Re: Re: CGIT 0.8.3.1 \"chokes\" on some bare repos","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2010-08-03T18:19:23Z","receivedAt":"2010-08-03T18:19:23Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Tue, Aug 3, 2010 at 1:49 PM, Lars Hjemli <hjemli@gmail.com> wrote:\n> On Tue, Aug 3, 2010 at 19:10,  <Euguess@gmail.com> wrote:\n>> The command you provided is not giving any error messages in one of the\n>> repositories which shows incorrectly.\n>>\n>> As for URL - unfortunately it cannot be done as all the code is on closed\n>> LAN\n>\n> Ok. Try the following:\n>\n> 1) make sure caching is disabled in /etc/cgitrc (nocache=1)\n> 2) find the repo.url setting for the troublesome repo in /etc/cgitrc\n> 3) run `PATH_INFO=$BAD_REPO_URL /path/to/cgit.cgi 1>cgit.html 2>cgit.log`\n> 4) check if cgit.html is ok - if so, your problem is probably due to\n> stale cache entries which could be caused by permission problems or\n> stale *.lock files in /var/cache/cgit\n> 5) check cgit.log for any errormessage - if there's errors but they\n> don't make any sense to you, try repeating step 3 but run cgit under\n> either strace or gdb.\n> 6) please report the results of this experiment ;)\n>\n> --\n> larsh\n>\n\nI have disabled cache: i have nocache=1 (we are working without cache\nyet,  cache-size set to 0, but for the experiment i commented this\nout)\nWe are using scan mode as we have central folder to store our repos.\nSo I switched off the scanmode by commenting the scan-url out from\ncgitrc\n\nNow when i'm trying to generate the html for the repo in question i\nget html where it says \"no repositories found\". It is obviously not\npicking up the PATH_INFO\n\nThe command is like this:\n$ PATH_INFO=/home/users/gitrepouser/repos/subfolder/repo.git\n./cgit.cgi 1>cgit.html 2>cgit.log\n\nUsually, we are scanning the folder /home/users/gitrepouser/repos/\ncgit.log is empty so far\n\n\nThanks,\nEugene\n"},{"id":"147066","messageId":"AANLkTin6+X=nTTqLG=xCYDSPKWX3CVPTxAhzDM9uKMW5@mail.gmail.com","threadId":"24620","inReplyTo":"AANLkTindiOoy-4W5DJ9AGa8q29Tsm9P8K_4TEgRfmJW=@mail.gmail.com","subject":"Re: Re: CGIT 0.8.3.1 \"chokes\" on some bare repos","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2010-08-03T18:47:30Z","receivedAt":"2010-08-03T18:47:30Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Tue, Aug 3, 2010 at 20:19, Eugene Sajine <euguess@gmail.com> wrote:\n> I have disabled cache: i have nocache=1 (we are working without cache\n> yet,  cache-size set to 0, but for the experiment i commented this\n> out)\n\nGood\n\n> We are using scan mode as we have central folder to store our repos.\n> So I switched off the scanmode by commenting the scan-url out from\n> cgitrc\n\nThen you'll have to add the repo.* settings to cgitrc by hand, or else...\n\n> Now when i'm trying to generate the html for the repo in question i\n> get html where it says \"no repositories found\".\n\nThis is expected.\n\n\n> The command is like this:\n> $ PATH_INFO=/home/users/gitrepouser/repos/subfolder/repo.git\n> ./cgit.cgi 1>cgit.html 2>cgit.log\n\nAdd this to your cgitrc:\n\nrepo.url=foo\nrepo.path=/home/users/gitrepouser/repos/subfolder/repo.git\n\nThen run `PATH_INFO=foo ./cgit.cgi 1>cgit.html 2>cgit.log`\n\n--\nlarsh\n"},{"id":"147067","messageId":"AANLkTi=Ho=ZiOpMszSEWTjY=PKg9AHp9wY-jxcd3H_jG@mail.gmail.com","threadId":"24620","inReplyTo":"AANLkTin6+X=nTTqLG=xCYDSPKWX3CVPTxAhzDM9uKMW5@mail.gmail.com","subject":"Re: Re: CGIT 0.8.3.1 \"chokes\" on some bare repos","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2010-08-03T19:34:37Z","receivedAt":"2010-08-03T19:34:37Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Tue, Aug 3, 2010 at 2:47 PM, Lars Hjemli <hjemli@gmail.com> wrote:\n> On Tue, Aug 3, 2010 at 20:19, Eugene Sajine <euguess@gmail.com> wrote:\n>> I have disabled cache: i have nocache=1 (we are working without cache\n>> yet,  cache-size set to 0, but for the experiment i commented this\n>> out)\n>\n> Good\n>\n>> We are using scan mode as we have central folder to store our repos.\n>> So I switched off the scanmode by commenting the scan-url out from\n>> cgitrc\n>\n> Then you'll have to add the repo.* settings to cgitrc by hand, or else...\n>\n>> Now when i'm trying to generate the html for the repo in question i\n>> get html where it says \"no repositories found\".\n>\n> This is expected.\n>\n>\n>> The command is like this:\n>> $ PATH_INFO=/home/users/gitrepouser/repos/subfolder/repo.git\n>> ./cgit.cgi 1>cgit.html 2>cgit.log\n>\n> Add this to your cgitrc:\n>\n> repo.url=foo\n> repo.path=/home/users/gitrepouser/repos/subfolder/repo.git\n>\n> Then run `PATH_INFO=foo ./cgit.cgi 1>cgit.html 2>cgit.log`\n>\n> --\n> larsh\n>\n\nTouchdown!;)\n\nIt segfaults:\n\nGNU gdb Red Hat Linux (6.3.0.0-1.159.el4rh)\nCopyright 2004 Free Software Foundation, Inc.\nGDB is free software, covered by the GNU General Public License, and you are\nwelcome to change it and/or distribute copies of it under certain conditions.\nType \"show copying\" to see the conditions.\nThere is absolutely no warranty for GDB.  Type \"show warranty\" for details.\nThis GDB was configured as \"i386-redhat-linux-gnu\"...Using host\nlibthread_db library \"/lib/tls/libthread_db.so.1\".\n\nCore was generated by `./cgit.cgi'.\nProgram terminated with signal 11, Segmentation fault.\nReading symbols from /usr/lib/libz.so.1...done.\nLoaded symbols for /usr/lib/libz.so.1\nReading symbols from /lib/libcrypto.so.4...done.\nLoaded symbols for /lib/libcrypto.so.4\nReading symbols from /lib/tls/libc.so.6...done.\nLoaded symbols for /lib/tls/libc.so.6\nReading symbols from /usr/lib/libgssapi_krb5.so.2...done.\nLoaded symbols for /usr/lib/libgssapi_krb5.so.2\nReading symbols from /usr/lib/libkrb5.so.3...done.\nLoaded symbols for /usr/lib/libkrb5.so.3\nReading symbols from /lib/libcom_err.so.2...done.\nLoaded symbols for /lib/libcom_err.so.2\nReading symbols from /usr/lib/libk5crypto.so.3...done.\nLoaded symbols for /usr/lib/libk5crypto.so.3\nReading symbols from /lib/libresolv.so.2...done.\nLoaded symbols for /lib/libresolv.so.2\nReading symbols from /lib/libdl.so.2...done.\nLoaded symbols for /lib/libdl.so.2\nReading symbols from /lib/ld-linux.so.2...done.\nLoaded symbols for /lib/ld-linux.so.2\n#0  0x080538fa in cmp_tag_age (a=0x8bcc760, b=0x8bcc764) at ui-refs.c:52\n52      ui-refs.c: No such file or directory.\n        in ui-refs.c\n(gdb) where\n#0  0x080538fa in cmp_tag_age (a=0x8bcc760, b=0x8bcc764) at ui-refs.c:52\n#1  0x0040eb45 in msort_with_tmp () from /lib/tls/libc.so.6\n#2  0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6\n#3  0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6\n#4  0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6\n#5  0x0040ea1d in msort_with_tmp () from /lib/tls/libc.so.6\n#6  0x0040ecdc in qsort () from /lib/tls/libc.so.6\n#7  0x08053f8b in cgit_print_tags (maxcount=10) at ui-refs.c:217\n#8  0x08058189 in cgit_print_summary () at ui-summary.c:56\n#9  0x0804da70 in summary_fn (ctx=0x80e44a0) at cmd.c:119\n#10 0x0804cc6d in process_request (cbdata=0x80e44a0) at cgit.c:431\n#11 0x0804ae31 in cache_process (size=0, path=0x80a2e24\n\"../cgit/cache\", key=0x8ba6028 \"foo\", ttl=5, fn=0x804cb28\n<process_request>, cbdata=0x80e44a0) at cache.c:322\n#12 0x0804d81e in main (argc=1, argv=0xbfffa2b4) at cgit.c:712\n\nThanks,\nEugene\n"},{"id":"147069","messageId":"AANLkTimNyLBjVe+sWRJ+=eidazE-JP6Rshk1XzhrBCG3@mail.gmail.com","threadId":"24620","inReplyTo":"AANLkTi=Ho=ZiOpMszSEWTjY=PKg9AHp9wY-jxcd3H_jG@mail.gmail.com","subject":"Re: Re: CGIT 0.8.3.1 \"chokes\" on some bare repos","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2010-08-03T20:20:12Z","receivedAt":"2010-08-03T20:20:12Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Tue, Aug 3, 2010 at 21:34, Eugene Sajine <euguess@gmail.com> wrote:\n> It segfaults:\n>\n> #0  0x080538fa in cmp_tag_age (a=0x8bcc760, b=0x8bcc764) at ui-refs.c:52\n\nGreat, thanks for pinpointing the bug. Could you test if the following\npatch fixes the problem? I've also attached it since gmail tend to\ndamage patches...\n\n---snip---\nFrom: Lars Hjemli <hjemli@gmail.com>\nDate: Tue, 3 Aug 2010 22:06:21 +0200\nSubject: [PATCH] ui-refs.c: avoid segfault on unparsed ref objects\n\nWhen a ref refers to something other then a commit or tag object, cgit\ncould segfault when trying to display the ref info.\n\nNoticed-by: Eugene Sajine <euguess@gmail.com>\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n ui-refs.c |   26 ++++++++++++++------------\n 1 files changed, 14 insertions(+), 12 deletions(-)\n\ndiff --git a/ui-refs.c b/ui-refs.c\nindex d3b4f6e..6571cc4 100644\n--- a/ui-refs.c\n+++ b/ui-refs.c\n@@ -42,23 +42,25 @@ static int cmp_branch_age(const void *a, const void *b)\n \treturn cmp_age(r1->commit->committer_date, r2->commit->committer_date);\n }\n\n+static int get_ref_age(struct refinfo *ref)\n+{\n+\tif (!ref->object)\n+\t\treturn 0;\n+\tswitch (ref->object->type) {\n+\tcase OBJ_TAG:\n+\t\treturn ref->tag ? ref->tag->tagger_date : 0;\n+\tcase OBJ_COMMIT:\n+\t\treturn ref->commit ? ref->commit->committer_date : 0;\n+\t}\n+\treturn 0;\n+}\n+\n static int cmp_tag_age(const void *a, const void *b)\n {\n \tstruct refinfo *r1 = *(struct refinfo **)a;\n \tstruct refinfo *r2 = *(struct refinfo **)b;\n-\tint r1date, r2date;\n-\n-\tif (r1->object->type != OBJ_COMMIT)\n-\t\tr1date = r1->tag->tagger_date;\n-\telse\n-\t\tr1date = r1->commit->committer_date;\n-\n-\tif (r2->object->type != OBJ_COMMIT)\n-\t\tr2date = r2->tag->tagger_date;\n-\telse\n-\t\tr2date = r2->commit->committer_date;\n\n-\treturn cmp_age(r1date, r2date);\n+\treturn cmp_age(get_ref_age(r1), get_ref_age(r2));\n }\n\n static int print_branch(struct refinfo *ref)\n-- \n1.7.1\n\n\nFrom 3687be20bc4abf0c0c197d617afaa3a717b1ab9c Mon Sep 17 00:00:00 2001\nFrom: Lars Hjemli <hjemli@gmail.com>\nDate: Tue, 3 Aug 2010 22:06:21 +0200\nSubject: [PATCH] ui-refs.c: avoid segfault on unparsed ref objects\n\nWhen a ref refers to something other then a commit or tag object, cgit\ncould segfault when trying to display the ref info.\n\nNoticed-by: Eugene Sajine <euguess@gmail.com>\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n ui-refs.c |   26 ++++++++++++++------------\n 1 files changed, 14 insertions(+), 12 deletions(-)\n\ndiff --git a/ui-refs.c b/ui-refs.c\nindex d3b4f6e..6571cc4 100644\n--- a/ui-refs.c\n+++ b/ui-refs.c\n@@ -42,23 +42,25 @@ static int cmp_branch_age(const void *a, const void *b)\n \treturn cmp_age(r1->commit->committer_date, r2->commit->committer_date);\n }\n \n+static int get_ref_age(struct refinfo *ref)\n+{\n+\tif (!ref->object)\n+\t\treturn 0;\n+\tswitch (ref->object->type) {\n+\tcase OBJ_TAG:\n+\t\treturn ref->tag ? ref->tag->tagger_date : 0;\n+\tcase OBJ_COMMIT:\n+\t\treturn ref->commit ? ref->commit->committer_date : 0;\n+\t}\n+\treturn 0;\n+}\n+\n static int cmp_tag_age(const void *a, const void *b)\n {\n \tstruct refinfo *r1 = *(struct refinfo **)a;\n \tstruct refinfo *r2 = *(struct refinfo **)b;\n-\tint r1date, r2date;\n-\n-\tif (r1->object->type != OBJ_COMMIT)\n-\t\tr1date = r1->tag->tagger_date;\n-\telse\n-\t\tr1date = r1->commit->committer_date;\n-\n-\tif (r2->object->type != OBJ_COMMIT)\n-\t\tr2date = r2->tag->tagger_date;\n-\telse\n-\t\tr2date = r2->commit->committer_date;\n \n-\treturn cmp_age(r1date, r2date);\n+\treturn cmp_age(get_ref_age(r1), get_ref_age(r2));\n }\n \n static int print_branch(struct refinfo *ref)\n-- \n1.7.1\n\n"}]}