{"thread":{"id":"41180","subject":"[PATCH 0/5] Fix compile errors with MSys2","startedAt":"2016-01-13T13:30:45Z","lastAt":"2016-01-21T13:51:28Z","messageCount":23,"participants":["Johannes Schindelin","Jeff King","Dennis Kaarsemaker","Junio C Hamano","Johannes Sixt","SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"275904","messageId":"cover.1452691805.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":null,"subject":"[PATCH 0/5] Fix compile errors with MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T13:30:45Z","receivedAt":"2016-01-13T13:30:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Git for Windows 2.x is based on MSys2, and its first official version\nwas released already almost half a year ago, yet it is still impossible\neven to compile Git from the official, platform-independent Git source\ncode.\n\nThis patch series merely fixes the compile errors, and will be followed\nby other patch series that fix the compile warnings and test failures.\nThe idea is to move all Windows-specific patches of Git for Windows'\nfork to upstream Git proper.\n\n\nJohannes Schindelin (5):\n  config.mak.uname: support MSys2\n  config.mak.uname: supporting 64-bit MSys2\n  nedmalloc: allow compiling with MSys2's compiler\n  compat/mingw: support MSys2-based MinGW build\n  compat/winansi: support compiling with MSys2\n\n compat/mingw.h              | 24 +++++++++++++++++++++++-\n compat/nedmalloc/malloc.c.h |  6 ++++++\n compat/winansi.c            |  2 ++\n config.mak.uname            | 31 ++++++++++++++++++++++++++++---\n 4 files changed, 59 insertions(+), 4 deletions(-)\n\n-- \n2.6.3.windows.1.300.g1c25e49\n"},{"id":"275907","messageId":"e63d391a79396e095d2ebb139bb44c390e50bb62.1452691805.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"[PATCH 1/5] config.mak.uname: support MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T13:30:53Z","receivedAt":"2016-01-13T13:30:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"For a long time, Git for Windows lagged behind Git's 2.x releases because\nthe Git for Windows developers wanted to let that big jump coincide with\na well-needed jump away from MSys to MSys2.\n\nTo understand why this is such a big issue, it needs to be noted that\nmany parts of Git are not written in portable C, but instead Git relies\non a POSIX shell and Perl to be available.\n\nTo support the scripts, Git for Windows has to ship a minimal POSIX\nemulation layer with Bash and Perl thrown in, and when the Git for\nWindows effort started in August 2007, this developer settled on using\nMSys, a stripped down version of Cygwin. Consequently, the original name\nof the project was \"msysGit\" (which, sadly, caused a *lot* of confusion\nbecause few Windows users know about MSys, and even less care).\n\nTo compile the C code of Git for Windows, MSys was used, too: it sports\ntwo versions of the GNU C Compiler: one that links implicitly to the\nPOSIX emulation layer, and another one that targets the plain Win32 API\n(with a few convenience functions thrown in).  Git for Windows'\nexecutables are built using the latter, and therefore they are really\njust Win32 programs. To discern executables requiring the POSIX\nemulation layer from the ones that do not, the latter are called MinGW\n(Minimal GNU for Windows) when the former are called MSys executables.\n\nThis reliance on MSys incurred challenges, too, though: some of our\nchanges to the MSys runtime -- necessary to support Git for Windows\nbetter -- were not accepted upstream, so we had to maintain our own\nfork. Also, the MSys runtime was not developed further to support e.g.\nUTF-8 or 64-bit, and apart from lacking a package management system\nuntil much later (when mingw-get was introduced), many packages provided\nby the MSys/MinGW project lag behind the respective source code\nversions, in particular Bash and OpenSSL. For a while, the Git for\nWindows project tried to remedy the situation by trying to build newer\nversions of those packages, but the situation quickly became untenable,\nespecially with problems like the Heartbleed bug requiring swift action\nthat has nothing to do with developing Git for Windows further.\n\nHappily, in the meantime the MSys2 project (https://msys2.github.io/)\nemerged, and was chosen to be the base of the Git for Windows 2.x. Just\nlike MSys, MSys2 is a stripped down version of Cygwin, but it is\nactively kept up-to-date with Cygwin's source code.  Thereby, it already\nsupports Unicode internally, and it also offers the 64-bit support that\nwe yearned for since the beginning of the Git for Windows project.\n\nMSys2 also ported the Pacman package management system from Arch Linux\nand uses it heavily. This brings the same convenience to which Linux\nusers are used to from `yum` or `apt-get`, and to which MacOSX users are\nused to from Homebrew or MacPorts, or BSD users from the Ports system,\nto MSys2: a simple `pacman -Syu` will update all installed packages to\nthe newest versions currently available.\n\nMSys2 is also *very* active, typically providing package updates\nmultiple times per week.\n\nIt still required a two-month effort to bring everything to a state\nwhere Git's test suite passes, many more months until the first official\nGit for Windows 2.x was released, and a couple of patches still await\ntheir submission to the respective upstream projects. Yet without MSys2,\nthe modernization of Git for Windows would simply not have happened.\n\nThis commit lays the ground work to supporting MSys2-based Git builds.\n\nAssisted-by: Waldek Maleska <weakcamel@users.github.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 21 +++++++++++++++++++--\n 1 file changed, 19 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex f34dcaa..b0592c1 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,7 +518,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_INET_NTOP = YesPlease\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tDEFAULT_HELP_FORMAT = html\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n+\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n@@ -541,8 +541,25 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n \tINTERNAL_QSORT = YesPlease\n \tHAVE_LIBCHARSET_H = YesPlease\n \tNO_GETTEXT = YesPlease\n+\tCOMPAT_CLFAGS += -D__USE_MINGW_ACCESS\n else\n-\tNO_CURL = YesPlease\n+\tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n+\t\t# MSys2\n+\t\tCC = gcc\n+\t\tprefix = /mingw32\n+\t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0\n+\t\tINSTALL = /bin/install\n+\t\tNO_R_TO_GCC_LINKER = YesPlease\n+\t\tINTERNAL_QSORT = YesPlease\n+\t\tHAVE_LIBCHARSET_H = YesPlease\n+\t\tNO_GETTEXT = YesPlease\n+\t\tUSE_LIBPCRE= YesPlease\n+\t\tNO_CURL =\n+\t\tUSE_NED_ALLOCATOR = YesPlease\n+\telse\n+\t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO\n+\t\tNO_CURL = YesPlease\n+\tendif\n endif\n endif\n ifeq ($(uname_S),QNX)\n-- \n2.6.3.windows.1.300.g1c25e49\n"},{"id":"275908","messageId":"a54e0357d8f274c7ffa49daa2c91ba371fa501ab.1452691805.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"[PATCH 2/5] config.mak.uname: supporting 64-bit MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T13:31:01Z","receivedAt":"2016-01-13T13:31:01Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"This just makes things compile, the test suite needs extra tender loving\ncare in addition to this change. We will address these issues in later\ncommits.\n\nWhile at it, also allow building MSys2 Git (i.e. a Git that uses MSys2's\nPOSIX emulation layer).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex b0592c1..4b2e1b8 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,13 +518,12 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_INET_NTOP = YesPlease\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tDEFAULT_HELP_FORMAT = html\n-\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n+\tCOMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/dirent.o\n \tBASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1\n-\tBASIC_LDFLAGS += -Wl,--large-address-aware\n \tEXTLIBS += -lws2_32\n \tGITLIBS += git.res\n \tPTHREAD_LIBS =\n@@ -545,8 +544,17 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n else\n \tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n \t\t# MSys2\n+\t\tprefix = /usr/\n+\t\tifeq (MINGW32,$(MSYSTEM))\n+\t\t\tprefix = /mingw32\n+\t\tendif\n+\t\tifeq (MINGW64,$(MSYSTEM))\n+\t\t\tprefix = /mingw64\n+\t\telse\n+\t\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n+\t\tendif\n \t\tCC = gcc\n-\t\tprefix = /mingw32\n \t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0\n \t\tINSTALL = /bin/install\n \t\tNO_R_TO_GCC_LINKER = YesPlease\n-- \n2.6.3.windows.1.300.g1c25e49\n"},{"id":"275906","messageId":"cb506b103e7102073a1567044727837ab8ff5c64.1452691805.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"[PATCH 3/5] nedmalloc: allow compiling with MSys2's compiler","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T13:31:05Z","receivedAt":"2016-01-13T13:31:05Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"With MSys2's GCC, `ReadWriteBarrier` is already defined, and FORCEINLINE\nunfortunately gets defined incorrectly.\n\nLet's work around both problems, using the MSys2-specific\n__MINGW64_VERSION_MAJOR constant to guard them.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/nedmalloc/malloc.c.h | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\nindex f216a2a..18634e3 100644\n--- a/compat/nedmalloc/malloc.c.h\n+++ b/compat/nedmalloc/malloc.c.h\n@@ -720,6 +720,9 @@ struct mallinfo {\n   inlining are defined as macros, so these aren't used for them.\n */\n \n+#ifdef __MINGW64_VERSION_MAJOR\n+#undef FORCEINLINE\n+#endif\n #ifndef FORCEINLINE\n   #if defined(__GNUC__)\n #define FORCEINLINE __inline __attribute__ ((always_inline))\n@@ -1382,6 +1385,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);\n \n   /*** Atomic operations ***/\n   #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100\n+    #ifdef __MINGW64_VERSION_MAJOR\n+      #undef _ReadWriteBarrier\n+    #endif\n     #define _ReadWriteBarrier() __sync_synchronize()\n   #else\n     static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)\n-- \n2.6.3.windows.1.300.g1c25e49\n"},{"id":"275905","messageId":"5f66f66d4f3b693076bdf40cccfebd0ab032c779.1452691805.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"[PATCH 4/5] compat/mingw: support MSys2-based MinGW build","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T13:31:09Z","receivedAt":"2016-01-13T13:31:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"The excellent MSys2 project brings a substantially updated MinGW\nenvironment including newer GCC versions and new headers. To support\ncompiling Git, let's special-case the new MinGW (tell-tale: the\n_MINGW64_VERSION_MAJOR constant is defined).\n\nNote: this commit only addresses compile failures, not compile warnings\n(that task is left for a future patch).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.h | 24 +++++++++++++++++++++++-\n 1 file changed, 23 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex b3e5044..a2da783 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -1,14 +1,26 @@\n+#ifdef __MINGW64_VERSION_MAJOR\n+#include <stdint.h>\n+#include <wchar.h>\n+typedef _sigset_t sigset_t;\n+#endif\n #include <winsock2.h>\n #include <ws2tcpip.h>\n \n+/* MinGW-w64 reports to have flockfile, but it does not actually have it. */\n+#ifdef __MINGW64_VERSION_MAJOR\n+#undef _POSIX_THREAD_SAFE_FUNCTIONS\n+#endif\n+\n /*\n  * things that are not available in header files\n  */\n \n-typedef int pid_t;\n typedef int uid_t;\n typedef int socklen_t;\n+#ifndef __MINGW64_VERSION_MAJOR\n+typedef int pid_t;\n #define hstrerror strerror\n+#endif\n \n #define S_IFLNK    0120000 /* Symbolic link */\n #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)\n@@ -100,8 +112,10 @@ static inline int symlink(const char *oldpath, const char *newpath)\n { errno = ENOSYS; return -1; }\n static inline int fchmod(int fildes, mode_t mode)\n { errno = ENOSYS; return -1; }\n+#ifndef __MINGW64_VERSION_MAJOR\n static inline pid_t fork(void)\n { errno = ENOSYS; return -1; }\n+#endif\n static inline unsigned int alarm(unsigned int seconds)\n { return 0; }\n static inline int fsync(int fd)\n@@ -176,8 +190,10 @@ int pipe(int filedes[2]);\n unsigned int sleep (unsigned int seconds);\n int mkstemp(char *template);\n int gettimeofday(struct timeval *tv, void *tz);\n+#ifndef __MINGW64_VERSION_MAJOR\n struct tm *gmtime_r(const time_t *timep, struct tm *result);\n struct tm *localtime_r(const time_t *timep, struct tm *result);\n+#endif\n int getpagesize(void);\t/* defined in MinGW's libgcc.a */\n struct passwd *getpwuid(uid_t uid);\n int setitimer(int type, struct itimerval *in, struct itimerval *out);\n@@ -301,8 +317,10 @@ static inline int getrlimit(int resource, struct rlimit *rlp)\n /*\n  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.\n  */\n+#ifndef __MINGW64_VERSION_MAJOR\n #define off_t off64_t\n #define lseek _lseeki64\n+#endif\n \n /* use struct stat with 64 bit st_size */\n #ifdef stat\n@@ -383,8 +401,12 @@ static inline char *mingw_find_last_dir_sep(const char *path)\n int mingw_offset_1st_component(const char *path);\n #define offset_1st_component mingw_offset_1st_component\n #define PATH_SEP ';'\n+#ifndef __MINGW64_VERSION_MAJOR\n #define PRIuMAX \"I64u\"\n #define PRId64 \"I64d\"\n+#else\n+#include <inttypes.h>\n+#endif\n \n void mingw_open_html(const char *path);\n #define open_html mingw_open_html\n-- \n2.6.3.windows.1.300.g1c25e49\n"},{"id":"275909","messageId":"83eb6f9b075d56049ca80502f79127db9e61979b.1452691805.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"[PATCH 5/5] compat/winansi: support compiling with MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T13:31:13Z","receivedAt":"2016-01-13T13:31:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"MSys2 already defines the _CONSOLE_FONT_INFOEX structure.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/winansi.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/compat/winansi.c b/compat/winansi.c\nindex ceff55b..3aa5535 100644\n--- a/compat/winansi.c\n+++ b/compat/winansi.c\n@@ -23,6 +23,7 @@ static HANDLE hthread, hread, hwrite;\n static HANDLE hconsole1, hconsole2;\n \n #ifdef __MINGW32__\n+#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 5\n typedef struct _CONSOLE_FONT_INFOEX {\n \tULONG cbSize;\n \tDWORD nFont;\n@@ -32,6 +33,7 @@ typedef struct _CONSOLE_FONT_INFOEX {\n \tWCHAR FaceName[LF_FACESIZE];\n } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;\n #endif\n+#endif\n \n typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL,\n \t\tPCONSOLE_FONT_INFOEX);\n-- \n2.6.3.windows.1.300.g1c25e49\n"},{"id":"275911","messageId":"20160113161128.GA11898@sigill.intra.peff.net","threadId":"41180","inReplyTo":"e63d391a79396e095d2ebb139bb44c390e50bb62.1452691805.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 1/5] config.mak.uname: support MSys2","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-01-13T16:11:29Z","receivedAt":"2016-01-13T16:11:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 13, 2016 at 02:30:53PM +0100, Johannes Schindelin wrote:\n\n> For a long time, Git for Windows lagged behind Git's 2.x releases because\n> the Git for Windows developers wanted to let that big jump coincide with\n> a well-needed jump away from MSys to MSys2.\n> [...]\n\nI can't say much about the patch itself, but I think this commit is\nworth it for the message alone. Now I finally know the subtle\ndifferences between all of those systems!\n\n-Peff\n"},{"id":"275920","messageId":"alpine.DEB.2.20.1601131745040.2964@virtualbox","threadId":"41180","inReplyTo":"20160113161128.GA11898@sigill.intra.peff.net","subject":"Re: [PATCH 1/5] config.mak.uname: support MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-13T16:45:48Z","receivedAt":"2016-01-13T16:45:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Peff,\n\nOn Wed, 13 Jan 2016, Jeff King wrote:\n\n> On Wed, Jan 13, 2016 at 02:30:53PM +0100, Johannes Schindelin wrote:\n> \n> > For a long time, Git for Windows lagged behind Git's 2.x releases because\n> > the Git for Windows developers wanted to let that big jump coincide with\n> > a well-needed jump away from MSys to MSys2.\n> > [...]\n> \n> I can't say much about the patch itself, but I think this commit is\n> worth it for the message alone. Now I finally know the subtle\n> differences between all of those systems!\n\nThanks! I spent some quality time on reworking this particular commit\nmessage this morning, so I am extra glad about your positive feedback!\n\nCiao,\nDscho\n"},{"id":"275962","messageId":"1452712985.18946.2.camel@kaarsemaker.net","threadId":"41180","inReplyTo":"20160113161128.GA11898@sigill.intra.peff.net","subject":"Re: [PATCH 1/5] config.mak.uname: support MSys2","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2016-01-13T19:23:05Z","receivedAt":"2016-01-13T19:23:05Z","isPatch":true,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On wo, 2016-01-13 at 11:11 -0500, Jeff King wrote:\n> On Wed, Jan 13, 2016 at 02:30:53PM +0100, Johannes Schindelin wrote:\n> \n> > For a long time, Git for Windows lagged behind Git's 2.x releases\n> > because\n> > the Git for Windows developers wanted to let that big jump coincide\n> > with\n> > a well-needed jump away from MSys to MSys2.\n> > [...]\n> \n> I can't say much about the patch itself, but I think this commit is\n> worth it for the message alone. Now I finally know the subtle\n> differences between all of those systems!\n\nAgreed. It might even make sense to have that explanation somewhere in\nDocumentation/technical/\n\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"275964","messageId":"xmqq8u3tnurx.fsf@gitster.mtv.corp.google.com","threadId":"41180","inReplyTo":"cb506b103e7102073a1567044727837ab8ff5c64.1452691805.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 3/5] nedmalloc: allow compiling with MSys2's compiler","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-01-13T19:28:50Z","receivedAt":"2016-01-13T19:28:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> With MSys2's GCC, `ReadWriteBarrier` is already defined, and FORCEINLINE\n> unfortunately gets defined incorrectly.\n>\n> Let's work around both problems, using the MSys2-specific\n> __MINGW64_VERSION_MAJOR constant to guard them.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n\nThanks.  I actually do not think #undef _ReadWriteBarrier needs to\nbe inside any #ifdef, though.  It isn't like it is an error to\n#undef that you did not #define before.\n\n>  compat/nedmalloc/malloc.c.h | 6 ++++++\n>  1 file changed, 6 insertions(+)\n>\n> diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\n> index f216a2a..18634e3 100644\n> --- a/compat/nedmalloc/malloc.c.h\n> +++ b/compat/nedmalloc/malloc.c.h\n> @@ -720,6 +720,9 @@ struct mallinfo {\n>    inlining are defined as macros, so these aren't used for them.\n>  */\n>  \n> +#ifdef __MINGW64_VERSION_MAJOR\n> +#undef FORCEINLINE\n> +#endif\n>  #ifndef FORCEINLINE\n>    #if defined(__GNUC__)\n>  #define FORCEINLINE __inline __attribute__ ((always_inline))\n> @@ -1382,6 +1385,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);\n>  \n>    /*** Atomic operations ***/\n>    #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100\n> +    #ifdef __MINGW64_VERSION_MAJOR\n> +      #undef _ReadWriteBarrier\n> +    #endif\n>      #define _ReadWriteBarrier() __sync_synchronize()\n>    #else\n>      static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)\n"},{"id":"275965","messageId":"xmqq4mehnuo1.fsf@gitster.mtv.corp.google.com","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 0/5] Fix compile errors with MSys2","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-01-13T19:31:10Z","receivedAt":"2016-01-13T19:31:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It would really be nice to see the endgame of what this series\nstarts sometime not in too distant a future.  Many users in Windows\nland would appreciate this effort, I am sure.\n\nThanks, will queue.\n"},{"id":"276008","messageId":"alpine.DEB.2.20.1601140752250.2964@virtualbox","threadId":"41180","inReplyTo":"xmqq4mehnuo1.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 0/5] Fix compile errors with MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T06:53:37Z","receivedAt":"2016-01-14T06:53:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Wed, 13 Jan 2016, Junio C Hamano wrote:\n\n> It would really be nice to see the endgame of what this series\n> starts sometime not in too distant a future.\n\nThat is indeed the intention:\n\n\thttps://github.com/git-for-windows/git/issues/285\n\nCiao,\nDscho\n"},{"id":"276047","messageId":"cover.1452790142.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452691805.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 0/5] Fix compile errors with MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T16:51:14Z","receivedAt":"2016-01-14T16:51:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Git for Windows 2.x is based on MSys2, and its first official version\nwas released already almost half a year ago, yet it is still impossible\neven to compile Git from the official, platform-independent Git source\ncode.\n\nThis patch series merely fixes the compile errors, and will be followed\nby other patch series that fix the compile warnings and test failures.\nThe idea is to move all Windows-specific patches of Git for Windows'\nfork to upstream Git proper.\n\nRelative to v1, I only removed the guards about the \"#undef\nReadWriteBarrier\".\n\nJohannes Schindelin (5):\n  config.mak.uname: support MSys2\n  config.mak.uname: supporting 64-bit MSys2\n  nedmalloc: allow compiling with MSys2's compiler\n  compat/mingw: support MSys2-based MinGW build\n  compat/winansi: support compiling with MSys2\n\n compat/mingw.h              | 24 +++++++++++++++++++++++-\n compat/nedmalloc/malloc.c.h |  4 ++++\n compat/winansi.c            |  2 ++\n config.mak.uname            | 31 ++++++++++++++++++++++++++++---\n 4 files changed, 57 insertions(+), 4 deletions(-)\n\nInterdiff vs v1:\n\n diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\n index 18634e3..bf70037 100644\n --- a/compat/nedmalloc/malloc.c.h\n +++ b/compat/nedmalloc/malloc.c.h\n @@ -1385,9 +1385,7 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);\n  \n    /*** Atomic operations ***/\n    #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100\n -    #ifdef __MINGW64_VERSION_MAJOR\n -      #undef _ReadWriteBarrier\n -    #endif\n +    #undef _ReadWriteBarrier\n      #define _ReadWriteBarrier() __sync_synchronize()\n    #else\n      static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)\n\n-- \n2.7.0.windows.1.7.g55a05c8\n"},{"id":"276048","messageId":"e63d391a79396e095d2ebb139bb44c390e50bb62.1452790142.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 1/5] config.mak.uname: support MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T16:51:22Z","receivedAt":"2016-01-14T16:51:22Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"For a long time, Git for Windows lagged behind Git's 2.x releases because\nthe Git for Windows developers wanted to let that big jump coincide with\na well-needed jump away from MSys to MSys2.\n\nTo understand why this is such a big issue, it needs to be noted that\nmany parts of Git are not written in portable C, but instead Git relies\non a POSIX shell and Perl to be available.\n\nTo support the scripts, Git for Windows has to ship a minimal POSIX\nemulation layer with Bash and Perl thrown in, and when the Git for\nWindows effort started in August 2007, this developer settled on using\nMSys, a stripped down version of Cygwin. Consequently, the original name\nof the project was \"msysGit\" (which, sadly, caused a *lot* of confusion\nbecause few Windows users know about MSys, and even less care).\n\nTo compile the C code of Git for Windows, MSys was used, too: it sports\ntwo versions of the GNU C Compiler: one that links implicitly to the\nPOSIX emulation layer, and another one that targets the plain Win32 API\n(with a few convenience functions thrown in).  Git for Windows'\nexecutables are built using the latter, and therefore they are really\njust Win32 programs. To discern executables requiring the POSIX\nemulation layer from the ones that do not, the latter are called MinGW\n(Minimal GNU for Windows) when the former are called MSys executables.\n\nThis reliance on MSys incurred challenges, too, though: some of our\nchanges to the MSys runtime -- necessary to support Git for Windows\nbetter -- were not accepted upstream, so we had to maintain our own\nfork. Also, the MSys runtime was not developed further to support e.g.\nUTF-8 or 64-bit, and apart from lacking a package management system\nuntil much later (when mingw-get was introduced), many packages provided\nby the MSys/MinGW project lag behind the respective source code\nversions, in particular Bash and OpenSSL. For a while, the Git for\nWindows project tried to remedy the situation by trying to build newer\nversions of those packages, but the situation quickly became untenable,\nespecially with problems like the Heartbleed bug requiring swift action\nthat has nothing to do with developing Git for Windows further.\n\nHappily, in the meantime the MSys2 project (https://msys2.github.io/)\nemerged, and was chosen to be the base of the Git for Windows 2.x. Just\nlike MSys, MSys2 is a stripped down version of Cygwin, but it is\nactively kept up-to-date with Cygwin's source code.  Thereby, it already\nsupports Unicode internally, and it also offers the 64-bit support that\nwe yearned for since the beginning of the Git for Windows project.\n\nMSys2 also ported the Pacman package management system from Arch Linux\nand uses it heavily. This brings the same convenience to which Linux\nusers are used to from `yum` or `apt-get`, and to which MacOSX users are\nused to from Homebrew or MacPorts, or BSD users from the Ports system,\nto MSys2: a simple `pacman -Syu` will update all installed packages to\nthe newest versions currently available.\n\nMSys2 is also *very* active, typically providing package updates\nmultiple times per week.\n\nIt still required a two-month effort to bring everything to a state\nwhere Git's test suite passes, many more months until the first official\nGit for Windows 2.x was released, and a couple of patches still await\ntheir submission to the respective upstream projects. Yet without MSys2,\nthe modernization of Git for Windows would simply not have happened.\n\nThis commit lays the ground work to supporting MSys2-based Git builds.\n\nAssisted-by: Waldek Maleska <weakcamel@users.github.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 21 +++++++++++++++++++--\n 1 file changed, 19 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex f34dcaa..b0592c1 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,7 +518,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_INET_NTOP = YesPlease\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tDEFAULT_HELP_FORMAT = html\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n+\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n@@ -541,8 +541,25 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n \tINTERNAL_QSORT = YesPlease\n \tHAVE_LIBCHARSET_H = YesPlease\n \tNO_GETTEXT = YesPlease\n+\tCOMPAT_CLFAGS += -D__USE_MINGW_ACCESS\n else\n-\tNO_CURL = YesPlease\n+\tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n+\t\t# MSys2\n+\t\tCC = gcc\n+\t\tprefix = /mingw32\n+\t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0\n+\t\tINSTALL = /bin/install\n+\t\tNO_R_TO_GCC_LINKER = YesPlease\n+\t\tINTERNAL_QSORT = YesPlease\n+\t\tHAVE_LIBCHARSET_H = YesPlease\n+\t\tNO_GETTEXT = YesPlease\n+\t\tUSE_LIBPCRE= YesPlease\n+\t\tNO_CURL =\n+\t\tUSE_NED_ALLOCATOR = YesPlease\n+\telse\n+\t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO\n+\t\tNO_CURL = YesPlease\n+\tendif\n endif\n endif\n ifeq ($(uname_S),QNX)\n-- \n2.7.0.windows.1.7.g55a05c8\n"},{"id":"276050","messageId":"a54e0357d8f274c7ffa49daa2c91ba371fa501ab.1452790142.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 2/5] config.mak.uname: supporting 64-bit MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T16:51:49Z","receivedAt":"2016-01-14T16:51:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"This just makes things compile, the test suite needs extra tender loving\ncare in addition to this change. We will address these issues in later\ncommits.\n\nWhile at it, also allow building MSys2 Git (i.e. a Git that uses MSys2's\nPOSIX emulation layer).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex b0592c1..4b2e1b8 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,13 +518,12 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_INET_NTOP = YesPlease\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tDEFAULT_HELP_FORMAT = html\n-\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n+\tCOMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/dirent.o\n \tBASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1\n-\tBASIC_LDFLAGS += -Wl,--large-address-aware\n \tEXTLIBS += -lws2_32\n \tGITLIBS += git.res\n \tPTHREAD_LIBS =\n@@ -545,8 +544,17 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n else\n \tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n \t\t# MSys2\n+\t\tprefix = /usr/\n+\t\tifeq (MINGW32,$(MSYSTEM))\n+\t\t\tprefix = /mingw32\n+\t\tendif\n+\t\tifeq (MINGW64,$(MSYSTEM))\n+\t\t\tprefix = /mingw64\n+\t\telse\n+\t\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n+\t\tendif\n \t\tCC = gcc\n-\t\tprefix = /mingw32\n \t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0\n \t\tINSTALL = /bin/install\n \t\tNO_R_TO_GCC_LINKER = YesPlease\n-- \n2.7.0.windows.1.7.g55a05c8\n"},{"id":"276051","messageId":"0436c74f0fcd46d9a77a3012d146d741ca2c7a0a.1452790142.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 3/5] nedmalloc: allow compiling with MSys2's compiler","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T16:51:54Z","receivedAt":"2016-01-14T16:51:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"With MSys2's GCC, `ReadWriteBarrier` is already defined, and FORCEINLINE\nunfortunately gets defined incorrectly.\n\nLet's work around both problems, using the MSys2-specific\n__MINGW64_VERSION_MAJOR constant to guard the FORCEINLINE definition so\nas not to affect other platforms.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/nedmalloc/malloc.c.h | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\nindex f216a2a..bf70037 100644\n--- a/compat/nedmalloc/malloc.c.h\n+++ b/compat/nedmalloc/malloc.c.h\n@@ -720,6 +720,9 @@ struct mallinfo {\n   inlining are defined as macros, so these aren't used for them.\n */\n \n+#ifdef __MINGW64_VERSION_MAJOR\n+#undef FORCEINLINE\n+#endif\n #ifndef FORCEINLINE\n   #if defined(__GNUC__)\n #define FORCEINLINE __inline __attribute__ ((always_inline))\n@@ -1382,6 +1385,7 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);\n \n   /*** Atomic operations ***/\n   #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100\n+    #undef _ReadWriteBarrier\n     #define _ReadWriteBarrier() __sync_synchronize()\n   #else\n     static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)\n-- \n2.7.0.windows.1.7.g55a05c8\n"},{"id":"276049","messageId":"ed8e411fc0447058bba75a4bdce1b8519813e10b.1452790142.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 4/5] compat/mingw: support MSys2-based MinGW build","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T16:51:59Z","receivedAt":"2016-01-14T16:51:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"The excellent MSys2 project brings a substantially updated MinGW\nenvironment including newer GCC versions and new headers. To support\ncompiling Git, let's special-case the new MinGW (tell-tale: the\n_MINGW64_VERSION_MAJOR constant is defined).\n\nNote: this commit only addresses compile failures, not compile warnings\n(that task is left for a future patch).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.h | 24 +++++++++++++++++++++++-\n 1 file changed, 23 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex b3e5044..a2da783 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -1,14 +1,26 @@\n+#ifdef __MINGW64_VERSION_MAJOR\n+#include <stdint.h>\n+#include <wchar.h>\n+typedef _sigset_t sigset_t;\n+#endif\n #include <winsock2.h>\n #include <ws2tcpip.h>\n \n+/* MinGW-w64 reports to have flockfile, but it does not actually have it. */\n+#ifdef __MINGW64_VERSION_MAJOR\n+#undef _POSIX_THREAD_SAFE_FUNCTIONS\n+#endif\n+\n /*\n  * things that are not available in header files\n  */\n \n-typedef int pid_t;\n typedef int uid_t;\n typedef int socklen_t;\n+#ifndef __MINGW64_VERSION_MAJOR\n+typedef int pid_t;\n #define hstrerror strerror\n+#endif\n \n #define S_IFLNK    0120000 /* Symbolic link */\n #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)\n@@ -100,8 +112,10 @@ static inline int symlink(const char *oldpath, const char *newpath)\n { errno = ENOSYS; return -1; }\n static inline int fchmod(int fildes, mode_t mode)\n { errno = ENOSYS; return -1; }\n+#ifndef __MINGW64_VERSION_MAJOR\n static inline pid_t fork(void)\n { errno = ENOSYS; return -1; }\n+#endif\n static inline unsigned int alarm(unsigned int seconds)\n { return 0; }\n static inline int fsync(int fd)\n@@ -176,8 +190,10 @@ int pipe(int filedes[2]);\n unsigned int sleep (unsigned int seconds);\n int mkstemp(char *template);\n int gettimeofday(struct timeval *tv, void *tz);\n+#ifndef __MINGW64_VERSION_MAJOR\n struct tm *gmtime_r(const time_t *timep, struct tm *result);\n struct tm *localtime_r(const time_t *timep, struct tm *result);\n+#endif\n int getpagesize(void);\t/* defined in MinGW's libgcc.a */\n struct passwd *getpwuid(uid_t uid);\n int setitimer(int type, struct itimerval *in, struct itimerval *out);\n@@ -301,8 +317,10 @@ static inline int getrlimit(int resource, struct rlimit *rlp)\n /*\n  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.\n  */\n+#ifndef __MINGW64_VERSION_MAJOR\n #define off_t off64_t\n #define lseek _lseeki64\n+#endif\n \n /* use struct stat with 64 bit st_size */\n #ifdef stat\n@@ -383,8 +401,12 @@ static inline char *mingw_find_last_dir_sep(const char *path)\n int mingw_offset_1st_component(const char *path);\n #define offset_1st_component mingw_offset_1st_component\n #define PATH_SEP ';'\n+#ifndef __MINGW64_VERSION_MAJOR\n #define PRIuMAX \"I64u\"\n #define PRId64 \"I64d\"\n+#else\n+#include <inttypes.h>\n+#endif\n \n void mingw_open_html(const char *path);\n #define open_html mingw_open_html\n-- \n2.7.0.windows.1.7.g55a05c8\n"},{"id":"276052","messageId":"42e165cf0cfd5791136c719e5c4fa3e5755b3580.1452790142.git.johannes.schindelin@gmx.de","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"[PATCH v2 5/5] compat/winansi: support compiling with MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-14T16:52:02Z","receivedAt":"2016-01-14T16:52:02Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"MSys2 already defines the _CONSOLE_FONT_INFOEX structure.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/winansi.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/compat/winansi.c b/compat/winansi.c\nindex ceff55b..3aa5535 100644\n--- a/compat/winansi.c\n+++ b/compat/winansi.c\n@@ -23,6 +23,7 @@ static HANDLE hthread, hread, hwrite;\n static HANDLE hconsole1, hconsole2;\n \n #ifdef __MINGW32__\n+#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 5\n typedef struct _CONSOLE_FONT_INFOEX {\n \tULONG cbSize;\n \tDWORD nFont;\n@@ -32,6 +33,7 @@ typedef struct _CONSOLE_FONT_INFOEX {\n \tWCHAR FaceName[LF_FACESIZE];\n } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;\n #endif\n+#endif\n \n typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL,\n \t\tPCONSOLE_FONT_INFOEX);\n-- \n2.7.0.windows.1.7.g55a05c8\n"},{"id":"276074","messageId":"xmqqmvs7kj3d.fsf@gitster.mtv.corp.google.com","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH v2 0/5] Fix compile errors with MSys2","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-01-14T20:21:42Z","receivedAt":"2016-01-14T20:21:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.  Let's see if there is anything else people discover in this\nseries and merge it to 'next'.\n"},{"id":"276084","messageId":"569816EB.1060607@kdbg.org","threadId":"41180","inReplyTo":"e63d391a79396e095d2ebb139bb44c390e50bb62.1452790142.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH v2 1/5] config.mak.uname: support MSys2","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-01-14T21:45:15Z","receivedAt":"2016-01-14T21:45:15Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 14.01.2016 um 17:51 schrieb Johannes Schindelin:\n> diff --git a/config.mak.uname b/config.mak.uname\n> index f34dcaa..b0592c1 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -518,7 +518,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n>   \tNO_INET_NTOP = YesPlease\n>   \tNO_POSIX_GOODIES = UnfortunatelyYes\n>   \tDEFAULT_HELP_FORMAT = html\n> -\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n> +\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n>   \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n>   \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n>   \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n> @@ -541,8 +541,25 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n>   \tINTERNAL_QSORT = YesPlease\n>   \tHAVE_LIBCHARSET_H = YesPlease\n>   \tNO_GETTEXT = YesPlease\n> +\tCOMPAT_CLFAGS += -D__USE_MINGW_ACCESS\n>   else\n> -\tNO_CURL = YesPlease\n> +\tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n> +\t\t# MSys2\n> +\t\tCC = gcc\n> +\t\tprefix = /mingw32\n\nHmm. Setting the prefix like this is certainly ideal for Git for Windows \n(the installer), but it is very uncommon to set the prefix in \nconfig.mak.uname.\n\n> +\t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0\n> +\t\tINSTALL = /bin/install\n> +\t\tNO_R_TO_GCC_LINKER = YesPlease\n> +\t\tINTERNAL_QSORT = YesPlease\n> +\t\tHAVE_LIBCHARSET_H = YesPlease\n> +\t\tNO_GETTEXT = YesPlease\n> +\t\tUSE_LIBPCRE= YesPlease\n> +\t\tNO_CURL =\n> +\t\tUSE_NED_ALLOCATOR = YesPlease\n\nUSE_NED_ALLOCATOR is already set in the common section (line 510).\n\n> +\telse\n> +\t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO\n\nDid you mean to set -D__USE_MINGW_ACCESS here? But, as I noticed, it \ndoesn't make a whole lot of a difference; my build (which picks this \nbranch, if I'm not mistaken) still passes the test suite.\n\n> +\t\tNO_CURL = YesPlease\n> +\tendif\n>   endif\n>   endif\n>   ifeq ($(uname_S),QNX)\n>\n\n-- Hannes\n"},{"id":"276085","messageId":"569819CA.3040804@kdbg.org","threadId":"41180","inReplyTo":"cover.1452790142.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH v2 0/5] Fix compile errors with MSys2","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-01-14T21:57:30Z","receivedAt":"2016-01-14T21:57:30Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 14.01.2016 um 17:51 schrieb Johannes Schindelin:\n> Git for Windows 2.x is based on MSys2, and its first official version\n> was released already almost half a year ago, yet it is still impossible\n> even to compile Git from the official, platform-independent Git source\n> code.\n>\n> This patch series merely fixes the compile errors, and will be followed\n> by other patch series that fix the compile warnings and test failures.\n> The idea is to move all Windows-specific patches of Git for Windows'\n> fork to upstream Git proper.\n>\n> Relative to v1, I only removed the guards about the \"#undef\n> ReadWriteBarrier\".\n>\n> Johannes Schindelin (5):\n>    config.mak.uname: support MSys2\n>    config.mak.uname: supporting 64-bit MSys2\n>    nedmalloc: allow compiling with MSys2's compiler\n>    compat/mingw: support MSys2-based MinGW build\n>    compat/winansi: support compiling with MSys2\n>\n>   compat/mingw.h              | 24 +++++++++++++++++++++++-\n>   compat/nedmalloc/malloc.c.h |  4 ++++\n>   compat/winansi.c            |  2 ++\n>   config.mak.uname            | 31 ++++++++++++++++++++++++++++---\n>   4 files changed, 57 insertions(+), 4 deletions(-)\n>\n> Interdiff vs v1:\n>\n>   diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\n>   index 18634e3..bf70037 100644\n>   --- a/compat/nedmalloc/malloc.c.h\n>   +++ b/compat/nedmalloc/malloc.c.h\n>   @@ -1385,9 +1385,7 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);\n>\n>      /*** Atomic operations ***/\n>      #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100\n>   -    #ifdef __MINGW64_VERSION_MAJOR\n>   -      #undef _ReadWriteBarrier\n>   -    #endif\n>   +    #undef _ReadWriteBarrier\n>        #define _ReadWriteBarrier() __sync_synchronize()\n>      #else\n>        static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)\n>\n\nIt is very considerate of you to keep compatibility with the old MSYS \nbuild environment, which I'm still using. (The new Git for Windows build \nenvironment is already on my disk, but I haven't found time to get \nfamiliar with it.) So, it doesn't mean a whole lot, unfortunatley, when \nI report that I've tested v1, and that it passes the test suite, because \nI've exercised almost none of the new code.\n\n-- Hannes\n"},{"id":"276495","messageId":"1453372574-20431-1-git-send-email-szeder@ira.uka.de","threadId":"41180","inReplyTo":"a54e0357d8f274c7ffa49daa2c91ba371fa501ab.1452691805.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 2/5] config.mak.uname: supporting 64-bit MSys2","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2016-01-21T10:36:14Z","receivedAt":"2016-01-21T10:36:14Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"> This just makes things compile, the test suite needs extra tender loving\n> care in addition to this change. We will address these issues in later\n> commits.\n> \n> While at it, also allow building MSys2 Git (i.e. a Git that uses MSys2's\n> POSIX emulation layer).\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>  config.mak.uname | 14 +++++++++++---\n>  1 file changed, 11 insertions(+), 3 deletions(-)\n> \n> diff --git a/config.mak.uname b/config.mak.uname\n> index b0592c1..4b2e1b8 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -518,13 +518,12 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n>  \tNO_INET_NTOP = YesPlease\n>  \tNO_POSIX_GOODIES = UnfortunatelyYes\n>  \tDEFAULT_HELP_FORMAT = html\n> -\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n> +\tCOMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32\n>  \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n>  \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n>  \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n>  \t\tcompat/win32/dirent.o\n>  \tBASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1\n> -\tBASIC_LDFLAGS += -Wl,--large-address-aware\n>  \tEXTLIBS += -lws2_32\n>  \tGITLIBS += git.res\n>  \tPTHREAD_LIBS =\n\n(On Windows I only used git, and only briefly, and it was back in the\nv1.9.x era, so please pardon my ignorance...)\n\nI'm puzzled by the if statements in the hunk below:\n\n> @@ -545,8 +544,17 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n>  else\n>  \tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n>  \t\t# MSys2\n> +\t\tprefix = /usr/\n> +\t\tifeq (MINGW32,$(MSYSTEM))\n> +\t\t\tprefix = /mingw32\n\nHere prefix is set for 32 bit MSys2.  OK.\n\n> +\t\tendif\n> +\t\tifeq (MINGW64,$(MSYSTEM))\n> +\t\t\tprefix = /mingw64\n\nHere prefix is set for 64 bit MSys2.  Still OK.\n\n> +\t\telse\n> +\t\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n> +\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n\nBut then these flags are set for any MSys2 that is not 64 bit, which\nalso includes MINGW32, which we've already dealt with above\nexplicitly.  Hmm.\n\nIs this intentional?  It would be easier to follow if the settings\nspecific to MINGW32 weren't scattered in two discontinuous blocks.\nWhat values can MSYSTEM have here besides MINGW32 and MINGW64?\n\nThanks,\nGábor\n\n> +\t\tendif\n>  \t\tCC = gcc\n> -\t\tprefix = /mingw32\n>  \t\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0\n>  \t\tINSTALL = /bin/install\n>  \t\tNO_R_TO_GCC_LINKER = YesPlease\n> -- \n> 2.6.3.windows.1.300.g1c25e49\n"},{"id":"276498","messageId":"alpine.DEB.2.20.1601211438440.2964@virtualbox","threadId":"41180","inReplyTo":"1453372574-20431-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH 2/5] config.mak.uname: supporting 64-bit MSys2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-01-21T13:51:28Z","receivedAt":"2016-01-21T13:51:28Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Gábor,\n\nOn Thu, 21 Jan 2016, SZEDER Gábor wrote:\n\n> > This just makes things compile, the test suite needs extra tender\n> > loving care in addition to this change. We will address these issues\n> > in later commits.\n\nPlease note this statement:\n\n> > While at it, also allow building MSys2 Git (i.e. a Git that uses MSys2's\n> > POSIX emulation layer).\n> > [...]\n> > diff --git a/config.mak.uname b/config.mak.uname\n> > index b0592c1..4b2e1b8 100644\n> > --- a/config.mak.uname\n> > +++ b/config.mak.uname\n> > @@ -545,8 +544,17 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n> >  else\n\n... and that this here condition triggers only for MSYS2 [*1*], but in all\nmodes, i.e. 32-bit/64-bit MSYS2/MINGW...\n\n> >  \tifeq ($(shell expr \"$(uname_R)\" : '2\\.'),2)\n> >  \t\t# MSys2\n> > +\t\tprefix = /usr/\n> > +\t\tifeq (MINGW32,$(MSYSTEM))\n> > +\t\t\tprefix = /mingw32\n> \n> Here prefix is set for 32 bit MSys2.  OK.\n\nActually, it is not 32-bit MSYS2 but 32-bit MINGW. Please remember that\nMSYS2 programs use the MSYS2 runtime (in essence a portable version of\nCygwin's runtime), i.e. a POSIX emulation layer, while MINGW programs do\nnot.\n\nAs a consequence, MINGW programs are 1) faster, and 2) cannot use POSIX\nfunctionality such as fork().\n\nSo yes, this triggers when we are using the 32-bit MINGW environment,\nwhich is just a mode in which you can start MSYS2 (or for that matter, the\nGit for Windows SDK), simply by setting the environment variable `MSYSTEM`\naccordingly.\n\nThe modes are MINGW32, MINGW64 and MSYS. You cannot switch between 32-bit\nMSYS2 and 64-bit MSYS2 that way because you can run either with 32-bit\nMSYS2 runtime & programs or 64-bit MSYS2 runtime & programs. You can\neasily mix & match 32-bit and 64-bit MINGW programs, though.\n\n> > +\t\tendif\n> > +\t\tifeq (MINGW64,$(MSYSTEM))\n> > +\t\t\tprefix = /mingw64\n> \n> Here prefix is set for 64 bit MSys2.  Still OK.\n\nWell, 64-bit *MINGW*, not 64-bit *MSYS2*.\n\n> > +\t\telse\n> > +\t\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n> > +\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n> \n> But then these flags are set for any MSys2 that is not 64 bit, which\n> also includes MINGW32, which we've already dealt with above\n> explicitly.  Hmm.\n\nRemember the second paragraph of the commit message here, please: we want\nMSYS2 Git to be compiled, too. As opposed to MINGW Git. It is slower, yes,\nbut by being able to use POSIX functionality, it can side-step any bugs in\nour Windows-specific code, if any.\n\nAnd even 64-bit MSYS2's tools can handle those C and LD flags, last time I\nchecked, it is just 64-bit MINGW's tools that cannot.\n\nCiao,\nJohannes\n\nFootnote *1*: While \"MSYS2\" suggests that it is a four-letter acronym\nrather than a two-letter one (it really only stands for \"*M*inimal\n*Sys*tem\" version 2), at least one of the MSYS2 developers is adamant\nabout using all-caps. It's a fight I don't need, so I don't fight it."}]}