git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/2] Add Windows support to the new RUNTIME_PREFIX design

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 29, 2018, 14:54 UTC
Message-ID
<nycvar.QRO.7.76.6.1803291637050.5026@qfpub.tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqa7us86pi.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Wed, 28 Mar 2018, Junio C Hamano wrote:
Show 23 quoted lines
> Daniel Jacques <dnj@google.com> writes:
> 
> > A simple grep suggests that the current test suite doesn't seem to have any
> > RUNTIME_PREFIX-specific tests. When I've been running the test suites, I've
> > been doing it with a "config.mak" file that explicitly enables
> > RUNTIME_PREFIX to get the runtime prefix code tested against the standard
> > Git testing suites.
> >
> > From a Git maintainer's perspective, would such a test be a prerequisite
> > for landing this patch series, or is this a good candidate for follow-up
> > work to improve our testing coverage?
> 
> It would be a nice-to-have follow-up, I would say, but as you two
> seem to be working well together and it shouldn't be too involved to
> have the minimum test that makes sure the version of "git" being
> tested thinks things should be where we think they should be, with
> something like...
> 
> 	test_expect_success RUNTIME_PREFIX 'runtime-prefix basics' '
> 		(
> 			# maybe others
> 			safe_unset GIT_EXEC_PATH &&
> 			git --exec-path >actual

That will only work when the directory into which git (or git.exe) was compiled is called "bin" or "git" (or "git-core" in a "libexec" directory), because this is the sanity check we have to determine that Git is installed into a sensible location where we *can* assume that libexec/git-core/ is the corresponding location of the support executables/scripts.

I initially thought that we could somehow do this:
-- snip --
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 2b3c5092a19..3040f0dae49 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "string-list.h"
+#include "exec_cmd.h"
 
 /*
  * A "string_list_each_func_t" function that normalizes an entry from
@@ -270,6 +271,25 @@ int cmd_main(int argc, const char **argv)
 	if (argc == 2 && !strcmp(argv[1], "dirname"))
 		return test_function(dirname_data, posix_dirname,
argv[1]);
 
+	if (argc == 3 && !strcmp(argv[1], "runtime-prefix")) {
+#ifndef RUNTIME_PREFIX
+		warning("RUNTIME_PREFIX support not compiled in;
skipping");
+		return 0;
+#else
+		char *path;
+
+		git_resolve_executable_dir(argv[2]);
+		path = system_path("");
+
+		if (!starts_with(argv[2], path))
+			return error("unexpected prefix: '%s'", path);
+
+		puts(path);
+
+		return 0;
+#endif
+	}
+
 	fprintf(stderr, "%s: unknown function name: %s\n", argv[0],
 		argv[1] ? argv[1] : "(there was none)");
 	return 1;
```

but this simply won't work, as the main idea of
`git_resolve_executable_dir()` is to use the executable path whenever
possible, instead of the passed-in parameter.

And since we usually work via the bin-wrappers, we cannot even add a
sanity check that Git was cloned into a directory called "git"...

So... I think we have to leave this out of the patch series, unless
somebody comes up with an idea neither Dan nor I has thought about to test
this reliably *without* copying the Git executable (which would, as I
mentioned, break testing when .dll files need to be present in the same
directory as git.exe).

Ciao,
Dscho
Previous: Junio C HamanoNext: Johannes Schindelin
Message 18 of 20 in “RUNTIME_PREFIX relocatable Git”
  1. 0/3 RUNTIME_PREFIX relocatable GitDan Jacques, Mar 25, 2018
  2. 1/3 Makefile: generate Perl header from template fileDan Jacques, Mar 25, 2018
  3. 2/3 Makefile: add Perl runtime prefix supportDan Jacques, Mar 25, 2018
  4. 3/3 exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Mar 25, 2018
  5. Ævar Arnfjörð BjarmasonMar 25, 2018
  6. Daniel JacquesMar 26, 2018
  7. Ævar Arnfjörð BjarmasonMar 26, 2018
  8. Daniel JacquesMar 26, 2018
  9. Junio C HamanoMar 26, 2018
  10. Daniel JacquesMar 26, 2018
  11. Johannes SchindelinMar 26, 2018
  12. 0/2 Add Windows support to the new RUNTIME_PREFIX designJohannes Schindelin, Mar 26, 2018
  13. Daniel JacquesMar 27, 2018
  14. Johannes SchindelinMar 27, 2018
  15. Daniel JacquesMar 27, 2018
  16. Johannes SchindelinMar 27, 2018
  17. Junio C HamanoMar 28, 2018
  18. Johannes SchindelinMar 29, 2018
  19. 1/2 exec_cmd: provide a new-style RUNTIME_PREFIX helper for WindowsJohannes Schindelin, Mar 26, 2018
  20. 2/2 mingw/msvc: use the new-style RUNTIME_PREFIX helperJohannes Schindelin, Mar 26, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.