Re: [PATCH] transport-helper: fix TSAN race in transfer_debug()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 4, 2026, 01:09 UTC
- Message-ID
- <xmqqv7bzp0vc.fsf@gitster.g>
- In-Reply-To
- <20260602201309.38434-2-pushkarkumarsingh1970@gmail.com>
Pushkar Singh <pushkarkumarsingh1970@gmail.com> writes:
Show 7 quoted lines
> +static int transfer_debug_enabled = -1;
> ...
> - if (debug_enabled < 0)
> - debug_enabled = getenv("GIT_TRANSLOOP_DEBUG") ? 1 : 0;
> - if (!debug_enabled)
> + if (!transfer_debug_enabled)
> return;Would it be possible that transfer_debug_enabled is still -1 at this point? We would proceed in such a case, which is a bit different from what would have happened in the original.
Perhaps
if (transfer_debug_enabled <= 0) return;
is what you want? I dunno.
Show 10 quoted lines
> @@ -1648,6 +1640,9 @@ int bidirectional_transfer_loop(int input, int output)
> {
> struct bidirectional_transfer_state state;
>
> + if (transfer_debug_enabled < 0)
> + transfer_debug_enabled = getenv("GIT_TRANSLOOP_DEBUG") ? 1 : 0;
> +
> /* Fill the state fields. */
> state.ptg.src = input;
> state.ptg.dest = 1;