Various msysgit patches
cover Various msysgit patches
Hello,
Here are more patches that are in msysgit but not yet in official git.git. The patches have been discussed in the following two threads:
http://thread.gmane.org/gmane.comp.version-control.msysgit/5373
http://thread.gmane.org/gmane.comp.version-control.msysgit/4876
The first couple of patches are small an obvious. The patches with larger numbers are more complex and might need discussion.
Best,
Steffen
Edward Z. Yang (1):
connect.c: Support PuTTY plink and TortoisePlink as SSH on Windows
Johannes Schindelin (6):
MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore Quiet make: do not leave Windows behind
Work around a regression in Windows 7, causing erase_in_line() to
crash sometimes
test-chmtime: work around Windows limitation
winansi: fix compile warnings
Fix warnings in nedmalloc when compiling with GCC 4.4.0
Marius Storm-Olsen (2):
MinGW readdir reimplementation to support d_type Add custom memory allocator to MinGW and MacOS builds
Pat Thoyts (1):
git: browsing paths with spaces when using the start command
Steffen Prohaska (1):
MinGW: Teach Makefile to detect msysgit and apply specific settings
Makefile | 26 +- compat/mingw.c | 59 + compat/mingw.h | 29 + compat/nedmalloc/License.txt | 23 + compat/nedmalloc/Readme.txt | 136 + compat/nedmalloc/malloc.c.h | 5752 ++++++++++++++++++++++++++++++++++++++++++ compat/nedmalloc/nedmalloc.c | 966 +++++++ compat/nedmalloc/nedmalloc.h | 180 ++ compat/snprintf.c | 4 + compat/win32.h | 1 + compat/winansi.c | 3 +- connect.c | 8 +- git-web--browse.sh | 5 +- test-chmtime.c | 9 + 14 files changed, 7193 insertions(+), 8 deletions(-) create mode 100644 compat/nedmalloc/License.txt create mode 100644 compat/nedmalloc/Readme.txt create mode 100644 compat/nedmalloc/malloc.c.h create mode 100644 compat/nedmalloc/nedmalloc.c create mode 100644 compat/nedmalloc/nedmalloc.h
PATCH 1/11 MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore
From: Johannes Schindelin <[email protected]>
--- Makefile | 1 - compat/snprintf.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletions(-)
Makefile +0 -1
@@ -845,7 +845,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) UNRELIABLE_FSTAT = UnfortunatelyYes OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch - COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o EXTLIBS += -lws2_32
compat/snprintf.c +4 -0
@@ -6,8 +6,12 @@* number of characters to write without the trailing NUL. */ #ifndef SNPRINTF_SIZE_CORR +#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ <4 +#define SNPRINTF_SIZE_CORR 1 +#else #define SNPRINTF_SIZE_CORR 0#endif +#endif #undef vsnprintfint git_vsnprintf (char *str,size_t maxsize,const char *format,va_list ap)
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 2/11 Quiet make: do not leave Windows behind
From: Johannes Schindelin <[email protected]>
On Windows, we have to check whether there are scripts which would override .exe files, but this check missed the "quietification". Make now prints 'BUILTIN all' instead of a long chain of 'test || rm' commands.
[spr: added clarification what make will print. ]
--- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -1202,7 +1202,7 @@ SHELL = $(SHELL_PATH) all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS ifneq (,$X) - $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';) + $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';) endif all::
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 3/11 Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
From: Johannes Schindelin <[email protected]>
The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure.
--- compat/winansi.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
compat/winansi.c +2 -1
@@ -80,6 +80,7 @@ static void set_console_attr(void)static void erase_in_line (void ) {CONSOLE_SCREEN_BUFFER_INFO sbi; +long dummy;/* Needed for Windows 7 (or Vista) regression */ if (!console)return ;
@@ -87,7 +88,7 @@ static void erase_in_line(void)GetConsoleScreenBufferInfo (console, &sbi);FillConsoleOutputCharacterA (console,' ' , sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition, -NULL ); + &dummy); }
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 4/11 test-chmtime: work around Windows limitation
From: Johannes Schindelin <[email protected]>
Windows has problems changing the mtime when the file is write protected, even by the owner of said file.
Add a Windows-only workaround to change the mode if necessary before trying to change the mtime.
--- test-chmtime.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
test-chmtime.c +9 -0
@@ -87,6 +87,15 @@ int main(int argc, const char *argv[])return -1 ; } +#ifdef WIN32 +if (!(sb.st_mode &S_IWUSR ) && +chmod (argv[i], sb.st_mode |S_IWUSR )) { +fprintf (stderr,"Could not make user-writable %s: %s" , + argv[i],strerror (errno)); +return -1 ; + } +#endif + utb.actime = sb.st_atime; utb.modtime = set_eq ? set_time : sb.st_mtime + set_time;
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 5/11 winansi: fix compile warnings
From: Johannes Schindelin <[email protected]>
--- compat/win32.h | 1 + compat/winansi.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
compat/win32.h +1 -0
@@ -1,5 +1,6 @@/* common Win32 functions for MinGW and Cygwin */ #include <windows.h> +#include <conio.h> static inline int file_attr_to_st_mode (DWORD attr) {
compat/winansi.c +1 -1
@@ -80,7 +80,7 @@ static void set_console_attr(void)static void erase_in_line (void ) {CONSOLE_SCREEN_BUFFER_INFO sbi; -long dummy;/* Needed for Windows 7 (or Vista) regression */ +DWORD dummy;/* Needed for Windows 7 (or Vista) regression */ if (!console)return ;
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 6/11 git: browsing paths with spaces when using the start command
From: Pat Thoyts <[email protected]>
msysGit issue 258 tracks a problem opening a browser onto file paths that contain spaces or parentheses when calling the web--browse script. This patch modifies how the start command is called to solve this.
--- git-web--browse.sh | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
git-web--browse.sh +4 -1
@@ -161,9 +161,12 @@ case "$browser" in ;; esac ;; - w3m|links|lynx|open|start) + w3m|links|lynx|open) eval "$browser_path" "$@" ;; + start) + exec "$browser_path" '"web-browse"' "$@" + ;; dillo) "$browser_path" "$@" & ;;
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 7/11 connect.c: Support PuTTY plink and TortoisePlink as SSH on Windows
From: Edward Z. Yang <[email protected]>
OpenSSH uses -p to specify custom ports, while PuTTY plink and TortoisePlink use -P. Git now detects if plink is in GIT_SSH and modify its flags as necessary.
We call plink with -batch, so that it will error out with an error message instead of waiting for user input. As reported in msysGit issue 96, plink wants to interact with the user asking if a host key should be accepted, but this just blocks the terminal, since plink tries to get the answer from stdin. However, stdin is already connected to Git that wants to send input to the remote command.
But we do not pass -batch to TortoisePlink, because TortoisePlink uses a GUI to communicate with the user, and it does not understand -batch.
--- connect.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
connect.c +6 -2
@@ -602,14 +602,18 @@ struct child_process *git_connect(int fd[2], const char *url_orig,die ("command line too long" ); conn->in = conn->out =-1 ; - conn->argv = arg =xcalloc (6 ,sizeof (*arg)); + conn->argv = arg =xcalloc (7 ,sizeof (*arg));if (protocol ==PROTO_SSH ) {const char *ssh =getenv ("GIT_SSH" ); +int putty = ssh &&strcasestr (ssh,"plink" );if (!ssh) ssh ="ssh" ; *arg++ = ssh; +if (putty && !strcasestr (ssh,"tortoiseplink" )) + *arg++ ="-batch" ;if (port) { - *arg++ ="-p" ; +/* P is for PuTTY, p is for OpenSSH */ + *arg++ = putty ?"-P" :"-p" ; *arg++ = port; } *arg++ = host;
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 8/11 MinGW readdir reimplementation to support d_type
From: Marius Storm-Olsen <[email protected]>
The original readdir implementation was fast, but didn't support the d_type. This means that git would do additional lstats for each entry, to figure out if the entry was a directory or not. This unneedingly slowed down many operations, since Windows API provides this information directly when walking the directories.
By running this implementation on Moe's repo structure:
mkdir bummer && cd bummer; for ((i=0;i<100;i++)); do
mkdir $i && pushd $i;
for ((j=0;j<1000;j++)); do echo "$j" >$j; done;
popd;done
We see the following speedups:
git add .
-------------------
old: 00:00:23(.087)
new: 00:00:21(.512) 1.07x
git status
-------------------
old: 00:00:03(.306)
new: 00:00:01(.684) 1.96x
git clean -dxf
-------------------
old: 00:00:01(.918)
new: 00:00:00(.295) 6.50x
--- compat/mingw.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ compat/mingw.h | 29 +++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 0 deletions(-)
compat/mingw.c +59 -0
@@ -1171,3 +1171,62 @@ char *getpass(const char *prompt)fputs ("\n" , stderr);return strbuf_detach (&buf,NULL ); } + +#ifndef NO_MINGW_REPLACE_READDIR +/* MinGW readdir implementation to avoid extra lstats for Git */ +struct mingw_DIR +{ +struct _finddata_t dd_dta;/* disk transfer area for this dir */ +struct mingw_dirent dd_dir;/* Our own implementation, including d_type */ +long dd_handle;/* _findnext handle */ +int dd_stat;/* 0 = next entry to read is first entry, -1 = off the end, positive = 0 based index of next entry */ +char dd_name[1 ];/* given path for dir with search pattern (struct is extended) */ +}; + +struct dirent *mingw_readdir (DIR *dir) +{ +WIN32_FIND_DATAA buf; +HANDLE handle; +struct mingw_DIR *mdir = (struct mingw_DIR *)dir; + +if (!dir->dd_handle) { + errno =EBADF ;/* No set_errno for mingw */ +return NULL ; + } + +if (dir->dd_handle == (long )INVALID_HANDLE_VALUE && dir->dd_stat ==0 ) + { + handle =FindFirstFileA (dir->dd_name, &buf); +DWORD lasterr =GetLastError (); + dir->dd_handle = (long )handle; +if (handle ==INVALID_HANDLE_VALUE && (lasterr !=ERROR_NO_MORE_FILES )) { + errno =err_win_to_posix (lasterr); +return NULL ; + } + }else if (dir->dd_handle == (long )INVALID_HANDLE_VALUE ) { +return NULL ; + }else if (!FindNextFileA ((HANDLE )dir->dd_handle, &buf)) { +DWORD lasterr =GetLastError (); +FindClose ((HANDLE )dir->dd_handle); + dir->dd_handle = (long )INVALID_HANDLE_VALUE ; +/* POSIX says you shouldn't set errno when readdir can't +find any more files; so, if another error we leave it set. */ +if (lasterr !=ERROR_NO_MORE_FILES ) + errno =err_win_to_posix (lasterr); +return NULL ; + } + +/* We get here if `buf' contains valid data. */ +strcpy (dir->dd_dir.d_name, buf.cFileName); + ++dir->dd_stat; + +/* Set file type, based on WIN32_FIND_DATA */ + mdir->dd_dir.d_type =0 ; +if (buf.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY ) + mdir->dd_dir.d_type |=DT_DIR ; +else + mdir->dd_dir.d_type |=DT_REG ; + +return (struct dirent *)&dir->dd_dir; +} +#endif // !NO_MINGW_REPLACE_READDIR
compat/mingw.h +29 -0
@@ -235,3 +235,32 @@ int main(int argc, const char **argv) \return mingw_main (argc, argv); \ } \ static int mingw_main(c,v) + +#ifndef NO_MINGW_REPLACE_READDIR +/* +* A replacement of readdir, to ensure that it reads the file type at +* the same time. This avoid extra unneeded lstats in git on MinGW +*/ +#undef DT_UNKNOWN +#undef DT_DIR +#undef DT_REG +#undef DT_LNK +#define DT_UNKNOWN 0 +#define DT_DIR 1 +#define DT_REG 2 +#define DT_LNK 3 + +struct mingw_dirent +{ +long d_ino;/* Always zero. */ +union { +unsigned short d_reclen;/* Always zero. */ +unsigned char d_type;/* Reimplementation adds this */ + }; +unsigned short d_namlen;/* Length of name in d_name. */ +char d_name[FILENAME_MAX ];/* File name. */ +}; +#define dirent mingw_dirent +#define readdir (x) mingw_readdir(x) +struct dirent *mingw_readdir (DIR *dir); +#endif // !NO_MINGW_REPLACE_READDIR
Signature · 1 line
1.6.3.1.54.g99dd
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 10/11 Fix warnings in nedmalloc when compiling with GCC 4.4.0
From: Johannes Schindelin <[email protected]>
--- compat/nedmalloc/malloc.c.h | 4 +++- compat/nedmalloc/nedmalloc.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
compat/nedmalloc/malloc.c.h +3 -1
@@ -1270,7 +1270,9 @@ int mspace_mallopt(int, int);/*------------------------------ internal #includes ---------------------- */ #ifdef WIN32 +#ifndef __GNUC__#pragma warning( disable : 4146 )/* no "unsigned" warnings */ +#endif #endif /* WIN32 */ #include <stdio.h> /* for printing in malloc_stats */
@@ -2541,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () (mparams.magic != 0 || init_mparams()) +#define ensure_initialization () if (mparams.magic == 0) init_mparams()#if !ONLY_MSPACES
compat/nedmalloc/nedmalloc.c +1 -1
@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE./*#define FULLSANITYCHECKS*/ #include "nedmalloc.h" -#if defined(WIN32 ) && !defined(__MINGW32__) +#if defined(WIN32 )#include <malloc.h> #endif #define MSPACES 1
Signature · 1 line
1.6.3.1.54.g99dd
PATCH 11/11 MinGW: Teach Makefile to detect msysgit and apply specific settings
This commit changes handling of the msysgit specific settings, so that they can be applied to official git.git. Some msysgit settings differ from the standard MinGW settings. We move them into an ifndef block that is only evaluated if a file THIS_IS_MSYSGIT is present in the parent directory, which is the case for an msysgit working environment. The tag file is unlikely to be present accidentally.
--- Makefile | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
Makefile +12 -2
@@ -823,7 +823,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) pathsep = ; NO_PREAD = YesPlease NO_OPENSSL = YesPlease - NO_CURL = YesPlease NO_SYMLINK_HEAD = YesPlease NO_IPV6 = YesPlease NO_SETENV = YesPlease
@@ -831,7 +830,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease - NO_PTHREADS = YesPlease NEEDS_LIBICONV = YesPlease OLD_ICONV = YesPlease NO_C99_FORMAT = YesPlease
@@ -853,6 +851,18 @@ ifneq (,$(findstring MINGW,$(uname_S))) COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o EXTLIBS += -lws2_32 X = .exe +ifneq (,$(wildcard ../THIS_IS_MSYSGIT)) + htmldir=doc/git/html/ + prefix = + INSTALL = /bin/install + EXTLIBS += /mingw/lib/libz.a + NO_R_TO_GCC_LINKER = YesPlease + INTERNAL_QSORT = YesPlease + THREADED_DELTA_SEARCH = YesPlease +else + NO_CURL = YesPlease + NO_PTHREADS = YesPlease +endif endif ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease
Signature · 1 line
1.6.3.1.54.g99dd
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
In reply to Steffen Prohaskacompat/nedmalloc/malloc.c.h struct malloc_params { · line 2548
Quoted 8 lines · Steffen Prohaska
compat/nedmalloc/malloc.c.h +1
-1@@ -2541,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () (mparams.magic != 0 || init_mparams()) +#define ensure_initialization () if (mparams.magic == 0) init_mparams()#if !ONLY_MSPACES
The code after the patch looks more fragile than the original. I know there currently is no code like:
if (foo())
ensure_initialization();
else
warn("oops");but this change still feels wrong.
What issue is this patch trying to work around? Returned value not being used?
compat/nedmalloc/nedmalloc.c DEALINGS IN THE SOFTWARE. · line 39
Quoted 12 lines
compat/nedmalloc/nedmalloc.c +1
-1@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE./*#define FULLSANITYCHECKS*/ #include "nedmalloc.h" -#if defined(WIN32 ) && !defined(__MINGW32__) +#if defined(WIN32 )#include <malloc.h> #endif
Can somebody enlighten me what this hunk is about, and how it helps GCC 4.4?
There are many "#if[n]def __MINGW32__" remaining in the codebase both inside and outside compat/ area, so it is not that that symbol is somehow special. I cannot even tell which one of the following is closer to the reason behind this change:
(1) "Because tacking '&& !defined(__MINGW32__)' after defined(WIN32) is unnecessary for such and such reasons, it is removed"; or
(2) "Because tacking '&& !defined(__MINGW32__)' after defined(WIN32) is harmful for such and such reasons, it is removed".
Puzzled.
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Hi,
Quoted 14 lines · Junio C Hamano
compat/nedmalloc/malloc.c.h struct malloc_params { · line 2548
Quoted 8 lines · Steffen Prohaska
compat/nedmalloc/malloc.c.h +1
-1@@ -2541,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () (mparams.magic != 0 || init_mparams()) +#define ensure_initialization () if (mparams.magic == 0) init_mparams()#if !ONLY_MSPACES The code after the patch looks more fragile than the original. I know there currently is no code like:
Quoted 6 lines
if (foo()) ensure_initialization(); else warn("oops");but this change still feels wrong.
I know, but the whole use of ensure_initialization() feels wrong to me, and I did _not_ want to change the code too much, lest we end up maintaining a proper fork as has happened with libxdiff.
Quoted 2 lines
What issue is this patch trying to work around? Returned value not being used?
I forgot what the GCC warning looked like, and have only text-mode access to the web right now, so I cannot access any Windows machine and try again.
It was a warning, though, that much I remember.
Quoted 7 lines
Quoted 7 lines
compat/nedmalloc/nedmalloc.c +0
-0@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE./*#define FULLSANITYCHECKS*/
Quoted 8 lines
compat/nedmalloc/nedmalloc.c DEALINGS IN THE SOFTWARE. · line 39
Quoted 5 lines
compat/nedmalloc/nedmalloc.c +1
-1#include "nedmalloc.h" -#if defined(WIN32 ) && !defined(__MINGW32__) +#if defined(WIN32 )#include <malloc.h> #endif Can somebody enlighten me what this hunk is about, and how it helps GCC 4.4?
It helps in that malloc.h is included even if we happen to compile the stuff as a MinGW program. Otherwise necessary function declarations are missing.
Quoted 10 lines
There are many "#if[n]def
__MINGW32__" remaining in the codebase both inside and outside compat/ area, so it is not that that symbol is somehow special. I cannot even tell which one of the following is closer to the reason behind this change:(1) "Because tacking '&& !defined(__MINGW32__)' after defined(WIN32) is unnecessary for such and such reasons, it is removed"; or
(2) "Because tacking '&& !defined(__MINGW32__)' after defined(WIN32) is harmful for such and such reasons, it is removed".
The latter.
Quoted 1 line
Puzzled.
Hopefully less so, now.
Ciao,
Dscho
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 16 lines · Johannes Schindelin
Quoted 7 lines
Quoted 7 lines
compat/nedmalloc/nedmalloc.c +0
-0@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE./*#define FULLSANITYCHECKS*/ Quoted 8 lines
compat/nedmalloc/nedmalloc.c DEALINGS IN THE SOFTWARE. · line 39
Quoted 5 lines
compat/nedmalloc/nedmalloc.c +1
-1#include "nedmalloc.h" -#if defined(WIN32 ) && !defined(__MINGW32__) +#if defined(WIN32 )#include <malloc.h> #endif Can somebody enlighten me what this hunk is about, and how it helps GCC 4.4?
Quoted 5 lines
It helps in that
malloc.his included even if we happen to compile the stuff as a MinGW program. Otherwise necessary function declarations are missing.
...
Hopefully less so, now.
I wish enough information were in the commit log message from the beginning.
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 3 lines · Junio C Hamano
Quoted 3 lines
Quoted 2 lines
Can somebody enlighten me what this hunk is about, and how it helps GCC 4.4?
Um... It's strange.
I can not connect to http://gcc.gnu.org website
to get GCC 4.4 manual(pdf format) currently.
ping is normal just.
[invain@fedora9 invain]$ ping gcc.gnu.org
PING gcc.gnu.org (209.132.176.174) 56(84) bytes of data.
64 bytes from sourceware.org (209.132.176.174): icmp_seq=1 ttl=40 time=194 ms 64 bytes from sourceware.org (209.132.176.174): icmp_seq=2 ttl=40 time=199 ms ^X64 bytes from sourceware.org (209.132.176.174): icmp_seq=3 ttl=40 time=193 ms 64 bytes from sourceware.org (209.132.176.174): icmp_seq=4 ttl=40 time=203 ms ^C
--- gcc.gnu.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3326ms
rtt min/avg/max/mdev = 193.762/198.126/203.978/4.135 ms [invain@fedora9 invain]$
[invain@fedora9 invain]$ nmap gcc.gnu.org
[invain@fedora9 invain]$ nmap -p 80 gcc.gnu.org
Starting Nmap 4.53 ( http://insecure.org ) at 2009-06-02 08:37 KST
Note: Host seems down. If it is really up, but blocking our ping probes, try -PN Nmap done: 1 IP address (0 hosts up) scanned in 2.023 seconds [invain@fedora9 invain]$
Signature · 5 lines
Regards, GeunSik Lim ( Samsung Electronics ) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected]
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
In reply to Junio C HamanoHi,
Quoted 18 lines · Junio C Hamano
Quoted 16 lines · Johannes Schindelin
Quoted 15 lines
compat/nedmalloc/nedmalloc.c DEALINGS IN THE SOFTWARE. · line 39
Quoted 12 lines
compat/nedmalloc/nedmalloc.c +1
-1@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE./*#define FULLSANITYCHECKS*/ #include "nedmalloc.h" -#if defined(WIN32 ) && !defined(__MINGW32__) +#if defined(WIN32 )#include <malloc.h> #endif Can somebody enlighten me what this hunk is about, and how it helps GCC 4.4?
Quoted 8 lines
Quoted 5 lines
It helps in that
malloc.his included even if we happen to compile the stuff as a MinGW program. Otherwise necessary function declarations are missing.
...
Hopefully less so, now.I wish enough information were in the commit log message from the beginning.
Okay, how about this in the commit body in addition?
-- snip --
Nedmalloc's source code has a cute #define construct to avoid inserting an if() statement, because that might interact badly with enclosing if() statements. However, there is no danger of that now, but GCC > 4 complains "warning: value computed is not used".
Also, with the version of MinGW's headers in msysGit, we need to include malloc.h lest the compiler complain about an "incompatible implicit declaration of built-in function 'alloca'".
-- snap --
Hmm?
Dscho
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 8 lines · Johannes Schindelin
Okay, how about this in the commit body in addition?
-- snip --
Nedmalloc's source code has a cute #define construct to avoid inserting anif()statement, because that might interact badly with enclosingif()statements. However, there is no danger of that now, but GCC > 4 complains "warning: value computed is not used".
Quoted 6 lines
Also, with the version of MinGW's headers in msysGit, we need to include
malloc.hlest the compiler complain about an "incompatible implicit declaration of built-in function 'alloca'".
-- snap --Hmm?
As to the first one, I think your problem description is clear (the problem is clear without being explained to begin with) but "there is no danger of that now" is somewhere between a lame excuse for not doing it the right way and a bug waiting to happen. If "value computed is not used" is the issue, why doesn't this work?
#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams())
or at least wrap your fragile "if" in a bog-standard do {} while(0), like...
#define ensure_initialization() \
do { if (mparams.magic == 0) init_mparams(); } while (0)Then you do not have to make excuses, and instead can just say
Squelch GCC > 4's "value computed not used" warnings from ensure_initialization() macro definition.
As to the second one, I think you lost "even if we happen to" part (that logically corresponds to "... that is why we do not want to limit the inclusion to !__MINGW32__ case") from the description, making it less readable...
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Hi,
Quoted 17 lines · Junio C Hamano
Quoted 8 lines · Johannes Schindelin
Okay, how about this in the commit body in addition?
-- snip --
Nedmalloc's source code has a cute #define construct to avoid inserting anif()statement, because that might interact badly with enclosingif()statements. However, there is no danger of that now, but GCC > 4 complains "warning: value computed is not used".Quoted 6 lines
Also, with the version of MinGW's headers in msysGit, we need to include
malloc.hlest the compiler complain about an "incompatible implicit declaration of built-in function 'alloca'".
-- snap --Hmm?
Quoted 7 lines
As to the first one, I think your problem description is clear (the problem is clear without being explained to begin with) but "there is no danger of that now" is somewhere between a lame excuse for not doing it the right way and a bug waiting to happen. If "value computed is not used" is the issue, why doesn't this work?
#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams())
That works.
Quoted 4 lines
As to the second one, I think you lost "even if we happen to" part (that logically corresponds to "... that is why we do not want to limit the inclusion to !__MINGW32__ case") from the description, making it less readable...
You mean "even if we happen to be on Windows"? Fine with me. Want me to resend a fixed patch?
Ciao,
Dscho
Re: [PATCH 10/11] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 6 lines · Johannes Schindelin
Quoted 4 lines
As to the second one, I think you lost "even if we happen to" part (that logically corresponds to "... that is why we do not want to limit the inclusion to !__MINGW32__ case") from the description, making it less readable...
You mean "even if we happen to be on Windows"?
I meant this part from your earlier message.
Quoted 3 lines
It helps in that
malloc.his included even if we happen to compile the stuff as a MinGW program. Otherwise necessary function declarations are missing.
compared with the newer "how about" version, which is
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Also, with the version of MinGW's headers in msysGit, we need to include
malloc.hlest the compiler complain about an "incompatible implicit declaration of built-in function 'alloca'".
I thought the former explains the change in question
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-#if defined(WIN32) && !defined(__MINGW32__) +#if defined(WIN32)
much more clearly: "If you are compiling for Windows, regardless of MINGW32, you would want this section to apply".
Quoted 1 line
... Want me to resend a fixed patch?
Surely. I think I could come up with something based on the discussion here, but I'd rather not. A patch signed off by either you or Steffen, or both is very much appreciated.
PATCH v2 10/11 Fix warnings in nedmalloc when compiling with GCC 4.4.0
Nedmalloc's source code has a cute #define construct to avoid inserting an if() statement, because that might interact badly with enclosing if() statements. However, GCC > 4 complains with a "warning: value computed is not used". So we cast the result to "void".
GCC also does not understand the Visual C++ specific pragmas, so we need to disable them for MinGW.
We need to include malloc.h on Windows even if we happen to compile the stuff as a MinGW program. Otherwise the function declaration of alloca() is missing.
---
Forgot to send.
compat/nedmalloc/malloc.c.h | 4 +++- compat/nedmalloc/nedmalloc.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
compat/nedmalloc/malloc.c.h +3 -1
@@ -1270,7 +1270,9 @@ int mspace_mallopt(int, int);/*------------------------------ internal #includes ---------------------- */ #ifdef WIN32 +#ifndef __GNUC__#pragma warning( disable : 4146 )/* no "unsigned" warnings */ +#endif #endif /* WIN32 */ #include <stdio.h> /* for printing in malloc_stats */
@@ -2541,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () (mparams.magic != 0 || init_mparams()) +#define ensure_initialization () ((void)(mparams.magic == 0 || init_mparams()))#if !ONLY_MSPACES
compat/nedmalloc/nedmalloc.c +1 -1
@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE./*#define FULLSANITYCHECKS*/ #include "nedmalloc.h" -#if defined(WIN32 ) && !defined(__MINGW32__) +#if defined(WIN32 )#include <malloc.h> #endif #define MSPACES 1
Signature · 1 line
1.6.3.284.g6fecc
Re: [PATCH 10/11 v2] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 6 lines · Johannes Schindelin
Nedmalloc's source code has a cute #define construct to avoid inserting an
if()statement, because that might interact badly with enclosingif()statements. However, GCC > 4 complains with a "warning: value computed is not used". So we cast the result to "void".Forgot to send.
Thanks. The description on the pragma is a good thing to add, which you did.
Is Visual C++ happy with casting discarded result to (void)? I'd find it broken if it isn't, but it would not hurt to ask just to make sure.
Steffen, can we move the series, with this patch replaced, to 'next' now? I think it looks good (thanks!) but again it would not hurt to ask just to make sure ;-).
Quoted 27 lines
compat/nedmalloc/malloc.c.h | 4 +++- compat/nedmalloc/nedmalloc.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)compat/nedmalloc/malloc.c.h +3
-1@@ -1270,7 +1270,9 @@ int mspace_mallopt(int, int);/*------------------------------ internal #includes ---------------------- */ #ifdef WIN32 +#ifndef __GNUC__#pragma warning( disable : 4146 )/* no "unsigned" warnings */ +#endif #endif /* WIN32 */ #include <stdio.h> /* for printing in malloc_stats */ @@ -2541,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () (mparams.magic != 0 || init_mparams()) +#define ensure_initialization () ((void)(mparams.magic == 0 || init_mparams()))#if !ONLY_MSPACES
Re: [PATCH 10/11 v2] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 2 lines · Junio C Hamano
Is Visual C++ happy with casting discarded result to (void)? I'd find it broken if it isn't, but it would not hurt to ask just to make sure.
It is OK. Visual C++ is not *that* broken ;)
-- Hannes
Re: [PATCH 10/11 v2] Fix warnings in nedmalloc when compiling with GCC 4.4.0
In reply to Junio C HamanoQuoted 3 lines · Junio C Hamano
Steffen, can we move the series, with this patch replaced, to 'next' now? I think it looks good (thanks!) but again it would not hurt to ask just to make sure ;-).
I agree, it looks good. Thanks.
Steffen
Re: [PATCH 10/11 v2] Fix warnings in nedmalloc when compiling with GCC 4.4.0
Quoted 9 lines · Steffen Prohaska
Quoted 4 lines · Junio C Hamano
Steffen, can we move the series, with this patch replaced, to 'next' now? I think it looks good (thanks!) but again it would not hurt to ask just to
make sure ;-).I agree, it looks good. Thanks.
Please don't advance this series to master just yet: I see severe breakage with the nedmalloc patch on one of my systems, but I ran out of time to investigate further. (And I'm afraid I can continue only next Monday.)
-- Hannes
PATCH 1/1 Fix typo in nedmalloc warning fix
---
Quoted 3 lines · Johannes Sixt
Please don't advance this series to master just yet: I see severe breakage with the nedmalloc patch on one of my systems, but I ran out of time to investigate further. (And I'm afraid I can continue only next Monday.)
So, I have the failure on my other system as well, and this is the fix ;)
-- Hannes
compat/nedmalloc/malloc.c.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
compat/nedmalloc/malloc.c.h +1 -1
@@ -2543,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () ((void)(mparams.magic == 0 || init_mparams())) +#define ensure_initialization () ((void)(mparams.magic != 0 || init_mparams()))#if !ONLY_MSPACES
Signature · 1 line
1.6.3.2.1225.g177fa.dirty
PATCH 1/1 compat/ has subdirectories: do not omit them in 'make clean'
---
Quoted 1 line · Johannes Sixt
So, I have the failure on my other system as well, and this is the fix ;)
And this was quite helpful to find the breakage.
-- Hannes
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -1691,7 +1691,7 @@ distclean: clean $(RM) configure clean: - $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \ + $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \ $(LIB_FILE) $(XDIFF_LIB) $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X $(RM) $(TEST_PROGRAMS)
Signature · 1 line
1.6.3.2.1225.g177fa.dirty
Re: [PATCH] Fix typo in nedmalloc warning fix
In reply to Johannes SixtHi,
Quoted 19 lines · Johannes Sixt
Signed-off-by Johannes Sixt <[email protected]>---
Quoted 3 lines · Johannes Sixt
Please don't advance this series to master just yet: I see severe breakage with the nedmalloc patch on one of my systems, but I ran out of time to investigate further. (And I'm afraid I can continue only next Monday.)
So, I have the failure on my other system as well, and this is the fix ;)
-- Hannes
compat/nedmalloc/malloc.c.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)compat/nedmalloc/malloc.c.h +0
-0
compat/nedmalloc/malloc.c.h struct malloc_params { · line 2548
Quoted 7 lines
compat/nedmalloc/malloc.c.h +1
-1@@ -2543,7 +2543,7 @@ struct malloc_params {static struct malloc_params mparams;/* Ensure mparams initialized */ -#define ensure_initialization () ((void)(mparams.magic == 0 || init_mparams())) +#define ensure_initialization () ((void)(mparams.magic != 0 || init_mparams()))
Aargh!
Thanks for catching this stupid bug,
Dscho
Re: [PATCH 05/11] winansi: fix compile warnings
In reply to Steffen Prohaskacompat/win32.h line 6
Quoted 11 lines · Steffen Prohaska
compat/win32.h +1
-0@@ -1,5 +1,6 @@/* common Win32 functions for MinGW and Cygwin */ #include <windows.h> +#include <conio.h> static inline int file_attr_to_st_mode (DWORD attr) {
I assume this is to remove the warning about missing declaration of _getch(). Can we have this patch instead? I don't have conio.h in my oldish MinGW environment.
compat/mingw.c +3 -0
@@ -1211,6 +1211,9 @@ int link(const char *oldpath, const char *newpath)return 0 ; } +/* from conio.h */ +int _getch (void );// FIXME: really look this up in conio.h!!!! +char *getpass (const char *prompt) {struct strbuf buf =STRBUF_INIT ;
compat/winansi.c static void set_console_attr(void) · line 86
Quoted 13 lines
compat/winansi.c +1
-1@@ -80,7 +80,7 @@ static void set_console_attr(void)static void erase_in_line (void ) {CONSOLE_SCREEN_BUFFER_INFO sbi; -long dummy;/* Needed for Windows 7 (or Vista) regression */ +DWORD dummy;/* Needed for Windows 7 (or Vista) regression */ if (!console)return ;
This should really be squashed into 03/11, where the line is introduced.
-- Hannes
PATCH v2 3/11 Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
From: Johannes Schindelin <[email protected]>
The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure.
--- compat/winansi.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
I squashed the second chunk of 05/11, as suggested by Hannes.
compat/winansi.c +2 -1
@@ -80,6 +80,7 @@ static void set_console_attr(void)static void erase_in_line (void ) {CONSOLE_SCREEN_BUFFER_INFO sbi; +DWORD dummy;/* Needed for Windows 7 (or Vista) regression */ if (!console)return ;
@@ -87,7 +88,7 @@ static void erase_in_line(void)GetConsoleScreenBufferInfo (console, &sbi);FillConsoleOutputCharacterA (console,' ' , sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition, -NULL ); + &dummy); }
Signature · 1 line
1.6.3.1.54.g99dd
Re: [PATCH 03/11 v2] Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
Hi,
Quoted 6 lines · Steffen Prohaska
From: Johannes Schindelin <[email protected]>
The function
FillConsoleOutputCharacterA()was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure.
Did I really have too-long lines in my commit message?
Quoted 8 lines
Signed-off-by Johannes Schindelin <[email protected]>Signed-off-by Steffen Prohaska <[email protected]>--- compat/winansi.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)I squashed the second chunk of 05/11, as suggested by Hannes.
Makes sense, thank you!
Dscho
Re: [PATCH 03/11 v2] Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
Quoted 4 lines · Johannes Schindelin
Hi,
On Mon, 1 Jun 2009, Steffen Prohaska wrote:
Quoted 8 lines
Quoted 6 lines
From: Johannes Schindelin <[email protected]>
The function
FillConsoleOutputCharacterA()was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure.Did I really have too-long lines in my commit message?
Yes. See aa3abfc9852a4d4cfaa7f0042102eb56ed2e0daa on 4msysgit's devel. You are author and committer.
Steffen
Re: [PATCH 03/11 v2] Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
Hi,
Quoted 14 lines · Steffen Prohaska
Quoted 12 lines · Johannes Schindelin
Quoted 9 lines · Steffen Prohaska
From: Johannes Schindelin <[email protected]>
The function
FillConsoleOutputCharacterA()was pretty content in XP to take a NULL
pointer if we did not want to store the number of written columns. In Windows 7,
it crashes, but only when called from within Git Bash, not from within cmd.exe.
Go figure.
Quoted 5 lines
Quoted 1 line
Did I really have too-long lines in my commit message?
Yes. See
aa3abfc9852a4d4cfaa7f0042102eb56ed2e0daaon 4msysgit's devel. You are author and committer.
My bad, then!
Ciao,
Dscho
Re: [PATCH 05/11] winansi: fix compile warnings
In reply to Johannes SixtQuoted 22 lines · Johannes Sixt
compat/win32.h line 6
Quoted 11 lines · Steffen Prohaska
compat/win32.h +1
-0@@ -1,5 +1,6 @@/* common Win32 functions for MinGW and Cygwin */ #include <windows.h> +#include <conio.h> static inline int file_attr_to_st_mode (DWORD attr) {I assume this is to remove the warning about missing declaration of
_getch(). Can we have this patch instead? I don't haveconio.hin my oldish MinGW environment.compat/mingw.c +0
-0
compat/mingw.c int link(const char *oldpath, const char *newpath) · line 1219
Quoted 9 lines
compat/mingw.c +3
-0@@ -1211,6 +1211,9 @@ int link(const char *oldpath, const char *newpath)return 0 ; } +/* from conio.h */ +int _getch (void );// FIXME: really look this up in conio.h!!!! +char *getpass (const char *prompt) {struct strbuf buf =STRBUF_INIT ;
Ok, forget this patch; I'll upgrade my MinGW instead, and let's assume all other mingw.git h4ckrz who aren't using the latest msysgit will upgrade as well.
Nevertheless, I think that the #include <conio.h> is in the wrong file: it should be included from compat/mingw.c.
-- Hannes
PATCH v2 5/11 MinGW: fix warning about implicit declaration of _getch()
From: Johannes Schindelin <[email protected]>
conio.h provides the declaration.
--- compat/mingw.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
This replaces 05/11. The original commit messages was misleading. Apparently, the original 05/11 solved two things. First, it fixed a warning in winansi.c, which has been squashed into 03/11. Second, it fixed a warning about implict decl of _getch(). Including conio.h in mingw.c is sufficient to fix this warning.
compat/mingw.c +1 -0
@@ -1,5 +1,6 @@#include "../git-compat-util.h" #include "win32.h" +#include <conio.h> #include "../strbuf.h" unsigned int _CRT_fmode = _O_BINARY;
Signature · 1 line
1.6.3.1.54.g99dd
Re: [PATCH 04/11] test-chmtime: work around Windows limitation
In reply to Steffen ProhaskaQuoted 7 lines · Steffen Prohaska
From: Johannes Schindelin <[email protected]>
Windows has problems changing the mtime when the file is write protected, even by the owner of said file.
Add a Windows-only workaround to change the mode if necessary before trying to change the mtime.
I'll queue this as-is for now, but shouldn't the code remember the original mode and change it back?
Quoted 28 lines
Signed-off-by Johannes Schindelin <[email protected]>Signed-off-by Steffen Prohaska <[email protected]>--- test-chmtime.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)test-chmtime.c +9
-0@@ -87,6 +87,15 @@ int main(int argc, const char *argv[])return -1 ; } +#ifdef WIN32 +if (!(sb.st_mode &S_IWUSR ) && +chmod (argv[i], sb.st_mode |S_IWUSR )) { +fprintf (stderr,"Could not make user-writable %s: %s" , + argv[i],strerror (errno)); +return -1 ; + } +#endif + utb.actime = sb.st_atime; utb.modtime = set_eq ? set_time : sb.st_mtime + set_time;Signature · 1 line
1.6.3.1.54.g99dd
Re: [PATCH 04/11] test-chmtime: work around Windows limitation
Hi,
Quoted 4 lines · Junio C Hamano
Quoted 2 lines · Steffen Prohaska
From: Johannes Schindelin <[email protected]>
Quoted 8 lines
Quoted 5 lines
Windows has problems changing the mtime when the file is write protected, even by the owner of said file.
Add a Windows-only workaround to change the mode if necessary before trying to change the mtime.
I'll queue this as-is for now, but shouldn't the code remember the original mode and change it back?
Hmm, good point. As I mentioned in another mail, though, I cannot access any Windows machine to fix this issue now, sorry.
Not changing the mode back _might_ paper over another issue: if the files are deleted later, that mode change might mean that the deletion now succeeds, and fixing test-chmtime may make it fail again. Not sure, though.
Ciao,
Dscho
Quoted 7 lines · Steffen Prohaska
Hello,
Here are more patches that are in msysgit but not yet in official git.git. The patches have been discussed in the following two threads:http://thread.gmane.org/gmane.comp.version-control.msysgit/5373
http://thread.gmane.org/gmane.comp.version-control.msysgit/4876
Thanks a lot, your work is very much appreciated. Let me add that these patches have been in use for weeks, some even for months now.
Please consider to resend updated 03/11 and 05/11 as I have suggested elsewhere in the thread.
-- Hannes