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

Re: [PATCH] git-compat-util.h: Fix build without threads

From
Jeff King <peff@peff.net>
Date
Nov 28, 2022, 05:04 UTC
Message-ID
<Y4RBUa5ILEszSpOu@coredump.intra.peff.net>
In-Reply-To
<221126.86lenymw7p.gmgdl@evledraar.gmail.com>
On Sat, Nov 26, 2022 at 12:47:27AM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 23 quoted lines
> On Fri, Nov 25 2022, Bagas Sanjaya wrote:
> 
> > From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> >
> > Git build with toolchains without threads support is broken (as reported
> > by Buildroot autobuilder [1]) since version 2.29.0, which traces back to
> 
> > --- a/git-compat-util.h
> > +++ b/git-compat-util.h
> > @@ -1470,7 +1470,8 @@ int open_nofollow(const char *path, int flags);
> >  # define SHELL_PATH "/bin/sh"
> >  #endif
> >  
> > -#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
> > +
> > +#if !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(NO_FLOCKFILE)
> 
> Per f43cce23add (git-compat-util: add fallbacks for unlocked stdio,
> 2015-04-16) wouldn't it make more sense to do something like:
> 
> #ifdef NO_FLOCKFILE
> #undef _POSIX_THREAD_SAFE_FUNCTIONS
> #endif

That doesn't work, because the NO_FLOCKFILE is actually overriding the _lack_ of _POSIX_THREAD_SAFE_FUNCTIONS. So it's kind of confusingly named. In this patch, NO_FLOCKFILE means "do not define a noop wrapper flockfile()", which can only work if the system really does define it.

I do think this patch is doing the wrong thing, though. See my other reply.

-Peff
Previous: Ævar Arnfjörð BjarmasonNext: Bagas Sanjaya
Message 3 of 14 in “git-compat-util.h: Fix build without threads”
  1. git-compat-util.h: Fix build without threadsBagas Sanjaya, Nov 25, 2022
  2. Ævar Arnfjörð BjarmasonNov 25, 2022
  3. Jeff KingNov 28, 2022
  4. Bagas SanjayaNov 29, 2022
  5. Bagas SanjayaNov 29, 2022
  6. Jeff KingNov 28, 2022
  7. git-compat-util: avoid redefining system function namesJeff King, Nov 30, 2022
  8. Bagas SanjayaDec 2, 2022
  9. Jeff KingDec 2, 2022
  10. Bagas SanjayaDec 3, 2022
  11. Bagas SanjayaDec 7, 2022
  12. Jeff KingDec 7, 2022
  13. Ævar Arnfjörð BjarmasonDec 2, 2022
  14. Jeff KingDec 2, 2022

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.