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

Re: [PATCH v3 1/3] read-cache.c: Handle long filenames correctly

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Jul 11, 2012, 11:34 UTC
Message-ID
<CACsJy8A880GeyTXy9jCa6vhD-ajL29qimf5Mf94eCVjAOb-TMg@mail.gmail.com>
In-Reply-To
<1341998558-8502-2-git-send-email-t.gummerer@gmail.com>
On Wed, Jul 11, 2012 at 4:22 PM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 5 quoted lines
> Make git handle long file/path names (> 4096 characters) correctly.
>
> There is a bug in the current version, which causes very long
> file/pathnames to be handled incorrectly, or not even added to
> the index, if they share the first 4096 characters.

The patch looks correct to me though we're stepping on the border here. Linux's PATH_MAX is 4k and Git already has hard time dealing with >=4k paths (even when a single path component is less than 4k).

Show 9 quoted lines
> +       >path1 &&
> +       git update-index --add path1 &&
> +       (
> +               git ls-files -s path1 |
> +               sed -e "s/      .*/     /" |
> +               tr -d "\012"
> +               echo "$a"
> +       ) | git update-index --index-info &&
> +
or

BLOB=$(git hash-object -w -t blob --stdin </dev/null) git update-index --cacheinfo 100644 $BLOB $a

I don't think git cares much in these tests and using empty tree sha-1 may even work (git recognizes that sha-1 automatically), but it may hurt the reader..

-- 
Duy
Previous: Thomas GummererNext: Junio C Hamano
Message 11 of 18 in “Replace ce_namelen() with a ce_namelen field”
  1. Replace ce_namelen() with a ce_namelen fieldThomas Gummerer, Jul 4, 2012
  2. Thomas RastJul 4, 2012
  3. Nguyen Thai Ngoc DuyJul 4, 2012
  4. Nguyen Thai Ngoc DuyJul 4, 2012
  5. Junio C HamanoJul 4, 2012
  6. Introduction of a ce_namelen fieldThomas Gummerer, Jul 6, 2012
  7. 1/2 Strip namelen out of ce_flags into a ce_namelen fieldThomas Gummerer, Jul 6, 2012
  8. Junio C HamanoJul 9, 2012
  9. 0/3 Introduction of a ce_namelen fieldThomas Gummerer, Jul 11, 2012
  10. 1/3 read-cache.c: Handle long filenames correctlyThomas Gummerer, Jul 11, 2012
  11. Nguyen Thai Ngoc DuyJul 11, 2012
  12. Junio C HamanoJul 11, 2012
  13. 2/3 Strip namelen out of ce_flags into a ce_namelen fieldThomas Gummerer, Jul 11, 2012
  14. 3/3 Replace strlen() with ce_namelen()Thomas Gummerer, Jul 11, 2012
  15. Junio C HamanoJul 11, 2012
  16. Junio C HamanoJul 11, 2012
  17. 2/2 Replace strlen() with ce_namelen()Thomas Gummerer, Jul 6, 2012
  18. Junio C HamanoJul 9, 2012

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.