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

Re: [PATCH 1/2] symlinks: remove PATH_MAX limitation

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2014, 18:30 UTC
Message-ID
<xmqqsimdc988.fsf@gitster.dls.corp.google.com>
In-Reply-To
<53B72DAA.5050007@gmail.com>
Karsten Blees <karsten.blees@gmail.com> writes:
Show 5 quoted lines
> 'git checkout' fails if a directory is longer than PATH_MAX, because the
> lstat_cache in symlinks.c checks if the leading directory exists using
> PATH_MAX-bounded string operations.
>
> Remove the limitation by using strbuf instead.
Good.
Show 20 quoted lines
> diff --git a/cache.h b/cache.h
> index df65231..44aa439 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -1090,12 +1090,16 @@ struct checkout {
>  extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath);
>  
>  struct cache_def {
> -	char path[PATH_MAX + 1];
> -	int len;
> +	struct strbuf path;
>  	int flags;
>  	int track_flags;
>  	int prefix_len_stat_func;
>  };
> +#define CACHE_DEF_INIT { STRBUF_INIT, 0, 0, 0 }
> +static inline void cache_def_free(struct cache_def *cache)
> +{
> +	strbuf_release(&cache->path);
> +}

The above cache_def_free(cache) does not free the cache itself, but only its associated data, so the name cache_def_free() is somewhat misleading.

It seems that we use the name that consists solely of "something" and "free" if the pointer to "something" itself is also freed. For example "diff_free_filespec_data(struct diff_filespec *)" frees data associated with the filespec but not the filespec itself, which is done with "diff_free_filespec()".

Another name that may not be misleading would be cache_def_clear(); I think I'd prefer it over cache_def_free_data().

-- 
-- 
*** 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: Johannes SchindelinNext: Karsten Blees
Message 13 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.