<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch gitk-resize-error</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=gitk-resize-error</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=gitk-resize-error'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2022-01-14T23:25:15Z</updated>
<entry>
<title>Merge branch 'ab/refs-errno-cleanup'</title>
<updated>2022-01-14T23:25:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-14T23:25:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=31e391236958c2e75787b7579146b3569fb6ec17'/>
<id>urn:sha1:31e391236958c2e75787b7579146b3569fb6ec17</id>
<content type='text'>
A brown-paper-bag fix on top of a topic that was merged during this
cycle.

* ab/refs-errno-cleanup:
  refs API: use "failure_errno", not "errno"
</content>
</entry>
<entry>
<title>refs API: use "failure_errno", not "errno"</title>
<updated>2022-01-13T18:53:54Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-01-12T12:36:46Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=cac15b3fb422efb2cd1572cc654793d5df5fa434'/>
<id>urn:sha1:cac15b3fb422efb2cd1572cc654793d5df5fa434</id>
<content type='text'>
Fix a logic error in refs_resolve_ref_unsafe() introduced in a recent
series of mine to abstract the refs API away from errno. See
96f6623ada0 (Merge branch 'ab/refs-errno-cleanup', 2021-11-29)for that
series.

In that series introduction of "failure_errno" to
refs_resolve_ref_unsafe came in ef18119dec8 (refs API: add a version
of refs_resolve_ref_unsafe() with "errno", 2021-10-16). There we'd set
"errno = 0" immediately before refs_read_raw_ref(), and then set
"failure_errno" to "errno" if errno was non-zero afterwards.

Then in the next commit 8b72fea7e91 (refs API: make
refs_read_raw_ref() not set errno, 2021-10-16) we started expecting
"refs_read_raw_ref()" to set "failure_errno". It would do that if
refs_read_raw_ref() failed, but it wouldn't be the same errno.

So we might set the "errno" here to any arbitrary bad value, and end
up e.g. returning NULL when we meant to return the refname from
refs_resolve_ref_unsafe(), or the other way around. Instrumenting this
code will reveal cases where refs_read_raw_ref() will fail, and
"errno" and "failure_errno" will be set to different values.

In practice I haven't found a case where this scary bug changed
anything in practice. The reason for that is that we'll not care about
the actual value of "errno" here per-se, but only whether:

 1. We have an errno
 2. If it's one of ENOENT, EISDIR or ENOTDIR. See the adjacent code
    added in a1c1d8170db (refs_resolve_ref_unsafe: handle d/f
    conflicts for writes, 2017-10-06)

I.e. if we clobber "failure_errno" with "errno", but it happened to be
one of those three, and we'll clobber it with another one of the three
we were OK.

Perhaps there are cases where the difference ended up mattering, but I
haven't found them. Instrumenting the test suite to fail if "errno"
and "failure_errno" are different shows a lot of failures, checking if
they're different *and* one is but not the other is outside that list
of three "errno" values yields no failures.

But let's fix the obvious bug. We should just stop paying attention to
"errno" in refs_resolve_ref_unsafe(). In addition let's change the
partial resetting of "errno" in files_read_raw_ref() to happen just
before the "return", to ensure that any such bug will be more easily
spotted in the future.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hn/refs-debug-update'</title>
<updated>2022-01-10T19:52:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=01ea04f76e096c0c371e475c3a277e67b8f4b082'/>
<id>urn:sha1:01ea04f76e096c0c371e475c3a277e67b8f4b082</id>
<content type='text'>
Debugging support for refs API.

* hn/refs-debug-update:
  refs: centralize initialization of the base ref_store.
  refs: print error message in debug output
  refs: pass gitdir to packed_ref_store_create
</content>
</entry>
<entry>
<title>Merge branch 'ns/tmp-objdir'</title>
<updated>2022-01-04T00:24:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-04T00:24:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=0dc90d954db852c6604796b8d817365f94e92a16'/>
<id>urn:sha1:0dc90d954db852c6604796b8d817365f94e92a16</id>
<content type='text'>
New interface into the tmp-objdir API to help in-core use of the
quarantine feature.

* ns/tmp-objdir:
  tmp-objdir: disable ref updates when replacing the primary odb
  tmp-objdir: new API for creating temporary writable databases
</content>
</entry>
<entry>
<title>refs: centralize initialization of the base ref_store.</title>
<updated>2021-12-22T21:51:38Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2021-12-22T18:11:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=f9f7fd3b238cc56224c30235a0d248d027b7ecfa'/>
<id>urn:sha1:f9f7fd3b238cc56224c30235a0d248d027b7ecfa</id>
<content type='text'>
Signed-off-by: Han-Wen Nienhuys &lt;hanwen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hn/allow-bogus-oid-in-ref-tests'</title>
<updated>2021-12-15T17:39:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-15T17:39:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=b174a3c01423897154d26c96baab366229f16976'/>
<id>urn:sha1:b174a3c01423897154d26c96baab366229f16976</id>
<content type='text'>
The test helper for refs subsystem learned to write bogus and/or
nonexistent object name to refs to simulate error situations we
want to test Git in.

* hn/allow-bogus-oid-in-ref-tests:
  t1430: create valid symrefs using test-helper
  t1430: remove refs using test-tool
  refs: introduce REF_SKIP_REFNAME_VERIFICATION flag
  refs: introduce REF_SKIP_OID_VERIFICATION flag
  refs: update comment.
  test-ref-store: plug memory leak in cmd_delete_refs
  test-ref-store: parse symbolic flag constants
  test-ref-store: remove force-create argument for create-reflog
</content>
</entry>
<entry>
<title>Merge branch 'hn/create-reflog-simplify'</title>
<updated>2021-12-10T22:35:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-10T22:35:13Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=b8148376a2dbb02ade419c2e3fdc478c1f0981dd'/>
<id>urn:sha1:b8148376a2dbb02ade419c2e3fdc478c1f0981dd</id>
<content type='text'>
A small simplification of API.

* hn/create-reflog-simplify:
  refs: drop force_create argument of create_reflog API
</content>
</entry>
<entry>
<title>Merge branch 'jk/refs-g11-workaround'</title>
<updated>2021-12-10T22:35:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-10T22:35:12Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=8bb6fe853f6910526ed761938343cca79648a0b4'/>
<id>urn:sha1:8bb6fe853f6910526ed761938343cca79648a0b4</id>
<content type='text'>
Workaround for a false-alarm by gcc-11

* jk/refs-g11-workaround:
  refs: work around gcc-11 warning with REF_HAVE_NEW
</content>
</entry>
<entry>
<title>tmp-objdir: disable ref updates when replacing the primary odb</title>
<updated>2021-12-08T22:06:46Z</updated>
<author>
<name>Neeraj Singh</name>
<email>neerajsi@microsoft.com</email>
</author>
<published>2021-12-06T22:05:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=ecd81dfc79cf12cc21fc0340da8ca8fcc5aa58a7'/>
<id>urn:sha1:ecd81dfc79cf12cc21fc0340da8ca8fcc5aa58a7</id>
<content type='text'>
When creating a subprocess with a temporary ODB, we set the
GIT_QUARANTINE_ENVIRONMENT env var to tell child Git processes not
to update refs, since the tmp-objdir may go away.

Introduce a similar mechanism for in-process temporary ODBs when
we call tmp_objdir_replace_primary_odb. Now both mechanisms set
the disable_ref_updates flag on the odb, which is queried by
the ref_transaction_prepare function.

Peff's test case [1] was invoking ref updates via the cachetextconv
setting. That particular code silently does nothing when a ref
update is forbidden. See the call to notes_cache_put in
fill_textconv where errors are ignored.

[1] https://lore.kernel.org/git/YVOn3hDsb5pnxR53@coredump.intra.peff.net/

Reported-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Neeraj Singh &lt;neerajsi@microsoft.com&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: introduce REF_SKIP_REFNAME_VERIFICATION flag</title>
<updated>2021-12-07T21:15:19Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2021-12-07T13:38:18Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3c966c7b4e97a5399662f85ab73af08a6419a303'/>
<id>urn:sha1:3c966c7b4e97a5399662f85ab73af08a6419a303</id>
<content type='text'>
Use this flag with the test-helper in t1430, to avoid direct writes to the ref
database.

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