Skip to contentSkip to conversation

msysgit fallout

PATCH In review Steffen Prohaska 5 participants 18 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover msysgit fallout

Here are three patches that come from msysgit. They do not bring any functional changes, but only clean up code, or fix warnings.

Steffen

 builtin-init-db.c |    4 +---
 git.c             |    6 +++---
 path.c            |    2 +-
 setup.c           |    2 +-
 sha1_file.c       |   10 ++++++----
 5 files changed, 12 insertions(+), 12 deletions(-)

[PATCH 1/3] sha1_file.c: Fix size_t related printf format warnings [PATCH 2/3] builtin-init-db: use get_git_dir() instead of getenv() [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

#1 lore raw

PATCH 1/3 sha1_file.c: Fix size_t related printf format warnings

The old way of fixing warnings did not succeed on MinGW. MinGW does not support C99 printf format strings for size_t [1]. But gcc on MinGW issues warnings if C99 printf format is not used. Hence, the old stragegy to avoid warnings fails.

[1] http://www.mingw.org/MinGWiki/index.php/C99

This commits passes arguments of type size_t through a tiny helper functions that casts to the type expected by the format string.

---
 sha1_file.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
sha1_file.c +6 -4
index f007874..4f68e53 100644
@@ -25,8 +25,10 @@
 
 #ifdef NO_C99_FORMAT
 #define SZ_FMT "lu"
+static unsigned long sz_fmt(size_t s) { return (unsigned long)s; }
 #else
 #define SZ_FMT "zu"
+static size_t sz_fmt(size_t s) { return s; }
 #endif
 
 const unsigned char null_sha1[20];
@@ -423,9 +425,9 @@ void pack_report(void)
 		"pack_report: getpagesize()            = %10" SZ_FMT "\n"
 		"pack_report: core.packedGitWindowSize = %10" SZ_FMT "\n"
 		"pack_report: core.packedGitLimit      = %10" SZ_FMT "\n",
-		(size_t) getpagesize(),
-		packed_git_window_size,
-		packed_git_limit);
+		sz_fmt(getpagesize()),
+		sz_fmt(packed_git_window_size),
+		sz_fmt(packed_git_limit));
 	fprintf(stderr,
 		"pack_report: pack_used_ctr            = %10u\n"
 		"pack_report: pack_mmap_calls          = %10u\n"
@@ -435,7 +437,7 @@ void pack_report(void)
 		pack_used_ctr,
 		pack_mmap_calls,
 		pack_open_windows, peak_pack_open_windows,
-		pack_mapped, peak_pack_mapped);
+		sz_fmt(pack_mapped), sz_fmt(peak_pack_mapped));
 }
 
 static int check_packed_git_idx(const char *path,  struct packed_git *p)
Signature · 1 line
1.5.3.5.750.g8692
#2 lore raw

PATCH 2/3 builtin-init-db: use get_git_dir() instead of getenv()

We have a function get_git_dir(). So let's use it, instead of querying the environment.

---
 builtin-init-db.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
builtin-init-db.c +1 -3
index 763fa55..80d2f27 100644
@@ -378,9 +378,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	/*
 	 * Set up the default .git directory contents
 	 */
-	git_dir = getenv(GIT_DIR_ENVIRONMENT);
-	if (!git_dir)
-		git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
+	git_dir = get_git_dir();
 	safe_create_dir(git_dir, 0);
 
 	/* Check to see if the repository version is right.
Signature · 1 line
1.5.3.5.750.g8692
#3 lore raw

PATCH 3/3 Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

From: Dmitry Kakurin <[email protected]>

We have a function set_git_dir(). So let's use it, instead of setting the evironment directly.

This also fixes a problem on Windows: environment.c caches results of many getenv calls. A setenv(X) call to the Windows C runtime (CRT) invalidates all previous values returned by getenv(X). So cached values become dangling pointers.

Before this change, git clone was failing with 'invalid object name HEAD' if ran from Windows' cmd.exe.

[sp: rebased; split off get_git_dir() in builtin-init-db.c
to separate commit; adjusted commit message. ]

---
 git.c   |    6 +++---
 path.c  |    2 +-
 setup.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
git.c +3 -3
index 7604319..8bc25b7 100644
@@ -45,14 +45,14 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
 				fprintf(stderr, "No directory given for --git-dir.\n" );
 				usage(git_usage_string);
 			}
-			setenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);
+			set_git_dir( (*argv)[1] );
 			if (envchanged)
 				*envchanged = 1;
 			(*argv)++;
 			(*argc)--;
 			handled++;
 		} else if (!prefixcmp(cmd, "--git-dir=")) {
-			setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);
+			set_git_dir(cmd + 10);
 			if (envchanged)
 				*envchanged = 1;
 		} else if (!strcmp(cmd, "--work-tree")) {
@@ -72,7 +72,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
 		} else if (!strcmp(cmd, "--bare")) {
 			static char git_dir[PATH_MAX+1];
 			is_bare_repository_cfg = 1;
-			setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 0);
+			set_git_dir(getcwd(git_dir, sizeof(git_dir)));
 			if (envchanged)
 				*envchanged = 1;
 		} else {
path.c +1 -1
index 4260952..f26a4a1 100644
@@ -248,7 +248,7 @@ char *enter_repo(char *path, int strict)
 
 	if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
 	    validate_headref("HEAD") == 0) {
-		setenv(GIT_DIR_ENVIRONMENT, ".", 1);
+		set_git_dir(".");
 		check_repository_format();
 		return path;
 	}
setup.c +1 -1
index 43cd3f9..8dbd46c 100644
@@ -285,7 +285,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 			inside_git_dir = 1;
 			if (!work_tree_env)
 				inside_work_tree = 0;
-			setenv(GIT_DIR_ENVIRONMENT, ".", 1);
+			set_git_dir(".");
 			return NULL;
 		}
 		chdir("..");
Signature · 1 line
1.5.3.5.750.g8692
#4 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Hi,

Quoted 2 lines · Steffen Prohaska

We have a function set_git_dir(). So let's use it, instead of setting the evironment directly.

Does this not have a fundamental issue? When you call other git programs with run_command(), you _need_ GIT_DIR to be set, no?

Ciao,
Dscho

#5 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 9 lines · Johannes Schindelin

Hi,

Quoted 2 lines · Steffen Prohaska

We have a function set_git_dir(). So let's use it, instead of setting the evironment directly.

Does this not have a fundamental issue? When you call other git programs with run_command(), you _need_ GIT_DIR to be set, no?

It is much worse. set_git_dir() does not just setenv() but does setup_git_env() as well.

#6 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 11 lines · Junio C Hamano
Quoted 6 lines · Johannes Schindelin

Hi,

Quoted 1 line · Steffen Prohaska

We have a function set_git_dir(). So let's use it, instead of setting the evironment directly.

Does this not have a fundamental issue? When you call other git programs with run_command(), you _need_ GIT_DIR to be set, no?

It is much worse. set_git_dir() does not just setenv() but does setup_git_env() as well.

I don't see what's wrong with that. Could you please explain?

-- Hannes

#7 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

In reply to Junio C Hamano
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Johannes Schindelin

Hi,

On Wed, 21 Nov 2007, Steffen Prohaska wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

We have a function set_git_dir(). So let's use it, instead of setting the evironment directly.

Does this not have a fundamental issue? When you call other git programs with run_command(), you _need_ GIT_DIR to be set, no?

It is much worse. set_git_dir() does not just setenv() but does setup_git_env() as well.

What do your comments mean?

My understanding is that set_git_dir() sets the environment and then calls setup_git_env() to cache all pointers. This call updates dangling pointer if they have been cached earlier.

But maybe there is a hidden secret that I don't see.

Steffen

#8 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 8 lines · Steffen Prohaska
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Johannes Schindelin

Does this not have a fundamental issue? When you call other git programs
with run_command(), you _need_ GIT_DIR to be set, no?

Quoted 8 lines
Quoted 2 lines

It is much worse. set_git_dir() does not just setenv() but does setup_git_env() as well.

What do your comments mean?

My understanding is that set_git_dir() sets the environment and then calls setup_git_env() to cache all pointers. This call updates dangling pointer if they have been cached earlier.

Well, I was agreeing with you. "Worse" was about what the current code does _not_ do.

If there are earlier calls that obtain locations relative to the earlier definition of GIT_DIR, the locations they obtained are not just stored in memory that is "dangling" (which was what your proposed log message described) but they are also inconsistent with the updated definition of GIT_DIR.

I suspect Johannes mistook set_git_dir() was only local (i.e. per calling process) matter without noticing that it has its own setenv() when he made that comment, hence my response to point out that the current code only calls setenv(), but set_git_dir() does setup_git_env() too, which should hide the inconsistency problem.

HOWEVER.

I suspect that if there are even earlier callers than these early parts in the codepaths (handle_options, enter_repo, and setup_git_directory_gently), maybe these earlier callers are doing something wrong. Logically, if you are somewhere very early in the codepath that you can still change the value of GIT_DIR, you shouldn't have assumed the unknown value of GIT_DIR and cached locations relative to that directory, no? What are the problematic callers? What values do they access and why?

#9 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 37 lines · Junio C Hamano
Quoted 8 lines · Steffen Prohaska
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Johannes Schindelin

Does this not have a fundamental issue? When you call other git programs
with run_command(), you _need_ GIT_DIR to be set, no?

Quoted 8 lines
Quoted 2 lines

It is much worse. set_git_dir() does not just setenv() but does setup_git_env() as well.

What do your comments mean?

My understanding is that set_git_dir() sets the environment and then calls setup_git_env() to cache all pointers. This call updates dangling pointer if they have been cached earlier.

Well, I was agreeing with you. "Worse" was about what the current code does _not_ do.

If there are earlier calls that obtain locations relative to the earlier definition of GIT_DIR, the locations they obtained are not just stored in memory that is "dangling" (which was what your proposed log message described) but they are also inconsistent with the updated definition of GIT_DIR.

I suspect Johannes mistook set_git_dir() was only local (i.e. per calling process) matter without noticing that it has its own setenv() when he made that comment, hence my response to point out that the current code only calls setenv(), but set_git_dir() does setup_git_env() too, which should hide the inconsistency problem.

HOWEVER.

Quoted 8 lines

I suspect that if there are even earlier callers than these early parts in the codepaths (handle_options, enter_repo, and setup_git_directory_gently), maybe these earlier callers are doing something wrong. Logically, if you are somewhere very early in the codepath that you can still change the value of GIT_DIR, you shouldn't have assumed the unknown value of GIT_DIR and cached locations relative to that directory, no? What are the problematic callers? What values do they access and why?

I thought about these questions, too. But only very briefly. I did not analyze the code path that lead to calls of getenv().

I'm not sure if it's really necessary. Calling set_git_dir() looks more sensible too me than the old code. I believe using set_git_dir() is the safer choice, and should not do any harm. So I stopped analyzing too much, and instead proposed to use set_git_dir().

Interesting, though, is to find out if we have other potentially dangerous calls to getenv() that are not removed by this patch.

Steffen

#10 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 11 lines · Steffen Prohaska
Quoted 8 lines · Junio C Hamano

I suspect that if there are even earlier callers than these early parts in the codepaths (handle_options, enter_repo, and setup_git_directory_gently), maybe these earlier callers are doing something wrong. Logically, if you are somewhere very early in the codepath that you can still change the value of GIT_DIR, you shouldn't have assumed the unknown value of GIT_DIR and cached locations relative to that directory, no? What are the problematic callers? What values do they access and why?

Quoted 8 lines

I thought about these questions, too. But only very briefly. I did not analyze the code path that lead to calls of getenv().

I'm not sure if it's really necessary. Calling set_git_dir() looks more sensible too me than the old code. I believe using set_git_dir() is the safer choice, and should not do any harm. So I stopped analyzing too much, and instead proposed to use set_git_dir().

Junio's point is this: If we stumble over a dangling pointer that getenv() produced, then this has obviously happened before setenv(GIT_DIR), and caching that pointer is probably the wrong thing to do anyway (because it refers to the wrong GIT_DIR) and needs to be fixed.

So the task is to find those traps. Dmitry obviously stumbled over one case, but I haven't ever encountered any problems with the current code. But then this might be sheer luck. And I'm not a heavy user of export GIT_DIR=foo, either. Do *you* know a problematic case?

Quoted 2 lines

Interesting, though, is to find out if we have other potentially dangerous calls to getenv() that are not removed by this patch.

Side note for other readers: This is a Windows specific problem for the moment because its getenv() does not behave well.

-- Hannes

#11 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 18 lines · Johannes Sixt
Quoted 9 lines · Steffen Prohaska
Quoted 8 lines · Junio C Hamano

I suspect that if there are even earlier callers than these early parts in the codepaths (handle_options, enter_repo, and setup_git_directory_gently), maybe these earlier callers are doing something wrong. Logically, if you are somewhere very early in the codepath that you can still change the value of GIT_DIR, you shouldn't have assumed the unknown value of GIT_DIR and cached locations relative to that directory, no? What are the problematic callers? What values do they access and why?

Quoted 7 lines

I thought about these questions, too. But only very briefly. I did not analyze the code path that lead to calls of getenv(). I'm not sure if it's really necessary. Calling set_git_dir() looks more sensible too me than the old code. I believe using set_git_dir() is the safer choice, and should not do any harm. So I stopped analyzing too much, and instead proposed to use set_git_dir().

Quoted 1 line

Junio's point is this: If we stumble over a dangling pointer that getenv() produced, then this has obviously happened before setenv(GIT_DIR), and caching that pointer is probably the wrong thing to do anyway (because it refers to the wrong GIT_DIR) and needs to be fixed.

I see your point. It is probably more important to investigate this than I recognized at a first glance.

Quoted 1 line

So the task is to find those traps. Dmitry obviously stumbled over one case, but I haven't ever encountered any problems with the current code. But then this might be sheer luck. And I'm not a heavy user of export GIT_DIR=foo, either. Do *you* know a problematic case?

No. I only stumbled over the code, when I reviewed differences between msysgit and mingw. I rarely use GIT_DIR=foo. Actually, I can't remember the last time I did.

Quoted 4 lines
Quoted 2 lines

Interesting, though, is to find out if we have other potentially dangerous calls to getenv() that are not removed by this patch.

Side note for other readers: This is a Windows specific problem for the moment because its getenv() does not behave well.

Yes, and apparently even nobody knows how to trigger the problem on Windows. At this point, we only know that caching getenv() calls is unsafe, while on Unix it is safe (at least for BSD it's documented to be safe).

Steffen

#12 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Hi,

Quoted 2 lines · Steffen Prohaska

Yes, and apparently even nobody knows how to trigger the problem on Windows.

A quick and easy way would be to instrument getenv(), unsetenv() and setenv(), which would trigger an error. Something like this (but you will have to put in a few "extern called_getenv; called_getenv = 0;", since already a simple git-init fails because of setup_path()):

-- snipsnap --
[PATCH] Instrument getenv(), setenv(), unsetenv() and putenv()

... for finding places where a pointer obtained by getenv() could be invalidated later.

---

 environment.c     |    1 +
 git-compat-util.h |   31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
environment.c +1 -0
index ce75e98..027340e 100644
@@ -9,6 +9,7 @@
  */
 #include "cache.h"
 
+int called_setenv, called_getenv;
 char git_default_email[MAX_GITNAME];
 char git_default_name[MAX_GITNAME];
 int trust_executable_bit = 1;
git-compat-util.h +31 -0
index 79eb10e..a41469b 100644
@@ -427,4 +427,35 @@ static inline int strtol_i(char const *s, int base, int *result)
 	return 0;
 }
 
+extern int called_setenv, called_getenv;
+static inline char *test_getenv(const char *name)
+{
+	if (!called_setenv)
+		warning ("called test_getenv %s", name);
+	called_getenv = 1;
+	return getenv(name);
+}
+static inline int test_setenv(const char *name, const char *value, int overwrite)
+{
+	if (!called_setenv && called_getenv)
+		die ("getenv was called before setenv(%s, %s, %d)",
+				name, value, overwrite);
+	return setenv(name, value, overwrite);
+}
+static inline int test_unsetenv(const char *name)
+{
+	if (!called_setenv && called_getenv)
+		die ("getenv was called before unsetenv(%s)", name);
+	return unsetenv(name);
+}
+static inline int test_putenv(char *string)
+{
+	if (!called_setenv && called_getenv)
+		die ("getenv was called before putenv(%s)", string);
+	return putenv(string);
+}
+#define getenv test_getenv
+#define setenv test_setenv
+#define unsetenv test_unsetenv
+
 #endif
#13 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

In reply to Steffen Prohaska

Eventually I found some time to investigate this issue ...

Quoted 21 lines · Steffen Prohaska
Quoted 18 lines · Johannes Sixt
Quoted 16 lines · Steffen Prohaska
Quoted 8 lines · Junio C Hamano

I suspect that if there are even earlier callers than these early parts in the codepaths (handle_options, enter_repo, and setup_git_directory_gently), maybe these earlier callers are doing something wrong. Logically, if you are somewhere very early in the codepath that you can still change the value of GIT_DIR, you shouldn't have assumed the unknown value of GIT_DIR and cached locations relative to that directory, no? What are the problematic callers? What values do they access and why?

I thought about these questions, too. But only very briefly. I did not analyze the code path that lead to calls of getenv(). I'm not sure if it's really necessary. Calling set_git_dir() looks more sensible too me than the old code. I believe using set_git_dir() is the safer choice, and should not do any harm. So I stopped analyzing too much, and instead proposed to use set_git_dir().

Quoted 4 lines
Quoted 1 line

Junio's point is this: If we stumble over a dangling pointer that getenv() produced, then this has obviously happened before setenv(GIT_DIR), and caching that pointer is probably the wrong thing to do anyway (because it refers to the wrong GIT_DIR) and needs to be fixed.

I see your point. It is probably more important to investigate this than I recognized at a first glance.

I instrumented the code to verify if setenv(GIT_DIR) is called after setup_git_env(). This is not the case for all tests.

I also searched for problematic code paths.

setup_git_directory_gently() looks correct. It explicitly calls getenv(GIT_DIR_ENVIRONMENT); but uses the value returned in a safe manner. It does not cache the result and the only code path that calls set_git_dir() does not access the return value of the getenv() call after the call to set_git_dir().

setup_work_tree() looks correct, too. Here, get_git_dir() is called, which implicitly results in caching the pointer returned from getenv(GIT_DIR_ENVIRONMENT). But the result of get_git_dir() is neither cached nor used after a subsequent call to set_git_dir().

So, I don't find any obvious problems.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Interesting, though, is to find out if we have other potentially dangerous calls to getenv() that are not removed by this patch.

Side note for other readers: This is a Windows specific problem for the moment because its getenv() does not behave well.

Yes, and apparently even nobody knows how to trigger the problem on Windows. At this point, we only know that caching getenv() calls is unsafe, while on Unix it is safe (at least for BSD it's documented to be safe).

In conclusion, using setenv() as in the original code instead of set_git_dir() should be safe and this patch is not needed.

I tend to revert the changes in msysgit and see if we hit any problems. But I'll wait until 1.5.4 is released.

Steffen

#14 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 7 lines · Steffen Prohaska

In conclusion, using setenv() as in the original code instead of set_git_dir() should be safe and this patch is not needed.

I tend to revert the changes in msysgit and see if we hit any problems. But I'll wait until 1.5.4 is released.

Steffen

Please don't revert this change. I've made it in response to git clone failing, commit 855f254b2b5b083a63fc8d7709a42e2cbdc5a136.

Signature · 1 line
- Dmitry
#15 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 11 lines · Dmitry Kakurin
Quoted 7 lines · Steffen Prohaska

In conclusion, using setenv() as in the original code instead of set_git_dir() should be safe and this patch is not needed.

I tend to revert the changes in msysgit and see if we hit any problems. But I'll wait until 1.5.4 is released.

Steffen

Please don't revert this change. I've made it in response to git clone failing, commit 855f254b2b5b083a63fc8d7709a42e2cbdc5a136.

I know. But I cannot reproduce the error.

Do you have a test case that demonstrates the problem?

I either want to see the patch upstream in official git or revert it in msysgit. But I cannot answer the questions that were raised after I sent the patch (see earlier in this thread). And I can't see the problem that your patch solves, even after spending some time on reading and instrumenting code.

Steffen

#16 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 18 lines · Steffen Prohaska
Quoted 11 lines · Dmitry Kakurin
Quoted 7 lines · Steffen Prohaska

In conclusion, using setenv() as in the original code instead of set_git_dir() should be safe and this patch is not needed.

I tend to revert the changes in msysgit and see if we hit any problems. But I'll wait until 1.5.4 is released.

Steffen

Please don't revert this change. I've made it in response to git clone failing, commit 855f254b2b5b083a63fc8d7709a42e2cbdc5a136.

I know. But I cannot reproduce the error.

Quoted 7 lines

Do you have a test case that demonstrates the problem?

I either want to see the patch upstream in official git or revert it in msysgit. But I cannot answer the questions that were raised after I sent the patch (see earlier in this thread). And I can't see the problem that your patch solves, even after spending some time on reading and instrumenting code.

I remember that the problem was as simple as git clone or git clone --bare failing.
Also I'm not sure if it matters but I'm running Vista. There is also a chance that code has changed since then and this problem went away.

Signature · 1 line
- Dmitry
#17 lore raw

Re: [PATCH 3/3] Replace setenv(GIT_DIR_ENVIRONMENT, ...) with set_git_dir()

Quoted 21 lines · Dmitry Kakurin
Quoted 20 lines · Steffen Prohaska
Quoted 11 lines · Dmitry Kakurin
Quoted 7 lines · Steffen Prohaska

In conclusion, using setenv() as in the original code instead of set_git_dir() should be safe and this patch is not needed.

I tend to revert the changes in msysgit and see if we hit any problems. But I'll wait until 1.5.4 is released.

Steffen

Please don't revert this change. I've made it in response to git clone failing, commit 855f254b2b5b083a63fc8d7709a42e2cbdc5a136.

I know. But I cannot reproduce the error.

Do you have a test case that demonstrates the problem?

Quoted 8 lines
Quoted 5 lines

I either want to see the patch upstream in official git or revert it in msysgit. But I cannot answer the questions that were raised after I sent the patch (see earlier in this thread). And I can't see the problem that your patch solves, even after spending some time on reading and instrumenting code.

I remember that the problem was as simple as git clone or git clone --bare failing.

This is what I understood from the commit message.

I need a script that I can run to see the error. All tests that come with git pass (on my machine).

Quoted 1 line

Also I'm not sure if it matters but I'm running Vista.

It only matters if you see an error on Vista that I don't see on XP. If this was the case I'd debug on Vista.

Quoted 2 lines

There is also a chance that code has changed since then and this problem went away.

Maybe.

Steffen