Re: [PATCH] fix misuse of prefix_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> wrote:
> When DEFAULT_GIT_TEMPLATE_DIR is specified as a relative path,
> init-db made it relative to exec_path using prefix_path(), which
> is wrong.  prefix_path() is about a file inside the work tree.
> There was a similar misuse in config.c that takes relative
> ETC_GITCONFIG path.
>
> A convenience function prefix_filename() can concatenate two paths
> to form a path that points at somewhere outside the work tree.
> Use it in these codepaths instead.

Thanks for catching that. But, no, your patch does not work. The reason is
that prefix_filename() assumes that the prefix ends with a directory
separator ('/'), but git_exec_path() doesn't have one.

prefix_path() has the same assumption, but at the same time it does the
"../" sanitization. In the MinGW configuration both relative paths begin
with "../" and prefix_path() removed one path component from the prefix,
but left a trailing '/' behind. IOW, so far the code worked by accident,
not by design ;)

I'll work on a fix (later today).

-- Hannes


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux