Re: /about redirected to /about/

2015-08-13 Thread Daniel Reichelt
Hi Jason,

> Please let me know if this poses any problems.

I'm afraid, it does here:


Requesting a document works, however a request to /cgit/$repo.git/about/ gets
301'd to /cgit/$repo.git/about/ until firefox throws up.


I added some debug printing to cmd.c:about_pre():
--8<
static void about_pre(void)
{
fprintf(stderr, "cmd url is: #%s#\n", ctx.qry.url);
fprintf(stderr, "cmd qryp is: #%s#\n", ctx.qry.path);
if (ctx.repo && !ctx.qry.path && ctx.qry.url[strlen(ctx.qry.url) - 1] 
!= '/')
cgit_redirect(fmtalloc("%s/", cgit_currenturl()), true);
}
--8<


For requesting a document, say cryptsetup.md, it writes
--8<
[Thu Aug 13 10:44:25.121565 2015] [cgi:error] [pid 1192] [client ::1:60435]
AH01215: cmd url is: #wiki.git/about#
[Thu Aug 13 10:44:25.121672 2015] [cgi:error] [pid 1192] [client ::1:60435]
AH01215: cmd qryp is: #cryptsetup.md#
--8<


For requesting the document listing about/, it writes
--8<
==> /var/log/apache2/error-repositories-hacking.log <==
[Thu Aug 13 10:45:46.755487 2015] [cgi:error] [pid 7586] [client ::1:60522]
AH01215: cmd url is: #wiki.git/about#, referer: https://
[Thu Aug 13 10:45:46.755567 2015] [cgi:error] [pid 7586] [client ::1:60522]
AH01215: cmd qryp is: #(null)#, referer: https://
--8<



As you can see, there's no trailing slash at that point, even when contained in
the http request. So the check for the trailing slash in cmd.c:49 always
triggers the redirect.

Here's a trace of firefox' "Live HTTP headers" for a request to about/:

--8<
https://www./repositories/cgit/wiki.git/about/

GET /repositories/cgit/wiki.git/about/ HTTP/1.1
Host: www.*
User-Agent: Mozilla/5.0[...]
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: https://www.*/repositories/cgit/wiki.git/
Connection: keep-alive

HTTP/1.1 301 Moved
Date: Thu, 13 Aug 2015 08:47:41 GMT
Server: Apache
Location: /repositories/cgit/wiki.git/about/
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Content-Length: 0
Keep-Alive: timeout=5, max=80
Connection: Keep-Alive
--8<


And here's the corresponding entry from apache2's access.log:
--8<
::1 - - [13/Aug/2015:10:47:41 +0200] "GET /repositories/cgit/wiki.git/about/
HTTP/1.1" 301 4611 "https://***/repositories/cgit/wiki.git/"; "Mozilla/5.0[...]"
--8<


Hauler if you need additional info.


Cheers
Daniel

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: /about redirected to /about/

2015-08-13 Thread Jason A. Donenfeld
Hey Daniel,

Can you hop on IRC and debug this interactively with me?

#cgit on freenode. I'm zx2c4.

Jason
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] add new option atom-root

2015-08-13 Thread Jason A. Donenfeld
Wouldn't it be better to just use a relative URL?
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] add new option atom-root

2015-08-13 Thread Daniel Reichelt
You yourself got me thinking about this (see previous archive link) :)

The problem is, we don't know how different browsers would call external feed 
reader programs
a) with the correctly assembled feed url
b) dumb as hell with just the relative part...
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 2/8] Makefile: include Git's config.mak.uname

2015-08-13 Thread John Keeping
This pulls in the correct value of $(INSTALL) on a wide variety of
systems.

Signed-off-by: John Keeping 
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 65b4318..74061a3 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ DOC_PDF  = $(patsubst %.txt,%.pdf,$(MAN_TXT))
 
 #-include config.mak
 
+include git/config.mak.uname
 #
 # Let the user override the above settings.
 #
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 5/8] cache.c: fix header order

2015-08-13 Thread John Keeping
git-compat-util.h may define values that affect how system headers are
interpreted, so move sys/sendfile.h after cgit.h (which includes
git-compat-util.h).

Signed-off-by: John Keeping 
---
 cache.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cache.c b/cache.c
index cd99812..57c8918 100644
--- a/cache.c
+++ b/cache.c
@@ -13,12 +13,12 @@
  *
  */
 
-#ifdef HAVE_LINUX_SENDFILE
-#include 
-#endif
 #include "cgit.h"
 #include "cache.h"
 #include "html.h"
+#ifdef HAVE_LINUX_SENDFILE
+#include 
+#endif
 
 #define CACHE_BUFSIZE (1024 * 4)
 
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 7/8] ui-tree: use "sane" isgraph()

2015-08-13 Thread John Keeping
Git's git-compat-util.h defines a "sane ctype" that does not use locale
information and works with signed chars, but it does not include
isgraph() so we have included ctype.h ourselves.

However, this means we have to include a system header before
git-compat-util.h which may lead to the system defining some macros
(e.g. _FILE_OFFSET_BITS on Solaris) before git-compat-util.h redefines
them with a different value.  We cannot include ctype.h after
git-compat-util.h because we have defined many of its functions as
macros which causes a stream of compilation errors.

Defining our own "sane" isgraph() using Git's sane isprint() and
isspace() avoids all of these problems.

Signed-off-by: John Keeping 
---
 cgit.h| 3 +++
 ui-tree.c | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/cgit.h b/cgit.h
index 508179a..f327627 100644
--- a/cgit.h
+++ b/cgit.h
@@ -25,6 +25,9 @@
 #include 
 #include 
 
+/* Add isgraph(x) to Git's sane ctype support (see git-compat-util.h) */
+#undef isgraph
+#define isgraph(x) (isprint((x)) && !isspace((x)))
 
 /*
  * Dateformats used on misc. pages
diff --git a/ui-tree.c b/ui-tree.c
index c8d24f6..2dbe89e 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -6,7 +6,6 @@
  *   (see COPYING for full license text)
  */
 
-#include 
 #include "cgit.h"
 #include "ui-tree.h"
 #include "html.h"
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 1/8] tests: allow shell to be overridden

2015-08-13 Thread John Keeping
On some systems (e.g. Solaris), /bin/sh is not a POSIX shell.  Git
already provides suitable overrides in its config.mak.uname file and we
provide cgit.conf to allow the user to further change this.

The code for this is taken from Git's t/Makefile, meaning that we now
invoke the tests in the same way that Git does.

Signed-off-by: John Keeping 
---
 tests/Makefile | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile b/tests/Makefile
index 1556475..65e1117 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,11 +1,15 @@
+include ../git/config.mak.uname
+-include ../cgit.conf
 
+SHELL_PATH ?= $(SHELL)
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 
 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 
 all: $(T)
 
 $(T):
-   @./$@ $(CGIT_TEST_OPTS)
+   @'$(SHELL_PATH_SQ)' $@ $(CGIT_TEST_OPTS)
 
 clean:
$(RM) -rf trash
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 8/8] filter: don't use dlsym unnecessarily

2015-08-13 Thread John Keeping
We only need to hook write() if Lua filter's are in use.  If support has
been disabled, remove the dependency on dlsym().

Signed-off-by: John Keeping 
---
 filter.c | 78 ++--
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/filter.c b/filter.c
index c7037a3..949c931 100644
--- a/filter.c
+++ b/filter.c
@@ -8,17 +8,13 @@
 
 #include "cgit.h"
 #include "html.h"
-#include 
 #ifndef NO_LUA
+#include 
 #include 
 #include 
 #include 
 #endif
 
-static ssize_t (*libc_write)(int fd, const void *buf, size_t count);
-static ssize_t (*filter_write)(struct cgit_filter *base, const void *buf, 
size_t count) = NULL;
-static struct cgit_filter *current_write_filter = NULL;
-
 static inline void reap_filter(struct cgit_filter *filter)
 {
if (filter && filter->cleanup)
@@ -43,37 +39,6 @@ void cgit_cleanup_filters(void)
}
 }
 
-void cgit_init_filters(void)
-{
-   libc_write = dlsym(RTLD_NEXT, "write");
-   if (!libc_write)
-   die("Could not locate libc's write function");
-}
-
-ssize_t write(int fd, const void *buf, size_t count)
-{
-   if (fd != STDOUT_FILENO || !filter_write)
-   return libc_write(fd, buf, count);
-   return filter_write(current_write_filter, buf, count);
-}
-
-static inline void hook_write(struct cgit_filter *filter, ssize_t 
(*new_write)(struct cgit_filter *base, const void *buf, size_t count))
-{
-   /* We want to avoid buggy nested patterns. */
-   assert(filter_write == NULL);
-   assert(current_write_filter == NULL);
-   current_write_filter = filter;
-   filter_write = new_write;
-}
-
-static inline void unhook_write(void)
-{
-   assert(filter_write != NULL);
-   assert(current_write_filter != NULL);
-   filter_write = NULL;
-   current_write_filter = NULL;
-}
-
 static int open_exec_filter(struct cgit_filter *base, va_list ap)
 {
struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
@@ -170,7 +135,48 @@ void cgit_exec_filter_init(struct cgit_exec_filter 
*filter, char *cmd, char **ar
filter->base.argument_count = 0;
 }
 
+#ifdef NO_LUA
+void cgit_init_filters(void)
+{
+}
+#endif
+
 #ifndef NO_LUA
+static ssize_t (*libc_write)(int fd, const void *buf, size_t count);
+static ssize_t (*filter_write)(struct cgit_filter *base, const void *buf, 
size_t count) = NULL;
+static struct cgit_filter *current_write_filter = NULL;
+
+void cgit_init_filters(void)
+{
+   libc_write = dlsym(RTLD_NEXT, "write");
+   if (!libc_write)
+   die("Could not locate libc's write function");
+}
+
+ssize_t write(int fd, const void *buf, size_t count)
+{
+   if (fd != STDOUT_FILENO || !filter_write)
+   return libc_write(fd, buf, count);
+   return filter_write(current_write_filter, buf, count);
+}
+
+static inline void hook_write(struct cgit_filter *filter, ssize_t 
(*new_write)(struct cgit_filter *base, const void *buf, size_t count))
+{
+   /* We want to avoid buggy nested patterns. */
+   assert(filter_write == NULL);
+   assert(current_write_filter == NULL);
+   current_write_filter = filter;
+   filter_write = new_write;
+}
+
+static inline void unhook_write(void)
+{
+   assert(filter_write != NULL);
+   assert(current_write_filter != NULL);
+   filter_write = NULL;
+   current_write_filter = NULL;
+}
+
 struct lua_filter {
struct cgit_filter base;
char *script_file;
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 4/8] configfile.c: don't include system headers directly

2015-08-13 Thread John Keeping
git-compat-util.h may define various values that affect the
interpretation of system headers.  In most places we include cgit.h
first, which pulls in git-compat-util.h, but this file does not depend
on anything else in CGit, so use git-compat-util.h directly.

Signed-off-by: John Keeping 
---
 configfile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configfile.c b/configfile.c
index 833f158..5b0d880 100644
--- a/configfile.c
+++ b/configfile.c
@@ -6,8 +6,7 @@
  *   (see COPYING for full license text)
  */
 
-#include 
-#include 
+#include 
 #include "configfile.h"
 
 static int next_char(FILE *f)
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 6/8] cgit.h: move stdbool.h from ui-shared.h

2015-08-13 Thread John Keeping
Follow the Git policy of including system headers in only one place.

Signed-off-by: John Keeping 
---
 cgit.h  | 2 ++
 ui-shared.h | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cgit.h b/cgit.h
index 3120562..508179a 100644
--- a/cgit.h
+++ b/cgit.h
@@ -3,6 +3,8 @@
 
 
 #include 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/ui-shared.h b/ui-shared.h
index 788b1bc..d8a3551 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -1,8 +1,6 @@
 #ifndef UI_SHARED_H
 #define UI_SHARED_H
 
-#include 
-
 extern const char *cgit_httpscheme();
 extern const char *cgit_hosturl();
 extern const char *cgit_rooturl();
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 0/8] Portability fixes

2015-08-13 Thread John Keeping
This is a collection of vaguely-related changes that make us take fuller
advantage of git.git's support for a variety of platform so that we
build more reliably out of the box.

The header ordering issue is definitely painful on Solaris where the
system headers define _FILE_OFFSET_BITS=32 if it's not already defined
and git-compat-util.h defines it to 64 unconditionally.


John Keeping (8):
  tests: allow shell to be overridden
  Makefile: include Git's config.mak.uname
  Remove redundant includes
  configfile.c: don't include system headers directly
  cache.c: fix header order
  cgit.h: move stdbool.h from ui-shared.h
  ui-tree: use "sane" isgraph()
  filter: don't use dlsym unnecessarily

 Makefile   |  1 +
 cache.c|  6 ++---
 cgit.h |  5 
 configfile.c   |  3 +--
 filter.c   | 84 +-
 html.c |  6 -
 shared.c   |  1 -
 tests/Makefile |  6 -
 ui-plain.c |  1 -
 ui-repolist.c  |  1 -
 ui-shared.h|  2 --
 ui-summary.c   |  1 -
 ui-tree.c  |  1 -
 13 files changed, 57 insertions(+), 61 deletions(-)

-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 3/8] Remove redundant includes

2015-08-13 Thread John Keeping
These are all included in git-compat-util.h (when necessary), which we
include in cgit.h.

Signed-off-by: John Keeping 
---
 filter.c  | 6 --
 html.c| 6 --
 shared.c  | 1 -
 ui-plain.c| 1 -
 ui-repolist.c | 1 -
 ui-summary.c  | 1 -
 6 files changed, 16 deletions(-)

diff --git a/filter.c b/filter.c
index ebf4937..c7037a3 100644
--- a/filter.c
+++ b/filter.c
@@ -8,13 +8,7 @@
 
 #include "cgit.h"
 #include "html.h"
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 #ifndef NO_LUA
 #include 
 #include 
diff --git a/html.c b/html.c
index 155cde5..a47cff0 100644
--- a/html.c
+++ b/html.c
@@ -8,12 +8,6 @@
 
 #include "cgit.h"
 #include "html.h"
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 /* Percent-encoding of each character, except: a-zA-Z0-9!$()*,./:;@- */
 static const char* url_escape_table[256] = {
diff --git a/shared.c b/shared.c
index 0431b59..3bd2a9e 100644
--- a/shared.c
+++ b/shared.c
@@ -7,7 +7,6 @@
  */
 
 #include "cgit.h"
-#include 
 
 struct cgit_repolist cgit_repolist;
 struct cgit_context ctx;
diff --git a/ui-plain.c b/ui-plain.c
index b787bc3..3a2cb47 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -6,7 +6,6 @@
  *   (see COPYING for full license text)
  */
 
-#include 
 #include "cgit.h"
 #include "ui-plain.h"
 #include "html.h"
diff --git a/ui-repolist.c b/ui-repolist.c
index edefc4c..43253ed 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -10,7 +10,6 @@
 #include "ui-repolist.h"
 #include "html.h"
 #include "ui-shared.h"
-#include 
 
 static time_t read_agefile(char *path)
 {
diff --git a/ui-summary.c b/ui-summary.c
index b0af073..a5c7078 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -13,7 +13,6 @@
 #include "ui-refs.h"
 #include "ui-blob.h"
 #include "ui-shared.h"
-#include 
 
 static int urls;
 
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 0/3] Fix date tooltips in the distant past

2015-08-13 Thread John Keeping
This addresses an oversight in commit caed6cb (ui-shared: show absolute
time in tooltip for relative dates, 2014-12-20) which missed the case
where we show a short date if a time is too long ago, which should also
show the full date as a tooltip.

The first two patches are preparatory refactoring and the final one is
the point of the series.

John Keeping (3):
  ui-shared: extract date formatting to a function
  ui-shared: use common function in print_rel_date()
  ui-shared: show full date in tooltip if longer ago than max_relative

 ui-shared.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 1/3] ui-shared: extract date formatting to a function

2015-08-13 Thread John Keeping
This will allow this code to be common with print_rel_date.

Signed-off-by: John Keeping 
---
 ui-shared.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index 6be0c2e..a6d4b65 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -604,19 +604,24 @@ void cgit_submodule_link(const char *class, char *path, 
const char *rev)
path[len - 1] = tail;
 }
 
-void cgit_print_date(time_t secs, const char *format, int local_time)
+static const char *fmt_date(time_t secs, const char *format, int local_time)
 {
-   char buf[64];
+   static char buf[64];
struct tm *time;
 
if (!secs)
-   return;
+   return "";
if (local_time)
time = localtime(&secs);
else
time = gmtime(&secs);
strftime(buf, sizeof(buf)-1, format, time);
-   html_txt(buf);
+   return buf;
+}
+
+void cgit_print_date(time_t secs, const char *format, int local_time)
+{
+   html_txt(fmt_date(secs, format, local_time));
 }
 
 static void print_rel_date(time_t t, double value,
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 3/3] ui-shared: show full date in tooltip if longer ago than max_relative

2015-08-13 Thread John Keeping
Commit caed6cb (ui-shared: show absolute time in tooltip for relative
dates, 2014-12-20) added a toolip when we show a relative time.

However, in some cases we show a short date (that is, the date but not
the time) if an event was sufficiently far in the past and that commit
did not update that case to add the same tooltip.

Signed-off-by: John Keeping 
---
 ui-shared.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/ui-shared.c b/ui-shared.c
index 792f3ee..57d7336 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -644,7 +644,11 @@ void cgit_print_age(time_t t, time_t max_relative, const 
char *format)
secs = 0;
 
if (secs > max_relative && max_relative >= 0) {
+   html("");
cgit_print_date(t, format, ctx.cfg.local_time);
+   html("");
return;
}
 
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 2/3] ui-shared: use common function in print_rel_date()

2015-08-13 Thread John Keeping
Signed-off-by: John Keeping 
---
 ui-shared.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index a6d4b65..792f3ee 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -627,17 +627,8 @@ void cgit_print_date(time_t secs, const char *format, int 
local_time)
 static void print_rel_date(time_t t, double value,
const char *class, const char *suffix)
 {
-   char buf[64];
-   struct tm *time;
-
-   if (ctx.cfg.local_time)
-   time = localtime(&t);
-   else
-   time = gmtime(&t);
-   strftime(buf, sizeof(buf) - 1, FMT_LONGDATE, time);
-
htmlf("%.0f %s", value, suffix);
 }
 
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH 3/8] Remove redundant includes

2015-08-13 Thread Jason A. Donenfeld
Do you have a clever tool of computing these automatically, or is this work
by hand?
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH 0/8] Portability fixes

2015-08-13 Thread Jason A. Donenfeld
Merged, thanks.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH 0/3] Fix date tooltips in the distant past

2015-08-13 Thread Jason A. Donenfeld
Excellent series, thank you.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH 3/8] Remove redundant includes

2015-08-13 Thread John Keeping
On Thu, Aug 13, 2015 at 03:36:48PM +0200, Jason A. Donenfeld wrote:
> Do you have a clever tool of computing these automatically, or is this work
> by hand?

By hand.  It boils down to checking against:

git grep '#include <'

and making sure that the relevant headers are indeed in
git-compat-util.h.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Fwd: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread Ferry Huberts




 Forwarded Message 
Subject: 	Build failed in Jenkins: cgit - upstream - get-git - master 
#190 - remotes/origin/master - a360666

Date:   Thu, 13 Aug 2015 15:43:11 +0200 (CEST)
From:   Pelagic Jenkins (Public) 
To: ferry.hube...@pelagic.nl



See 


Changes:

[ja...@zx2c4.com] tests: allow shell to be overridden

[ja...@zx2c4.com] Makefile: include Git's config.mak.uname

[ja...@zx2c4.com] Remove redundant includes

[ja...@zx2c4.com] configfile.c: don't include system headers directly

[ja...@zx2c4.com] cache.c: fix header order

[ja...@zx2c4.com] cgit.h: move stdbool.h from ui-shared.h

[ja...@zx2c4.com] ui-tree: use "sane" isgraph()

[ja...@zx2c4.com] filter: don't use dlsym unnecessarily

[ja...@zx2c4.com] ui-shared: extract date formatting to a function

[ja...@zx2c4.com] ui-shared: use common function in print_rel_date()

[ja...@zx2c4.com] ui-shared: show full date in tooltip if longer ago than 
max_relative

--
Started by an SCM change
Building in workspace 

 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://git.zx2c4.com/cgit # timeout=10
Pruning obsolete local branches
Fetching upstream changes from http://git.zx2c4.com/cgit
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress http://git.zx2c4.com/cgit 
+refs/heads/*:refs/remotes/origin/* --prune
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision a360666df3cfcd1b384cd66b18803d72e3893b3d 
(refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f a360666df3cfcd1b384cd66b18803d72e3893b3d
 > git rev-list c0b59823035efc136a82a96094d164a979d9b2e9 # timeout=10
Cleaning workspace
 > git rev-parse --verify HEAD # timeout=10
Resetting working tree
 > git reset --hard # timeout=10
 > git clean -fdx # timeout=10
[cgit_upstream_get-git_master] $ /bin/bash /tmp/hudson885616167373264074.sh
Makefile:36: git/config.mak.uname: No such file or directory
make: *** No rule to make target 'git/config.mak.uname'.  Stop.
Build step 'Execute shell' marked build as failure
Archiving artifacts



___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Fwd: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread Ferry Huberts

Maybe you guys can check my build server after merging commits? :-)

It runs Fedora 22, x86_64

On 13/08/15 16:28, Ferry Huberts wrote:




 Forwarded Message 
Subject:Build failed in Jenkins: cgit - upstream - get-git - master
#190 - remotes/origin/master - a360666
Date:   Thu, 13 Aug 2015 15:43:11 +0200 (CEST)
From:   Pelagic Jenkins (Public) 
To: ferry.hube...@pelagic.nl



See

Changes:

[ja...@zx2c4.com] tests: allow shell to be overridden

[ja...@zx2c4.com] Makefile: include Git's config.mak.uname

[ja...@zx2c4.com] Remove redundant includes

[ja...@zx2c4.com] configfile.c: don't include system headers directly

[ja...@zx2c4.com] cache.c: fix header order

[ja...@zx2c4.com] cgit.h: move stdbool.h from ui-shared.h

[ja...@zx2c4.com] ui-tree: use "sane" isgraph()

[ja...@zx2c4.com] filter: don't use dlsym unnecessarily

[ja...@zx2c4.com] ui-shared: extract date formatting to a function

[ja...@zx2c4.com] ui-shared: use common function in print_rel_date()

[ja...@zx2c4.com] ui-shared: show full date in tooltip if longer ago than 
max_relative

--
Started by an SCM change
Building in 
workspace
  > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
  > git config remote.origin.urlhttp://git.zx2c4.com/cgit  # timeout=10
Pruning obsolete local branches
Fetching upstream changes fromhttp://git.zx2c4.com/cgit
  > git --version # timeout=10
  > git -c core.askpass=true fetch --tags --progresshttp://git.zx2c4.com/cgit  
+refs/heads/*:refs/remotes/origin/* --prune
  > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
  > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision a360666df3cfcd1b384cd66b18803d72e3893b3d 
(refs/remotes/origin/master)
  > git config core.sparsecheckout # timeout=10
  > git checkout -f a360666df3cfcd1b384cd66b18803d72e3893b3d
  > git rev-list c0b59823035efc136a82a96094d164a979d9b2e9 # timeout=10
Cleaning workspace
  > git rev-parse --verify HEAD # timeout=10
Resetting working tree
  > git reset --hard # timeout=10
  > git clean -fdx # timeout=10
[cgit_upstream_get-git_master] $ /bin/bash /tmp/hudson885616167373264074.sh
Makefile:36: git/config.mak.uname: No such file or directory
make: *** No rule to make target 'git/config.mak.uname'.  Stop.
Build step 'Execute shell' marked build as failure
Archiving artifacts





___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit



--
Ferry Huberts
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread Jason A. Donenfeld
John -- why are their circumstances in which your config.mak.uname isn't
created?
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread Ferry Huberts



On 13/08/15 16:32, Jason A. Donenfeld wrote:

John -- why are their circumstances in which your config.mak.uname isn't
created?


It's in the 'get-git' build.
So that is the build in which git is built from a 'release' tar instead 
of from its repo



--
Ferry Huberts
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread John Keeping
On Thu, Aug 13, 2015 at 04:35:51PM +0200, Ferry Huberts wrote:
> 
> 
> On 13/08/15 16:32, Jason A. Donenfeld wrote:
> > John -- why are their circumstances in which your config.mak.uname isn't
> > created?
> 
> It's in the 'get-git' build.
> So that is the build in which git is built from a 'release' tar instead 
> of from its repo

And the problem is in the "get-git" stage, at which point the "git"
directory doesn't exist.

This fixes it:

-- >8 --
Subject: [PATCH] Makefile: make "git/config.mak.uname" inclusion optional

If we haven't got a "git" directory, it should still be possible to run
"make get-git", so we cannot include this file unconditionally.

Signed-off-by: John Keeping 
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 74061a3..a0a6615 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ DOC_PDF  = $(patsubst %.txt,%.pdf,$(MAN_TXT))
 
 #-include config.mak
 
-include git/config.mak.uname
+-include git/config.mak.uname
 #
 # Let the user override the above settings.
 #
-- 
2.5.0.466.g9af26fa

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread Jason A. Donenfeld
Thanks for the fix John. All set now.
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Build failed in Jenkins: cgit - upstream - get-git - master #190 - remotes/origin/master - a360666

2015-08-13 Thread Ferry Huberts
I've talked to Jason and from now on my build server will also send 
email to the cgit-dev list upon build failures.


That might give some noise when I'm fiddling with the build server, but 
I'll try to avoid that.


On 13/08/15 17:05, Jason A. Donenfeld wrote:

Thanks for the fix John. All set now.



--
Ferry Huberts
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 1/1] make sure to send http headers

2015-08-13 Thread Christian Hesse
From: Christian Hesse 

Requesting a text/plain patch with bad commit id made cgit send text
without proper http headers. This results in "500 Internal Server Error"
with "Premature end of script headers" in server logs.
So print http headers before error message and return.

Signed-off-by: Christian Hesse 
---
 ui-patch.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/ui-patch.c b/ui-patch.c
index 6ec89b4..57ca2f8 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -25,21 +25,25 @@ void cgit_print_patch(const char *new_rev, const char 
*old_rev,
new_rev = ctx.qry.head;
 
if (get_sha1(new_rev, new_rev_sha1)) {
+   cgit_print_http_headers();
cgit_print_error("Bad object id: %s", new_rev);
return;
}
commit = lookup_commit_reference(new_rev_sha1);
if (!commit) {
+   cgit_print_http_headers();
cgit_print_error("Bad commit reference: %s", new_rev);
return;
}
 
if (old_rev) {
if (get_sha1(old_rev, old_rev_sha1)) {
+   cgit_print_http_headers();
cgit_print_error("Bad object id: %s", old_rev);
return;
}
if (!lookup_commit_reference(old_rev_sha1)) {
+   cgit_print_http_headers();
cgit_print_error("Bad commit reference: %s", old_rev);
return;
}
-- 
2.5.0

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit