Re: [PATCH v2 00/45] parse_pathspec and :(glob) magic
On Thu, Mar 21, 2013 at 12:33:26PM +0700, Duy Nguyen wrote:
Show 21 quoted lines
> > I am still getting this out of 7300, though.
>
> 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?
>
> -- 8< --
> diff --git a/setup.c b/setup.c
> index 3584f22..6ae147a 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -14,6 +14,7 @@ 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);
> + *p_len = 0;
> } else {
> sanitized = xmalloc(len + strlen(path) + 1);
> if (len)
>
> -- 8< --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;
} else {
sanitized = xmalloc(len + strlen(path) + 1);
if (len)
-- 8< --