From: Johannes Sixt <johannes.sixt@telecom.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fix misuse of prefix_path()
Date: Mon, 4 Feb 2008 12:13:26 +0100 [thread overview]
Message-ID: <1202123606.47a6f3567ebb9@webmail.eunet.at> (raw)
In-Reply-To: <7v3as9mce7.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> 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
next prev parent reply other threads:[~2008-02-04 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-04 7:03 [PATCH] fix misuse of prefix_path() Junio C Hamano
2008-02-04 8:09 ` [PATCH] builtin-mv: minimum fix to avoid losing files Junio C Hamano
2008-02-04 18:08 ` Johannes Schindelin
2008-02-04 11:13 ` Johannes Sixt [this message]
2008-02-05 8:17 ` [PATCH] Fix misuse of prefix_path() Johannes Sixt
2008-02-05 9:45 ` Junio C Hamano
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=1202123606.47a6f3567ebb9@webmail.eunet.at \
--to=johannes.sixt@telecom.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).