Skip to contentSkip to conversation

Fixed error 'fatal: Not a git repository' on Vista

PATCH In review Dmitry Kakurin 4 participants 4 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixed error 'fatal: Not a git repository' on Vista

Any git command was immediately failing on Vista under MinGW with
fatal: Not a git repository

Quoted 1 line

From 51d66fbfe3a7876d9a7b699bb47c0ab186ddc7a2 Mon Sep 17 00:00:00 2001

From: Dmitry Kakurin <[email protected]>
Date: Wed, 1 Aug 2007 22:30:43 -0700
Subject: [PATCH] Fixed error 'fatal: Not a git repository' on Vista Defined __USE_MINGW_ACCESS that changes access( ..., X_OK ) into F_OK

---
Makefile | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 8e9a76b..ef40267 100644
@@ -500,7 +500,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 NO_SYMLINKS=YesPlease
 NO_SVN_TESTS=YesPlease
 NO_PERL_MAKEMAKER=YesPlease
- COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat
+ COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -D__USE_MINGW_ACCESS -I compat
 COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o
 EXTLIBS += -lws2_32
 X = .exe
Signature · 1 line
1.5.2.2
#1 lore raw

Hi,

[please consider reading Documentation/SubmittingPatches; you did not Cc:
the maintainer, Johannes Sixt]

Quoted 2 lines · Dmitry Kakurin

Any git command was immediately failing on Vista under MinGW with
fatal: Not a git repository

Thanks for submitting this patch. I cannot test personally, because nobody I know has Vista.

I guess that Hannes will apply your patch when he comes back from his well-deserved holiday.

You might want to consider pushing your changes to the mob branch on repo.or.cz/git/mingw.git.

Quoted 1 line

From your mail, I take it that the .zip file I sent you is working

properly?

Ciao,
Dscho

#2 lore raw
In reply to Dmitry Kakurin
Quoted 4 lines · Dmitry Kakurin

- COMPAT_CFLAGS
+= -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat
+ COMPAT_CFLAGS
+= -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -D__USE_MINGW_ACCESS

I don't see how this could make a difference: __USE_MINGW_ACCESS appears in none of the mingw header files nor in the mingw.git sources.

Is my build environment outdated?

-- Hannes

#3 lore raw
Quoted 4 lines · On Thursday August 16th 2007 at 10:37 Johannes Sixt wrote:

I don't see how this could make a difference: __USE_MINGW_ACCESS appears in none of the mingw header files nor in the mingw.git sources.

Is my build environment outdated?

The mingw patch for fixing this Vista regression (from Danny Smith on March 5th) is in mingw-runtime-3.12-1. It is in file <include/io.h> and works like this:

#ifdef __USE_MINGW_ACCESS
/* Old versions of MSVCRT access() just ignored X_OK, while the version
shipped with Vista, returns an error code. This will restore the old behaviour */
static inline int __mingw_access (const char* __fname, int __mode)
{ return _access (__fname, __mode & ~X_OK); }
#define access(__f,__m) __mingw_access (__f, __m)
#endif

Whenever the X_OK bit is set in the mode flag for access(2) Vista returns an error for the call. So yes, using __USE_MINGW_ACCESS will not work on older mingw versions. Defining X_OK to 0 for mingw might fix the problem for older versions.

Signature · 1 line
Marco Roeland