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

Re: [git-for-windows] Git for Windows v2.24.0-rc0, was Re: [ANNOUNCE] Git v2.24.0-rc0

From
Jeff King <peff@peff.net>
Date
Oct 25, 2019, 16:58 UTC
Message-ID
<20191025165849.GA20304@sigill.intra.peff.net>
In-Reply-To
<nycvar.QRO.7.76.6.1910251007550.46@tvgsbejvaqbjf.bet>
On Fri, Oct 25, 2019 at 10:18:30AM +0200, Johannes Schindelin wrote:
Show 8 quoted lines
> > This cast made me wonder why it was OK to write to system_wide. The
> > answer is that system_path() hands ownership of the memory to us, since
> > 59362e560d (system_path(): always return free'able memory to the caller,
> > 2014-11-24). So I think the better solution than the cast is to drop the
> > "const" from its declaration to better indicate our ownership within the
> > function.
> 
> Makes sense, I changed it to `static char *system_wide;`.
Thanks, perfect.
Show 15 quoted lines
> > I also wondered how we know that system_wide is a large enough buffer,
> > but I guess normalizing always makes things smaller. It would be nice if
> > normalize_path_copy() said so in its docstring, but that is certainly
> > not new to your patch. :)
> 
> Well, `normalize_path_copy()`'s documentation says:
> 
> 	It is okay if dst == src, but they should not overlap otherwise.
> 
> But yes, that does not state explicitly that the resulting string won't
> be longer than the original one. It is currently true, though the
> documentation hints at the possibility that a future version might
> follow symbolic links (in which case it would no longer be true). But
> then, that would technically not be normalization anymore, but
> canonicalization.

Yeah, and I think we already have functions that do that (and return an allocated buffer). I have a few cleanups around some callers of normalize_path_copy(), so I'll roll in the documentation change I suggested.

-Peff
Previous: Johannes SchindelinNext: Bryan Turner
Message 10 of 12 in “[ANNOUNCE] Git v2.24.0-rc0”
  1. Junio C HamanoOct 18, 2019
  2. Derrick StoleeOct 21, 2019
  3. Elijah NewrenOct 21, 2019
  4. Jeff KingOct 22, 2019
  5. Git for Windows v2.24.0-rc0, was Re: [ANNOUNCE] Git v2.24.0-rc0Johannes Schindelin, Oct 21, 2019
  6. Philip OakleyOct 22, 2019
  7. Johannes SchindelinOct 24, 2019
  8. Jeff KingOct 24, 2019
  9. Johannes SchindelinOct 25, 2019
  10. Jeff KingOct 25, 2019
  11. Bryan TurnerOct 24, 2019
  12. Johannes SchindelinOct 24, 2019

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.