From: Junio C Hamano <gitster@pobox•com>
To: Karsten Blees <karsten.blees@gmail•com>
Cc: Git List <git@vger•kernel.org>, msysGit <msysgit@googlegroups•com>
Subject: Re: [PATCH 1/2] symlinks: remove PATH_MAX limitation
Date: Mon, 07 Jul 2014 11:30:30 -0700 [thread overview]
Message-ID: <xmqqsimdc988.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <53B72DAA.5050007@gmail.com> (Karsten Blees's message of "Sat, 05 Jul 2014 00:41:46 +0200")
Karsten Blees <karsten.blees@gmail•com> writes:
> '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.
> 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.
next prev parent reply other threads:[~2014-07-07 18:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 22:41 [PATCH 1/2] symlinks: remove PATH_MAX limitation Karsten Blees
2014-07-04 22:42 ` [PATCH 2/2] dir: " Karsten Blees
2014-07-05 10:48 ` Duy Nguyen
2014-07-11 19:10 ` Karsten Blees
2014-07-09 5:42 ` Jeff King
2014-07-09 16:33 ` Junio C Hamano
2014-07-11 19:11 ` Karsten Blees
2014-07-11 22:29 ` Junio C Hamano
2014-07-11 23:43 ` Karsten Blees
2014-07-12 2:56 ` Duy Nguyen
2014-07-14 4:29 ` Junio C Hamano
2014-07-05 2:52 ` [PATCH 1/2] symlinks: " Johannes Schindelin
2014-07-07 18:30 ` Junio C Hamano [this message]
2014-07-11 19:11 ` Karsten Blees
2014-07-11 22:19 ` Junio C Hamano
2014-07-11 23:02 ` [PATCH] fixup! " Karsten Blees
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqsimdc988.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=karsten.blees@gmail$(echo .)com \
--cc=msysgit@googlegroups$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox