Re: [PATCH] Correctly initialize 'installed_handlers'
- From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
- Date
- May 8, 2020, 08:33 UTC
- Message-ID
- <20200508083340.GA36538@Carlos-MBP>
- In-Reply-To
- <pull.630.git.1588921514146.gitgitgadget@gmail.com>
On Fri, May 08, 2020 at 07:05:13AM +0000, Force Charlie via GitGitGadget wrote:
> From: Force Charlie <charlieio@outlook.com> > > Because static variables are not initialized properly,
what do you mean by "properly"?, all static variables are set to 0; that is a warranty of the language (all the way to K&R) and any C compiler should enforce that as part of the standard.
> temporary files may not be deleted when receive-pack receives a signal.
the way this is handled would seem to indicate otherwise
if (!installed_handlers) {
atexit(remove_tmp_objdir);
sigchain_push_common(remove_tmp_objdir_on_signal);
installed_handlers++;
}there is no explicit locking and so there might be a thread race condition, but the code below wouldn't make a difference in that case.
could you elaborate more on how to reproduce the problem?, I suspect that if there was a problem then suppressing whatever signal that was triggered before sigchain_push_common might help, but the window is too short to be a likely issue.
Carlo