<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/entry.c, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-03-25T18:07:09Z</updated>
<entry>
<title>Merge branch 'mh/remove-subtree-long-pathname-fix'</title>
<updated>2014-03-25T18:07:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-25T18:07:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec8cd4fc111266e005d1a1bc3d4b388564105ce2'/>
<id>urn:sha1:ec8cd4fc111266e005d1a1bc3d4b388564105ce2</id>
<content type='text'>
* mh/remove-subtree-long-pathname-fix:
  entry.c: fix possible buffer overflow in remove_subtree()
  checkout_entry(): use the strbuf throughout the function
</content>
</entry>
<entry>
<title>entry.c: fix possible buffer overflow in remove_subtree()</title>
<updated>2014-03-13T17:57:48Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-03-13T09:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f29e0c6fa5d312c4e0675b0dd23d3126b9f55fa'/>
<id>urn:sha1:2f29e0c6fa5d312c4e0675b0dd23d3126b9f55fa</id>
<content type='text'>
remove_subtree() manipulated path in a fixed-size buffer even though
the length of the input, let alone the length of entries within the
directory, were not known in advance.  Change the function to take a
strbuf argument and use that object as its scratch space.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>checkout_entry(): use the strbuf throughout the function</title>
<updated>2014-03-13T17:56:50Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-03-13T09:19:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f63272a35e03a9895c468d1a698dabaa4c3d9273'/>
<id>urn:sha1:f63272a35e03a9895c468d1a698dabaa4c3d9273</id>
<content type='text'>
There is no need to break out the "buf" and "len" members into
separate temporary variables.  Rename path_buf to path and use
path.buf and path.len directly.  This makes it easier to reason about
the data flow in the function.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>checkout_entry(): clarify the use of topath[] parameter</title>
<updated>2013-10-24T21:59:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-10-23T17:52:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=af2a651d2ecb3967244c9a44a5813a0cf9977df5'/>
<id>urn:sha1:af2a651d2ecb3967244c9a44a5813a0cf9977df5</id>
<content type='text'>
The said function has this signature:

	extern int checkout_entry(struct cache_entry *ce,
				  const struct checkout *state,
				  char *topath);

At first glance, it might appear that the caller of checkout_entry()
can specify to which path the contents are written out by the last
parameter, and it is tempting to add "const" in front of its type.

In reality, however, topath[] is to point at a buffer to store the
temporary path generated by the callchain originating from this
function, and the temporary path is always short, much shorter than
the buffer prepared by its only caller in builtin/checkout-index.c.

Document the code a bit to clarify so that future callers know how
to use the function better.

Noticed-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>entry.c: convert checkout_entry to use strbuf</title>
<updated>2013-10-24T21:58:37Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2013-10-24T01:55:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd356f6aa8bb75ebef56fbc61caf7e02517fa6d3'/>
<id>urn:sha1:fd356f6aa8bb75ebef56fbc61caf7e02517fa6d3</id>
<content type='text'>
The old code does not do boundary check so any paths longer than
PATH_MAX can cause buffer overflow. Replace it with strbuf to handle
paths of arbitrary length.

The OS may reject if the path is too long though. But in that case we
report the cause (e.g. name too long) and usually move on to checking
out the next entry.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/const-struct-cache-entry'</title>
<updated>2013-07-22T18:24:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-07-22T18:24:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d3aeb31dc410a71ee41b87328f0d71996417294f'/>
<id>urn:sha1:d3aeb31dc410a71ee41b87328f0d71996417294f</id>
<content type='text'>
* nd/const-struct-cache-entry:
  Convert "struct cache_entry *" to "const ..." wherever possible
</content>
</entry>
<entry>
<title>apply, entry: speak of submodules instead of subprojects</title>
<updated>2013-07-18T17:56:06Z</updated>
<author>
<name>Thomas Rast</name>
<email>trast@inf.ethz.ch</email>
</author>
<published>2013-07-18T12:26:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=42063f95a0f285382458f357bd256df252000ef1'/>
<id>urn:sha1:42063f95a0f285382458f357bd256df252000ef1</id>
<content type='text'>
There are only four (with some generous rounding) instances in the
current source code where we speak of "subproject" instead of
"submodule".  They are as follows:

* one error message in git-apply and two in entry.c

* the patch format for submodule changes

The latter was introduced in 0478675 (Expose subprojects as special
files to "git diff" machinery, 2007-04-15), apparently before the
terminology was settled.  We can of course not change the patch
format.

Let's at least change the error messages to consistently call them
"submodule".

Signed-off-by: Thomas Rast &lt;trast@inf.ethz.ch&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert "struct cache_entry *" to "const ..." wherever possible</title>
<updated>2013-07-09T16:12:48Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2013-07-09T15:29:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9c5e6c802cde9881785b7f1b3278b97be4aabd82'/>
<id>urn:sha1:9c5e6c802cde9881785b7f1b3278b97be4aabd82</id>
<content type='text'>
I attempted to make index_state-&gt;cache[] a "const struct cache_entry **"
to find out how existing entries in index are modified and where. The
question I have is what do we do if we really need to keep track of on-disk
changes in the index. The result is

 - diff-lib.c: setting CE_UPTODATE

 - name-hash.c: setting CE_HASHED

 - preload-index.c, read-cache.c, unpack-trees.c and
   builtin/update-index: obvious

 - entry.c: write_entry() may refresh the checked out entry via
   fill_stat_cache_info(). This causes "non-const struct cache_entry
   *" in builtin/apply.c, builtin/checkout-index.c and
   builtin/checkout.c

 - builtin/ls-files.c: --with-tree changes stagemask and may set
   CE_UPDATE

Of these, write_entry() and its call sites are probably most
interesting because it modifies on-disk info. But this is stat info
and can be retrieved via refresh, at least for porcelain
commands. Other just uses ce_flags for local purposes.

So, keeping track of "dirty" entries is just a matter of setting a
flag in index modification functions exposed by read-cache.c. Except
unpack-trees, the rest of the code base does not do anything funny
behind read-cache's back.

The actual patch is less valueable than the summary above. But if
anyone wants to re-identify the above sites. Applying this patch, then
this:

    diff --git a/cache.h b/cache.h
    index 430d021..1692891 100644
    --- a/cache.h
    +++ b/cache.h
    @@ -267,7 +267,7 @@ static inline unsigned int canon_mode(unsigned int mode)
     #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)

     struct index_state {
    -	struct cache_entry **cache;
    +	const struct cache_entry **cache;
     	unsigned int version;
     	unsigned int cache_nr, cache_alloc, cache_changed;
     	struct string_list *resolve_undo;

will help quickly identify them without bogus warnings.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/check-corrupt-objects-carefully'</title>
<updated>2013-04-03T16:34:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-04-03T16:34:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b9c78e97237df7df45549d29755e51b4a0fdc5ea'/>
<id>urn:sha1:b9c78e97237df7df45549d29755e51b4a0fdc5ea</id>
<content type='text'>
Have the streaming interface and other codepaths more carefully
examine for corrupt objects.

* jk/check-corrupt-objects-carefully:
  clone: leave repo in place after checkout errors
  clone: run check_everything_connected
  clone: die on errors from unpack_trees
  add tests for cloning corrupted repositories
  streaming_write_entry: propagate streaming errors
  add test for streaming corrupt blobs
  avoid infinite loop in read_istream_loose
  read_istream_filtered: propagate read error from upstream
  check_sha1_signature: check return value from read_istream
  stream_blob_to_fd: detect errors reading from stream
</content>
</entry>
<entry>
<title>Merge branch 'jk/checkout-attribute-lookup'</title>
<updated>2013-03-28T21:37:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-03-28T21:37:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39c5835dd68473e6b829d94533e892cffee09286'/>
<id>urn:sha1:39c5835dd68473e6b829d94533e892cffee09286</id>
<content type='text'>
Codepath to stream blob object contents directly from the object
store to filesystem did not use the correct path to find conversion
filters when writing to temporary files.

* jk/checkout-attribute-lookup:
  t2003: work around path mangling issue on Windows
  entry: fix filter lookup
  t2003: modernize style
</content>
</entry>
</feed>
