Re: [PATCH v2 00/45] parse_pathspec and :(glob) magic
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 21, 2013, 17:28 UTC
- Message-ID
- <7v4ng4br1y.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130321054349.GA18101@duynguyen-vnpc.dek-tpc.internal>
Duy Nguyen <pclouds@gmail.com> writes:
Show 17 quoted lines
>> I still can't reproduce it. But I think I found a bug that >> miscalculates prefix length from absolute paths. Does this "fix" your >> test? >> ... > Nope, that one could cause more crashes. Try this > > -- 8< -- > diff --git a/setup.c b/setup.c > index 3584f22..3d8eb97 100644 > --- a/setup.c > +++ b/setup.c > @@ -14,6 +14,8 @@ char *prefix_path_gently(const char *prefix, int *p_len, const char *path) > const char *temp = real_path(path); > sanitized = xmalloc(len + strlen(temp) + 1); > strcpy(sanitized, temp); > + if (p_len) > + *p_len = 0;
Yes, this one seems to. "$(pwd)/../src" was not handled correctly.
The callchain to this locaiton would look like
parse_pathspec() with prefix="docs/", prefixlen set to 5
-> prefix_pathspec(), &prefixlen passed down
-> prefix_path_gently(), p_len points at the above prefixlen
your "this should fix" patch sets *p_len to 0,
original leaves *p_len as 5.
-> normalize_path_copy_len() with p_len
*p_len is used here.Why could the test pass for you without it? It doesn't look like a bug that depended on uninitialized memory or something from the above observation.