<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fsmonitor.c, branch v2.23.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.23.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.23.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-07-09T22:25:38Z</updated>
<entry>
<title>Merge branch 'cb/fsmonitor-intfix'</title>
<updated>2019-07-09T22:25:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-07-09T22:25:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ceca45541d0046544cc95acb6b849c14637e0e3e'/>
<id>urn:sha1:ceca45541d0046544cc95acb6b849c14637e0e3e</id>
<content type='text'>
Variable type fix.

* cb/fsmonitor-intfix:
  fsmonitor: avoid signed integer overflow / infinite loop
</content>
</entry>
<entry>
<title>fsmonitor: avoid signed integer overflow / infinite loop</title>
<updated>2019-06-18T01:14:29Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2019-06-15T16:11:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d137fc2c7ba08455b2734c8e2ca9b9a284f3706'/>
<id>urn:sha1:5d137fc2c7ba08455b2734c8e2ca9b9a284f3706</id>
<content type='text'>
883e248b8a ("fsmonitor: teach git to optionally utilize a file system
monitor to speed up detecting new or changed files.", 2017-09-22) uses
an int in a loop that would wrap if index_state-&gt;cache_nr (unsigned)
is bigger than INT_MAX

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: force a refresh after the index was discarded</title>
<updated>2019-05-08T03:03:48Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-05-07T11:10:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=398a3b0899dd8a440d4adbcbda38362e3f8359b1'/>
<id>urn:sha1:398a3b0899dd8a440d4adbcbda38362e3f8359b1</id>
<content type='text'>
With this change, the `index_state` struct becomes the new home for the
flag that says whether the fsmonitor hook has been run, i.e. it is now
per-index.

It also gets re-set when the index is discarded, fixing the bug
demonstrated by the "test_expect_failure" test added in the preceding
commit. In that case fsmonitor-enabled Git would miss updates under
certain circumstances, see that preceding commit for details.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/snprintf-truncation'</title>
<updated>2018-05-30T12:51:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-30T12:51:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c3d15fe3113cf48db60656eedd152c46f47bf6b'/>
<id>urn:sha1:7c3d15fe3113cf48db60656eedd152c46f47bf6b</id>
<content type='text'>
Avoid unchecked snprintf() to make future code auditing easier.

* jk/snprintf-truncation:
  fmt_with_err: add a comment that truncation is OK
  shorten_unambiguous_ref: use xsnprintf
  fsmonitor: use internal argv_array of struct child_process
  log_write_email_headers: use strbufs
  http: use strbufs instead of fixed buffers
</content>
</entry>
<entry>
<title>fsmonitor: use internal argv_array of struct child_process</title>
<updated>2018-05-21T00:58:56Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2018-05-19T08:27:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=735e4173b3feba0cc495bbb2dd85341b6378f628'/>
<id>urn:sha1:735e4173b3feba0cc495bbb2dd85341b6378f628</id>
<content type='text'>
Avoid magic array sizes and indexes by constructing the fsmonitor
command line using the embedded argv_array of the child_process.  The
resulting code is shorter and easier to extend.

Getting rid of the snprintf() calls is a bonus -- even though the
buffers were big enough here to avoid truncation -- as it makes auditing
the remaining callers easier.

Inspired-by: Jeff King &lt;peff@peff.net&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>Merge branch 'bp/fsmonitor-prime-index'</title>
<updated>2018-04-25T04:29:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a79d7e9fb187f17515053f616d3eca13c9c1585'/>
<id>urn:sha1:7a79d7e9fb187f17515053f616d3eca13c9c1585</id>
<content type='text'>
The index file is updated to record the fsmonitor section after a
full scan was made, to avoid wasting the effort that has already
spent.

* bp/fsmonitor-prime-index:
  fsmonitor: force index write after full scan
</content>
</entry>
<entry>
<title>Merge branch 'bp/fsmonitor-bufsize-fix'</title>
<updated>2018-04-25T04:29:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:29:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=beed7e22fdc81ba325c4bfaadf84d23f5c697d93'/>
<id>urn:sha1:beed7e22fdc81ba325c4bfaadf84d23f5c697d93</id>
<content type='text'>
Fix an unexploitable (because the oversized contents are not under
attacker's control) buffer overflow.

* bp/fsmonitor-bufsize-fix:
  fsmonitor: fix incorrect buffer size when printing version number
</content>
</entry>
<entry>
<title>fsmonitor: force index write after full scan</title>
<updated>2018-04-11T09:09:48Z</updated>
<author>
<name>Ben Peart</name>
<email>benpeart@microsoft.com</email>
</author>
<published>2018-04-10T18:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ca598d5f2ab988935a5b882b44122cbfa5fd99f5'/>
<id>urn:sha1:ca598d5f2ab988935a5b882b44122cbfa5fd99f5</id>
<content type='text'>
fsmonitor currently only flags the index as dirty if the extension is being
added or removed. This is a performance optimization that recognizes you can
stat() a lot of files in less time than it takes to write out an updated index.

This patch makes a small enhancement and flags the index dirty if we end up
having to stat() all files and scan the entire working directory.  The assumption
being that must be expensive or you would not have turned on the feature.

Signed-off-by: Ben Peart &lt;benpeart@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: fix incorrect buffer size when printing version number</title>
<updated>2018-04-11T06:28:34Z</updated>
<author>
<name>Ben Peart</name>
<email>Ben.Peart@microsoft.com</email>
</author>
<published>2018-04-10T18:43:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d8579accfaea398a157a3a8ad2ca6cac25f1b999'/>
<id>urn:sha1:d8579accfaea398a157a3a8ad2ca6cac25f1b999</id>
<content type='text'>
This is a trivial bug fix for passing the incorrect size to snprintf() when
outputting the version.  It should be passing the size of the destination buffer
rather than the size of the value being printed.

Signed-off-by: Ben Peart &lt;benpeart@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>dir.c: ignore paths containing .git when invalidating untracked cache</title>
<updated>2018-02-07T20:27:02Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-02-07T09:21:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0cacebf099dd6467845419f212acdcfe5f8d923f'/>
<id>urn:sha1:0cacebf099dd6467845419f212acdcfe5f8d923f</id>
<content type='text'>
read_directory() code ignores all paths named ".git" even if it's not
a valid git repository. See treat_path() for details. Since ".git" is
basically invisible to read_directory(), when we are asked to
invalidate a path that contains ".git", we can safely ignore it
because the slow path would not consider it anyway.

This helps when fsmonitor is used and we have a real ".git" repo at
worktree top. Occasionally .git/index will be updated and if the
fsmonitor hook does not filter it, untracked cache is asked to
invalidate the path ".git/index".

Without this patch, we invalidate the root directory unncessarily,
which:

- makes read_directory() fall back to slow path for root directory
  (slower)

- makes the index dirty (because UNTR extension is updated). Depending
  on the index size, writing it down could also be slow.

A note about the new "safe_path" knob. Since this new check could be
relatively expensive, avoid it when we know it's not needed. If the
path comes from the index, it can't contain ".git". If it does
contain, we may be screwed up at many more levels, not just this one.

Noticed-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
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>
</feed>
