<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/strbuf.c, branch v2.13.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.13.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.13.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-03-30T21:07:15Z</updated>
<entry>
<title>Merge branch 'rs/freebsd-getcwd-workaround'</title>
<updated>2017-03-30T21:07:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-03-30T21:07:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=49a8fe8e962ed929cf5bed5520e581025f5bfe9a'/>
<id>urn:sha1:49a8fe8e962ed929cf5bed5520e581025f5bfe9a</id>
<content type='text'>
FreeBSD implementation of getcwd(3) behaved differently when an
intermediate directory is unreadable/unsearchable depending on the
length of the buffer provided, which our strbuf_getcwd() was not
aware of.  strbuf_getcwd() has been taught to cope with it better.

* rs/freebsd-getcwd-workaround:
  strbuf: support long paths w/o read rights in strbuf_getcwd() on FreeBSD
</content>
</entry>
<entry>
<title>strbuf: support long paths w/o read rights in strbuf_getcwd() on FreeBSD</title>
<updated>2017-03-27T00:41:05Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-03-26T13:43:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a54e938e5b53c76ebcd5c068a4f74739c1c68bac'/>
<id>urn:sha1:a54e938e5b53c76ebcd5c068a4f74739c1c68bac</id>
<content type='text'>
FreeBSD implements getcwd(3) as a syscall, but falls back to a version
based on readdir(3) if it fails for some reason.  The latter requires
permissions to read and execute path components, while the former does
not.  That means that if our buffer is too small and we're missing
rights we could get EACCES, but we may succeed with a bigger buffer.

Keep retrying if getcwd(3) indicates lack of permissions until our
buffer can fit PATH_MAX bytes, as that's the maximum supported by the
syscall on FreeBSD anyway.  This way we do what we can to be able to
benefit from the syscall, but we also won't loop forever if there is a
real permission issue.

This fixes a regression introduced with 7333ed17 (setup: convert
setup_git_directory_gently_1 et al. to strbuf, 2014-07-28) for paths
longer than 127 bytes with components that miss read or execute
permissions (e.g. 0711 on /home for privacy reasons); we used a fixed
PATH_MAX-sized buffer before.

Reported-by: Zenobiusz Kunegunda &lt;zenobiusz.kunegunda@interia.pl&gt;
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>strbuf: add strbuf_add_real_path()</title>
<updated>2017-02-27T19:02:06Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-02-25T16:00:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=33ad9ddd0b5398063f0aabea639b5fe569f458ea'/>
<id>urn:sha1:33ad9ddd0b5398063f0aabea639b5fe569f458ea</id>
<content type='text'>
Add a function for appending the canonized absolute pathname of a given
path to a strbuf.  It keeps the existing contents intact, as expected of
a function of the strbuf_add() family, while avoiding copying the result
if the given strbuf is empty.  It's more consistent with the rest of the
strbuf API than strbuf_realpath(), which it's wrapping.

Also add a semantic patch demonstrating its intended usage and apply it
to the current tree.  Using strbuf_add_real_path() instead of calling
strbuf_addstr() and real_path() avoids an extra copy to a static buffer.

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>link_alt_odb_entry: handle normalize_path errors</title>
<updated>2016-10-10T20:52:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-10-03T20:34:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=670c359da357639f9f9a814ed646b4d854ec5d55'/>
<id>urn:sha1:670c359da357639f9f9a814ed646b4d854ec5d55</id>
<content type='text'>
When we add a new alternate to the list, we try to normalize
out any redundant "..", etc. However, we do not look at the
return value of normalize_path_copy(), and will happily
continue with a path that could not be normalized. Worse,
the normalizing process is done in-place, so we are left
with whatever half-finished working state the normalizing
function was in.

Fortunately, this cannot cause us to read past the end of
our buffer, as that working state will always leave the
NUL from the original path in place. And we do tend to
notice problems when we check is_directory() on the path.
But you can see the nonsense that we feed to is_directory
with an entry like:

  this/../../is/../../way/../../too/../../deep/../../to/../../resolve

in your objects/info/alternates, which yields:

  error: object directory
  /to/e/deep/too/way//ects/this/../../is/../../way/../../too/../../deep/../../to/../../resolve
  does not exist; check .git/objects/info/alternates.

We can easily fix this just by checking the return value.
But that makes it hard to generate a good error message,
since we're normalizing in-place and our input value has
been overwritten by cruft.

Instead, let's provide a strbuf helper that does an in-place
normalize, but restores the original contents on error. This
uses a second buffer under the hood, which is slightly less
efficient, but this is not a performance-critical code path.

The strbuf helper can also properly set the "len" parameter
of the strbuf before returning. Just doing:

  normalize_path_copy(buf.buf, buf.buf);

will shorten the string, but leave buf.len at the original
length. That may be confusing to later code which uses the
strbuf.

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>Merge branch 'rs/strbuf-remove-fix'</title>
<updated>2016-09-21T22:15:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-09-21T22:15:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ba0bbb901c6fdb092944bced927a10a1ed25bf5'/>
<id>urn:sha1:3ba0bbb901c6fdb092944bced927a10a1ed25bf5</id>
<content type='text'>
Code cleanup.

* rs/strbuf-remove-fix:
  strbuf: use valid pointer in strbuf_remove()
</content>
</entry>
<entry>
<title>strbuf: use valid pointer in strbuf_remove()</title>
<updated>2016-09-13T23:07:37Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-09-13T16:40:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a8342a417e48385f7ebc19ab46a940ea1fa060ae'/>
<id>urn:sha1:a8342a417e48385f7ebc19ab46a940ea1fa060ae</id>
<content type='text'>
The fourth argument of strbuf_splice() is passed to memcpy(3), which is
not supposed to handle NULL pointers.  Let's be extra careful and use a
valid empty string instead.  It even shortens the source code. :)

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>Merge branch 'rs/use-strbuf-addbuf'</title>
<updated>2016-07-25T21:13:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-07-25T21:13:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b4e8a847ba4e775fb7d422b2daf18356db50eec8'/>
<id>urn:sha1:b4e8a847ba4e775fb7d422b2daf18356db50eec8</id>
<content type='text'>
Code cleanup.

* rs/use-strbuf-addbuf:
  strbuf: avoid calling strbuf_grow() twice in strbuf_addbuf()
  use strbuf_addbuf() for appending a strbuf to another
</content>
</entry>
<entry>
<title>strbuf: avoid calling strbuf_grow() twice in strbuf_addbuf()</title>
<updated>2016-07-22T16:22:26Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-07-21T16:46:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=31471ba21ee29886ab856981e52f723c913d7f40'/>
<id>urn:sha1:31471ba21ee29886ab856981e52f723c913d7f40</id>
<content type='text'>
Implement strbuf_addbuf() as a normal function in order to avoid calling
strbuf_grow() twice, with the second callinside strbud_add() being a
no-op.  This is slightly faster and also reduces the text size a bit.

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>Merge branch 'jk/getwholeline-getdelim-empty' into maint</title>
<updated>2016-04-15T01:57:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-04-15T01:57:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f55f97cb3307f49e6b15d9f0145b6d3f00b22ff7'/>
<id>urn:sha1:f55f97cb3307f49e6b15d9f0145b6d3f00b22ff7</id>
<content type='text'>
strbuf_getwholeline() did not NUL-terminate the buffer on certain
corner cases in its error codepath.

* jk/getwholeline-getdelim-empty:
  strbuf_getwholeline: NUL-terminate getdelim buffer on error
</content>
</entry>
<entry>
<title>Merge branch 'sb/submodule-parallel-update'</title>
<updated>2016-04-06T18:39:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-04-06T18:39:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bdebbeb3346e9867005947aff356b99a7358e5ab'/>
<id>urn:sha1:bdebbeb3346e9867005947aff356b99a7358e5ab</id>
<content type='text'>
A major part of "git submodule update" has been ported to C to take
advantage of the recently added framework to run download tasks in
parallel.

* sb/submodule-parallel-update:
  clone: allow an explicit argument for parallel submodule clones
  submodule update: expose parallelism to the user
  submodule helper: remove double 'fatal: ' prefix
  git submodule update: have a dedicated helper for cloning
  run_processes_parallel: rename parameters for the callbacks
  run_processes_parallel: treat output of children as byte array
  submodule update: direct error message to stderr
  fetching submodules: respect `submodule.fetchJobs` config option
  submodule-config: drop check against NULL
  submodule-config: keep update strategy around
</content>
</entry>
</feed>
