<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/fetch.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-12T23:11:43Z</updated>
<entry>
<title>Merge branch 'ps/lockfile-cleanup-fix'</title>
<updated>2022-01-12T23:11:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-12T23:11:43Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=12f82b0dd70aaefdb9363a96403d41d13b97e5b0'/>
<id>urn:sha1:12f82b0dd70aaefdb9363a96403d41d13b97e5b0</id>
<content type='text'>
Some lockfile code called free() in signal-death code path, which
has been corrected.

* ps/lockfile-cleanup-fix:
  fetch: fix deadlock when cleaning up lockfiles in async signals
</content>
</entry>
<entry>
<title>Merge branch 'ja/i18n-similar-messages'</title>
<updated>2022-01-10T19:52:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:56Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c17de5a505a2da23fcbfefdc8b0aad3f045a510f'/>
<id>urn:sha1:c17de5a505a2da23fcbfefdc8b0aad3f045a510f</id>
<content type='text'>
Similar message templates have been consolidated so that
translators need to work on fewer number of messages.

* ja/i18n-similar-messages:
  i18n: turn even more messages into "cannot be used together" ones
  i18n: ref-filter: factorize "%(foo) atom used without %(bar) atom"
  i18n: factorize "--foo outside a repository"
  i18n: refactor "unrecognized %(foo) argument" strings
  i18n: factorize "no directory given for --foo"
  i18n: factorize "--foo requires --bar" and the like
  i18n: tag.c factorize i18n strings
  i18n: standardize "cannot open" and "cannot read"
  i18n: turn "options are incompatible" into "cannot be used together"
  i18n: refactor "%s, %s and %s are mutually exclusive"
  i18n: refactor "foo and bar are mutually exclusive"
</content>
</entry>
<entry>
<title>Merge branch 'ds/fetch-pull-with-sparse-index'</title>
<updated>2022-01-10T19:52:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3c0e4178277dee1cdc4607d7277a368379b12b3f'/>
<id>urn:sha1:3c0e4178277dee1cdc4607d7277a368379b12b3f</id>
<content type='text'>
"git fetch" and "git pull" are now declared sparse-index clean.
Also "git ls-files" learns the "--sparse" option to help debugging.

* ds/fetch-pull-with-sparse-index:
  test-read-cache: remove --table, --expand options
  t1091/t3705: remove 'test-tool read-cache --table'
  t1092: replace 'read-cache --table' with 'ls-files --sparse'
  ls-files: add --sparse option
  fetch/pull: use the sparse index
</content>
</entry>
<entry>
<title>fetch: fix deadlock when cleaning up lockfiles in async signals</title>
<updated>2022-01-07T21:49:19Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2022-01-07T10:55:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=58d4d7f1c5a665111f05c61901a11a555703fe11'/>
<id>urn:sha1:58d4d7f1c5a665111f05c61901a11a555703fe11</id>
<content type='text'>
When fetching packfiles, we write a bunch of lockfiles for the packfiles
we're writing into the repository. In order to not leave behind any
cruft in case we exit or receive a signal, we register both an exit
handler as well as signal handlers for common signals like SIGINT. These
handlers will then unlink the locks and free the data structure tracking
them. We have observed a deadlock in this logic though:

    (gdb) bt
    #0  __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
    #1  0x00007f4932bea2cd in _int_free (av=0x7f4932f2eb20 &lt;main_arena&gt;, p=0x3e3e4200, have_lock=0) at malloc.c:3969
    #2  0x00007f4932bee58c in __GI___libc_free (mem=&lt;optimized out&gt;) at malloc.c:2975
    #3  0x0000000000662ab1 in string_list_clear ()
    #4  0x000000000044f5bc in unlock_pack_on_signal ()
    #5  &lt;signal handler called&gt;
    #6  _int_free (av=0x7f4932f2eb20 &lt;main_arena&gt;, p=&lt;optimized out&gt;, have_lock=0) at malloc.c:4024
    #7  0x00007f4932bee58c in __GI___libc_free (mem=&lt;optimized out&gt;) at malloc.c:2975
    #8  0x000000000065afd5 in strbuf_release ()
    #9  0x000000000066ddb9 in delete_tempfile ()
    #10 0x0000000000610d0b in files_transaction_cleanup.isra ()
    #11 0x0000000000611718 in files_transaction_abort ()
    #12 0x000000000060d2ef in ref_transaction_abort ()
    #13 0x000000000060d441 in ref_transaction_prepare ()
    #14 0x000000000060e0b5 in ref_transaction_commit ()
    #15 0x00000000004511c2 in fetch_and_consume_refs ()
    #16 0x000000000045279a in cmd_fetch ()
    #17 0x0000000000407c48 in handle_builtin ()
    #18 0x0000000000408df2 in cmd_main ()
    #19 0x00000000004078b5 in main ()

The process was killed with a signal, which caused the signal handler to
kick in and try free the data structures after we have unlinked the
locks. It then deadlocks while calling free(3P).

The root cause of this is that it is not allowed to call certain
functions in async-signal handlers, as specified by signal-safety(7).
Next to most I/O functions, this list of disallowed functions also
includes memory-handling functions like malloc(3P) and free(3P) because
they may not be reentrant. As a result, if we execute such functions in
the signal handler, then they may operate on inconistent state and fail
in unexpected ways.

Fix this bug by not calling non-async-signal-safe functions when running
in the signal handler. We're about to re-raise the signal anyway and
will thus exit, so it's not much of a problem to keep the string list of
lockfiles untouched. Note that it's fine though to call unlink(2), so
we'll still clean up the lockfiles correctly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Reviewed-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>i18n: standardize "cannot open" and "cannot read"</title>
<updated>2022-01-05T21:29:23Z</updated>
<author>
<name>Jean-Noël Avila</name>
<email>jn.avila@free.fr</email>
</author>
<published>2022-01-05T20:02:17Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c4904377ba98842b68e053e1328ee414f1dbe102'/>
<id>urn:sha1:c4904377ba98842b68e053e1328ee414f1dbe102</id>
<content type='text'>
Signed-off-by: Jean-Noël Avila &lt;jn.avila@free.fr&gt;
Reviewed-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>i18n: refactor "foo and bar are mutually exclusive"</title>
<updated>2022-01-05T21:29:23Z</updated>
<author>
<name>Jean-Noël Avila</name>
<email>jn.avila@free.fr</email>
</author>
<published>2022-01-05T20:02:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=43ea635c35371b22a7a2010398d47040c5b95adc'/>
<id>urn:sha1:43ea635c35371b22a7a2010398d47040c5b95adc</id>
<content type='text'>
Use static strings for constant parts of the sentences. They are all
turned into "cannot be used together".

Signed-off-by: Jean-Noël Avila &lt;jn.avila@free.fr&gt;
Reviewed-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/fetch-set-upstream-while-detached'</title>
<updated>2021-12-23T06:48:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-23T06:48:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=dcaf17c75d925531ba399a211e63664784d96821'/>
<id>urn:sha1:dcaf17c75d925531ba399a211e63664784d96821</id>
<content type='text'>
"git fetch --set-upstream" did not check if there is a current
branch, leading to a segfault when it is run on a detached HEAD,
which has been corrected.

* ab/fetch-set-upstream-while-detached:
  pull, fetch: fix segfault in --set-upstream option
</content>
</entry>
<entry>
<title>fetch/pull: use the sparse index</title>
<updated>2021-12-22T19:42:39Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2021-12-22T14:20:52Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=5a4e0547e2386f9bf0565316d7b751fe9459898b'/>
<id>urn:sha1:5a4e0547e2386f9bf0565316d7b751fe9459898b</id>
<content type='text'>
The 'git fetch' and 'git pull' commands parse the index in order to
determine if submodules exist. Without command_requires_full_index=0,
this will expand a sparse index, causing slow performance even when
there is no new data to fetch.

The .gitmodules file will never be inside a sparse directory entry, and
even if it was, the index_name_pos() method would expand the sparse
index if needed as we search for the path by name. These commands do not
iterate over the index, which is the typical thing we are careful about
when integrating with the sparse index.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pull, fetch: fix segfault in --set-upstream option</title>
<updated>2021-12-07T23:19:28Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-12-07T22:04:30Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=17baeaf82db5581f451c876320bf9719d72da675'/>
<id>urn:sha1:17baeaf82db5581f451c876320bf9719d72da675</id>
<content type='text'>
Fix a segfault in the --set-upstream option added in
24bc1a12926 (pull, fetch: add --set-upstream option, 2019-08-19) added
in v2.24.0.

The code added there did not do the same checking we do for "git
branch" itself since 8efb8899cfe (branch: segfault fixes and
validation, 2013-02-23), which in turn fixed the same sort of segfault
I'm fixing now in "git branch --set-upstream-to", see
6183d826ba6 (branch: introduce --set-upstream-to, 2012-08-20).

The warning message I'm adding here is an amalgamation of the error
added for "git branch" in 8efb8899cfe, and the error output
install_branch_config() itself emits, i.e. it trims "refs/heads/" from
the name and says "branch X on remote", not "branch refs/heads/X on
remote".

I think it would make more sense to simply die() here, but in the
other checks for --set-upstream added in 24bc1a12926 we issue a
warning() instead. Let's do the same here for consistency for now.

There was an earlier submitted alternate way of fixing this in [1],
due to that patch breaking threading with the original report at [2] I
didn't notice it before authoring this version. I think the more
detailed warning message here is better, and we should also have tests
for this behavior.

The --no-rebase option to "git pull" is needed as of the recently
merged 7d0daf3f12f (Merge branch 'en/pull-conflicting-options',
2021-08-30).

1. https://lore.kernel.org/git/20210706162238.575988-1-clemens@endorphin.org/
2. https://lore.kernel.org/git/CAG6gW_uHhfNiHGQDgGmb1byMqBA7xa8kuH1mP-wAPEe5Tmi2Ew@mail.gmail.com/

Reported-by: Clemens Fruhwirth &lt;clemens@endorphin.org&gt;
Reported-by: Jan Pokorný &lt;poki@fnusa.cz&gt;
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>fetch: protect branches checked out in all worktrees</title>
<updated>2021-12-02T06:18:25Z</updated>
<author>
<name>Anders Kaseorg</name>
<email>andersk@mit.edu</email>
</author>
<published>2021-12-01T22:15:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=8bc1f39f411e06b940230dc84da5568dfafec922'/>
<id>urn:sha1:8bc1f39f411e06b940230dc84da5568dfafec922</id>
<content type='text'>
Refuse to fetch into the currently checked out branch of any working
tree, not just the current one.

Fixes this previously reported bug:

https://lore.kernel.org/git/cb957174-5e9a-5603-ea9e-ac9b58a2eaad@mathema.de/

As a side effect of using find_shared_symref, we’ll also refuse the
fetch when we’re on a detached HEAD because we’re rebasing or bisecting
on the branch in question. This seems like a sensible change.

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