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

[PATCH v8 5/5] mingw/msvc: use the new-style RUNTIME_PREFIX helper

From
Dan Jacques <dnj@google.com>
Date
Apr 10, 2018, 15:05 UTC
Message-ID
<20180410150546.38062-6-dnj@google.com>
In-Reply-To
<20180410150546.38062-1-dnj@google.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

This change also allows us to stop overriding argv[0] with the absolute path of the executable, allowing us to preserve e.g. the case of the executable's file name.

This fixes https://github.com/git-for-windows/git/issues/1496 partially.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c   | 5 ++---
 config.mak.uname | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index a67872bab..6ded1c859 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2221,7 +2221,7 @@ void mingw_startup(void)
 		die_startup();
 
 	/* determine size of argv and environ conversion buffer */
-	maxlen = wcslen(_wpgmptr);
+	maxlen = wcslen(wargv[0]);
 	for (i = 1; i < argc; i++)
 		maxlen = max(maxlen, wcslen(wargv[i]));
 	for (i = 0; wenv[i]; i++)
@@ -2241,8 +2241,7 @@ void mingw_startup(void)
 	buffer = malloc_startup(maxlen);
 
 	/* convert command line arguments and environment to UTF-8 */
-	__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
-	for (i = 1; i < argc; i++)
+	for (i = 0; i < argc; i++)
 		__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
 	for (i = 0; wenv[i]; i++)
 		environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);
diff --git a/config.mak.uname b/config.mak.uname
index e1cfe5e5e..a6e734c5d 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -357,6 +357,7 @@ ifeq ($(uname_S),Windows)
 	SNPRINTF_RETURNS_BOGUS = YesPlease
 	NO_SVN_TESTS = YesPlease
 	RUNTIME_PREFIX = YesPlease
+	HAVE_WPGMPTR = YesWeDo
 	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 	NO_NSEC = YesPlease
 	USE_WIN32_MMAP = YesPlease
@@ -506,6 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	NO_SVN_TESTS = YesPlease
 	NO_PERL_MAKEMAKER = YesPlease
 	RUNTIME_PREFIX = YesPlease
+	HAVE_WPGMPTR = YesWeDo
 	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 	NO_NSEC = YesPlease
 	USE_WIN32_MMAP = YesPlease
-- 
2.15.0.chromium12
Previous: Dan JacquesNext: Junio C Hamano
Message 6 of 8 in “RUNTIME_PREFIX relocatable Git”
  1. 0/5 RUNTIME_PREFIX relocatable GitDan Jacques, Apr 10, 2018
  2. 1/5 Makefile: generate Perl header from template fileDan Jacques, Apr 10, 2018
  3. 2/5 Makefile: add Perl runtime prefix supportDan Jacques, Apr 10, 2018
  4. 3/5 exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques, Apr 10, 2018
  5. 4/5 exec_cmd: provide a new-style RUNTIME_PREFIX helper for WindowsDan Jacques, Apr 10, 2018
  6. 5/5 mingw/msvc: use the new-style RUNTIME_PREFIX helperDan Jacques, Apr 10, 2018
  7. Junio C HamanoApr 11, 2018
  8. Ævar Arnfjörð BjarmasonApr 11, 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.