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

Re: [PATCH 2/2] dir: remove PATH_MAX limitation

From
Jeff King <peff@peff.net>
Date
Jul 9, 2014, 05:42 UTC
Message-ID
<20140709054215.GE2318@sigill.intra.peff.net>
In-Reply-To
<53B72DD5.6020603@gmail.com>
On Sat, Jul 05, 2014 at 12:42:29AM +0200, Karsten Blees wrote:
> Note: this fix just 'abuses' strbuf as string allocator, len is always 0.
> prep_exclude() can probably be simplified using more strbuf APIs.

Hrm. It looks like you grow it and add some data, but really don't want the length to expand (because the caller depends on it).

In other directory-traversal code we follow a pattern like:
  size_t prefix_len = dir->base.len;
  strbuf_add(&dir->base, cp, stk->baselen - current);
  /* use full path in dir->base, then "pop" */
  strbuf_setlen(&dir->base, stk->baselen);

That makes it a little more obvious that the memcpy matches the strbuf_grow (because it all happens inside strbuf_add).

Is it possible to do something like that here?
-Peff
Previous: Karsten BleesNext: Junio C Hamano
Message 5 of 16 in “symlinks: remove PATH_MAX limitation”
  1. 1/2 symlinks: remove PATH_MAX limitationKarsten Blees, Jul 4, 2014
  2. 2/2 dir: remove PATH_MAX limitationKarsten Blees, Jul 4, 2014
  3. Duy NguyenJul 5, 2014
  4. Karsten BleesJul 11, 2014
  5. Jeff KingJul 9, 2014
  6. Junio C HamanoJul 9, 2014
  7. Karsten BleesJul 11, 2014
  8. Junio C HamanoJul 11, 2014
  9. Karsten BleesJul 11, 2014
  10. Duy NguyenJul 12, 2014
  11. Junio C HamanoJul 14, 2014
  12. Johannes SchindelinJul 5, 2014
  13. Junio C HamanoJul 7, 2014
  14. Karsten BleesJul 11, 2014
  15. Junio C HamanoJul 11, 2014
  16. fixup! symlinks: remove PATH_MAX limitationKarsten Blees, Jul 11, 2014

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.