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

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

From
Karsten Blees <karsten.blees@gmail.com>
Date
Jul 11, 2014, 19:11 UTC
Message-ID
<53C036CD.902@gmail.com>
In-Reply-To
<xmqqa98i7aqt.fsf@gitster.dls.corp.google.com>
Am 09.07.2014 18:33, schrieb Junio C Hamano:
Show 17 quoted lines
> Karsten Blees <karsten.blees@gmail.com> writes:
> 
>> 'git status' segfaults if a directory is longer than PATH_MAX, because
>> processing .gitignore files in prep_exclude() writes past the end of a
>> PATH_MAX-bounded buffer.
>>
>> Remove the limitation by using strbuf instead.
>>
>> Note: this fix just 'abuses' strbuf as string allocator, len is always 0.
>> prep_exclude() can probably be simplified using more strbuf APIs.
> 
> In addition to what Jeff already said, I am afraid that this may
> make things a lot worse for normal case.  By sizing the strbuf to
> absolute minimum as you dig deeper at each level, wouldn't you copy
> and reallocate the buffer a lot more, compared to the case where
> everything fits in the original buffer?
> 

strbuf uses ALLOC_GROW, which resizes in (x+16)*1.5 steps (i.e. 24, 60, 114, 195, 316...). Max path len in git is 85, and linux and WebKit are 170ish. I don't think three or four extra reallocs per directory traversal will be noticeable.

Anyways, I'd like to kindly withdraw this patch in favor of Duy's version.
http://article.gmane.org/gmane.comp.version-control.git/248310
-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 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.