<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/daemon.c, branch v2.9.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.9.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.9.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-05-25T16:42:53Z</updated>
<entry>
<title>daemon: enable SO_KEEPALIVE for all sockets</title>
<updated>2016-05-25T16:42:53Z</updated>
<author>
<name>Eric Wong</name>
<email>e@80x24.org</email>
</author>
<published>2016-05-25T03:15:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a43b68a196652a0c6b054ee4905ac98d1cdcbbb9'/>
<id>urn:sha1:a43b68a196652a0c6b054ee4905ac98d1cdcbbb9</id>
<content type='text'>
While --init-timeout and --timeout options exist and I've never
run git-daemon without them, some users may forget to set them
and encounter hung daemon processes when connections fail.
Enable socket-level timeouts so the kernel can send keepalive
probes as necessary to detect failed connections.

Signed-off-by: Eric Wong &lt;e@80x24.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/tighten-alloc'</title>
<updated>2016-02-26T21:37:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-02-26T21:37:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=11529ecec914d2f0d7575e6d443c2d5a6ff75424'/>
<id>urn:sha1:11529ecec914d2f0d7575e6d443c2d5a6ff75424</id>
<content type='text'>
Update various codepaths to avoid manually-counted malloc().

* jk/tighten-alloc: (22 commits)
  ewah: convert to REALLOC_ARRAY, etc
  convert ewah/bitmap code to use xmalloc
  diff_populate_gitlink: use a strbuf
  transport_anonymize_url: use xstrfmt
  git-compat-util: drop mempcpy compat code
  sequencer: simplify memory allocation of get_message
  test-path-utils: fix normalize_path_copy output buffer size
  fetch-pack: simplify add_sought_entry
  fast-import: simplify allocation in start_packfile
  write_untracked_extension: use FLEX_ALLOC helper
  prepare_{git,shell}_cmd: use argv_array
  use st_add and st_mult for allocation size computation
  convert trivial cases to FLEX_ARRAY macros
  use xmallocz to avoid size arithmetic
  convert trivial cases to ALLOC_ARRAY
  convert manual allocations to argv_array
  argv-array: add detach function
  add helpers for allocating flex-array structs
  harden REALLOC_ARRAY and xcalloc against size_t overflow
  tree-diff: catch integer overflow in combine_diff_path allocation
  ...
</content>
</entry>
<entry>
<title>convert manual allocations to argv_array</title>
<updated>2016-02-22T22:50:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:44:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=850d2fec53ee188bab9e458f77906041ac7f1904'/>
<id>urn:sha1:850d2fec53ee188bab9e458f77906041ac7f1904</id>
<content type='text'>
There are many manual argv allocations that predate the
argv_array API. Switching to that API brings a few
advantages:

  1. We no longer have to manually compute the correct final
     array size (so it's one less thing we can screw up).

  2. In many cases we had to make a separate pass to count,
     then allocate, then fill in the array. Now we can do it
     in one pass, making the code shorter and easier to
     follow.

  3. argv_array handles memory ownership for us, making it
     more obvious when things should be free()d and and when
     not.

Most of these cases are pretty straightforward. In some, we
switch from "run_command_v" to "run_command" which lets us
directly use the argv_array embedded in "struct
child_process".

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>strbuf: introduce strbuf_getline_{lf,nul}()</title>
<updated>2016-01-15T18:12:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-01-13T23:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f309aeb8225a9c26f20c0dbc031f1ea8df75d49'/>
<id>urn:sha1:8f309aeb8225a9c26f20c0dbc031f1ea8df75d49</id>
<content type='text'>
The strbuf_getline() interface allows a byte other than LF or NUL as
the line terminator, but this is only because I wrote these
codepaths anticipating that there might be a value other than NUL
and LF that could be useful when I introduced line_termination long
time ago.  No useful caller that uses other value has emerged.

By now, it is clear that the interface is overly broad without a
good reason.  Many codepaths have hardcoded preference to read
either LF terminated or NUL terminated records from their input, and
then call strbuf_getline() with LF or NUL as the third parameter.

This step introduces two thin wrappers around strbuf_getline(),
namely, strbuf_getline_lf() and strbuf_getline_nul(), and
mechanically rewrites these call sites to call either one of
them.  The changes contained in this patch are:

 * introduction of these two functions in strbuf.[ch]

 * mechanical conversion of all callers to strbuf_getline() with
   either '\n' or '\0' as the third parameter to instead call the
   respective thin wrapper.

After this step, output from "git grep 'strbuf_getline('" would
become a lot smaller.  An interim goal of this series is to make
this an empty set, so that we can have strbuf_getline_crlf() take
over the shorter name strbuf_getline().

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/daemon-plug-child-leak'</title>
<updated>2015-11-03T23:13:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-11-03T23:13:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c3c592ef95ee21833e2214fb9068889dcac220c9'/>
<id>urn:sha1:c3c592ef95ee21833e2214fb9068889dcac220c9</id>
<content type='text'>
"git daemon" uses "run_command()" without "finish_command()", so it
needs to release resources itself, which it forgot to do.

* rs/daemon-plug-child-leak:
  daemon: plug memory leak
  run-command: factor out child_process_clear()
</content>
</entry>
<entry>
<title>daemon: plug memory leak</title>
<updated>2015-11-02T23:01:23Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2015-10-24T12:23:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b1b49ff8d42a21ade6a72b40a147fd3eaff3db8d'/>
<id>urn:sha1:b1b49ff8d42a21ade6a72b40a147fd3eaff3db8d</id>
<content type='text'>
Call child_process_clear() when a child ends to release the memory
allocated for its environment.  This is necessary because unlike all
other users of start_command() we don't call finish_command(), which
would have taken care of that for us.

This leak was introduced by f063d38b (daemon: use cld-&gt;env_array
when re-spawning).

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>daemon: use cld-&gt;env_array when re-spawning</title>
<updated>2015-10-05T18:08:05Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:08:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f063d38b808e184675e5b0931ea0167a013b3fcb'/>
<id>urn:sha1:f063d38b808e184675e5b0931ea0167a013b3fcb</id>
<content type='text'>
This avoids an ugly strcat into a fixed-size buffer. It's
not wrong (the buffer is plenty large enough for an IPv6
address plus some minor formatting), but it takes some
effort to verify that.

Unfortunately we are still stuck with some fixed-size
buffers to hold the output of inet_ntop. But at least we now
pass very easy-to-verify parameters, rather than doing a
manual computation to account for other data in the buffer.

As a side effect, this also fixes the case where we might
pass an uninitialized portbuf buffer through the
environment. This probably couldn't happen in practice, as
it would mean that addr-&gt;sa_family was neither AF_INET nor
AF_INET6 (and that is all we are listening on).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert trivial sprintf / strcpy calls to xsnprintf</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:06:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5096d4909f9b13c7a650d9dbb7c9702ea7413566'/>
<id>urn:sha1:5096d4909f9b13c7a650d9dbb7c9702ea7413566</id>
<content type='text'>
We sometimes sprintf into fixed-size buffers when we know
that the buffer is large enough to fit the input (either
because it's a constant, or because it's numeric input that
is bounded in size). Likewise with strcpy of constant
strings.

However, these sites make it hard to audit sprintf and
strcpy calls for buffer overflows, as a reader has to
cross-reference the size of the array with the input. Let's
use xsnprintf instead, which communicates to a reader that
we don't expect this to overflow (and catches the mistake in
case we do).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_file(): drop caller-supplied LF from calls to create a one-liner file</title>
<updated>2015-08-25T19:49:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-24T20:20:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1f76a10b2d72245332ac41bd79249cb82f3946f0'/>
<id>urn:sha1:1f76a10b2d72245332ac41bd79249cb82f3946f0</id>
<content type='text'>
All of the callsites covered by this change call write_file() or
write_file_gently() to create a one-liner file.  Drop the caller
supplied LF and let these callees to append it as necessary.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_file(): drop "fatal" parameter</title>
<updated>2015-08-24T20:09:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-24T20:03:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12d6ce1dba504dfc5279b8d24da3edb4865c2820'/>
<id>urn:sha1:12d6ce1dba504dfc5279b8d24da3edb4865c2820</id>
<content type='text'>
All callers except three passed 1 for the "fatal" parameter to ask
this function to die upon error, but to a casual reader of the code,
it was not all obvious what that 1 meant.  Instead, split the
function into two based on a common write_file_v() that takes the
flag, introduce write_file_gently() as a new way to attempt creating
a file without dying on error, and make three callers to call it.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
