Re: [PATCH] exec_cmd.c, sideband.c, Makefile: avoid multiple PREFIX definitions

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

 



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

"Philip Oakley" <philipoakley@xxxxxxx> 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.

--
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]