+
Skip to content

Git doesn't need to question itself. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Git doesn't need to question itself. #24

wants to merge 1 commit into from

Conversation

mattbasta
Copy link

Added a little confidence to one of the more common git messages.

@mattbasta mattbasta closed this Jul 10, 2012
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Add a Gitter chat badge to README.md
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Add a Gitter chat badge to README.md
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Add a Gitter chat badge to README.md
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Add a Gitter chat badge to README.md
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Add a Gitter chat badge to README.md
derrickstolee referenced this pull request in derrickstolee/git Nov 1, 2018
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Nov 29, 2018
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Nov 29, 2018
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Dec 10, 2018
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Dec 10, 2018
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Jan 17, 2019
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Jun 11, 2019
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Aug 20, 2019
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Nov 7, 2019
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Jan 17, 2020
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
derrickstolee referenced this pull request in derrickstolee/git Mar 24, 2020
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 20, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 20, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 20, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 21, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 21, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 21, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 24, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 25, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 25, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 26, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 29, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 30, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Jun 19, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
avar added a commit to avar/git that referenced this pull request Jul 28, 2022
This fails with e.g. this t9350-fast-export.sh test, perhaps we have a
\0-delimited and use that last byte for an implicit \n?

	+ git tag -a -m valentin muss
	=================================================================
	==32504==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60d0000005ab at pc 0x556431ac3cac bp 0x7ffe67fcff50 sp 0x7ffe67fcff48
	READ of size 1 at 0x60d0000005ab thread T0
	    #0 0x556431ac3cab in parse_tag_buffer tag.c:155
	    #1 0x5564319194f3 in parse_object_buffer object.c:245
	    #2 0x556431919a11 in parse_object object.c:298
	    #3 0x5564319e2e96 in write_ref_to_lockfile refs/files-backend.c:1781
	    #4 0x5564319e71e8 in lock_ref_for_update refs/files-backend.c:2590
	    #5 0x5564319e7db5 in files_transaction_prepare refs/files-backend.c:2763
	    git#6 0x5564319d41d9 in ref_transaction_prepare refs.c:2146
	    #7 0x5564319d4465 in ref_transaction_commit refs.c:2195
	    git#8 0x5564316706b9 in cmd_tag builtin/tag.c:630
	    git#9 0x5564314168ff in run_builtin git.c:466
	    git#10 0x5564314172ab in handle_builtin git.c:720
	    git#11 0x5564314179d5 in run_argv git.c:787
	    git#12 0x55643141874f in cmd_main git.c:920
	    git#13 0x556431695a4d in main common-main.c:56
	    git#14 0x7fa9ba2aa81c in __libc_start_main ../csu/libc-start.c:332
	    git#15 0x556431412209 in _start (git+0x1d2209)

	0x60d0000005ab is located 0 bytes to the right of 139-byte region [0x60d000000520,0x60d0000005ab)
	allocated by thread T0 here:
	    #0 0x7fa9ba5fc9cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
	    #1 0x556431b3f334 in do_xmalloc wrapper.c:51
	    #2 0x556431b3f43a in do_xmallocz wrapper.c:85
	    #3 0x556431b3f4ab in xmallocz wrapper.c:93
	    #4 0x556431902114 in unpack_loose_rest object-file.c:1312
	    #5 0x556431902ed9 in loose_object_info object-file.c:1479
	    git#6 0x556431903785 in do_oid_object_info_extended object-file.c:1577
	    #7 0x556431903b2d in oid_object_info_extended object-file.c:1639
	    git#8 0x556431903f3f in read_object object-file.c:1671
	    git#9 0x5564319043c7 in read_object_file_extended object-file.c:1714
	    git#10 0x556431917ff0 in repo_read_object_file object-store.h:253
	    git#11 0x5564319198b3 in parse_object object.c:290
	    git#12 0x5564319e2e96 in write_ref_to_lockfile refs/files-backend.c:1781
	    git#13 0x5564319e71e8 in lock_ref_for_update refs/files-backend.c:2590
	    git#14 0x5564319e7db5 in files_transaction_prepare refs/files-backend.c:2763
	    git#15 0x5564319d41d9 in ref_transaction_prepare refs.c:2146
	    git#16 0x5564319d4465 in ref_transaction_commit refs.c:2195
	    git#17 0x5564316706b9 in cmd_tag builtin/tag.c:630
	    git#18 0x5564314168ff in run_builtin git.c:466
	    git#19 0x5564314172ab in handle_builtin git.c:720
	    git#20 0x5564314179d5 in run_argv git.c:787
	    git#21 0x55643141874f in cmd_main git.c:920
	    git#22 0x556431695a4d in main common-main.c:56
	    git#23 0x7fa9ba2aa81c in __libc_start_main ../csu/libc-start.c:332
	    git#24 0x556431412209 in _start (git+0x1d2209)

	SUMMARY: AddressSanitizer: heap-buffer-overflow tag.c:155 in parse_tag_buffer
	Shadow bytes around the buggy address:
	  0x0c1a7fff8060: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
	  0x0c1a7fff8080: 00 03 fa fa fa fa fa fa fa fa fd fd fd fd fd fd
	  0x0c1a7fff8090: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
	  0x0c1a7fff80a0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
	=>0x0c1a7fff80b0: 00 00 00 00 00[03]fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	Shadow byte legend (one shadow byte represents 8 application bytes):

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
avar added a commit to avar/git that referenced this pull request Sep 14, 2022
This fails with e.g. this t9350-fast-export.sh test, perhaps we have a
\0-delimited and use that last byte for an implicit \n?

	+ git tag -a -m valentin muss
	=================================================================
	==32504==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60d0000005ab at pc 0x556431ac3cac bp 0x7ffe67fcff50 sp 0x7ffe67fcff48
	READ of size 1 at 0x60d0000005ab thread T0
	    #0 0x556431ac3cab in parse_tag_buffer tag.c:155
	    #1 0x5564319194f3 in parse_object_buffer object.c:245
	    #2 0x556431919a11 in parse_object object.c:298
	    #3 0x5564319e2e96 in write_ref_to_lockfile refs/files-backend.c:1781
	    #4 0x5564319e71e8 in lock_ref_for_update refs/files-backend.c:2590
	    #5 0x5564319e7db5 in files_transaction_prepare refs/files-backend.c:2763
	    git#6 0x5564319d41d9 in ref_transaction_prepare refs.c:2146
	    #7 0x5564319d4465 in ref_transaction_commit refs.c:2195
	    git#8 0x5564316706b9 in cmd_tag builtin/tag.c:630
	    git#9 0x5564314168ff in run_builtin git.c:466
	    git#10 0x5564314172ab in handle_builtin git.c:720
	    git#11 0x5564314179d5 in run_argv git.c:787
	    git#12 0x55643141874f in cmd_main git.c:920
	    git#13 0x556431695a4d in main common-main.c:56
	    git#14 0x7fa9ba2aa81c in __libc_start_main ../csu/libc-start.c:332
	    git#15 0x556431412209 in _start (git+0x1d2209)

	0x60d0000005ab is located 0 bytes to the right of 139-byte region [0x60d000000520,0x60d0000005ab)
	allocated by thread T0 here:
	    #0 0x7fa9ba5fc9cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
	    #1 0x556431b3f334 in do_xmalloc wrapper.c:51
	    #2 0x556431b3f43a in do_xmallocz wrapper.c:85
	    #3 0x556431b3f4ab in xmallocz wrapper.c:93
	    #4 0x556431902114 in unpack_loose_rest object-file.c:1312
	    #5 0x556431902ed9 in loose_object_info object-file.c:1479
	    git#6 0x556431903785 in do_oid_object_info_extended object-file.c:1577
	    #7 0x556431903b2d in oid_object_info_extended object-file.c:1639
	    git#8 0x556431903f3f in read_object object-file.c:1671
	    git#9 0x5564319043c7 in read_object_file_extended object-file.c:1714
	    git#10 0x556431917ff0 in repo_read_object_file object-store.h:253
	    git#11 0x5564319198b3 in parse_object object.c:290
	    git#12 0x5564319e2e96 in write_ref_to_lockfile refs/files-backend.c:1781
	    git#13 0x5564319e71e8 in lock_ref_for_update refs/files-backend.c:2590
	    git#14 0x5564319e7db5 in files_transaction_prepare refs/files-backend.c:2763
	    git#15 0x5564319d41d9 in ref_transaction_prepare refs.c:2146
	    git#16 0x5564319d4465 in ref_transaction_commit refs.c:2195
	    git#17 0x5564316706b9 in cmd_tag builtin/tag.c:630
	    git#18 0x5564314168ff in run_builtin git.c:466
	    git#19 0x5564314172ab in handle_builtin git.c:720
	    git#20 0x5564314179d5 in run_argv git.c:787
	    git#21 0x55643141874f in cmd_main git.c:920
	    git#22 0x556431695a4d in main common-main.c:56
	    git#23 0x7fa9ba2aa81c in __libc_start_main ../csu/libc-start.c:332
	    git#24 0x556431412209 in _start (git+0x1d2209)

	SUMMARY: AddressSanitizer: heap-buffer-overflow tag.c:155 in parse_tag_buffer
	Shadow bytes around the buggy address:
	  0x0c1a7fff8060: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
	  0x0c1a7fff8080: 00 03 fa fa fa fa fa fa fa fa fd fd fd fd fd fd
	  0x0c1a7fff8090: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
	  0x0c1a7fff80a0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
	=>0x0c1a7fff80b0: 00 00 00 00 00[03]fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	Shadow byte legend (one shadow byte represents 8 application bytes):

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
avar added a commit to avar/git that referenced this pull request Sep 15, 2022
This fails with e.g. this t9350-fast-export.sh test, perhaps we have a
\0-delimited and use that last byte for an implicit \n?

	+ git tag -a -m valentin muss
	=================================================================
	==32504==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60d0000005ab at pc 0x556431ac3cac bp 0x7ffe67fcff50 sp 0x7ffe67fcff48
	READ of size 1 at 0x60d0000005ab thread T0
	    #0 0x556431ac3cab in parse_tag_buffer tag.c:155
	    #1 0x5564319194f3 in parse_object_buffer object.c:245
	    #2 0x556431919a11 in parse_object object.c:298
	    #3 0x5564319e2e96 in write_ref_to_lockfile refs/files-backend.c:1781
	    #4 0x5564319e71e8 in lock_ref_for_update refs/files-backend.c:2590
	    #5 0x5564319e7db5 in files_transaction_prepare refs/files-backend.c:2763
	    git#6 0x5564319d41d9 in ref_transaction_prepare refs.c:2146
	    #7 0x5564319d4465 in ref_transaction_commit refs.c:2195
	    git#8 0x5564316706b9 in cmd_tag builtin/tag.c:630
	    git#9 0x5564314168ff in run_builtin git.c:466
	    git#10 0x5564314172ab in handle_builtin git.c:720
	    git#11 0x5564314179d5 in run_argv git.c:787
	    git#12 0x55643141874f in cmd_main git.c:920
	    git#13 0x556431695a4d in main common-main.c:56
	    git#14 0x7fa9ba2aa81c in __libc_start_main ../csu/libc-start.c:332
	    git#15 0x556431412209 in _start (git+0x1d2209)

	0x60d0000005ab is located 0 bytes to the right of 139-byte region [0x60d000000520,0x60d0000005ab)
	allocated by thread T0 here:
	    #0 0x7fa9ba5fc9cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
	    #1 0x556431b3f334 in do_xmalloc wrapper.c:51
	    #2 0x556431b3f43a in do_xmallocz wrapper.c:85
	    #3 0x556431b3f4ab in xmallocz wrapper.c:93
	    #4 0x556431902114 in unpack_loose_rest object-file.c:1312
	    #5 0x556431902ed9 in loose_object_info object-file.c:1479
	    git#6 0x556431903785 in do_oid_object_info_extended object-file.c:1577
	    #7 0x556431903b2d in oid_object_info_extended object-file.c:1639
	    git#8 0x556431903f3f in read_object object-file.c:1671
	    git#9 0x5564319043c7 in read_object_file_extended object-file.c:1714
	    git#10 0x556431917ff0 in repo_read_object_file object-store.h:253
	    git#11 0x5564319198b3 in parse_object object.c:290
	    git#12 0x5564319e2e96 in write_ref_to_lockfile refs/files-backend.c:1781
	    git#13 0x5564319e71e8 in lock_ref_for_update refs/files-backend.c:2590
	    git#14 0x5564319e7db5 in files_transaction_prepare refs/files-backend.c:2763
	    git#15 0x5564319d41d9 in ref_transaction_prepare refs.c:2146
	    git#16 0x5564319d4465 in ref_transaction_commit refs.c:2195
	    git#17 0x5564316706b9 in cmd_tag builtin/tag.c:630
	    git#18 0x5564314168ff in run_builtin git.c:466
	    git#19 0x5564314172ab in handle_builtin git.c:720
	    git#20 0x5564314179d5 in run_argv git.c:787
	    git#21 0x55643141874f in cmd_main git.c:920
	    git#22 0x556431695a4d in main common-main.c:56
	    git#23 0x7fa9ba2aa81c in __libc_start_main ../csu/libc-start.c:332
	    git#24 0x556431412209 in _start (git+0x1d2209)

	SUMMARY: AddressSanitizer: heap-buffer-overflow tag.c:155 in parse_tag_buffer
	Shadow bytes around the buggy address:
	  0x0c1a7fff8060: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff8070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
	  0x0c1a7fff8080: 00 03 fa fa fa fa fa fa fa fa fd fd fd fd fd fd
	  0x0c1a7fff8090: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
	  0x0c1a7fff80a0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
	=>0x0c1a7fff80b0: 00 00 00 00 00[03]fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	  0x0c1a7fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
	Shadow byte legend (one shadow byte represents 8 application bytes):

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing the
directory's contents and the directory itself. However, the function
responsible for recursively removing the contents and directory,
remove_dir_recurse() calls opendir(3) and closedir(3). This can be problematic
because these functions allocate and free memory, which are not
async-signal-safe functions. This can lead to deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where we create a
temporary quarantine directory "incoming". Incoming objects will be written to
this directory before they get moved to the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80 <main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc (bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60, flags=0, close_fd=true, fd=5) at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>) at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>, bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160) at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ () from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows remove_dir_recurse()
to know that a signal is being handled and avoid calling opendir(3).
One implication of this change is that when signal handling, the temporary
directory may not get cleaned up properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing the
directory's contents and the directory itself. However, the function
responsible for recursively removing the contents and directory,
remove_dir_recurse() calls opendir(3) and closedir(3). This can be problematic
because these functions allocate and free memory, which are not
async-signal-safe functions. This can lead to deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where we create a
temporary quarantine directory "incoming". Incoming objects will be written to
this directory before they get moved to the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc (bytes=bytes@entry=32816)
		at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60, flags=0,
		close_fd=true, fd=5) at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>) at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows remove_dir_recurse()
to know that a signal is being handled and avoid calling opendir(3).
One implication of this change is that when signal handling, the temporary
directory may not get cleaned up properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows
remove_dir_recurse() to know that a signal is being handled and avoid
calling opendir(3). One implication of this change is that when
signal handling, the temporary directory may not get cleaned up
properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows
remove_dir_recurse() to know that a signal is being handled and avoid
calling opendir(3). One implication of this change is that when
signal handling, the temporary directory may not get cleaned up
properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 27, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 27, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 28, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 30, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

In the event of a normal exit, we should still be cleaning up via the
atexit() handler.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Cai <johncai86@gmail.com>
gitster pushed a commit that referenced this pull request Oct 2, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	#11 0x0000557c19dbe5f4 in git_inflate_init ()
	#12 0x0000557c19cee02a in unpack_compressed_entry ()
	#13 0x0000557c19cf08cb in unpack_entry ()
	#14 0x0000557c19cf0f32 in packed_object_info ()
	#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	#16 0x0000557c19cd6e2b in read_object_file_extended ()
	#17 0x0000557c19cdec2f in parse_object ()
	#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	#19 0x0000557c19d69309 in mark_uninteresting ()
	#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	#21 0x0000557c19d21678 in for_each_ref ()
	#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	#24 0x0000557c19b29fdd in handle_builtin ()
	#25 0x0000557c19b2a526 in cmd_main ()
	#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

In the event of a normal exit, we should still be cleaning up via the
atexit() handler.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
rudyrigot pushed a commit to rudyrigot/git that referenced this pull request Oct 28, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

In the event of a normal exit, we should still be cleaning up via the
atexit() handler.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
vdye pushed a commit to vdye/git that referenced this pull request Jan 9, 2024
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
vdye pushed a commit to vdye/git that referenced this pull request Jan 9, 2024
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
vdye pushed a commit to vdye/git that referenced this pull request Jan 9, 2024
This includes commits that fixup!-revert all the midx-related commits from our GVFS branch and replaces them with the exact commits that are being merged upstream. This should automatically remove the commits during our next version rebase-and-merge action.

Changes upstream:
- The builtin is called 'git multi-pack-index'.
- The command-line takes a 'write' verb and an '--object-dir' parameter.
- We no longer have a 'midx-head' or '*.midx' files.
- Instead, we have a 'multi-pack-index' file in the pack-dir.
- It no longer makes sense to specify '--update-head'
gitster pushed a commit that referenced this pull request Aug 19, 2024
It was recently reported that concurrent reads and writes may cause the
reftable backend to segfault. The root cause of this is that we do not
properly keep track of reftable readers across reloads.

Suppose that you have a reftable iterator and then decide to reload the
stack while iterating through the iterator. When the stack has been
rewritten since we have created the iterator, then we would end up
discarding a subset of readers that may still be in use by the iterator.
The consequence is that we now try to reference deallocated memory,
which of course segfaults.

One way to trigger this is in t5616, where some background maintenance
jobs have been leaking from one test into another. This leads to stack
traces like the following one:

  + git -c protocol.version=0 -C pc1 fetch --filter=blob:limit=29999 --refetch origin
  AddressSanitizer:DEADLYSIGNAL
  =================================================================
  ==657994==ERROR: AddressSanitizer: SEGV on unknown address 0x7fa0f0ec6089 (pc 0x55f23e52ddf9 bp
0x7ffe7bfa1700 sp 0x7ffe7bfa1700 T0)
  ==657994==The signal is caused by a READ memory access.
      #0 0x55f23e52ddf9 in get_var_int reftable/record.c:29
      #1 0x55f23e53295e in reftable_decode_keylen reftable/record.c:170
      #2 0x55f23e532cc0 in reftable_decode_key reftable/record.c:194
      #3 0x55f23e54e72e in block_iter_next reftable/block.c:398
      #4 0x55f23e5573dc in table_iter_next_in_block reftable/reader.c:240
      #5 0x55f23e5573dc in table_iter_next reftable/reader.c:355
      #6 0x55f23e5573dc in table_iter_next reftable/reader.c:339
      #7 0x55f23e551283 in merged_iter_advance_subiter reftable/merged.c:69
      #8 0x55f23e55169e in merged_iter_next_entry reftable/merged.c:123
      #9 0x55f23e55169e in merged_iter_next_void reftable/merged.c:172
      #10 0x55f23e537625 in reftable_iterator_next_ref reftable/generic.c:175
      #11 0x55f23e2cf9c6 in reftable_ref_iterator_advance refs/reftable-backend.c:464
      #12 0x55f23e2d996e in ref_iterator_advance refs/iterator.c:13
      #13 0x55f23e2d996e in do_for_each_ref_iterator refs/iterator.c:452
      #14 0x55f23dca6767 in get_ref_map builtin/fetch.c:623
      #15 0x55f23dca6767 in do_fetch builtin/fetch.c:1659
      #16 0x55f23dca6767 in fetch_one builtin/fetch.c:2133
      #17 0x55f23dca6767 in cmd_fetch builtin/fetch.c:2432
      #18 0x55f23dba7764 in run_builtin git.c:484
      #19 0x55f23dba7764 in handle_builtin git.c:741
      #20 0x55f23dbab61e in run_argv git.c:805
      #21 0x55f23dbab61e in cmd_main git.c:1000
      #22 0x55f23dba4781 in main common-main.c:64
      #23 0x7fa0f063fc89 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
      #24 0x7fa0f063fd44 in __libc_start_main_impl ../csu/libc-start.c:360
      #25 0x55f23dba6ad0 in _start (git+0xadfad0) (BuildId: 803b2b7f59beb03d7849fb8294a8e2145dd4aa27)

While it is somewhat awkward that the maintenance processes survive
tests in the first place, it is totally expected that reftables should
work alright with concurrent writers. Seemingly they don't.

The only underlying resource that we need to care about in this context
is the reftable reader, which is responsible for reading a single table
from disk. These readers get discarded immediately (unless reused) when
calling `reftable_stack_reload()`, which is wrong. We can only close
them once we know that there are no iterators using them anymore.

Prepare for a fix by converting the reftable readers to be refcounted.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitster pushed a commit that referenced this pull request Aug 22, 2024
It was recently reported that concurrent reads and writes may cause the
reftable backend to segfault. The root cause of this is that we do not
properly keep track of reftable readers across reloads.

Suppose that you have a reftable iterator and then decide to reload the
stack while iterating through the iterator. When the stack has been
rewritten since we have created the iterator, then we would end up
discarding a subset of readers that may still be in use by the iterator.
The consequence is that we now try to reference deallocated memory,
which of course segfaults.

One way to trigger this is in t5616, where some background maintenance
jobs have been leaking from one test into another. This leads to stack
traces like the following one:

  + git -c protocol.version=0 -C pc1 fetch --filter=blob:limit=29999 --refetch origin
  AddressSanitizer:DEADLYSIGNAL
  =================================================================
  ==657994==ERROR: AddressSanitizer: SEGV on unknown address 0x7fa0f0ec6089 (pc 0x55f23e52ddf9 bp
0x7ffe7bfa1700 sp 0x7ffe7bfa1700 T0)
  ==657994==The signal is caused by a READ memory access.
      #0 0x55f23e52ddf9 in get_var_int reftable/record.c:29
      #1 0x55f23e53295e in reftable_decode_keylen reftable/record.c:170
      #2 0x55f23e532cc0 in reftable_decode_key reftable/record.c:194
      #3 0x55f23e54e72e in block_iter_next reftable/block.c:398
      #4 0x55f23e5573dc in table_iter_next_in_block reftable/reader.c:240
      #5 0x55f23e5573dc in table_iter_next reftable/reader.c:355
      #6 0x55f23e5573dc in table_iter_next reftable/reader.c:339
      #7 0x55f23e551283 in merged_iter_advance_subiter reftable/merged.c:69
      #8 0x55f23e55169e in merged_iter_next_entry reftable/merged.c:123
      #9 0x55f23e55169e in merged_iter_next_void reftable/merged.c:172
      #10 0x55f23e537625 in reftable_iterator_next_ref reftable/generic.c:175
      #11 0x55f23e2cf9c6 in reftable_ref_iterator_advance refs/reftable-backend.c:464
      #12 0x55f23e2d996e in ref_iterator_advance refs/iterator.c:13
      #13 0x55f23e2d996e in do_for_each_ref_iterator refs/iterator.c:452
      #14 0x55f23dca6767 in get_ref_map builtin/fetch.c:623
      #15 0x55f23dca6767 in do_fetch builtin/fetch.c:1659
      #16 0x55f23dca6767 in fetch_one builtin/fetch.c:2133
      #17 0x55f23dca6767 in cmd_fetch builtin/fetch.c:2432
      #18 0x55f23dba7764 in run_builtin git.c:484
      #19 0x55f23dba7764 in handle_builtin git.c:741
      #20 0x55f23dbab61e in run_argv git.c:805
      #21 0x55f23dbab61e in cmd_main git.c:1000
      #22 0x55f23dba4781 in main common-main.c:64
      #23 0x7fa0f063fc89 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
      #24 0x7fa0f063fd44 in __libc_start_main_impl ../csu/libc-start.c:360
      #25 0x55f23dba6ad0 in _start (git+0xadfad0) (BuildId: 803b2b7f59beb03d7849fb8294a8e2145dd4aa27)

While it is somewhat awkward that the maintenance processes survive
tests in the first place, it is totally expected that reftables should
work alright with concurrent writers. Seemingly they don't.

The only underlying resource that we need to care about in this context
is the reftable reader, which is responsible for reading a single table
from disk. These readers get discarded immediately (unless reused) when
calling `reftable_stack_reload()`, which is wrong. We can only close
them once we know that there are no iterators using them anymore.

Prepare for a fix by converting the reftable readers to be refcounted.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitster pushed a commit that referenced this pull request Aug 23, 2024
It was recently reported that concurrent reads and writes may cause the
reftable backend to segfault. The root cause of this is that we do not
properly keep track of reftable readers across reloads.

Suppose that you have a reftable iterator and then decide to reload the
stack while iterating through the iterator. When the stack has been
rewritten since we have created the iterator, then we would end up
discarding a subset of readers that may still be in use by the iterator.
The consequence is that we now try to reference deallocated memory,
which of course segfaults.

One way to trigger this is in t5616, where some background maintenance
jobs have been leaking from one test into another. This leads to stack
traces like the following one:

  + git -c protocol.version=0 -C pc1 fetch --filter=blob:limit=29999 --refetch origin
  AddressSanitizer:DEADLYSIGNAL
  =================================================================
  ==657994==ERROR: AddressSanitizer: SEGV on unknown address 0x7fa0f0ec6089 (pc 0x55f23e52ddf9 bp
0x7ffe7bfa1700 sp 0x7ffe7bfa1700 T0)
  ==657994==The signal is caused by a READ memory access.
      #0 0x55f23e52ddf9 in get_var_int reftable/record.c:29
      #1 0x55f23e53295e in reftable_decode_keylen reftable/record.c:170
      #2 0x55f23e532cc0 in reftable_decode_key reftable/record.c:194
      #3 0x55f23e54e72e in block_iter_next reftable/block.c:398
      #4 0x55f23e5573dc in table_iter_next_in_block reftable/reader.c:240
      #5 0x55f23e5573dc in table_iter_next reftable/reader.c:355
      #6 0x55f23e5573dc in table_iter_next reftable/reader.c:339
      #7 0x55f23e551283 in merged_iter_advance_subiter reftable/merged.c:69
      #8 0x55f23e55169e in merged_iter_next_entry reftable/merged.c:123
      #9 0x55f23e55169e in merged_iter_next_void reftable/merged.c:172
      #10 0x55f23e537625 in reftable_iterator_next_ref reftable/generic.c:175
      #11 0x55f23e2cf9c6 in reftable_ref_iterator_advance refs/reftable-backend.c:464
      #12 0x55f23e2d996e in ref_iterator_advance refs/iterator.c:13
      #13 0x55f23e2d996e in do_for_each_ref_iterator refs/iterator.c:452
      #14 0x55f23dca6767 in get_ref_map builtin/fetch.c:623
      #15 0x55f23dca6767 in do_fetch builtin/fetch.c:1659
      #16 0x55f23dca6767 in fetch_one builtin/fetch.c:2133
      #17 0x55f23dca6767 in cmd_fetch builtin/fetch.c:2432
      #18 0x55f23dba7764 in run_builtin git.c:484
      #19 0x55f23dba7764 in handle_builtin git.c:741
      #20 0x55f23dbab61e in run_argv git.c:805
      #21 0x55f23dbab61e in cmd_main git.c:1000
      #22 0x55f23dba4781 in main common-main.c:64
      #23 0x7fa0f063fc89 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
      #24 0x7fa0f063fd44 in __libc_start_main_impl ../csu/libc-start.c:360
      #25 0x55f23dba6ad0 in _start (git+0xadfad0) (BuildId: 803b2b7f59beb03d7849fb8294a8e2145dd4aa27)

While it is somewhat awkward that the maintenance processes survive
tests in the first place, it is totally expected that reftables should
work alright with concurrent writers. Seemingly they don't.

The only underlying resource that we need to care about in this context
is the reftable reader, which is responsible for reading a single table
from disk. These readers get discarded immediately (unless reused) when
calling `reftable_stack_reload()`, which is wrong. We can only close
them once we know that there are no iterators using them anymore.

Prepare for a fix by converting the reftable readers to be refcounted.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载