<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cgit/cache.c, branch v0.12</title>
<subtitle>A hyperfast web frontend for git repositories written in C.</subtitle>
<id>http://git.cetero.st/cgit/atom/cache.c?h=v0.12</id>
<link rel='self' href='http://git.cetero.st/cgit/atom/cache.c?h=v0.12'/>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/'/>
<updated>2015-10-10T19:41:04Z</updated>
<entry>
<title>cache: fix resource leak: close file handle before return</title>
<updated>2015-10-10T19:41:04Z</updated>
<author>
<name>Christian Hesse</name>
<email>mail@eworm.de</email>
</author>
<published>2015-10-10T14:56:28Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=76dc7a3371e487fdc9de7b3b4c991fe370598f0e'/>
<id>urn:sha1:76dc7a3371e487fdc9de7b3b4c991fe370598f0e</id>
<content type='text'>
Coverity-id: 13910
Signed-off-by: Christian Hesse &lt;mail@eworm.de&gt;
</content>
</entry>
<entry>
<title>cache.c: fix header order</title>
<updated>2015-08-13T13:37:42Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2015-08-13T11:14:17Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=43620cf6aa62decaf319d00c28297e3b87a4da78'/>
<id>urn:sha1:43620cf6aa62decaf319d00c28297e3b87a4da78</id>
<content type='text'>
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 &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>cache: don't use an integer as a NULL pointer</title>
<updated>2015-03-09T16:40:44Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2015-03-08T16:32:26Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=80d52079f7f58d273d99745f93909e5c6524a9bd'/>
<id>urn:sha1:80d52079f7f58d273d99745f93909e5c6524a9bd</id>
<content type='text'>
Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>cache: use F_SETLK to avoid stale lock files</title>
<updated>2015-03-03T22:55:27Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2015-03-03T19:22:31Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=db9a70b159a107da29f88865d63ba14dd127556f'/>
<id>urn:sha1:db9a70b159a107da29f88865d63ba14dd127556f</id>
<content type='text'>
If CGit is killed while it holds a lock on a cache slot (for example
because it is taking too long to generate a page), the lock file will be
left in place.  This prevents any future attempt to use the same slot
since it will fail to exclusively create the lock file.

Since CGit is the only program that should be manipulating lock files,
we can use advisory locking to detect whether another process is
actually using the lock file or if it is now stale.

I have confirmed that this works on Linux by setting a short TTL in a
custom cgitrc and running the following with CGit patched to print a
message to stderr if the fcntl(2) fails:

	$ export CGIT_CONFIG=$PWD/cgitrc
	$ export QUERY_STRING=url=cgit/tree/ui-shared.c
	$ ./cgit |
		grep -v -e '^&lt;div class=.footer.&gt;' \
			-e '^Last-Modified: ' \
			-e ^'Expires: ' &gt;expect
	$ seq 50000 | dd bs=8192 |
		parallel -j200 "diff -u expect &lt;(./cgit |
			grep -v -e '^&lt;div class=.footer.&gt;' \
				-e '^Last-Modified: ' \
				-e ^'Expires: ') || echo BAD"

This printed the fail message several times without ever printing "BAD".

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>Skip cache slot when time-to-live is zero</title>
<updated>2014-02-21T00:19:45Z</updated>
<author>
<name>Lukas Fleischer</name>
<email>cgit@cryptocrack.de</email>
</author>
<published>2014-02-20T19:59:22Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=6ceba453a27ead382d0116d95bdeb6b6be1149e2'/>
<id>urn:sha1:6ceba453a27ead382d0116d95bdeb6b6be1149e2</id>
<content type='text'>
If time-to-live is set to zero, we don't need to regenerate the cache
slots on every request. Instead, just skip the caching process and
immediately provide the dynamically generated version of the page.
Setting time-to-live to zero is useful when you want to disable caching
for certain pages.

Signed-off-by: Lukas Fleischer &lt;cgit@cryptocrack.de&gt;
</content>
</entry>
<entry>
<title>cache: use sendfile() instead of a pair of read() + write()</title>
<updated>2014-01-19T14:08:49Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>sebastian@breakpoint.cc</email>
</author>
<published>2014-01-18T20:24:58Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=d3581b58890389794de5d5222c91a0129873e95c'/>
<id>urn:sha1:d3581b58890389794de5d5222c91a0129873e95c</id>
<content type='text'>
sendfile() does the same job and avoids to copy the content into userland
and back. One has to define NO_SENDFILE in case the OS (kernel / libc)
does not supported. It is disabled by default on non-linux environemnts.
According to the glibc, sendfile64() was added in Linux 2.4 (so it has
been there for a while) but after browsing over the mapage of FreeBSD's I
noticed that the prototype is little different.

Signed-off-by: Sebastian Andrzej Siewior &lt;sebastian@breakpoint.cc&gt;
</content>
</entry>
<entry>
<title>Switch to exclusively using global ctx</title>
<updated>2014-01-16T23:44:54Z</updated>
<author>
<name>Lukas Fleischer</name>
<email>cgit@cryptocrack.de</email>
</author>
<published>2014-01-15T20:53:15Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=f60ffa143cca61e9729ac71033e1a556cf422871'/>
<id>urn:sha1:f60ffa143cca61e9729ac71033e1a556cf422871</id>
<content type='text'>
Drop the context parameter from the following functions (and all static
helpers used by them) and use the global context instead:

* cgit_print_http_headers()
* cgit_print_docstart()
* cgit_print_pageheader()

Remove context parameter from all commands

Drop the context parameter from the following functions (and all static
helpers used by them) and use the global context instead:

* cgit_get_cmd()
* All cgit command functions.
* cgit_clone_info()
* cgit_clone_objects()
* cgit_clone_head()
* cgit_print_plain()
* cgit_show_stats()

In initialization routines, use the global context variable instead of
passing a pointer around locally.

Remove callback data parameter for cache slots

This is no longer needed since the context is always read from the
global context variable.

Signed-off-by: Lukas Fleischer &lt;cgit@cryptocrack.de&gt;
</content>
</entry>
<entry>
<title>cache: don't leave cache_slot fields uninitialized</title>
<updated>2014-01-12T18:32:20Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2014-01-12T16:49:40Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=382ecf152e1bd9546f6c84ace71c62ca07f6648b'/>
<id>urn:sha1:382ecf152e1bd9546f6c84ace71c62ca07f6648b</id>
<content type='text'>
Valgrind says:

==18344== Conditional jump or move depends on uninitialised value(s)
==18344==    at 0x406C83: open_slot (cache.c:63)
==18344==    by 0x407478: cache_ls (cache.c:403)
==18344==    by 0x404C9A: process_request (cgit.c:639)
==18344==    by 0x406BD2: fill_slot (cache.c:190)
==18344==    by 0x4071A0: cache_process (cache.c:284)
==18344==    by 0x404461: main (cgit.c:952)
==18344==  Uninitialised value was created by a stack allocation
==18344==    at 0x40738B: cache_ls (cache.c:375)

This is caused by the keylen field being used to calculate whether or
not a slot is matched.  We never then check the value of this and the
length of data read depends on the key length read from the file so this
isn't dangerous, but it's nice to avoid branching based on uninitialized
data.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
<entry>
<title>Update copyright information</title>
<updated>2014-01-08T14:10:49Z</updated>
<author>
<name>Lukas Fleischer</name>
<email>cgit@crytocrack.de</email>
</author>
<published>2014-01-08T14:10:49Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=f7f26f88755ac6a3b9af4918b51b0d6e7a692c78'/>
<id>urn:sha1:f7f26f88755ac6a3b9af4918b51b0d6e7a692c78</id>
<content type='text'>
* Name "cgit Development Team" as copyright holder to avoid listing
  every single developer.

* Update copyright ranges.

Signed-off-by: Lukas Fleischer &lt;cgit@crytocrack.de&gt;
</content>
</entry>
<entry>
<title>cache.c: cache ls_cache output properly</title>
<updated>2013-05-22T10:53:06Z</updated>
<author>
<name>John Keeping</name>
<email>john@keeping.me.uk</email>
</author>
<published>2013-05-18T17:46:39Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=f32a2da636ffa6eaa6b8d0d3f35a673fa12e404a'/>
<id>urn:sha1:f32a2da636ffa6eaa6b8d0d3f35a673fa12e404a</id>
<content type='text'>
By using the standard library's printf, cache_ls does not redirect its
output to the cache when we change the process' stdout file descriptor
to point to the cache file.  Fix this by using "htmlf" in the same way
that we do for writing HTTP headers.

Signed-off-by: John Keeping &lt;john@keeping.me.uk&gt;
</content>
</entry>
</feed>
