All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Philip Oakley" <philipoakley@iee.org>
Cc: "GitList" <git@vger.kernel.org>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] exec_cmd.c, sideband.c, Makefile: avoid multiple PREFIX definitions
Date: Fri, 06 May 2016 09:55:11 -0700	[thread overview]
Message-ID: <xmqqd1oz5dow.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1C7D96C1B53D45CCAA8658C9DBB1AAB5@PhilipOakley> (Philip Oakley's message of "Fri, 6 May 2016 08:23:23 +0100")

Dropped "git-for-windows" <git-for-windows@googlegroups.com> from
the Cc: list, as I seem to be getting bounces from it due to its
moderation policy.

"Philip Oakley" <philipoakley@iee.org> writes:

> Perhaps EXEC_CMD_PREFIX, for that is what it is?

That name is doubly wrong, I have to say.

This is used only after RUNTIME_PREFIX heuristics to learn the
binary location from argv[0] fails, or the result of it does not
have expected suffix string (i.e. GIT_EXEC_PATH . BINDIR . "git").
The code even says this:

	if (!prefix &&
	    !(prefix = strip_path_suffix(argv0_path, GIT_EXEC_PATH)) &&
	    !(prefix = strip_path_suffix(argv0_path, BINDIR)) &&
	    !(prefix = strip_path_suffix(argv0_path, "git"))) {
		prefix = PREFIX;
		trace_printf("RUNTIME_PREFIX requested, "
				"but prefix computation failed.  "
				"Using static fallback '%s'.\n", prefix);
	}

Notice "static fallback" there?

I have a very strong preference for the name to reflect that fact.
I.e.  send a signal to those who do not use RUNTIME_PREFIX
configuration that they do not have to care.

Also "EXEC" is wrong, too.  The way the 'prefix' variable we see
above is used is that system_path() takes a directory path to
various installed component of the Git package, e.g. GIT_MAN_PATH
is the location for manual pages, as its "path" parameter, and
then 

	strbuf_addf(&d, "%s/%s", prefix, path);

is used to formulate the absolute path for it.  A name with "EXEC"
in it would incorrectly hint that it points at a rough equivalent to
/usr/local/bin/ or /usr/local/libexec/git/, but PREFIX corresponds
more to /usr/local/.

Even if J6t's point about these two separate PREFIXes should never
exist at the same time is correct, I think it is a good change to
use a more explicit name for this variable that is used to
communicate between Makefile and the *.c source.

As to your "RUNTIME_PREFIX_FALLBACK is very long" objection, I do
not care ;-) More seriously, this is not something typed very often.
It appears only twice in this codepath and having clear names to
tell readers what it is about is much more important.

I do agree the most logical name, after understanding all of the
above, which is RUNTIME_PREFIX_STATIC_FALLBACK, may be a bit too
long, though.

  reply	other threads:[~2016-05-06 16:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 21:28 [PATCH] Conflicting PREFIX usage Philip Oakley
2016-05-05 21:28 ` [PATCH] exec_cmd.c, sideband.c, Makefile: avoid multiple PREFIX definitions Philip Oakley
2016-05-05 22:02   ` Junio C Hamano
2016-05-06  7:23     ` Philip Oakley
2016-05-06 16:55       ` Junio C Hamano [this message]
2016-05-06  6:18   ` [git-for-windows] " Johannes Sixt
2016-05-06  7:31     ` Philip Oakley

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=xmqqd1oz5dow.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=philipoakley@iee.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.