Duy Nguyen <[email protected]> writes:
>> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html