git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Force Charlie via GitGitGadgetNext: Junio C Hamano
Message 2 of 4 in “Correctly initialize 'installed_handlers'”
  1. Correctly initialize 'installed_handlers'Force Charlie via GitGitGadget, May 8, 2020
  2. Carlo Marcelo Arenas BelónMay 8, 2020
  3. Junio C HamanoMay 8, 2020
  4. Jeff KingMay 8, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.