]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
23 months agoMerge branch 'ab/coding-guidelines-c99'
Junio C Hamano [Wed, 19 Oct 2022 22:38:05 +0000 (15:38 -0700)] 
Merge branch 'ab/coding-guidelines-c99'

Update CodingGuidelines to clarify what features to use and avoid
in C99.

* ab/coding-guidelines-c99:
  CodingGuidelines: recommend against unportable C99 struct syntax
  CodingGuidelines: mention C99 features we can't use
  CodingGuidelines: allow declaring variables in for loops
  CodingGuidelines: mention dynamic C99 initializer elements
  CodingGuidelines: update for C99

23 months agoSync with v2.38.1
Junio C Hamano [Mon, 17 Oct 2022 22:46:09 +0000 (15:46 -0700)] 
Sync with v2.38.1

23 months agoThe third batch
Junio C Hamano [Mon, 17 Oct 2022 21:57:21 +0000 (14:57 -0700)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMerge branch 'pw/remove-rebase-p-test'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'pw/remove-rebase-p-test'

Remove outdated test.

* pw/remove-rebase-p-test:
  t3435: remove redundant test case

23 months agoMerge branch 'rj/branch-edit-desc-unborn'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'rj/branch-edit-desc-unborn'

"git branch --edit-description" on an unborh branch misleadingly
said that no such branch exists, which has been corrected.

* rj/branch-edit-desc-unborn:
  branch: description for non-existent branch errors

23 months agoMerge branch 'jt/promisor-remote-fetch-tweak'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'jt/promisor-remote-fetch-tweak'

Remove error detection from a function that fetches from promisor
remotes, and make it die when such a fetch fails to bring all the
requested objects, to give an early failure to various operations.

* jt/promisor-remote-fetch-tweak:
  promisor-remote: die upon failing fetch
  promisor-remote: remove a return value

23 months agoMerge branch 'rs/use-fspathncmp'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'rs/use-fspathncmp'

Code clean-up.

* rs/use-fspathncmp:
  dir: use fspathncmp() in pl_hashmap_cmp()

23 months agoMerge branch 'jc/use-of-uc-in-log-messages'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'jc/use-of-uc-in-log-messages'

Clarify that "the sentence after <area>: prefix does not begin with
a capital letter" rule applies only to the commit title.

* jc/use-of-uc-in-log-messages:
  SubmittingPatches: use usual capitalization in the log message body

23 months agoMerge branch 'dd/document-runtime-prefix-better'
Junio C Hamano [Mon, 17 Oct 2022 21:56:34 +0000 (14:56 -0700)] 
Merge branch 'dd/document-runtime-prefix-better'

Update comment in the Makefile about the RUNTIME_PREFIX config knob.

* dd/document-runtime-prefix-better:
  Makefile: clarify runtime relative gitexecdir

23 months agoMerge branch 'ab/unused-annotation'
Junio C Hamano [Mon, 17 Oct 2022 21:56:34 +0000 (14:56 -0700)] 
Merge branch 'ab/unused-annotation'

Compilation fix for ancient compilers.

* ab/unused-annotation:
  git-compat-util.h: GCC deprecated message arg only in GCC 4.5+

23 months agoMerge branch 'jc/tmp-objdir'
Junio C Hamano [Mon, 17 Oct 2022 21:56:33 +0000 (14:56 -0700)] 
Merge branch 'jc/tmp-objdir'

The code to clean temporary object directories (used for
quarantine) tried to remove them inside its signal handler, which
was a no-no.

* jc/tmp-objdir:
  tmp-objdir: skip clean up when handling a signal

23 months agoMerge branch 'jc/branch-description-unset'
Junio C Hamano [Mon, 17 Oct 2022 21:56:33 +0000 (14:56 -0700)] 
Merge branch 'jc/branch-description-unset'

"GIT_EDITOR=: git branch --edit-description" resulted in failure,
which has been corrected.

* jc/branch-description-unset:
  branch: do not fail a no-op --edit-desc

23 months agoMerge branch 'jk/cleanup-callback-parameters'
Junio C Hamano [Mon, 17 Oct 2022 21:56:32 +0000 (14:56 -0700)] 
Merge branch 'jk/cleanup-callback-parameters'

Code clean-up.

* jk/cleanup-callback-parameters:
  attr: drop DEBUG_ATTR code
  commit: avoid writing to global in option callback
  multi-pack-index: avoid writing to global in option callback
  test-submodule: inline resolve_relative_url() function

23 months agoMerge branch 'rs/bisect-start-leakfix'
Junio C Hamano [Mon, 17 Oct 2022 21:56:32 +0000 (14:56 -0700)] 
Merge branch 'rs/bisect-start-leakfix'

Code clean-up that results in plugging a leak.

* rs/bisect-start-leakfix:
  bisect--helper: plug strvec leak

23 months agoMerge branch 'ed/fsmonitor-on-networked-macos'
Junio C Hamano [Mon, 17 Oct 2022 21:56:31 +0000 (14:56 -0700)] 
Merge branch 'ed/fsmonitor-on-networked-macos'

By default, use of fsmonitor on a repository on networked
filesystem is disabled. Add knobs to make it workable on macOS.

* ed/fsmonitor-on-networked-macos:
  fsmonitor: fix leak of warning message
  fsmonitor: add documentation for allowRemote and socketDir options
  fsmonitor: check for compatability before communicating with fsmonitor
  fsmonitor: deal with synthetic firmlinks on macOS
  fsmonitor: avoid socket location check if using hook
  fsmonitor: relocate socket file if .git directory is remote
  fsmonitor: refactor filesystem checks to common interface

23 months agoThe second batch
Junio C Hamano [Tue, 11 Oct 2022 17:02:52 +0000 (10:02 -0700)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMerge branch 'rs/gc-pack-refs-simplify'
Junio C Hamano [Tue, 11 Oct 2022 17:36:12 +0000 (10:36 -0700)] 
Merge branch 'rs/gc-pack-refs-simplify'

Code clean-up.

* rs/gc-pack-refs-simplify:
  gc: simplify maintenance_task_pack_refs()

23 months agoMerge branch 'nb/doc-mergetool-typofix'
Junio C Hamano [Tue, 11 Oct 2022 17:36:12 +0000 (10:36 -0700)] 
Merge branch 'nb/doc-mergetool-typofix'

Typofix.

* nb/doc-mergetool-typofix:
  mergetool.txt: typofix 'overwriten' -> 'overwritten'

23 months agoMerge branch 'jk/sequencer-missing-author-name-check'
Junio C Hamano [Tue, 11 Oct 2022 17:36:12 +0000 (10:36 -0700)] 
Merge branch 'jk/sequencer-missing-author-name-check'

Typofix in code.

* jk/sequencer-missing-author-name-check:
  sequencer: detect author name errors in read_author_script()

23 months agoMerge branch 'pw/ssh-sign-report-errors'
Junio C Hamano [Tue, 11 Oct 2022 17:36:11 +0000 (10:36 -0700)] 
Merge branch 'pw/ssh-sign-report-errors'

The codepath to sign learned to report errors when it fails to read
from "ssh-keygen".

* pw/ssh-sign-report-errors:
  ssh signing: return an error when signature cannot be read

23 months agoMerge branch 'pw/mailinfo-b-fix'
Junio C Hamano [Tue, 11 Oct 2022 17:36:11 +0000 (10:36 -0700)] 
Merge branch 'pw/mailinfo-b-fix'

Fix a logic in "mailinfo -b" that miscomputed the length of a
substring, which lead to an out-of-bounds access.

* pw/mailinfo-b-fix:
  mailinfo -b: fix an out of bounds access

23 months agoMerge branch 'rs/test-httpd-in-C-locale'
Junio C Hamano [Tue, 11 Oct 2022 17:36:11 +0000 (10:36 -0700)] 
Merge branch 'rs/test-httpd-in-C-locale'

Force C locale while running tests around httpd to make sure we can
find expected error messages in the log.

* rs/test-httpd-in-C-locale:
  t/lib-httpd: pass LANG and LC_ALL to Apache

23 months agoMerge branch 'ds/bundle-uri-docfix'
Junio C Hamano [Tue, 11 Oct 2022 17:36:10 +0000 (10:36 -0700)] 
Merge branch 'ds/bundle-uri-docfix'

Doc formatting fix.

* ds/bundle-uri-docfix:
  bundle-uri: fix technical doc issues

23 months agoCodingGuidelines: recommend against unportable C99 struct syntax
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:38:00 +0000 (13:38 -0700)] 
CodingGuidelines: recommend against unportable C99 struct syntax

Per 33665d98e6b (reftable: make assignments portable to AIX xlc
v12.01, 2022-03-28) forms like ".a.b = *c" can be replaced by using
".a = { .b = *c }" instead.

We'll probably allow these sooner than later, but since the workaround
is trivial let's note it among the C99 features we'd like to hold off
on for now.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: fix leak of warning message
Jeff King [Tue, 11 Oct 2022 00:42:38 +0000 (20:42 -0400)] 
fsmonitor: fix leak of warning message

The fsm_settings__get_incompatible_msg() function returns an allocated
string.  So we can't pass its result directly to warning(); we must hold
on to the pointer and free it to avoid a leak.

The leak here is small and fixed size, but Coverity complained, and
presumably SANITIZE=leaks would eventually.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoCodingGuidelines: mention C99 features we can't use
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:59 +0000 (13:37 -0700)] 
CodingGuidelines: mention C99 features we can't use

The C99 section of the CodingGuidelines is a good overview of what we
can use, but is sorely lacking in what we can't use. Something that
comes up occasionally is the portability of %z.

Per [1] we couldn't use it for the longest time due to MSVC not
supporting it, but nowadays by requiring C99 we rely on the MSVC
version that does, but we can't use it yet because a C library that
MinGW uses doesn't support it.

1. https://lore.kernel.org/git/a67e0fd8-4a14-16c9-9b57-3430440ef93c@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoCodingGuidelines: allow declaring variables in for loops
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:58 +0000 (13:37 -0700)] 
CodingGuidelines: allow declaring variables in for loops

Since 44ba10d6712 (revision: use C99 declaration of variable in for()
loop, 2021-11-14) released with v2.35.0 we've had a variable declared
with in a for loop.

Since then we've had inadvertent follow-ups to that with at least
cb2607759e2 (merge-ort: store more specific conflict information,
2022-06-18) released with v2.38.0.

As November 2022 is within the window of this upcoming release,
let's update the guideline to allow this.  We can have the promised
"revisit" discussion while this patch cooks, and drop it if it turns
out that it is still premature, which is not expected to happen at
this moment.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoCodingGuidelines: mention dynamic C99 initializer elements
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:57 +0000 (13:37 -0700)] 
CodingGuidelines: mention dynamic C99 initializer elements

The first use of variables in initializer elements appears to have
been 2b6854c863a (Cleanup variables in cat-file, 2007-04-21) released
with v1.5.2.

Some of those caused portability issues, and e.g. that "cat-file" use
was changed in 66dbfd55e38 (Rewrite dynamic structure initializations
to runtime assignment, 2010-05-14) which went out with v1.7.2.

But curiously 66dbfd55e38 missed some of them, e.g. an archive.c use
added in d5f53d6d6f2 (archive: complain about path specs that don't
match anything, 2009-12-12), and another one in merge-index.c (later
builtin/merge-index.c) in 0077138cd9d (Simplify some instances of
run_command() by using run_command_v_opt()., 2009-06-08).

As far as I can tell there's been no point since 2b6854c863a in 2007
where a compiler that didn't support this has been able to compile
git. Presumably 66dbfd55e38 was an attempt to make headway with wider
portability that ultimately wasn't completed.

In any case, we are thoroughly reliant on this syntax at this point,
so let's update the guidelines, see
https://lore.kernel.org/git/xmqqy1tunjgp.fsf@gitster.g/ for the
initial discussion.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoCodingGuidelines: update for C99
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:56 +0000 (13:37 -0700)] 
CodingGuidelines: update for C99

Since 7bc341e21b5 (git-compat-util: add a test balloon for C99
support, 2021-12-01) we've had a hard dependency on C99, but the prose
in CodingGuidelines was written under the assumption that we were
using C89 with a few C99 features.

As the updated prose notes we'd still like to hold off on novel C99
features, but let's make it clear that we target that C version, and
then enumerate new C99 features that are safe to use.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agot3435: remove redundant test case
Phillip Wood [Mon, 10 Oct 2022 09:45:06 +0000 (09:45 +0000)] 
t3435: remove redundant test case

rebase --preserve-merges no longer exists so there is no point in
carrying this failing test case.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoThe (real) first batch for 2.39
Junio C Hamano [Mon, 10 Oct 2022 17:09:09 +0000 (10:09 -0700)] 
The (real) first batch for 2.39

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMerge branch 'js/merge-ort-in-read-only-repo'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'js/merge-ort-in-read-only-repo'

In read-only repositories, "git merge-tree" tried to come up with a
merge result tree object, which it failed (which is not wrong) and
led to a segfault (which is bad), which has been corrected.

* js/merge-ort-in-read-only-repo:
  merge-ort: return early when failing to write a blob
  merge-ort: fix segmentation fault in read-only repositories

23 months agoMerge branch 'tb/midx-repack-ignore-cruft-packs'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'tb/midx-repack-ignore-cruft-packs'

"git multi-pack-index repack/expire" used to repack unreachable
cruft into a new pack, which have been corrected.

* tb/midx-repack-ignore-cruft-packs:
  midx.c: avoid cruft packs with non-zero `repack --batch-size`
  midx.c: remove unnecessary loop condition
  midx.c: replace `xcalloc()` with `CALLOC_ARRAY()`
  midx.c: avoid cruft packs with `repack --batch-size=0`
  midx.c: prevent `expire` from removing the cruft pack
  Documentation/git-multi-pack-index.txt: clarify expire behavior
  Documentation/git-multi-pack-index.txt: fix typo

23 months agoMerge branch 'hn/parse-worktree-ref'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'hn/parse-worktree-ref'

Code and semantics cleaning.

* hn/parse-worktree-ref:
  refs: unify parse_worktree_ref() and ref_type()

23 months agoMerge branch 'ja/rebase-i-avoid-amending-self'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'ja/rebase-i-avoid-amending-self'

"git rebase -i" can mistakenly attempt to apply a fixup to a commit
itself, which has been corrected.

* ja/rebase-i-avoid-amending-self:
  sequencer: avoid dropping fixup commit that targets self via commit-ish

23 months agoMerge branch 'rj/ref-filter-get-head-description-leakfix'
Junio C Hamano [Mon, 10 Oct 2022 17:08:42 +0000 (10:08 -0700)] 
Merge branch 'rj/ref-filter-get-head-description-leakfix'

Leakfix.

* rj/ref-filter-get-head-description-leakfix:
  ref-filter.c: fix a leak in get_head_description

23 months agoMerge branch 'jc/environ-docs'
Junio C Hamano [Mon, 10 Oct 2022 17:08:41 +0000 (10:08 -0700)] 
Merge branch 'jc/environ-docs'

Documentation on various Boolean GIT_* environment variables have
been clarified.

* jc/environ-docs:
  environ: GIT_INDEX_VERSION affects not just a new repository
  environ: simplify description of GIT_INDEX_FILE
  environ: GIT_FLUSH should be made a usual Boolean
  environ: explain Boolean environment variables
  environ: document GIT_SSL_NO_VERIFY

23 months agoMerge branch 'ah/branch-autosetupmerge-grammofix'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'ah/branch-autosetupmerge-grammofix'

Fix grammar of a message introduced in previous round.

* ah/branch-autosetupmerge-grammofix:
  push: improve grammar of branch.autoSetupMerge advice

23 months agoMerge branch 'ab/test-malloc-with-sanitize-leak'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'ab/test-malloc-with-sanitize-leak'

Test fix.

* ab/test-malloc-with-sanitize-leak:
  test-lib: have SANITIZE=leak imply TEST_NO_MALLOC_CHECK

23 months agoMerge branch 'sy/sparse-grep'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'sy/sparse-grep'

"git grep" learned to expand the sparse-index more lazily and on
demand in a sparse checkout.

* sy/sparse-grep:
  builtin/grep.c: integrate with sparse index

23 months agoMerge branch 'ds/scalar-unregister-idempotent'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'ds/scalar-unregister-idempotent'

"scalar unregister" in a repository that is already been
unregistered reported an error.

* ds/scalar-unregister-idempotent:
  string-list: document iterator behavior on NULL input
  gc: replace config subprocesses with API calls
  scalar: make 'unregister' idempotent
  maintenance: add 'unregister --force'

23 months agoMerge branch 'mc/cred-helper-ignore-unknown'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'mc/cred-helper-ignore-unknown'

Most credential helpers ignored unknown entries in a credential
description, but a few died upon seeing them.  The latter were
taught to ignore them, too

* mc/cred-helper-ignore-unknown:
  osxkeychain: clarify that we ignore unknown lines
  netrc: ignore unknown lines (do not die)
  wincred: ignore unknown lines (do not die)

23 months agoMerge branch 'jk/remote-rename-without-fetch-refspec'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'jk/remote-rename-without-fetch-refspec'

"git remote rename" failed to rename a remote without fetch
refspec, which has been corrected.

* jk/remote-rename-without-fetch-refspec:
  remote: handle rename of remote without fetch refspec

23 months agoMerge branch 'jk/clone-allow-bare-and-o-together'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'jk/clone-allow-bare-and-o-together'

"git clone" did not like to see the "--bare" and the "--origin"
options used together without a good reason.

* jk/clone-allow-bare-and-o-together:
  clone: allow "--bare" with "-o"

23 months agoMerge branch 'jk/fsck-on-diet'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'jk/fsck-on-diet'

"git fsck" failed to release contents of tree objects already used
from the memory, which has been fixed.

* jk/fsck-on-diet:
  parse_object_buffer(): respect save_commit_buffer
  fsck: turn off save_commit_buffer
  fsck: free tree buffers after walking unreachable objects

23 months agoMerge branch 'so/diff-merges-cleanup'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'so/diff-merges-cleanup'

Code clean-up.

* so/diff-merges-cleanup:
  diff-merges: clarify log.diffMerges documentation
  diff-merges: cleanup set_diff_merges()
  diff-merges: cleanup func_by_opt()

23 months agoMerge branch 'ah/fsmonitor-daemon-usage-non-l10n'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'ah/fsmonitor-daemon-usage-non-l10n'

Fix messages incorrectly marked for translation.

* ah/fsmonitor-daemon-usage-non-l10n:
  fsmonitor--daemon: don't translate literal commands

23 months agodir: use fspathncmp() in pl_hashmap_cmp()
Jeff King [Sat, 8 Oct 2022 11:05:43 +0000 (13:05 +0200)] 
dir: use fspathncmp() in pl_hashmap_cmp()

Call fspathncmp() instead of open-coding it.  This shortens the code and
makes it less repetitive.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobranch: description for non-existent branch errors
Rubén Justo [Sat, 8 Oct 2022 00:39:43 +0000 (02:39 +0200)] 
branch: description for non-existent branch errors

When the repository does not yet have commits, some errors describe that
there is no branch:

    $ git init -b first

    $ git branch --edit-description first
    error: No branch named 'first'.

    $ git branch --set-upstream-to=upstream
    fatal: branch 'first' does not exist

    $ git branch -c second
    error: refname refs/heads/first not found
    fatal: Branch copy failed

That "first" branch is unborn but to say it doesn't exists is confusing.

Options "-c" (copy) and "-m" (rename) show the same error when the
origin branch doesn't exists:

    $ git branch -c non-existent-branch second
    error: refname refs/heads/non-existent-branch not found
    fatal: Branch copy failed

    $ git branch -m non-existent-branch second
    error: refname refs/heads/non-existent-branch not found
    fatal: Branch rename failed

Note that "--edit-description" without an explicit argument is already
considering the _empty repository_ circumstance in its error.  Also note
that "-m" on the initial branch it is an allowed operation.

Make the error descriptions for those branch operations with unborn or
non-existent branches, more informative.

This is the result of the change:

    $ git init -b first

    $ git branch --edit-description first
    error: No commit on branch 'first' yet.

    $ git branch --set-upstream-to=upstream
    fatal: No commit on branch 'first' yet.

    $ git branch -c second
    fatal: No commit on branch 'first' yet.

    $ git branch [-c/-m] non-existent-branch second
    fatal: No branch named 'non-existent-branch'.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoStart 2.39 cycle
Junio C Hamano [Sat, 8 Oct 2022 00:09:21 +0000 (17:09 -0700)] 
Start 2.39 cycle

The version numbers do not mean much, but we may want to call the
first one in 2023 version 3.1 or something, but let's just increment
the second digit from the previous one for this cycle.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMerge branch 'ac/fuzzers'
Junio C Hamano [Sat, 8 Oct 2022 00:19:59 +0000 (17:19 -0700)] 
Merge branch 'ac/fuzzers'

Source file shuffling.

* ac/fuzzers:
  fuzz: reorganise the path for existing oss-fuzz fuzzers

23 months agoMerge branch 'vd/fix-unaligned-read-index-v4'
Junio C Hamano [Sat, 8 Oct 2022 00:19:59 +0000 (17:19 -0700)] 
Merge branch 'vd/fix-unaligned-read-index-v4'

The codepath that reads from the index v4 had unaligned memory
accesses, which has been corrected.

* vd/fix-unaligned-read-index-v4:
  read-cache: avoid misaligned reads in index v4

23 months agoMerge branch 'es/retire-efgrep'
Junio C Hamano [Sat, 8 Oct 2022 00:19:59 +0000 (17:19 -0700)] 
Merge branch 'es/retire-efgrep'

Prepare for GNU [ef]grep that throw warning of their uses.

* es/retire-efgrep:
  check-non-portable-shell: detect obsolescent egrep/fgrep

23 months agoMerge branch 'dd/retire-efgrep'
Junio C Hamano [Sat, 8 Oct 2022 00:19:59 +0000 (17:19 -0700)] 
Merge branch 'dd/retire-efgrep'

Prepare for GNU [ef]grep that throw warning of their uses.

* dd/retire-efgrep:
  t: convert fgrep usage to "grep -F"
  t: convert egrep usage to "grep -E"
  t: remove \{m,n\} from BRE grep usage
  CodingGuidelines: allow grep -E

23 months agoMerge branch 'ds/use-platform-regex-on-macos'
Junio C Hamano [Sat, 8 Oct 2022 00:19:58 +0000 (17:19 -0700)] 
Merge branch 'ds/use-platform-regex-on-macos'

With a bit of header twiddling, use the native regexp library on
macOS instead of the compat/ one.

* ds/use-platform-regex-on-macos:
  grep: fix multibyte regex handling under macOS

23 months agoSubmittingPatches: use usual capitalization in the log message body
Junio C Hamano [Fri, 7 Oct 2022 18:07:54 +0000 (11:07 -0700)] 
SubmittingPatches: use usual capitalization in the log message body

Update the description of the summary section to clarify that the
"do not capitalize" rule applies only the word after the "<area>:"
prefix of the title and nowhere else.  This hopefully will prevent
folks from writing their proposed log message in all lowercase.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobundle-uri: fix technical doc issues
Derrick Stolee [Fri, 7 Oct 2022 15:50:09 +0000 (15:50 +0000)] 
bundle-uri: fix technical doc issues

Two documentation issues exist in the technical docs for the bundle URI
feature.

First, there is an extraneous "the" across a linebreak, making the
nonsensical phrase "the bundle the list" which should just be "the
bundle list".

Secondly, the asciidoc update treats the string "`have`s" as starting a
"<code>" block, but the second tick is interpreted as an apostrophe
instead of a closing "</code>" tag. This causes entire sentences to be
formatted as code until the next one comes along. Simply adding a space
here does not work properly as the rendered HTML keeps that space.
Instead, restructure the sentence slightly to avoid using a plural,
allowing the HTML to render correctly.

Reported-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobisect--helper: plug strvec leak
René Scharfe [Fri, 7 Oct 2022 15:08:42 +0000 (17:08 +0200)] 
bisect--helper: plug strvec leak

The strvec "argv" is used to build a command for run_command_v_opt(),
but never freed.  Use a constant string array instead, which doesn't
require any cleanup.

Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoGit 2.38.1 v2.38.1
Taylor Blau [Thu, 6 Oct 2022 00:24:38 +0000 (20:24 -0400)] 
Git 2.38.1

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.37.4
Taylor Blau [Fri, 7 Oct 2022 00:00:04 +0000 (20:00 -0400)] 
Sync with 2.37.4

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.37.4 v2.37.4
Taylor Blau [Thu, 6 Oct 2022 00:12:39 +0000 (20:12 -0400)] 
Git 2.37.4

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.36.3
Taylor Blau [Thu, 6 Oct 2022 21:48:57 +0000 (17:48 -0400)] 
Sync with 2.36.3

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agot7527: prepare for changing protocol.file.allow
Taylor Blau [Fri, 30 Sep 2022 20:47:00 +0000 (16:47 -0400)] 
t7527: prepare for changing protocol.file.allow

Explicitly cloning over the "file://" protocol in t7527 in preparation
for merging a security release which will change the default value of
this configuration to be "user".

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.36.3 v2.36.3
Taylor Blau [Fri, 30 Sep 2022 21:37:57 +0000 (17:37 -0400)] 
Git 2.36.3

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.35.5
Taylor Blau [Thu, 6 Oct 2022 21:44:44 +0000 (17:44 -0400)] 
Sync with 2.35.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.35.5 v2.35.5
Taylor Blau [Fri, 30 Sep 2022 21:25:26 +0000 (17:25 -0400)] 
Git 2.35.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.34.5
Taylor Blau [Thu, 6 Oct 2022 21:43:37 +0000 (17:43 -0400)] 
Sync with 2.34.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.34.5 v2.34.5
Taylor Blau [Fri, 30 Sep 2022 21:22:02 +0000 (17:22 -0400)] 
Git 2.34.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.33.5
Taylor Blau [Thu, 6 Oct 2022 21:42:55 +0000 (17:42 -0400)] 
Sync with 2.33.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.33.5 v2.33.5
Taylor Blau [Fri, 30 Sep 2022 21:04:26 +0000 (17:04 -0400)] 
Git 2.33.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.32.4
Taylor Blau [Thu, 6 Oct 2022 21:42:02 +0000 (17:42 -0400)] 
Sync with 2.32.4

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.32.4 v2.32.4
Taylor Blau [Fri, 30 Sep 2022 21:00:58 +0000 (17:00 -0400)] 
Git 2.32.4

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.31.5
Taylor Blau [Thu, 6 Oct 2022 21:40:44 +0000 (17:40 -0400)] 
Sync with 2.31.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.31.5 v2.31.5
Taylor Blau [Fri, 30 Sep 2022 20:56:02 +0000 (16:56 -0400)] 
Git 2.31.5

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoSync with 2.30.6
Taylor Blau [Thu, 6 Oct 2022 21:39:15 +0000 (17:39 -0400)] 
Sync with 2.30.6

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoGit 2.30.6 v2.30.6
Taylor Blau [Fri, 30 Sep 2022 20:32:10 +0000 (16:32 -0400)] 
Git 2.30.6

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agoattr: drop DEBUG_ATTR code
Jeff King [Thu, 6 Oct 2022 13:23:19 +0000 (09:23 -0400)] 
attr: drop DEBUG_ATTR code

Since its inception in d0bfd026a8 (Add basic infrastructure to assign
attributes to paths, 2007-04-12), the attribute code carries a little
bit of debug code that is conditionally compiled only when DEBUG_ATTR is
set. But since you have to know about it and make a special build of Git
to use it, it's not clear that it's helping anyone (and there are very
few mentions of it on the list over the years).

Meanwhile, it causes slight headaches. Since it's not built as part of a
regular compile, it's subject to bitrot. E.g., this was dealt with in
712efb1a42 (attr: make it build with DEBUG_ATTR again, 2013-01-15), and
it currently fails to build with DEVELOPER=1 since e810e06357 (attr:
tighten const correctness with git_attr and match_attr, 2017-01-27).

And it causes confusion with -Wunused-parameter; the "what" parameter of
fill_one() is unused in a normal build, but needed in a debug build.

Let's just get rid of this code (and the now-useless parameter).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agocommit: avoid writing to global in option callback
Jeff King [Thu, 6 Oct 2022 13:11:31 +0000 (09:11 -0400)] 
commit: avoid writing to global in option callback

The callback function for --trailer writes directly to the global
trailer_args and ignores opt->value completely. This is OK, since that's
where we expect to find the value. But it does mean the option
declaration isn't as clear. E.g., we have:

    OPT_BOOL(0, "reset-author", &renew_authorship, ...),
    OPT_CALLBACK_F(0, "trailer", NULL, ..., opt_pass_trailer)

In the first one we can see where the result will be stored, but in the
second, we get only NULL, and you have to go read the callback.

Let's pass &trailer_args, and use it in the callback. As a bonus, this
silences a -Wunused-parameter warning.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agomulti-pack-index: avoid writing to global in option callback
Jeff King [Thu, 6 Oct 2022 13:10:53 +0000 (09:10 -0400)] 
multi-pack-index: avoid writing to global in option callback

We declare the --object-dir option like:

  OPT_CALLBACK(0, "object-dir", &opts.object_dir, ...);

but the pointer to opts.object_dir is completely unused. Instead, the
callback writes directly to a global. Which fortunately happens to be
opts.object_dir. So everything works as expected, but it's unnecessarily
confusing.

Instead, let's have the callback write to the option value pointer that
has been passed in. This also quiets a -Wunused-parameter warning (since
we don't otherwise look at "opt").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agotest-submodule: inline resolve_relative_url() function
Jeff King [Thu, 6 Oct 2022 13:10:15 +0000 (09:10 -0400)] 
test-submodule: inline resolve_relative_url() function

The resolve_relative_url() function takes argc and argv parameters; it
then reads up to 3 elements of argv without looking at argc at all. At
first glance, this seems like a bug. But it has only one caller,
cmd__submodule_resolve_relative_url(), which does confirm that argc is
3.

The main reason this is a separate function is that it was moved from
library code in 96a28a9bc6 (submodule--helper: move
"resolve-relative-url-test" to a test-tool, 2022-09-01).

We can make this code simpler and more obviously safe by just inlining
the function in its caller. As a bonus, this silences a
-Wunused-parameter warning.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agot/lib-httpd: pass LANG and LC_ALL to Apache
René Scharfe [Thu, 6 Oct 2022 15:33:07 +0000 (17:33 +0200)] 
t/lib-httpd: pass LANG and LC_ALL to Apache

t5411 starts a web server with no explicit language setting, so it uses
the system default.  Ten of its tests expect it to return error messages
containing the prefix "fatal: ", emitted by die().  This prefix can be
localized since a1fd2cf8cd (i18n: mark message helpers prefix for
translation, 2022-06-21), however.  As a result these ten tests break
for me on a system with LANG="de_DE.UTF-8" because the web server sends
localized messages with "Schwerwiegend: " instead of "fatal: ".

Fix these tests by passing LANG and LC_ALL to the web server, which are
set to "C" by t/test-lib.sh, to get untranslated messages on both sides.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agogit-compat-util.h: GCC deprecated message arg only in GCC 4.5+
Alejandro R. Sedeño [Wed, 5 Oct 2022 22:19:28 +0000 (18:19 -0400)] 
git-compat-util.h: GCC deprecated message arg only in GCC 4.5+

https://gcc.gnu.org/gcc-4.5/changes.html says

  The deprecated attribute now takes an optional string argument, for
  example, __attribute__((deprecated("text string"))), that will be
  printed together with the deprecation warning.

While GCC 4.5 is already 12 years old, git checks for even older
versions in places. Let's not needlessly break older compilers when
a small and simple fix is readily available.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Signed-off-by: Alejandro R Sedeño <asedeno@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMakefile: clarify runtime relative gitexecdir
Đoàn Trần Công Danh [Thu, 6 Oct 2022 01:32:05 +0000 (08:32 +0700)] 
Makefile: clarify runtime relative gitexecdir

"git" built with RUNTIME_PREFIX flag turned on could figure out
gitexecdir and other paths as relative to "git" executable.

However, in the section specifies gitexecdir, RUNTIME_PREFIX wasn't
mentioned, thus users may wrongly assume that "git" always locates
gitexecdir as relative path to the executable.

Let's clarify that only "git" built with RUNTIME_PREFIX will locate
gitexecdir as relative path.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agot5537: prepare for changing protocol.file.allow
Taylor Blau [Fri, 30 Sep 2022 20:47:00 +0000 (16:47 -0400)] 
t5537: prepare for changing protocol.file.allow

Explicitly cloning over the "file://" protocol in t5537 in preparation
for merging a security release which will change the default value of
this configuration to be "user".

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agot3206: prepare for changing protocol.file.allow
Taylor Blau [Fri, 30 Sep 2022 20:47:00 +0000 (16:47 -0400)] 
t3206: prepare for changing protocol.file.allow

Explicitly cloning over the "file://" protocol in t3206 in preparation
for merging a security release which will change the default value of
this configuration to be "user".

Signed-off-by: Taylor Blau <me@ttaylorr.com>
23 months agogc: simplify maintenance_task_pack_refs()
René Scharfe [Tue, 4 Oct 2022 16:17:39 +0000 (18:17 +0200)] 
gc: simplify maintenance_task_pack_refs()

Pass a constant string array directly to run_command_v_opt() instead of
copying it into a strvec first.  This shortens the code and avoids heap
allocations.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agomergetool.txt: typofix 'overwriten' -> 'overwritten'
Noah Betzen [Tue, 4 Oct 2022 00:55:24 +0000 (00:55 +0000)] 
mergetool.txt: typofix 'overwriten' -> 'overwritten'

Signed-off-by: Noah Betzen <noah@nezteb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopromisor-remote: die upon failing fetch
Jonathan Tan [Tue, 4 Oct 2022 21:13:41 +0000 (14:13 -0700)] 
promisor-remote: die upon failing fetch

In a partial clone, an attempt to read a missing object results in an
attempt to fetch that single object. In order to avoid multiple
sequential fetches, which would occur when multiple objects are missing
(which is the typical case), some commands have been taught to prefetch
in a batch: such a command would, in a partial clone, notice that
several objects that it will eventually need are missing, and call
promisor_remote_get_direct() with all such objects at once.

When this batch prefetch fails, these commands fall back to the
sequential fetches. But at $DAYJOB we have noticed that this results in
a bad user experience: a command would take unexpectedly long to finish
(and possibly use up a lot of bandwidth) if the batch prefetch would
fail for some intermittent reason, but all subsequent fetches would
work. It would be a better user experience for such a command would
just fail.

Therefore, make it a fatal error if the prefetch fails and at least one
object being fetched is known to be a promisor object. (The latter
criterion is to make sure that we are not misleading the user that such
an object would be present from the promisor remote. For example, a
missing object may be a result of repository corruption and not because
it is expectedly missing due to the repository being a partial clone.)

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopromisor-remote: remove a return value
Jonathan Tan [Tue, 4 Oct 2022 21:13:40 +0000 (14:13 -0700)] 
promisor-remote: remove a return value

No caller of promisor_remote_get_direct() is checking its return value,
so remove it.

Not checking the return value means that the user would not know
whether the failure of reading an object is due to the promisor remote
not supplying the object or because of local repository corruption, but
this will be fixed in a subsequent patch.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: add documentation for allowRemote and socketDir options
Eric DeCosta [Tue, 4 Oct 2022 17:32:31 +0000 (17:32 +0000)] 
fsmonitor: add documentation for allowRemote and socketDir options

Add documentation for 'fsmonitor.allowRemote' and 'fsmonitor.socketDir'.
Call-out experimental nature of 'fsmonitor.allowRemote' and limited
filesystem support for 'fsmonitor.socketDir'.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: check for compatability before communicating with fsmonitor
Eric DeCosta [Tue, 4 Oct 2022 17:32:30 +0000 (17:32 +0000)] 
fsmonitor: check for compatability before communicating with fsmonitor

If fsmonitor is not in a compatible state, warn with an appropriate message.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: deal with synthetic firmlinks on macOS
Eric DeCosta [Tue, 4 Oct 2022 17:32:29 +0000 (17:32 +0000)] 
fsmonitor: deal with synthetic firmlinks on macOS

Starting with macOS 10.15 (Catalina), Apple introduced a new feature
called 'firmlinks' in order to separate the boot volume into two
volumes, one read-only and one writable but still present them to the
user as a single volume. Along with this change, Apple removed the
ability to create symlinks in the root directory and replaced them with
'synthetic firmlinks'. See 'man synthetic.conf'

When FSEevents reports the path of changed files, if the path involves
a synthetic firmlink, the path is reported from the point of the
synthetic firmlink and not the real path. For example:

Real path:
/System/Volumes/Data/network/working/directory/foo.txt

Synthetic firmlink:
/network -> /System/Volumes/Data/network

FSEvents path:
/network/working/directory/foo.txt

This causes the FSEvents path to not match against the worktree
directory.

There are several ways in which synthetic firmlinks can be created:
they can be defined in /etc/synthetic.conf, the automounter can create
them, and there may be other means. Simply reading /etc/synthetic.conf
is insufficient. No matter what process creates synthetic firmlinks,
they all get created in the root directory.

Therefore, in order to deal with synthetic firmlinks, the root directory
is scanned and the first possible synthetic firmink that, when resolved,
is a prefix of the worktree is used to map FSEvents paths to worktree
paths.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: avoid socket location check if using hook
Eric DeCosta [Tue, 4 Oct 2022 17:32:28 +0000 (17:32 +0000)] 
fsmonitor: avoid socket location check if using hook

If monitoring is done via fsmonitor hook rather than IPC there is no
need to check if the location of the Unix Domain socket (UDS) file is
on a remote filesystem.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: relocate socket file if .git directory is remote
Eric DeCosta [Tue, 4 Oct 2022 17:32:27 +0000 (17:32 +0000)] 
fsmonitor: relocate socket file if .git directory is remote

If the .git directory is on a remote filesystem, create the socket
file in 'fsmonitor.socketDir' if it is defined, else create it in $HOME.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofsmonitor: refactor filesystem checks to common interface
Eric DeCosta [Tue, 4 Oct 2022 17:32:26 +0000 (17:32 +0000)] 
fsmonitor: refactor filesystem checks to common interface

Provide a common interface for getting basic filesystem information
including filesystem type and whether the filesystem is remote.

Refactor existing code for getting basic filesystem info and detecting
remote file systems to the new interface.

Refactor filesystem checks to leverage new interface. For macOS,
error-out if the Unix Domain socket (UDS) file is on a remote
filesystem.

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agossh signing: return an error when signature cannot be read
Phillip Wood [Tue, 4 Oct 2022 10:01:34 +0000 (10:01 +0000)] 
ssh signing: return an error when signature cannot be read

If the signature file cannot be read we print an error message but do
not return an error to the caller. In practice it seems unlikely that
the file would be unreadable if the call to ssh-keygen succeeds.

The unlink_or_warn() call is moved to the end of the function so that
we always try and remove the signature file. This isn't strictly
necessary at the moment but it protects us against any extra code
being added between trying to read the signature file and the cleanup
at the end of the function in the future. unlink_or_warn() only prints
a warning if it exists and cannot be removed.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agosequencer: detect author name errors in read_author_script()
Jeff King [Mon, 3 Oct 2022 17:35:02 +0000 (13:35 -0400)] 
sequencer: detect author name errors in read_author_script()

As we parse the author-script file, we check for missing or duplicate
lines for GIT_AUTHOR_NAME, etc. But after reading the whole file, our
final error conditional checks "date_i" twice and "name_i" not at all.
This not only leads to us failing to abort, but we may do an
out-of-bounds read on the string_list array.

The bug goes back to 442c36bd08 (am: improve author-script error
reporting, 2018-10-31), though the code was soon after moved to this
spot by bcd33ec25f (add read_author_script() to libgit, 2018-10-31).
It was presumably just a typo in 442c36bd08.

We'll add test coverage for all the error cases here, though only the
GIT_AUTHOR_NAME ones fail (even in a vanilla build they segfault
consistently, but certainly with SANITIZE=address).

Reported-by: Michael V. Scovetta <michael.scovetta@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agomailinfo -b: fix an out of bounds access
Phillip Wood [Mon, 3 Oct 2022 09:23:30 +0000 (09:23 +0000)] 
mailinfo -b: fix an out of bounds access

To remove bracketed strings containing "PATCH" from the subject line
cleanup_subject() scans the subject for the opening bracket using an
offset from the beginning of the line. It then searches for the
closing bracket with strchr(). To calculate the length of the
bracketed string it unfortunately adds rather than subtracts the
offset from the result of strchr(). This leads to an out of bounds
access in memmem() when looking to see if the brackets contain
"PATCH".

We have tests that trigger this bug that were added in ae52d57f0b
(t5100: add some more mailinfo tests, 2017-05-31). The commit message
mentions that they are marked test_expect_failure as they trigger an
assertion in strbuf_splice(). While it is reassuring that
strbuf_splice() detects the problem and dies in retrospect that should
perhaps have warranted a little more investigation. The bug was
introduced by 17635fc900 (mailinfo: -b option keeps [bracketed]
strings that is not a [PATCH] marker, 2009-07-15). I think the reason
it has survived so long is that '-b' is not a popular option and
without it the offset is always zero.

This was found by the address sanitizer while I was cleaning up the
test_todo idea in [1].

[1] https://lore.kernel.org/git/db558292-2783-3270-4824-43757822a389@gmail.com/

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoGit 2.38 v2.38.0
Junio C Hamano [Sun, 2 Oct 2022 15:43:56 +0000 (08:43 -0700)] 
Git 2.38

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMerge tag 'l10n-2.38.0-rnd3' of https://github.com/git-l10n/git-po
Junio C Hamano [Sun, 2 Oct 2022 15:24:32 +0000 (08:24 -0700)] 
Merge tag 'l10n-2.38.0-rnd3' of https://github.com/git-l10n/git-po

l10n-2.38.0-rnd3

* tag 'l10n-2.38.0-rnd3' of https://github.com/git-l10n/git-po: (25 commits)
  l10n: zh_TW.po: Git 2.38.0, round 3
  l10n: fr: v2.38.0 round 3
  l10n: Update Catalan translation
  l10n: de.po: update German translation
  l10n: zh_CN: 2.38.0 round 3
  l10n: tr: v2.38.0 3rd round
  l10n: bg.po: Updated Bulgarian translation (5484t)
  l10n: po-id for 2.38 (round 3)
  l10n: es: update translation
  l10n: sv.po: Update Swedish translation (5484t0f0u)
  l10n: Update Catalan translation
  l10n: fr: don't say that merge is "the default strategy"
  l10n: zh_CN v2.38.0 rounds 1 & 2
  l10n: po-id for 2.38 (round 2)
  l10n: tr: v2.38.0 round 2
  l10n: bg.po: Updated Bulgarian translation (5484t)
  l10n: fr: v2.38.0 round 2
  l10n: fr: v2.38 round 1
  l10n: fr: The word 'branche' is only feminine
  l10n: Update Catalan translation
  ...