Skip to contentSkip to conversation

Version 1.8.1 does not compile on Cygwin 1.7.14

DISCUSSION Stephen & Linda Smith 10 participants 45 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

Commit 9fca6cffc05321445b59c91e8f8d308f41588b53 message states that the macro was being renamed for clarity. The patch also changes a define.

This change causes the code to not compile on cygwin 1.7.14.

I narrowed the problem to this patch by bisecting commits between v1.8.0 and
1.8.1

Here is the error sequence:

CC compat/cygwin.o
In file included from compat/../git-compat-util.h:90,
from compat/cygwin.c:9:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:103:2:
warning: #warning "fd_set and associated macros have been defined in sys/types. This may cause runtime problems with W32 sockets"
In file included from /usr/include/sys/socket.h:16,

                 from compat/../git-compat-util.h:131,
                 from compat/cygwin.c:9:

/usr/include/cygwin/socket.h:29: error: redefinition of struct sockaddr' /usr/include/cygwin/socket.h:41: error: redefinition of struct sockaddr_storage'
In file included from /usr/include/sys/socket.h:16,

                 from compat/../git-compat-util.h:131,
                 from compat/cygwin.c:9:

/usr/include/cygwin/socket.h:59: error: redefinition of `struct linger' In file included from compat/../git-compat-util.h:131,
from compat/cygwin.c:9:
/usr/include/sys/socket.h:30: error: conflicting types for 'accept' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:536:
error: previous declaration of 'accept' was here /usr/include/sys/socket.h:30: error: conflicting types for 'accept' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:536:
error: previous declaration of 'accept' was here /usr/include/sys/socket.h:32: error: conflicting types for 'bind' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:537:
error: previous declaration of 'bind' was here /usr/include/sys/socket.h:32: error: conflicting types for 'bind' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:537:
error: previous declaration of 'bind' was here /usr/include/sys/socket.h:33: error: conflicting types for 'connect' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:539:
error: previous declaration of 'connect' was here /usr/include/sys/socket.h:33: error: conflicting types for 'connect' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:539:
error: previous declaration of 'connect' was here /usr/include/sys/socket.h:34: error: conflicting types for 'getpeername' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:541:
error: previous declaration of 'getpeername' was here /usr/include/sys/socket.h:34: error: conflicting types for 'getpeername' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:541:
error: previous declaration of 'getpeername' was here /usr/include/sys/socket.h:35: error: conflicting types for 'getsockname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:542:
error: previous declaration of 'getsockname' was here /usr/include/sys/socket.h:35: error: conflicting types for 'getsockname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:542:
error: previous declaration of 'getsockname' was here /usr/include/sys/socket.h:36: error: conflicting types for 'listen' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:546:
error: previous declaration of 'listen' was here /usr/include/sys/socket.h:36: error: conflicting types for 'listen' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:546:
error: previous declaration of 'listen' was here /usr/include/sys/socket.h:37: error: conflicting types for 'recv' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:547:
error: previous declaration of 'recv' was here /usr/include/sys/socket.h:37: error: conflicting types for 'recv' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:547:
error: previous declaration of 'recv' was here /usr/include/sys/socket.h:39: error: conflicting types for 'recvfrom' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:548:
error: previous declaration of 'recvfrom' was here /usr/include/sys/socket.h:39: error: conflicting types for 'recvfrom' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:548:
error: previous declaration of 'recvfrom' was here /usr/include/sys/socket.h:41: error: conflicting types for 'send' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:549:
error: previous declaration of 'send' was here /usr/include/sys/socket.h:41: error: conflicting types for 'send' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:549:
error: previous declaration of 'send' was here /usr/include/sys/socket.h:44: error: conflicting types for 'sendto' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:550:
error: previous declaration of 'sendto' was here /usr/include/sys/socket.h:44: error: conflicting types for 'sendto' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:550:
error: previous declaration of 'sendto' was here /usr/include/sys/socket.h:46: error: conflicting types for 'setsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:551:
error: previous declaration of 'setsockopt' was here /usr/include/sys/socket.h:46: error: conflicting types for 'setsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:551:
error: previous declaration of 'setsockopt' was here /usr/include/sys/socket.h:48: error: conflicting types for 'getsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:543:
error: previous declaration of 'getsockopt' was here /usr/include/sys/socket.h:48: error: conflicting types for 'getsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:543:
error: previous declaration of 'getsockopt' was here /usr/include/sys/socket.h:49: error: conflicting types for 'shutdown' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:552:
error: previous declaration of 'shutdown' was here /usr/include/sys/socket.h:49: error: conflicting types for 'shutdown' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:552:
error: previous declaration of 'shutdown' was here /usr/include/sys/socket.h:50: error: conflicting types for 'socket' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:553:
error: previous declaration of 'socket' was here /usr/include/sys/socket.h:50: error: conflicting types for 'socket' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:553:
error: previous declaration of 'socket' was here /usr/include/sys/socket.h:53: error: conflicting types for 'getservbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:557:
error: previous declaration of 'getservbyname' was here /usr/include/sys/socket.h:53: error: conflicting types for 'getservbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:557:
error: previous declaration of 'getservbyname' was here
In file included from compat/../git-compat-util.h:135,
from compat/cygwin.c:9:
/usr/include/sys/select.h:31: error: conflicting types for 'select' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:632:
error: previous declaration of 'select' was here /usr/include/sys/select.h:31: error: conflicting types for 'select' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:632:
error: previous declaration of 'select' was here
In file included from /usr/include/netinet/in.h:14,

                 from compat/../git-compat-util.h:137,
                 from compat/cygwin.c:9:

/usr/include/cygwin/in.h:30: error: parse error before numeric constant /usr/include/cygwin/in.h:35: error: parse error before numeric constant /usr/include/cygwin/in.h:37: error: parse error before numeric constant /usr/include/cygwin/in.h:76: error: parse error before numeric constant /usr/include/cygwin/in.h:115: error: redefinition of struct in_addr' /usr/include/cygwin/in.h:116: error: parse error before '.' token /usr/include/cygwin/in.h:184: error: redefinition of struct sockaddr_in' In file included from /usr/include/cygwin/in.h:250,

                 from /usr/include/netinet/in.h:14,
                 from compat/../git-compat-util.h:137,
                 from compat/cygwin.c:9:

/usr/include/asm/byteorder.h:26: error: conflicting types for 'ntohl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:629:
error: previous declaration of 'ntohl' was here /usr/include/asm/byteorder.h:26: error: conflicting types for 'ntohl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:629:
error: previous declaration of 'ntohl' was here /usr/include/asm/byteorder.h:27: error: conflicting types for 'ntohs' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:631:
error: previous declaration of 'ntohs' was here /usr/include/asm/byteorder.h:27: error: conflicting types for 'ntohs' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:631:
error: previous declaration of 'ntohs' was here /usr/include/asm/byteorder.h:28: error: conflicting types for 'htonl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:628:
error: previous declaration of 'htonl' was here /usr/include/asm/byteorder.h:28: error: conflicting types for 'htonl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:628:
error: previous declaration of 'htonl' was here /usr/include/asm/byteorder.h:29: error: conflicting types for 'htons' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:630:
error: previous declaration of 'htons' was here /usr/include/asm/byteorder.h:29: error: conflicting types for 'htons' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:630:
error: previous declaration of 'htons' was here
In file included from compat/../git-compat-util.h:139,
from compat/cygwin.c:9:
/usr/include/arpa/inet.h:22: error: conflicting types for 'inet_addr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:544:
error: previous declaration of 'inet_addr' was here /usr/include/arpa/inet.h:22: error: conflicting types for 'inet_addr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:544:
error: previous declaration of 'inet_addr' was here /usr/include/arpa/inet.h:28: error: conflicting types for 'inet_ntoa' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:545:
error: previous declaration of 'inet_ntoa' was here /usr/include/arpa/inet.h:28: error: conflicting types for 'inet_ntoa' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:545:
error: previous declaration of 'inet_ntoa' was here
In file included from compat/../git-compat-util.h:140,
from compat/cygwin.c:9:
/usr/include/netdb.h:79: error: redefinition of struct hostent' /usr/include/netdb.h:93: error: redefinition of struct netent' /usr/include/netdb.h:100: error: redefinition of struct servent' /usr/include/netdb.h:108: error: redefinition of struct protoent' /usr/include/netdb.h:139: error: conflicting types for 'WSAGetLastError' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:594:
error: previous declaration of 'WSAGetLastError' was here /usr/include/netdb.h:139: error: conflicting types for 'WSAGetLastError' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:594:
error: previous declaration of 'WSAGetLastError' was here /usr/include/netdb.h:192: error: conflicting types for 'gethostbyaddr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:554:
error: previous declaration of 'gethostbyaddr' was here /usr/include/netdb.h:192: error: conflicting types for 'gethostbyaddr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:554:
error: previous declaration of 'gethostbyaddr' was here /usr/include/netdb.h:193: error: conflicting types for 'gethostbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:555:
error: previous declaration of 'gethostbyname' was here /usr/include/netdb.h:193: error: conflicting types for 'gethostbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:555:
error: previous declaration of 'gethostbyname' was here /usr/include/netdb.h:199: error: conflicting types for 'getprotobyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:559:
error: previous declaration of 'getprotobyname' was here /usr/include/netdb.h:199: error: conflicting types for 'getprotobyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:559:
error: previous declaration of 'getprotobyname' was here /usr/include/netdb.h:200: error: conflicting types for 'getprotobynumber' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:558:
error: previous declaration of 'getprotobynumber' was here /usr/include/netdb.h:200: error: conflicting types for 'getprotobynumber' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:558:
error: previous declaration of 'getprotobynumber' was here /usr/include/netdb.h:203: error: conflicting types for 'getservbyport' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:556:
error: previous declaration of 'getservbyport' was here /usr/include/netdb.h:203: error: conflicting types for 'getservbyport' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:556:
error: previous declaration of 'getservbyport' was here Makefile:2384: recipe for target `compat/cygwin.o' failed
make: *** [compat/cygwin.o] Error 1

#1 lore raw
Quoted 7 lines

Stephen & Linda Smith
Sent: Saturday, January 05, 2013 21:05

Commit 9fca6cffc05321445b59c91e8f8d308f41588b53 message
states that the macro was being renamed for clarity. The patch also changes a define.

Was it the commit before 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiles or was it 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiled? I am doing a cygwin update presently to look at it.

Quoted 7 lines

This change causes the code to not compile on cygwin 1.7.14.

I narrowed the problem to this patch by bisecting commits
between v1.8.0 and
1.8.1

Quoted 6 lines

Here is the error sequence:

CC compat/cygwin.o
In file included from compat/../git-compat-util.h:90,
from compat/cygwin.c:9:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:103:2:

Quoted 11 lines

warning: #warning "fd_set and associated macros have been defined in sys/types.
This may cause runtime problems with W32 sockets" In file included from /usr/include/sys/socket.h:16,

                 from compat/../git-compat-util.h:131,
                 from compat/cygwin.c:9:

/usr/include/cygwin/socket.h:29: error: redefinition of struct sockaddr' /usr/include/cygwin/socket.h:41: error: redefinition of struct sockaddr_storage'
In file included from /usr/include/sys/socket.h:16,

Quoted 8 lines
                 from compat/../git-compat-util.h:131,
                 from compat/cygwin.c:9:

/usr/include/cygwin/socket.h:59: error: redefinition of `struct linger'
In file included from compat/../git-compat-util.h:131,
from compat/cygwin.c:9:
/usr/include/sys/socket.h:30: error: conflicting types for 'accept' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:536:

Quoted 3 lines

error: previous declaration of 'accept' was here /usr/include/sys/socket.h:30: error: conflicting types for 'accept' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:536:

Quoted 3 lines

error: previous declaration of 'accept' was here /usr/include/sys/socket.h:32: error: conflicting types for 'bind' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:537:

Quoted 3 lines

error: previous declaration of 'bind' was here /usr/include/sys/socket.h:32: error: conflicting types for 'bind' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:537:

Quoted 3 lines

error: previous declaration of 'bind' was here /usr/include/sys/socket.h:33: error: conflicting types for 'connect' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:539:

Quoted 3 lines

error: previous declaration of 'connect' was here /usr/include/sys/socket.h:33: error: conflicting types for 'connect' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:539:

Quoted 4 lines

error: previous declaration of 'connect' was here /usr/include/sys/socket.h:34: error: conflicting types for 'getpeername' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:541:

Quoted 4 lines

error: previous declaration of 'getpeername' was here /usr/include/sys/socket.h:34: error: conflicting types for 'getpeername' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:541:

Quoted 4 lines

error: previous declaration of 'getpeername' was here /usr/include/sys/socket.h:35: error: conflicting types for 'getsockname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:542:

Quoted 4 lines

error: previous declaration of 'getsockname' was here /usr/include/sys/socket.h:35: error: conflicting types for 'getsockname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:542:

Quoted 3 lines

error: previous declaration of 'getsockname' was here /usr/include/sys/socket.h:36: error: conflicting types for 'listen' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:546:

Quoted 3 lines

error: previous declaration of 'listen' was here /usr/include/sys/socket.h:36: error: conflicting types for 'listen' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:546:

Quoted 3 lines

error: previous declaration of 'listen' was here /usr/include/sys/socket.h:37: error: conflicting types for 'recv' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:547:

Quoted 3 lines

error: previous declaration of 'recv' was here /usr/include/sys/socket.h:37: error: conflicting types for 'recv' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:547:

Quoted 3 lines

error: previous declaration of 'recv' was here /usr/include/sys/socket.h:39: error: conflicting types for 'recvfrom' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:548:

Quoted 3 lines

error: previous declaration of 'recvfrom' was here /usr/include/sys/socket.h:39: error: conflicting types for 'recvfrom' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:548:

Quoted 3 lines

error: previous declaration of 'recvfrom' was here /usr/include/sys/socket.h:41: error: conflicting types for 'send' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:549:

Quoted 3 lines

error: previous declaration of 'send' was here /usr/include/sys/socket.h:41: error: conflicting types for 'send' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:549:

Quoted 3 lines

error: previous declaration of 'send' was here /usr/include/sys/socket.h:44: error: conflicting types for 'sendto' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:550:

Quoted 3 lines

error: previous declaration of 'sendto' was here /usr/include/sys/socket.h:44: error: conflicting types for 'sendto' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:550:

Quoted 4 lines

error: previous declaration of 'sendto' was here /usr/include/sys/socket.h:46: error: conflicting types for 'setsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:551:

Quoted 4 lines

error: previous declaration of 'setsockopt' was here /usr/include/sys/socket.h:46: error: conflicting types for 'setsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:551:

Quoted 4 lines

error: previous declaration of 'setsockopt' was here /usr/include/sys/socket.h:48: error: conflicting types for 'getsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:543:

Quoted 4 lines

error: previous declaration of 'getsockopt' was here /usr/include/sys/socket.h:48: error: conflicting types for 'getsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:543:

Quoted 3 lines

error: previous declaration of 'getsockopt' was here /usr/include/sys/socket.h:49: error: conflicting types for 'shutdown' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:552:

Quoted 3 lines

error: previous declaration of 'shutdown' was here /usr/include/sys/socket.h:49: error: conflicting types for 'shutdown' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:552:

Quoted 3 lines

error: previous declaration of 'shutdown' was here /usr/include/sys/socket.h:50: error: conflicting types for 'socket' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:553:

Quoted 3 lines

error: previous declaration of 'socket' was here /usr/include/sys/socket.h:50: error: conflicting types for 'socket' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:553:

Quoted 4 lines

error: previous declaration of 'socket' was here /usr/include/sys/socket.h:53: error: conflicting types for 'getservbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:557:

Quoted 4 lines

error: previous declaration of 'getservbyname' was here /usr/include/sys/socket.h:53: error: conflicting types for 'getservbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:557:

Quoted 5 lines

error: previous declaration of 'getservbyname' was here In file included from compat/../git-compat-util.h:135,
from compat/cygwin.c:9:
/usr/include/sys/select.h:31: error: conflicting types for 'select' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:632:

Quoted 3 lines

error: previous declaration of 'select' was here /usr/include/sys/select.h:31: error: conflicting types for 'select' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:632:

Quoted 17 lines

error: previous declaration of 'select' was here In file included from /usr/include/netinet/in.h:14,

                 from compat/../git-compat-util.h:137,
                 from compat/cygwin.c:9:

/usr/include/cygwin/in.h:30: error: parse error before numeric constant
/usr/include/cygwin/in.h:35: error: parse error before numeric constant
/usr/include/cygwin/in.h:37: error: parse error before numeric constant
/usr/include/cygwin/in.h:76: error: parse error before numeric constant
/usr/include/cygwin/in.h:115: error: redefinition of struct in_addr' /usr/include/cygwin/in.h:116: error: parse error before '.' token /usr/include/cygwin/in.h:184: error: redefinition of struct sockaddr_in'
In file included from /usr/include/cygwin/in.h:250,

Quoted 5 lines
                 from /usr/include/netinet/in.h:14,
                 from compat/../git-compat-util.h:137,
                 from compat/cygwin.c:9:

/usr/include/asm/byteorder.h:26: error: conflicting types for 'ntohl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:629:

Quoted 3 lines

error: previous declaration of 'ntohl' was here /usr/include/asm/byteorder.h:26: error: conflicting types for 'ntohl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:629:

Quoted 3 lines

error: previous declaration of 'ntohl' was here /usr/include/asm/byteorder.h:27: error: conflicting types for 'ntohs' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:631:

Quoted 3 lines

error: previous declaration of 'ntohs' was here /usr/include/asm/byteorder.h:27: error: conflicting types for 'ntohs' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:631:

Quoted 3 lines

error: previous declaration of 'ntohs' was here /usr/include/asm/byteorder.h:28: error: conflicting types for 'htonl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:628:

Quoted 3 lines

error: previous declaration of 'htonl' was here /usr/include/asm/byteorder.h:28: error: conflicting types for 'htonl' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:628:

Quoted 3 lines

error: previous declaration of 'htonl' was here /usr/include/asm/byteorder.h:29: error: conflicting types for 'htons' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:630:

Quoted 3 lines

error: previous declaration of 'htons' was here /usr/include/asm/byteorder.h:29: error: conflicting types for 'htons' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:630:

Quoted 5 lines

error: previous declaration of 'htons' was here In file included from compat/../git-compat-util.h:139,
from compat/cygwin.c:9:
/usr/include/arpa/inet.h:22: error: conflicting types for 'inet_addr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:544:

Quoted 3 lines

error: previous declaration of 'inet_addr' was here /usr/include/arpa/inet.h:22: error: conflicting types for 'inet_addr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:544:

Quoted 3 lines

error: previous declaration of 'inet_addr' was here /usr/include/arpa/inet.h:28: error: conflicting types for 'inet_ntoa' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:545:

Quoted 3 lines

error: previous declaration of 'inet_ntoa' was here /usr/include/arpa/inet.h:28: error: conflicting types for 'inet_ntoa' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:545:

Quoted 10 lines

error: previous declaration of 'inet_ntoa' was here In file included from compat/../git-compat-util.h:140,
from compat/cygwin.c:9:
/usr/include/netdb.h:79: error: redefinition of struct hostent' /usr/include/netdb.h:93: error: redefinition of struct netent' /usr/include/netdb.h:100: error: redefinition of struct servent' /usr/include/netdb.h:108: error: redefinition of struct protoent' /usr/include/netdb.h:139: error: conflicting types for 'WSAGetLastError' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:594:

Quoted 4 lines

error: previous declaration of 'WSAGetLastError' was here /usr/include/netdb.h:139: error: conflicting types for 'WSAGetLastError' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:594:

Quoted 3 lines

error: previous declaration of 'WSAGetLastError' was here /usr/include/netdb.h:192: error: conflicting types for 'gethostbyaddr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:554:

Quoted 3 lines

error: previous declaration of 'gethostbyaddr' was here /usr/include/netdb.h:192: error: conflicting types for 'gethostbyaddr' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:554:

Quoted 3 lines

error: previous declaration of 'gethostbyaddr' was here /usr/include/netdb.h:193: error: conflicting types for 'gethostbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:555:

Quoted 3 lines

error: previous declaration of 'gethostbyname' was here /usr/include/netdb.h:193: error: conflicting types for 'gethostbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:555:

Quoted 4 lines

error: previous declaration of 'gethostbyname' was here /usr/include/netdb.h:199: error: conflicting types for 'getprotobyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:559:

Quoted 4 lines

error: previous declaration of 'getprotobyname' was here /usr/include/netdb.h:199: error: conflicting types for 'getprotobyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:559:

Quoted 4 lines

error: previous declaration of 'getprotobyname' was here /usr/include/netdb.h:200: error: conflicting types for 'getprotobynumber' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:558:

Quoted 4 lines

error: previous declaration of 'getprotobynumber' was here /usr/include/netdb.h:200: error: conflicting types for 'getprotobynumber' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:558:

Quoted 3 lines

error: previous declaration of 'getprotobynumber' was here /usr/include/netdb.h:203: error: conflicting types for 'getservbyport' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:556:

Quoted 3 lines

error: previous declaration of 'getservbyport' was here /usr/include/netdb.h:203: error: conflicting types for 'getservbyport' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:556:

Quoted 8 lines

error: previous declaration of 'getservbyport' was here Makefile:2384: recipe for target `compat/cygwin.o' failed
make: *** [compat/cygwin.o] Error 1
--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -

- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -

- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

#2 lore raw
Quoted 10 lines

-----Original Message-----
From: Jason Pyeron
Sent: Saturday, January 05, 2013 22:38

Quoted 4 lines

Stephen & Linda Smith
Sent: Saturday, January 05, 2013 21:05

Commit 9fca6cffc05321445b59c91e8f8d308f41588b53 message

Quoted 17 lines

states that

Quoted 2 lines

the macro was being renamed for clarity. The patch also changes a define.

Was it the commit before 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiles or was it 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiled? I am doing a cygwin update presently to look at it.

Quoted 8 lines

This change causes the code to not compile on cygwin 1.7.14.

I narrowed the problem to this patch by bisecting commits between
v1.8.0 and
1.8.1

Here is the error sequence:

Cannot reproduce on head and current cygwin, more details please.

Quoted 25 lines
Quoted 5 lines

CC compat/cygwin.o
In file included from compat/../git-compat-util.h:90,
from compat/cygwin.c:9:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:103:2:

Quoted 11 lines

warning: #warning "fd_set and associated macros have been defined in sys/types.
This may cause runtime problems with W32 sockets" In file included from /usr/include/sys/socket.h:16,

                 from compat/../git-compat-util.h:131,
                 from compat/cygwin.c:9:

/usr/include/cygwin/socket.h:29: error: redefinition of `struct sockaddr'
/usr/include/cygwin/socket.h:41: error: redefinition of `struct sockaddr_storage'
In file included from /usr/include/sys/socket.h:16,

Quoted 8 lines
                 from compat/../git-compat-util.h:131,
                 from compat/cygwin.c:9:

/usr/include/cygwin/socket.h:59: error: redefinition of `struct linger'
In file included from compat/../git-compat-util.h:131,
from compat/cygwin.c:9:
/usr/include/sys/socket.h:30: error: conflicting types for 'accept' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

Quoted 5 lines

insock2.h:536:

Quoted 3 lines

error: previous declaration of 'accept' was here /usr/include/sys/socket.h:30: error: conflicting types for 'accept' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:536:

jpyeron@porsche /projects/git/git

$ make && uname -a && git status && git log --oneline | head -n1
    GEN perl/PM.stamp
    SUBDIR gitweb
    SUBDIR ../
make[2]: `GIT-VERSION-FILE' is up to date.
    GEN git-instaweb
    BUILTIN all
    SUBDIR git-gui
    SUBDIR gitk-git
make[1]: Nothing to be done for `all'.
    SUBDIR perl
    SUBDIR git_remote_helpers
    SUBDIR templates
CYGWIN_NT-5.2-WOW64 porsche 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin
# On branch master
nothing to commit (working directory clean)
3e293fb Update draft release notes to 1.8.2
Quoted 287 lines
Quoted 3 lines

error: previous declaration of 'accept' was here /usr/include/sys/socket.h:32: error: conflicting types for 'bind' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:537:

Quoted 3 lines

error: previous declaration of 'bind' was here /usr/include/sys/socket.h:32: error: conflicting types for 'bind' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:537:

Quoted 3 lines

error: previous declaration of 'bind' was here /usr/include/sys/socket.h:33: error: conflicting types for 'connect' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:539:

Quoted 3 lines

error: previous declaration of 'connect' was here /usr/include/sys/socket.h:33: error: conflicting types for 'connect' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:539:

Quoted 4 lines

error: previous declaration of 'connect' was here /usr/include/sys/socket.h:34: error: conflicting types for 'getpeername' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:541:

Quoted 4 lines

error: previous declaration of 'getpeername' was here /usr/include/sys/socket.h:34: error: conflicting types for 'getpeername' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:541:

Quoted 4 lines

error: previous declaration of 'getpeername' was here /usr/include/sys/socket.h:35: error: conflicting types for 'getsockname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:542:

Quoted 4 lines

error: previous declaration of 'getsockname' was here /usr/include/sys/socket.h:35: error: conflicting types for 'getsockname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:542:

Quoted 3 lines

error: previous declaration of 'getsockname' was here /usr/include/sys/socket.h:36: error: conflicting types for 'listen' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:546:

Quoted 3 lines

error: previous declaration of 'listen' was here /usr/include/sys/socket.h:36: error: conflicting types for 'listen' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:546:

Quoted 3 lines

error: previous declaration of 'listen' was here /usr/include/sys/socket.h:37: error: conflicting types for 'recv' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:547:

Quoted 3 lines

error: previous declaration of 'recv' was here /usr/include/sys/socket.h:37: error: conflicting types for 'recv' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:547:

Quoted 2 lines

error: previous declaration of 'recv' was here /usr/include/sys/socket.h:39: error: conflicting types for

'recvfrom'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:548:

Quoted 2 lines

error: previous declaration of 'recvfrom' was here /usr/include/sys/socket.h:39: error: conflicting types for

'recvfrom'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:548:

Quoted 3 lines

error: previous declaration of 'recvfrom' was here /usr/include/sys/socket.h:41: error: conflicting types for 'send' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:549:

Quoted 3 lines

error: previous declaration of 'send' was here /usr/include/sys/socket.h:41: error: conflicting types for 'send' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:549:

Quoted 3 lines

error: previous declaration of 'send' was here /usr/include/sys/socket.h:44: error: conflicting types for 'sendto' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:550:

Quoted 3 lines

error: previous declaration of 'sendto' was here /usr/include/sys/socket.h:44: error: conflicting types for 'sendto' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:550:

Quoted 4 lines

error: previous declaration of 'sendto' was here /usr/include/sys/socket.h:46: error: conflicting types for 'setsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:551:

Quoted 4 lines

error: previous declaration of 'setsockopt' was here /usr/include/sys/socket.h:46: error: conflicting types for 'setsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:551:

Quoted 4 lines

error: previous declaration of 'setsockopt' was here /usr/include/sys/socket.h:48: error: conflicting types for 'getsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:543:

Quoted 4 lines

error: previous declaration of 'getsockopt' was here /usr/include/sys/socket.h:48: error: conflicting types for 'getsockopt' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:543:

Quoted 2 lines

error: previous declaration of 'getsockopt' was here /usr/include/sys/socket.h:49: error: conflicting types for

'shutdown'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:552:

Quoted 2 lines

error: previous declaration of 'shutdown' was here /usr/include/sys/socket.h:49: error: conflicting types for

'shutdown'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:552:

Quoted 3 lines

error: previous declaration of 'shutdown' was here /usr/include/sys/socket.h:50: error: conflicting types for 'socket' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:553:

Quoted 3 lines

error: previous declaration of 'socket' was here /usr/include/sys/socket.h:50: error: conflicting types for 'socket' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:553:

Quoted 4 lines

error: previous declaration of 'socket' was here /usr/include/sys/socket.h:53: error: conflicting types for 'getservbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:557:

Quoted 4 lines

error: previous declaration of 'getservbyname' was here /usr/include/sys/socket.h:53: error: conflicting types for 'getservbyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:557:

Quoted 5 lines

error: previous declaration of 'getservbyname' was here In file included from compat/../git-compat-util.h:135,
from compat/cygwin.c:9:
/usr/include/sys/select.h:31: error: conflicting types for 'select' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:632:

Quoted 3 lines

error: previous declaration of 'select' was here /usr/include/sys/select.h:31: error: conflicting types for 'select' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:632:

Quoted 1 line

error: previous declaration of 'select' was here In file

included from

Quoted 12 lines

/usr/include/netinet/in.h:14,

                 from compat/../git-compat-util.h:137,
                 from compat/cygwin.c:9:

/usr/include/cygwin/in.h:30: error: parse error before numeric constant
/usr/include/cygwin/in.h:35: error: parse error before numeric constant
/usr/include/cygwin/in.h:37: error: parse error before numeric constant
/usr/include/cygwin/in.h:76: error: parse error before numeric constant
/usr/include/cygwin/in.h:115: error: redefinition of

`struct in_addr'

Quoted 8 lines

/usr/include/cygwin/in.h:116: error: parse error before '.' token /usr/include/cygwin/in.h:184: error: redefinition of `struct sockaddr_in'
In file included from /usr/include/cygwin/in.h:250,

                 from /usr/include/netinet/in.h:14,
                 from compat/../git-compat-util.h:137,
                 from compat/cygwin.c:9:

/usr/include/asm/byteorder.h:26: error: conflicting types

for 'ntohl'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:629:

Quoted 2 lines

error: previous declaration of 'ntohl' was here /usr/include/asm/byteorder.h:26: error: conflicting types

for 'ntohl'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:629:

Quoted 2 lines

error: previous declaration of 'ntohl' was here /usr/include/asm/byteorder.h:27: error: conflicting types

for 'ntohs'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:631:

Quoted 2 lines

error: previous declaration of 'ntohs' was here /usr/include/asm/byteorder.h:27: error: conflicting types

for 'ntohs'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:631:

Quoted 2 lines

error: previous declaration of 'ntohs' was here /usr/include/asm/byteorder.h:28: error: conflicting types

for 'htonl'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:628:

Quoted 2 lines

error: previous declaration of 'htonl' was here /usr/include/asm/byteorder.h:28: error: conflicting types

for 'htonl'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:628:

Quoted 2 lines

error: previous declaration of 'htonl' was here /usr/include/asm/byteorder.h:29: error: conflicting types

for 'htons'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:630:

Quoted 2 lines

error: previous declaration of 'htons' was here /usr/include/asm/byteorder.h:29: error: conflicting types

for 'htons'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:630:

Quoted 1 line

error: previous declaration of 'htons' was here In file

included from

Quoted 3 lines

compat/../git-compat-util.h:139,
from compat/cygwin.c:9:
/usr/include/arpa/inet.h:22: error: conflicting types for

'inet_addr'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:544:

Quoted 2 lines

error: previous declaration of 'inet_addr' was here /usr/include/arpa/inet.h:22: error: conflicting types for

'inet_addr'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:544:

Quoted 2 lines

error: previous declaration of 'inet_addr' was here /usr/include/arpa/inet.h:28: error: conflicting types for

'inet_ntoa'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:545:

Quoted 2 lines

error: previous declaration of 'inet_ntoa' was here /usr/include/arpa/inet.h:28: error: conflicting types for

'inet_ntoa'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:545:

Quoted 1 line

error: previous declaration of 'inet_ntoa' was here In file

included

Quoted 9 lines

from compat/../git-compat-util.h:140,
from compat/cygwin.c:9:
/usr/include/netdb.h:79: error: redefinition of struct hostent' /usr/include/netdb.h:93: error: redefinition of struct netent' /usr/include/netdb.h:100: error: redefinition of struct servent' /usr/include/netdb.h:108: error: redefinition of struct protoent' /usr/include/netdb.h:139: error: conflicting types for 'WSAGetLastError' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:594:

Quoted 4 lines

error: previous declaration of 'WSAGetLastError' was here /usr/include/netdb.h:139: error: conflicting types for 'WSAGetLastError' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:594:

Quoted 2 lines

error: previous declaration of 'WSAGetLastError' was here /usr/include/netdb.h:192: error: conflicting types for

'gethostbyaddr'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:554:

Quoted 2 lines

error: previous declaration of 'gethostbyaddr' was here /usr/include/netdb.h:192: error: conflicting types for

'gethostbyaddr'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:554:

Quoted 2 lines

error: previous declaration of 'gethostbyaddr' was here /usr/include/netdb.h:193: error: conflicting types for

'gethostbyname'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:555:

Quoted 2 lines

error: previous declaration of 'gethostbyname' was here /usr/include/netdb.h:193: error: conflicting types for

'gethostbyname'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:555:

Quoted 4 lines

error: previous declaration of 'gethostbyname' was here /usr/include/netdb.h:199: error: conflicting types for 'getprotobyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:559:

Quoted 4 lines

error: previous declaration of 'getprotobyname' was here /usr/include/netdb.h:199: error: conflicting types for 'getprotobyname' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:559:

Quoted 4 lines

error: previous declaration of 'getprotobyname' was here /usr/include/netdb.h:200: error: conflicting types for 'getprotobynumber' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:558:

Quoted 4 lines

error: previous declaration of 'getprotobynumber' was here /usr/include/netdb.h:200: error: conflicting types for 'getprotobynumber' /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:558:

Quoted 2 lines

error: previous declaration of 'getprotobynumber' was here /usr/include/netdb.h:203: error: conflicting types for

'getservbyport'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:556:

Quoted 2 lines

error: previous declaration of 'getservbyport' was here /usr/include/netdb.h:203: error: conflicting types for

'getservbyport'

Quoted 1 line

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/w

insock2.h:556:

Quoted 10 lines
Quoted 5 lines

error: previous declaration of 'getservbyport' was here Makefile:2384: recipe for target `compat/cygwin.o' failed
make: *** [compat/cygwin.o] Error 1
--
To unsubscribe from this list: send the line "unsubscribe

git" in the

Quoted 1 line

body of a message to [email protected] More

majordomo info at

Quoted 2 lines

http://vger.kernel.org/majordomo-info.html

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -

- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -

- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

#3 lore raw
In reply to Stephen & Linda Smith
Quoted 4 lines

Was it the commit before 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiles or was it 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiled? I am doing a cygwin update presently to look at it.

Since the email earlier today, I had blown away the directory. I just now
did the following

git clone https://github.com/git/git.git git-src && cd git-src && make all
... The make errored out as before

git co 9fca6c && make all
... The make errored out as before

git co 9fca6c^ && make all
... and this compiles to completion

CYGWIN_NT-5.1 WINXPMACHINE 1.7.14(0.260/5/3) 2012-04-24 17:22 i686 Cygwin

What else can I do to test this out (I will get a current cygwin tomorrow to use in a test).

#4 lore raw
Quoted 10 lines

-----Original Message-----
From: Stephen & Linda Smith
Sent: Sunday, January 06, 2013 1:21

Quoted 3 lines

Was it the commit before 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiles or was it 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiled? I

am doing a

Quoted 1 line

cygwin update presently to look at it.

Quoted 8 lines

Since the email earlier today, I had blown away the
directory. I just now
did the following

git clone https://github.com/git/git.git git-src && cd git-src && make all
... The make errored out as before

No error for me.

Quoted 2 lines

git co 9fca6c && make all
... The make errored out as before

No error for me.

Quoted 6 lines

git co 9fca6c^ && make all
... and this compiles to completion

CYGWIN_NT-5.1 WINXPMACHINE 1.7.14(0.260/5/3) 2012-04-24 17:22 i686 Cygwin

This is old, do you have the luxury of updating it?

Quoted 3 lines

What else can I do to test this out (I will get a current cygwin tomorrow to use in a test).

I would also check to see if your devel packages are up to date too.

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -

- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -

- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

#5 lore raw
Quoted 33 lines · Jason Pyeron
Quoted 10 lines

-----Original Message-----
From: Stephen & Linda Smith
Sent: Sunday, January 06, 2013 1:21

Quoted 3 lines

Was it the commit before 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiles or was it 9fca6cffc05321445b59c91e8f8d308f41588b53 that compiled? I

am doing a

Quoted 1 line

cygwin update presently to look at it.

Quoted 8 lines

Since the email earlier today, I had blown away the
directory. I just now
did the following

git clone https://github.com/git/git.git git-src && cd git-src && make all
... The make errored out as before

No error for me.

Quoted 2 lines

git co 9fca6c && make all
... The make errored out as before

No error for me.

Quoted 6 lines

git co 9fca6c^ && make all
... and this compiles to completion

CYGWIN_NT-5.1 WINXPMACHINE 1.7.14(0.260/5/3) 2012-04-24 17:22 i686 Cygwin

Quoted 7 lines

This is old, do you have the luxury of updating it?

Quoted 3 lines

What else can I do to test this out (I will get a current cygwin tomorrow to use in a test).

I would also check to see if your devel packages are up to date too.

You can either upgrade to cygwin 1.17 or higher.
Or, if that is really not possible (because you are sitting on a production machine, where no changes are allowed),

You can enable this in Makefile:
CYGWIN_V15_WIN32API = YesPlease

HTH
/Torsten

#6 lore raw

Hi,

Quoted 4 lines · Torsten Bögershausen
Quoted 4 lines
Quoted 2 lines · Stephen & Linda Smith

git co 9fca6c && make all
... The make errored out as before

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

git co 9fca6c^ && make all
... and this compiles to completion

CYGWIN_NT-5.1 WINXPMACHINE 1.7.14(0.260/5/3) 2012-04-24 17:22 i686 Cygwin

[...]

Quoted 6 lines

You can either upgrade to cygwin 1.17 or higher.
Or, if that is really not possible (because you are sitting on a production machine, where no changes are allowed),

You can enable this in Makefile:
CYGWIN_V15_WIN32API = YesPlease

What I don't understand is why commit 9fca6c would have had any effect at all. Since 1.7.14 doesn't match /^1\.[1-6]\./, wouldn't the setting to avoid including <sys/stat.h> and <sys/errno.h> be unset both before and after that commit?

Stephen, what is the content of your config.mak?

Curious,
Jonathan

#7 lore raw
Quoted 26 lines · Jonathan Nieder

Hi,

Quoted 4 lines · Torsten Bögershausen
Quoted 4 lines
Quoted 2 lines · Stephen & Linda Smith

git co 9fca6c && make all
... The make errored out as before

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

git co 9fca6c^ && make all
... and this compiles to completion

CYGWIN_NT-5.1 WINXPMACHINE 1.7.14(0.260/5/3) 2012-04-24 17:22 i686 Cygwin

[...]

Quoted 6 lines

You can either upgrade to cygwin 1.17 or higher.
Or, if that is really not possible (because you are sitting on a production machine, where no changes are allowed),

You can enable this in Makefile:
CYGWIN_V15_WIN32API = YesPlease

What I don't understand is why commit 9fca6c would have had any effect at all. Since 1.7.14 doesn't match /^1\.[1-6]\./, wouldn't the setting to avoid including <sys/stat.h> and <sys/errno.h> be unset both before and after that commit?

Quoted 4 lines

Stephen, what is the content of your config.mak?

Curious,
Jonathan

The short version:
Cygwin versions 1.7.1 up to 1.7.16 use the same header files as cygwin 1.5

The change in cygwin came in in 1.7.17,
(and from that version of cygwin we need commit 9fca6c to compile git)

Currently we can not compile git under cygwin 1.7.1 .. 1.7.16 :-( As "everybody" running cygwin 1.7 seems to update to the latest,

I don't know if we want to improve the Makefile to enable CYGWIN_V15_WIN32API = YesPlease
for cygwin versions 1.7.1 .. 1.7.16 (which are outdated)

/Torsten

http://git.661346.n2.nabble.com/PATCH-Rename-V15-MINGW-HEADERS-into-CYGWIN-OLD-WINSOCK-HEADERS-td7571449.html

#8 lore raw
Quoted 2 lines · Torsten Bögershausen

The short version:
Cygwin versions 1.7.1 up to 1.7.16 use the same header files as cygwin 1.5

[...]

Quoted 3 lines

I don't know if we want to improve the Makefile to enable CYGWIN_V15_WIN32API = YesPlease
for cygwin versions 1.7.1 .. 1.7.16 (which are outdated)

Confusing. Sounds like the condition in 380a4d92 (Update cygwin.c for new mingw-64 win32 api headers, 2012-11-11) was too strict and the Makefile should say something like

	# Cygwin versions up to 1.7.16 used the same headers
	# as Cygwin 1.5.
	ifeq ($(shell expr "$(uname_R)" : '1\.7\.[0-9]$$'),5)
		CYGWIN_V15_WIN32API = YesPlease
	endif
	ifeq ($(shell expr "$(uname_R)" : '1\.7\.1[0-6]$$'),6)
		CYGWIN_V15_WIN32API = YesPlease
	endif

	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
		CYGWIN_V15_WIN32API = YesPlease
		...
	endif

Is that right?

#9 lore raw
Quoted 9 lines · Jonathan Nieder
Quoted 2 lines · Torsten Bögershausen

The short version:
Cygwin versions 1.7.1 up to 1.7.16 use the same header files as cygwin 1.5

[...]

Quoted 4 lines

I don't know if we want to improve the Makefile to enable CYGWIN_V15_WIN32API = YesPlease
for cygwin versions 1.7.1 .. 1.7.16 (which are outdated)

You are conflating the cygwin dll version with the win32 api version. These are independent packages (just as the kernel and glibc packages are independent on linux) and do not share a version number. However, the newer win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no updates are being made for the legacy version(s).

Cygwin does not version the win32api in any useful way: the package names changed completely, for instance, and there is no macro defined from the header files to indicate a version number. Also, there is no supported way to now install the older version: the only supported configuration is with the *current* win32api: multiple packages depend by name on the current win32api package, so the installer will insist upon its installation.

So the solution is to update the cygwin installation. Really. If you don't believe me, try asking on the cygwin mailing list. They only support the current releases, not obsolete packages, and the older win32api is explicitly obsolete.

Mark

#10 lore raw
Quoted 5 lines · Mark Levedahl

However, the newer
win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no updates are being made for the legacy version(s).

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date win32api and print a helpful message, I guess cygcheck would be the command to use.)

#11 lore raw
Quoted 10 lines · Jonathan Nieder
Quoted 8 lines · Mark Levedahl

However, the newer

win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the
older api as no updates are being made for the legacy version(s).

Quoted 4 lines

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date win32api and print a helpful message, I guess cygcheck would be the command to use.)

Thank you for the information. I will update my cygwin installation.

#12 lore raw
In reply to Jonathan Nieder
Quoted 8 lines · Jonathan Nieder
Quoted 5 lines · Mark Levedahl

However, the newer
win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no updates are being made for the legacy version(s).

Quoted 4 lines

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date win32api and print a helpful message, I guess cygcheck would be the command to use.)

Hmph, so we might see somebody who cares about Cygwin to come up with a solution based on cygcheck (not on uname) to update this part, perhaps on top of Peff's "split default settings based on uname into separate file" patch?

If I understood what Mark and Torsten wrote correctly, you will have the new win32api if you install 1.7.17 (or newer) from scratch, but if you are on older 1.7.x then you can update the win32api part as a package update (as opposed to the whole-system upgrade). A test based on "uname -r" cannot notice that an older 1.7.x (say 1.7.14) installation has a newer win32api because the user updated it from the package (hence the user should not define CYGWIN_V15_WIN32API).

Am I on the same page as you guys, or am I still behind?

In the meantime, perhaps we would need something like this?

Makefile +3 -0
index 8e225ca..b45b06d 100644
@@ -281,6 +281,9 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
+# Define CYGWIN_V15_WIN32API if your Cygwin uses win32api dll older than
+# 1.7.x (this typically is true on Cygwin older than 1.7.17)
+#
 # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
 # user.
 #
#13 lore raw
Quoted 38 lines · Junio C Hamano
Quoted 8 lines · Jonathan Nieder
Quoted 5 lines · Mark Levedahl

However, the newer
win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no updates are being made for the legacy version(s).

Quoted 4 lines

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date win32api and print a helpful message, I guess cygcheck would be the command to use.)

Hmph, so we might see somebody who cares about Cygwin to come up with a solution based on cygcheck (not on uname) to update this part, perhaps on top of Peff's "split default settings based on uname into separate file" patch?

If I understood what Mark and Torsten wrote correctly, you will have the new win32api if you install 1.7.17 (or newer) from scratch, but if you are on older 1.7.x then you can update the win32api part as a package update (as opposed to the whole-system upgrade). A test based on "uname -r" cannot notice that an older 1.7.x (say 1.7.14) installation has a newer win32api because the user updated it from the package (hence the user should not define CYGWIN_V15_WIN32API).

Am I on the same page as you guys, or am I still behind?

In the meantime, perhaps we would need something like this?

Makefile +0 -0
index 8e225ca..b45b06d 100644

Makefile all:: · line 289

Quoted 9 lines
Makefile +3 -0
@@ -281,6 +281,9 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
+# Define CYGWIN_V15_WIN32API if your Cygwin uses win32api dll older than
+# 1.7.x (this typically is true on Cygwin older than 1.7.17)
+#
 # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
 # user.
 #

Hm, I haven't understood the connection between the dll (cygwin1.dll ?) which is used in runtime, and the header files which are used when compiling.

Are they updated at the same time when updating from 1.7.16 to 1.7.17 ?

Until I updated my cygwin 1.7 (following Marks recommendation) this did the trick for me:

+ifeq ($(shell grep mingw /usr/include/w32api/winsock2.h />/dev/null 2>/dev/null && echo y),y)
+ CYGWIN_V15_WIN32API=YesPlease
+endif

As an alternative, would this be easier to read?

Quoted 1 line

+# Define CYGWIN_V15_WIN32API for Cygwin versions up to 1.7.16

#14 lore raw
Quoted 4 lines · Torsten Bögershausen

Hm, I haven't understood the connection between the dll (cygwin1.dll ?) which is used in runtime, and the header files which are used when compiling. Are they updated at the same time when updating from 1.7.16 to 1.7.17 ? Until I updated my cygwin 1.7 (following Marks recommendation) this did the trick for me: +ifeq ($(shell grep mingw /usr/include/w32api/winsock2.h />/dev/null 2>/dev/null && echo y),y) + CYGWIN_V15_WIN32API=YesPlease +endif As an alternative, would this be easier to read?

Quoted 1 line

+# Define CYGWIN_V15_WIN32API for Cygwin versions up to 1.7.16

The cygwin distribution has a very large number of packages, each with its own unique version number and update rhythm, just as in any linux distro. There is no "cygwin version", just a version for each individual package. So, "Cygwin version 1.7.16" is really nonsensical: there is only cygwin.dll version 1.7.16. What folks are noticing is a coincidence in the time when the cygwin dll package updated and when the old w32api was obsoleted. uname -r reports the cygwin dll version, not the version of any other package. Note that the cygwin api is "stable", meaning a package compiled against the 1.7.1 dll will still run against the current one: updating the cygwin dll does not require other packages to update.

The only hard linkage here is that the Cygwin developers are maintaining a legacy cygwin version (v1.5.x) as the newer dll series (v.1.7.x) dropped support for all Windows versions predating (I think) WinXP. So, someone on an old Windows version must use the legacy cygwin version which has not been updated since the first v1.7 dll was released, nor are there any plans by the developers to ever update the v1.5 packages. Cygwin 1.5 lives in a separate distribution repository, with packages frozen in time as of the last updates prior to going to v1.7 (packages compiled against v1.7 will not run on v.1.5).

So, encountering a v1.5.x dll is a guarantee of using the older w32api shared with the mingw project, rather than the current one now maintained by the mingw64 project. However, a cygwin with any v1.7.x dll could in theory have either w32api installed, or in theory yet another newer one we don't know about yet. Unless and until the w32api establishes a version number (independent of the Windows API version), we have nothing reliable to use.

Therefore, if using the v1.7 series, *update*

Mark

#15 lore raw
In reply to Junio C Hamano
Quoted 37 lines · Junio C Hamano
Quoted 11 lines · Jonathan Nieder
Quoted 5 lines · Mark Levedahl

However, the newer
win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no updates are being made for the legacy version(s).

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date win32api and print a helpful message, I guess cygcheck would be the command to use.)

Hmph, so we might see somebody who cares about Cygwin to come up with a solution based on cygcheck (not on uname) to update this part, perhaps on top of Peff's "split default settings based on uname into separate file" patch?

If I understood what Mark and Torsten wrote correctly, you will have the new win32api if you install 1.7.17 (or newer) from scratch, but if you are on older 1.7.x then you can update the win32api part as a package update (as opposed to the whole-system upgrade). A test based on "uname -r" cannot notice that an older 1.7.x (say 1.7.14) installation has a newer win32api because the user updated it from the package (hence the user should not define CYGWIN_V15_WIN32API).

Am I on the same page as you guys, or am I still behind?

In the meantime, perhaps we would need something like this?

Makefile +0 -0
index 8e225ca..b45b06d 100644

Makefile all:: · line 289

Quoted 9 lines
Makefile +3 -0
@@ -281,6 +281,9 @@ all::
  #
  # Define NO_REGEX if you have no or inferior regex support in your C library.
  #
+# Define CYGWIN_V15_WIN32API if your Cygwin uses win32api dll older than
+# 1.7.x (this typically is true on Cygwin older than 1.7.17)
+#
  # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
  # user.
  #

Looking at a current setup.ini, the obsolete win32 api is a single package "w32api" with last version 3.17-2, and is now replaced by the new win32 api is in two packages, "w32api-headers" + "w32api-runtime", both at version 3.0b_svn5496-1. If setup.exe updated an older installation of w32api, the old package is not deleted, but replaced by a special "empty" package with (as of today) version 9999-1. Note that all of this could change at any time. Also, note that the new w32api packages have version numbers that are lower than the older obsoleted version.

Running "cygcheck -c w32api w32api-headers w32api-runtime" on one machine gives

Cygwin Package Information

Package              Version            Status
w32api               9999-1             OK
w32api-headers       3.0b_svn5496-1     OK
w32api-runtime       3.0b_svn5496-1     OK

So now, what do folks propose checking for?
a) w32api is installed? Nope - the package is not "removed", it was updated to a special empty version to delete its former contents, but a new fresh installation won't have this.
b) w32api-headers is installed? Nope - what happens on the next repackaging?
c) w32api version is 9999-1? Maybe, but that number could change.
etc.

There is no documented, reliable, future-proof, method of determining the installed w32api version on Cygwin. There are many things that can be done that will work frequently, except when they won't. I really think the only sane thing is to follow the guidance of the Cygwin developers: the only supported configuration is that which the current setup.exe produces, and in the case of problems, if the installation is not up to date then updating is the first required action.

So, in the makefile, you might add:

+# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not +# using the current w32api packages. But, the recommended approach is to +# update your installation if compilation errors occur.
+#

Mark

#16 lore raw

Thanks; so perhaps you can give me an OK to forge your S-o-b to the following?

-- >8 --
From: Mark Levedahl <[email protected]>
Date: Sun, 6 Jan 2013 11:56:33 -0800
Subject: [PATCH] Makefile: add comment on CYGWIN_V15_WIN32API

There is no documented, reliable, and future-proof method to determine the installed w32api version on Cygwin. There are many things that can be done that will work frequently, except when they won't.

The only sane thing is to follow the guidance of the Cygwin
developers: the only supported configuration is that which the current setup.exe produces, and in the case of problems, if the installation is not up to date then updating is the first required action.

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +4 -0
index 4d47af5..52e298a 100644
@@ -273,6 +273,10 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
+# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
+# using the current w32api packages. The recommended approach, however,
+# is to update your installation if compilation errors occur.
+#
 # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
 # user.
 #
Signature · 1 line
1.8.1.302.g0f4eaa7
#17 lore raw
Quoted 29 lines · Junio C Hamano

Thanks; so perhaps you can give me an OK to forge your S-o-b to the following?

-- >8 --
From: Mark Levedahl <[email protected]>
Date: Sun, 6 Jan 2013 11:56:33 -0800
Subject: [PATCH] Makefile: add comment on CYGWIN_V15_WIN32API

There is no documented, reliable, and future-proof method to determine the installed w32api version on Cygwin. There are many things that can be done that will work frequently, except when they won't.

The only sane thing is to follow the guidance of the Cygwin
developers: the only supported configuration is that which the current setup.exe produces, and in the case of problems, if the installation is not up to date then updating is the first required action.

---
  Makefile | 4 ++++
  1 file changed, 4 insertions(+)
Makefile +0 -0
index 4d47af5..52e298a 100644

Makefile all:: · line 282

Quoted 10 lines
Makefile +4 -0
@@ -273,6 +273,10 @@ all::
  #
  # Define NO_REGEX if you have no or inferior regex support in your C library.
  #
+# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
+# using the current w32api packages. The recommended approach, however,
+# is to update your installation if compilation errors occur.
+#
  # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
  # user.
  #

Absolutely, that is ok by me.

Mark

#18 lore raw
In reply to Junio C Hamano
Quoted 6 lines

-----Original Message-----
From: Junio C Hamano
Sent: Sunday, January 06, 2013 16:36

Thanks; so perhaps you can give me an OK to forge your S-o-b to the following?

I am personally fine with it, because cygwin is used by developers not production systems and I expect my developers to upgrade their environment for security fixes, etc.
If I ever had a situation where I am using git, in production, on cygwin, where I could not upgrade I would effort to make a compile test based patch to the make file to accommodate the issue.

Quoted 38 lines

-- >8 --
From: Mark Levedahl <[email protected]>
Date: Sun, 6 Jan 2013 11:56:33 -0800
Subject: [PATCH] Makefile: add comment on CYGWIN_V15_WIN32API

There is no documented, reliable, and future-proof method to determine the installed w32api version on Cygwin. There are many things that can be done that will work frequently, except when they won't.

The only sane thing is to follow the guidance of the Cygwin
developers: the only supported configuration is that which the current setup.exe produces, and in the case of problems, if the installation is not up to date then updating is the first required action.

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +0 -0
index 4d47af5..52e298a 100644
@@ -273,6 +273,10 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support 

in your C library.
#
+# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
+# using the current w32api packages. The recommended approach, however,

Makefile +2 -0
+# is to update your installation if compilation errors occur.
+#
 # Define HAVE_DEV_TTY if your system can open /dev/tty to 
Quoted 4 lines

interact with the # user.
#
--
1.8.1.302.g0f4eaa7

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -

- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -

- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

#19 lore raw
In reply to Mark Levedahl
Quoted 69 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mark Levedahl
Sent: Sunday, January 06, 2013 16:10
To: Junio C Hamano
Cc: Jonathan Nieder; Torsten Bögershausen; Stephen & Linda Smith; Jason Pyeron; [email protected]; Eric Blake
Subject: Re: Version 1.8.1 does not compile on Cygwin 1.7.14

Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Jonathan Nieder
Quoted 1 line · Mark Levedahl

However,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the newer win32api is provided only for the current

cygwin release

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no

updates are being made for the legacy version(s).

Quoted 3 lines
Quoted 3 lines

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date

win32api and

Quoted 3 lines
Quoted 2 lines

print a helpful message, I guess cygcheck would be the command to use.)

Hmph, so we might see somebody who cares about Cygwin to

come up with

Quoted 2 lines

a solution based on cygcheck (not on uname) to update this part, perhaps on top of Peff's "split default settings based on

uname into

Quoted 3 lines

separate file" patch?

If I understood what Mark and Torsten wrote correctly, you

will have

Quoted 1 line

the new win32api if you install 1.7.17 (or newer) from

scratch, but if

Quoted 2 lines

you are on older 1.7.x then you can update the win32api part as a package update (as opposed to the whole-system upgrade). A

test based

Quoted 2 lines

on "uname -r" cannot notice that an older 1.7.x (say 1.7.14) installation has a newer win32api because the user updated

it from the

Quoted 12 lines

package (hence the user should not define CYGWIN_V15_WIN32API).

Am I on the same page as you guys, or am I still behind?

In the meantime, perhaps we would need something like this?

Makefile +0 -0
index 8e225ca..b45b06d 100644

Makefile all:: · line 282

Quoted 2 lines
Makefile +0 -0
@@ -281,6 +281,9 @@ all::
  #
  # Define NO_REGEX if you have no or inferior regex 

support in your C library.

Makefile all:: · line 284

Quoted 2 lines
Makefile +1 -0
  #
+# Define CYGWIN_V15_WIN32API if your Cygwin uses win32api 

dll older

Makefile all:: · line 286

Quoted 2 lines
Makefile +1 -0
+than # 1.7.x (this typically is true on Cygwin older than 1.7.17) #
  # Define HAVE_DEV_TTY if your system can open /dev/tty to 

interact with the

Makefile all:: · line 288

Quoted 3 lines
Makefile +0 -0
  # user.
  #
Quoted 10 lines

Looking at a current setup.ini, the obsolete win32 api is a single package "w32api" with last version 3.17-2, and is now replaced by the new win32 api is in two packages, "w32api-headers" + "w32api-runtime", both at version 3.0b_svn5496-1. If setup.exe updated an older installation of w32api, the old package is not deleted, but replaced by a special "empty" package with (as of today) version 9999-1. Note that all of this could change at any time. Also, note that the new w32api packages have version numbers that are lower than the older obsoleted version.

I would not rely on that information as it is not designed to convey the information the git build needs.

Quoted 10 lines

Running "cygcheck -c w32api w32api-headers w32api-runtime" on one machine gives

Cygwin Package Information

Package              Version            Status
w32api               9999-1             OK
w32api-headers       3.0b_svn5496-1     OK
w32api-runtime       3.0b_svn5496-1     OK
Quoted 8 lines

So now, what do folks propose checking for?
a) w32api is installed? Nope - the package is not "removed", it was updated to a special empty version to delete its former contents, but a new fresh installation won't have this.
b) w32api-headers is installed? Nope - what happens on the next repackaging?
c) w32api version is 9999-1? Maybe, but that number could change. etc.

This is what is typically done in a configure script by test compiling.

Quoted 17 lines

There is no documented, reliable, future-proof, method of determining the installed w32api version on Cygwin. There are many things that can be done that will work frequently, except when they won't. I really think the only sane thing is to follow the guidance of the Cygwin
developers: the only supported configuration is that which the current setup.exe produces, and in the case of problems, if the installation is not up to date then updating is the first required action.

So, in the makefile, you might add:

+# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
+# using the current w32api packages. But, the recommended approach is

Review

Quoted 2 lines
(quoted diff) +2 -0
+to # update your installation if compilation errors occur.
+#

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -

- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -

- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

#20 lore raw
In reply to Junio C Hamano
Quoted 26 lines · Junio C Hamano
Quoted 11 lines · Jonathan Nieder
Quoted 5 lines · Mark Levedahl

However, the newer
win32api is provided only for the current cygwin release series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no updates are being made for the legacy version(s).

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date win32api and print a helpful message, I guess cygcheck would be the command to use.)

Hmph, so we might see somebody who cares about Cygwin to come up with a solution based on cygcheck (not on uname) to update this part, perhaps on top of Peff's "split default settings based on uname into separate file" patch?

If I understood what Mark and Torsten wrote correctly, you will have the new win32api if you install 1.7.17 (or newer) from scratch, but if you are on older 1.7.x then you can update the win32api part as a package update (as opposed to the whole-system upgrade). A test based on "uname -r" cannot notice that an older 1.7.x (say 1.7.14) installation has a newer win32api because the user updated it from the package (hence the user should not define CYGWIN_V15_WIN32API).

Quoted 3 lines

Am I on the same page as you guys, or am I still behind?

In the meantime, perhaps we would need something like this?

It's perhaps worth noting how we got into this mess. The problems have their root in

    adbc0b6b6e57c11ca49779d01f549260a920a97d

Cygwin's entire goal is a completely POSIX compliant environment running under Windows. The above commit circumvents some of Cygwin's API regarding stat/fstat to make things perhaps a bit faster, and definitely not POSIX compliant (The commit message is wrong, the commit definitely breaks POSIX compliance). That code is also what will not compile on different w32api versions. It is curious: the Cygwin mailing list has been absolutely silent since the w32api change was introduced last summer, this is the only piece of code I am aware of that was broken by the new headers, and of course the purpose of this code is to circumvent the Cygwin API (and by extension, Cygwin project goals).

So, perhaps a better path forward is to disable / remove the above code by default. (Those wanting a native Win32 git should just use the native Win32 git).

Mark

#21 lore raw
Quoted 49 lines

-----Original Message-----
From: Mark Levedahl
Sent: Sunday, January 06, 2013 17:17

Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Jonathan Nieder
Quoted 1 line · Mark Levedahl

However,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the newer win32api is provided only for the current

cygwin release

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

series, which can be reliably identified by having dll version 1.7.x, while the older frozen releases (dll versions 1.6.x from redhat, 1.5.x open source) still have the older api as no

updates are being made for the legacy version(s).

Quoted 3 lines
Quoted 3 lines

Ah. That makes sense, thanks.

(For the future, if we wanted to diagnose an out-of-date

win32api and

Quoted 3 lines
Quoted 2 lines

print a helpful message, I guess cygcheck would be the command to use.)

Hmph, so we might see somebody who cares about Cygwin to

come up with

Quoted 2 lines

a solution based on cygcheck (not on uname) to update this part, perhaps on top of Peff's "split default settings based on

uname into

Quoted 3 lines

separate file" patch?

If I understood what Mark and Torsten wrote correctly, you

will have

Quoted 1 line

the new win32api if you install 1.7.17 (or newer) from

scratch, but if

Quoted 2 lines

you are on older 1.7.x then you can update the win32api part as a package update (as opposed to the whole-system upgrade). A

test based

Quoted 2 lines

on "uname -r" cannot notice that an older 1.7.x (say 1.7.14) installation has a newer win32api because the user updated

it from the

Quoted 5 lines

package (hence the user should not define CYGWIN_V15_WIN32API).

Am I on the same page as you guys, or am I still behind?

In the meantime, perhaps we would need something like this?

It's perhaps worth noting how we got into this mess. The problems have their root in

Quoted 6 lines
     adbc0b6b6e57c11ca49779d01f549260a920a97d

Cygwin's entire goal is a completely POSIX compliant environment running under Windows. The above commit circumvents some of Cygwin's API regarding stat/fstat to make things perhaps a bit faster, and definitely not POSIX

Ug!

Quoted 7 lines

compliant (The commit message is wrong, the commit definitely breaks POSIX compliance). That code is also what will not compile on different w32api versions. It is curious: the Cygwin mailing list has been absolutely silent since the w32api change was introduced last summer, this is the only piece of code I am aware of that was broken by the new headers, and of course the purpose of this code is to

Um, going out on a limb here, but those headers are used internally as "cygwin" apps are most likely to now know about those headers.

Quoted 6 lines

circumvent the Cygwin API (and by extension, Cygwin project goals).

So, perhaps a better path forward is to disable / remove the above code by default. (Those wanting a native Win32 git should just use the native
Win32 git).

Or a make option...

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -

- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -

- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

#22 lore raw

"Jason Pyeron" <[email protected]> writes:

[administrivia: please never cull CC list when you respond to a message on this list without a good reason]

Quoted 8 lines
Quoted 6 lines

circumvent the Cygwin API (and by extension, Cygwin project goals).

So, perhaps a better path forward is to disable / remove the above code by default. (Those wanting a native Win32 git should just use the native
Win32 git).

Or a make option...

It already is a runtime option, isn't it?

I do not have much stake in this personally, but IIRC, the (l)stat workaround was back then found to make Cygwin version from "unusably slow" to "slow but torelable", as our POSIX-y codebase assumes that lstat is fairly efficient, which Cygwin cannot satisify because it has call many win32 calls to collect bits that we do not even look at, in order to give faithful emulation. It does place extra maintenance burden (e.g. conditional compilation depending on the header file the particular version of Cygwin installation the user has at hand) on us, but as long as it works, the ugly hack is fairly isolated and I do not see a reason to unconditionally rip it out, especially if the reasoning behind such move is on "All programs that run in Cygwin environment has to be POSIX only and must not use Win32 API directly, even in a controlled way."

It is a completely different matter if the direct win32 calls we make, bypassing (l)stat emulation, somehow change the internal state of win32 resources Cygwin controls and violates the invariants Cygwin API implemenation expects, breaking later calls to it. I do not know that is the case here, but I doubt it.

#23 lore raw
Quoted 8 lines · Junio C Hamano

I do not have much stake in this personally, but IIRC, the (l)stat workaround was back then found to make Cygwin version from "unusably slow" to "slow but torelable", as our POSIX-y codebase assumes that lstat is fairly efficient, which Cygwin cannot satisify because it has call many win32 calls to collect bits that we do not even look at, in order to give faithful emulation. It does place extra maintenance burden

The maintenance burden is the only issue here, and I just wanted to point out the origin. I never enable that run-time option, the small gain in speed cannot compensate the loss of cross-platform operations for my uses. Actually, my git usage is mostly on Linux, but it seems 99% of my maintenance time is on the cygwin side that I almost never use. Sigh.

Mark

#25 lore raw
Quoted 7 lines · Alex Riesen

This short discussion on GitHub (file git-compat-util.h) might be relevant:

https://github.com/msysgit/git/commit/435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6#commitcomment-2407194

The change suggested there (to remove an inclusion of windows.h in git-compat-util.h) might simplify the solution a little. Might even remove the need for auto-configuration in Makefile (worked for me).

Just to be clear, the change is this:

git-compat-util.h +0 -6
index 4a1979f..780a919 100644
@@ -85,12 +85,6 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
#26 lore raw
Quoted 18 lines · Alex Riesen
Quoted 7 lines · Alex Riesen

This short discussion on GitHub (file git-compat-util.h) might be relevant:

https://github.com/msysgit/git/commit/435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6#commitcomment-2407194

The change suggested there (to remove an inclusion of windows.h in git-compat-util.h) might simplify the solution a little. Might even remove the need for auto-configuration in Makefile (worked for me).

Just to be clear, the change is this:

git-compat-util.h +0 -0
index 4a1979f..780a919 100644
@@ -85,12 +85,6 @@
  #define _NETBSD_SOURCE 1
  #define _SGI_SOURCE 1

git-compat-util.h line 90

Quoted 10 lines
git-compat-util.h +0 -6
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
  #include <unistd.h>
  #include <stdio.h>
  #include <sys/stat.h>

That change alone seems fine, no apparent change building on current cygwin. However, with that change the build still fails if CYGWIN_V15_WIN32API is defined, so unless someone can show the compilation works on cygwin1.5 WITHOUT defining CYGWIN_V15_WIN32API this change does not help. I do not have an older installation available, so cannot test. Frankly, assuming you can compile with that macro defined, I would suggest leaving well enough alone - an unsupported configuration is unsupported :^)

Mark

#27 lore raw
Quoted 29 lines · Mark Levedahl
Quoted 18 lines · Alex Riesen
Quoted 7 lines · Alex Riesen

This short discussion on GitHub (file git-compat-util.h) might be relevant:

https://github.com/msysgit/git/commit/435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6#commitcomment-2407194

The change suggested there (to remove an inclusion of windows.h in git-compat-util.h) might simplify the solution a little. Might even remove the need for auto-configuration in Makefile (worked for me).

Just to be clear, the change is this:

git-compat-util.h +0 -0
index 4a1979f..780a919 100644
@@ -85,12 +85,6 @@
  #define _NETBSD_SOURCE 1
  #define _SGI_SOURCE 1

git-compat-util.h line 90

Quoted 10 lines
git-compat-util.h +0 -6
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
  #include <unistd.h>
  #include <stdio.h>
  #include <sys/stat.h>
Quoted 8 lines

That change alone seems fine, no apparent change building on current cygwin. However, with that change the build still fails if CYGWIN_V15_WIN32API is defined, so unless someone can show the compilation works on cygwin1.5 WITHOUT defining CYGWIN_V15_WIN32API this change does not help. I do not have an older installation available, so cannot test. Frankly, assuming you can compile with that macro defined, I would suggest leaving well enough alone - an unsupported configuration is unsupported :^)

I haven't been following this thread too closely, so I may have misunderstood what you would like to test but, since I use cygwin 1.5, I tried the patch given below.

I only had time to compile test this patch (ie I have *not* run any of the tests - it takes over 3 hours for me), but it seems to work to that extent. (I also tried a few simple commands: status, diff, branch; seems to work OK.)

If you would like me to test something else, just let me know.

HTH

ATB,
Ramsay Jones

-- >8 --

Makefile +0 -7
index 1b30d7b..1c84f68 100644
@@ -281,10 +281,6 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
-# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
-# using the current w32api packages. The recommended approach, however,
-# is to update your installation if compilation errors occur.
-#
 # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
 # user.
 #
@@ -1402,9 +1398,6 @@ ifdef NO_REGEX
 	COMPAT_CFLAGS += -Icompat/regex
 	COMPAT_OBJS += compat/regex/regex.o
 endif
-ifdef CYGWIN_V15_WIN32API
-	COMPAT_CFLAGS += -DCYGWIN_V15_WIN32API
-endif
 
 ifdef USE_NED_ALLOCATOR
        COMPAT_CFLAGS += -Icompat/nedmalloc
compat/cygwin.c +0 -5
index 5428858..0a9aa6d 100644
@@ -1,13 +1,8 @@
 #define WIN32_LEAN_AND_MEAN
-#ifdef CYGWIN_V15_WIN32API
-#include "../git-compat-util.h"
-#include "win32.h"
-#else
 #include <sys/stat.h>
 #include <sys/errno.h>
 #include "win32.h"
 #include "../git-compat-util.h"
-#endif
 #include "../cache.h" /* to read configuration */
 
 static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
config.mak.uname +0 -1
index bea34f0..5e493c9 100644
@@ -158,7 +158,6 @@ ifeq ($(uname_O),Cygwin)
 		NO_SYMLINK_HEAD = YesPlease
 		NO_IPV6 = YesPlease
 		OLD_ICONV = UnfortunatelyYes
-		CYGWIN_V15_WIN32API = YesPlease
 	endif
 	NO_THREAD_SAFE_PREAD = YesPlease
 	NEEDS_LIBICONV = YesPlease
git-compat-util.h +0 -6
index e5a4b74..3186e55 100644
@@ -85,12 +85,6 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
#28 lore raw

git-compat-util.h line 92

Quoted 11 lines · Ramsay Jones
git-compat-util.h +0 -5
@@ -85,12 +85,6 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif

So, do I understand correctly that the above conditional should be something like

#if defined(WIN32) && !defined(__CYGWIN__)

to allow dropping the CYGWIN_V15_WIN32API setting?

"defined(WIN32)" is used throughout git to mean "win32 and not cygwin", so if I understand correctly we would either need to do

#if defined(WIN32) && defined(__CYGWIN__)

 # undef WIN32
 #endif

or define a new GIT_WIN32 (name is just a placeholder) macro to use consistently in its stead.

Thanks for investigating.
Jonathan

#29 lore raw
Quoted 25 lines · Jonathan Nieder

git-compat-util.h line 92

Quoted 11 lines · Ramsay Jones
git-compat-util.h +0 -5
@@ -85,12 +85,6 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif

So, do I understand correctly that the above conditional should be something like

#if defined(WIN32) && !defined(__CYGWIN__)

to allow dropping the CYGWIN_V15_WIN32API setting?

"defined(WIN32)" is used throughout git to mean "win32 and not cygwin", so if I understand correctly we would either need to do

#if defined(WIN32) && defined(__CYGWIN__)

Quoted 8 lines
 # undef WIN32
 #endif

or define a new GIT_WIN32 (name is just a placeholder) macro to use consistently in its stead.

Thanks for investigating.
Jonathan

I wonder, if if we can go one step further:

Replace
#ifdef WIN32 /* Both MinGW and MSVC */
#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ #include <winsock2.h>
#include <windows.h>
#endif

with
#if defined(_MSC_VER)
#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */ #include <winsock2.h>
#include <windows.h>
#endif

Any thougths from msysGit ?
/Torsten

#30 lore raw
Quoted 4 lines · Torsten Bögershausen

I wonder, if if we can go one step further:

Replace
#ifdef WIN32 /* Both MinGW and MSVC */

[...]

Quoted 2 lines

with
#if defined(_MSC_VER)

I thought Git for Windows was built using mingw, which doesn't define _MSC_VER?

Puzzled,
Jonathan

Signature · 12 lines
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en
#31 lore raw
Quoted 7 lines · Jonathan Nieder
Quoted 4 lines · Torsten Bögershausen

I wonder, if if we can go one step further:

Replace
#ifdef WIN32 /* Both MinGW and MSVC */

[...]

Quoted 9 lines
Quoted 2 lines

with
#if defined(_MSC_VER)

I thought Git for Windows was built using mingw, which doesn't define _MSC_VER?

Puzzled,
Jonathan

Yes,
After removing these lines in the git-compat-util.h of msysgit v1.8.1 it still compiled.
So I start to speculate if the comment is still valid for mingw, or if that was true in the old days and not now any more.

More investigation is needed, sorry for confusion. /Torsten

#32 lore raw
Quoted 17 lines · Torsten Bögershausen
Quoted 7 lines · Jonathan Nieder
Quoted 4 lines · Torsten Bögershausen

I wonder, if if we can go one step further:

Replace
#ifdef WIN32 /* Both MinGW and MSVC */

[...]

Quoted 9 lines
Quoted 2 lines

with
#if defined(_MSC_VER)

I thought Git for Windows was built using mingw, which doesn't define _MSC_VER?

Puzzled,
Jonathan

Quoted 7 lines

Yes,
After removing these lines in the git-compat-util.h of msysgit v1.8.1 it still compiled.
So I start to speculate if the comment is still valid for mingw, or if that was true in the old days and not now any more.

More investigation is needed, sorry for confusion.

Yes, I compiled the last patch on MinGW before I sent it to the list. I didn't bother with MSVC, since that build is already broken. I have a patch which fixed the MSVC build, but it already needs to be updated, since current master fails to build on MSVC.

ATB,
Ramsay Jones

#33 lore raw
In reply to Jonathan Nieder
Quoted 17 lines · Jonathan Nieder

git-compat-util.h line 92

Quoted 11 lines · Ramsay Jones
git-compat-util.h +0 -5
@@ -85,12 +85,6 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
-#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
-#include <winsock2.h>
-#include <windows.h>
-#endif

So, do I understand correctly that the above conditional should be something like

Quoted 3 lines

#if defined(WIN32) && !defined(__CYGWIN__)

to allow dropping the CYGWIN_V15_WIN32API setting?

Yes, replacing the git-compat-util.h hunk above with:

    diff --git a/git-compat-util.h b/git-compat-util.h
    index e5a4b74..a38ae8d 100644
    --- a/git-compat-util.h
    +++ b/git-compat-util.h
    @@ -85,7 +85,7 @@
     #define _NETBSD_SOURCE 1
     #define _SGI_SOURCE 1
 
    -#ifdef WIN32 /* Both MinGW and MSVC */
    +#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
     #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
     #include <winsock2.h>
     #include <windows.h>

will also compile on cygwin 1.5.x

Quoted 2 lines

"defined(WIN32)" is used throughout git to mean "win32 and not cygwin", so if I understand correctly we would either need to do

Hmm ... I remember being *very* nervous of commit 435bdf8c ("Make usage of windows.h lean and mean", 16-09-2009) exactly because it makes the code (on cygwin) much more fragile with respect to header include order. ;-)

As I have mentioned here before, the claim that "WIN32 is not defined on cygwin" is simply nonsense - it depends on if/when certain header files are included. For example, *as soon as* you include <windows.h> (and, I suspect, many other win32 headers) then "defined(WIN32)" is true.

Note that commit 380a4d92 ("Update cygwin.c for new mingw-64 win32 api headers", 11-11-2012) swaps the include order for the win32.h and git-compat-util.h header files. [I don't know the details, Mark didn't elaborate, but it is clearly an include order problem on cygwin 1.7.x :-D ] This causes compilation errors on cygwin 1.5.x, exactly because win32.h includes <windows.h>, which defines WIN32, which then leads to git-compat-util.h including <winsock2.h>.

Quoted 3 lines

#if defined(WIN32) && defined(__CYGWIN__)

 # undef WIN32
 #endif

Hmm, except when you want it defined on cygwin, of course ... ;-)

Quoted 1 line

Thanks for investigating.

No problem.

I've included the updated patch below, just for completeness.

HTH

ATB,
Ramsay Jones

-- >8 --
Subject: [PATCH] cygwin: Remove the CYGWIN_V15_WIN32API config

---
 Makefile          | 7 -------
 compat/cygwin.c   | 5 -----
 config.mak.uname  | 1 -
 git-compat-util.h | 2 +-
 4 files changed, 1 insertion(+), 14 deletions(-)
Makefile +0 -7
index 1b30d7b..1c84f68 100644
@@ -281,10 +281,6 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
-# Define CYGWIN_V15_WIN32API if you are using Cygwin v1.7.x but are not
-# using the current w32api packages. The recommended approach, however,
-# is to update your installation if compilation errors occur.
-#
 # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
 # user.
 #
@@ -1402,9 +1398,6 @@ ifdef NO_REGEX
 	COMPAT_CFLAGS += -Icompat/regex
 	COMPAT_OBJS += compat/regex/regex.o
 endif
-ifdef CYGWIN_V15_WIN32API
-	COMPAT_CFLAGS += -DCYGWIN_V15_WIN32API
-endif
 
 ifdef USE_NED_ALLOCATOR
        COMPAT_CFLAGS += -Icompat/nedmalloc
compat/cygwin.c +0 -5
index 5428858..0a9aa6d 100644
@@ -1,13 +1,8 @@
 #define WIN32_LEAN_AND_MEAN
-#ifdef CYGWIN_V15_WIN32API
-#include "../git-compat-util.h"
-#include "win32.h"
-#else
 #include <sys/stat.h>
 #include <sys/errno.h>
 #include "win32.h"
 #include "../git-compat-util.h"
-#endif
 #include "../cache.h" /* to read configuration */
 
 static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
config.mak.uname +0 -1
index bea34f0..5e493c9 100644
@@ -158,7 +158,6 @@ ifeq ($(uname_O),Cygwin)
 		NO_SYMLINK_HEAD = YesPlease
 		NO_IPV6 = YesPlease
 		OLD_ICONV = UnfortunatelyYes
-		CYGWIN_V15_WIN32API = YesPlease
 	endif
 	NO_THREAD_SAFE_PREAD = YesPlease
 	NEEDS_LIBICONV = YesPlease
git-compat-util.h +1 -1
index e5a4b74..a38ae8d 100644
@@ -85,7 +85,7 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
+#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
 #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
 #include <winsock2.h>
 #include <windows.h>
Signature · 1 line
1.8.1
#34 lore raw
Quoted 5 lines · Ramsay Jones

include order. ;-) As I have mentioned here before, the claim that "WIN32 is not defined on cygwin" is simply nonsense - it depends on if/when certain header files are included. For example, *as soon as* you include <windows.h> (and, I suspect, many other win32 headers) then "defined(WIN32)" is true. Note that commit 380a4d92 ("Update cygwin.c for new mingw-64 win32 api headers", 11-11-2012) swaps the include order for the win32.h and git-compat-util.h header files. [I don't know the details, Mark didn't elaborate, but it is clearly an include order problem on cygwin 1.7.x :-D ] This causes compilation errors on cygwin 1.5.x, exactly because win32.h includes <windows.h>, which defines WIN32, which then leads to git-compat-util.h including <winsock2.h>.

Quoted 3 lines
  #if defined(WIN32) && defined(__CYGWIN__)
  # undef WIN32
  #endif

Cygwin and Windows should be treated as completely separate platforms: if __CYGWIN__ is defined, do one thing, if not, go ahead and check WIN32, but the WIN32 macro should never be tested once we know the platform is CYGWIN - these really are different platforms (if you are unsure of this, consider that Cygwin includes a cross-compiler to target native Win32 as the Cygwin maintainers recognized the platforms are different).

Mark

#35 lore raw
Quoted 7 lines · Mark Levedahl

Cygwin and Windows should be treated as completely separate platforms:
if __CYGWIN__ is defined, do one thing, if not, go ahead and check WIN32, but the WIN32 macro should never be tested once we know the platform is CYGWIN - these really are different platforms (if you are unsure of this, consider that Cygwin includes a cross-compiler to target native Win32 as the Cygwin maintainers recognized the platforms are different).

Not disagreeing with your conclusion (they should be treated as different), why does it define WIN32 in the first place?

Perhaps we would want

	#ifdef __CYGWIN__
        #undef WIN32
        #endif

very early in some include file before nothing else is included?

Just being curious.

#36 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Mark Levedahl

Cygwin and Windows should be treated as completely separate platforms:
if __CYGWIN__ is defined, do one thing, if not, go ahead and check WIN32, but the WIN32 macro should never be tested once we know the platform is CYGWIN - these really are different platforms (if you are unsure of this, consider that Cygwin includes a cross-compiler to target native Win32 as the Cygwin maintainers recognized the platforms are different).

Quoted 8 lines

Not disagreeing with your conclusion (they should be treated as different), why does it define WIN32 in the first place?

Perhaps we would want

	#ifdef __CYGWIN__
        #undef WIN32
        #endif

Wouldn't work. Cygwin gcc does NOT define WIN32; rather, the inclusion of a Windows system header (generally discouraged, but sometimes a necessary evil) might cause WIN32 to be defined for all subsequent headers.

Which is why other projects, like gnulib, have

# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__

all over the place.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#37 lore raw

[PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

Throughout git, it is assumed that the WIN32 preprocessor symbol is defined on native Windows setups (mingw and msvc) and not on Cygwin. On Cygwin, most of the time git can pretend this is just another Unix machine, and Windows-specific magic is generally counterproductive.

Unfortunately Cygwin *does* define the WIN32 symbol in some headers. Best to rely on a new git-specific symbol NATIVE_WINDOWS instead, defined as follows:

	#if defined(WIN32) && !defined(__CYGWIN__)
	# define NATIVE_WINDOWS
	#endif

After this change, it should be possible to drop the CYGWIN_V15_WIN32API setting without any negative effect.

---

Quoted 5 lines · Eric Blake

Which is why other projects, like gnulib, have

# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__

all over the place.

So, how about this?

Completely untested.

 abspath.c         |  2 +-
 compat/terminal.c |  4 ++--
 compat/win32.h    |  2 +-
 diff-no-index.c   |  2 +-
 git-compat-util.h |  3 ++-
 help.c            |  2 +-
 run-command.c     | 10 +++++-----
 test-chmtime.c    |  2 +-
 thread-utils.c    |  2 +-
 9 files changed, 15 insertions(+), 14 deletions(-)
abspath.c +1 -1
index 40cdc462..c7d5458e 100644
@@ -216,7 +216,7 @@ const char *absolute_path(const char *path)
 const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
 {
 	static char path[PATH_MAX];
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 	if (!pfx_len || is_absolute_path(arg))
 		return arg;
 	memcpy(path, pfx, pfx_len);
compat/terminal.c +2 -2
index 9b5e3d1b..136e4a74 100644
@@ -3,7 +3,7 @@
 #include "sigchain.h"
 #include "strbuf.h"
 
-#if defined(HAVE_DEV_TTY) || defined(WIN32)
+#if defined(HAVE_DEV_TTY) || defined(WINDOWS_NATIVE)
 
 static void restore_term(void);
 
@@ -53,7 +53,7 @@ error:
 	return -1;
 }
 
-#elif defined(WIN32)
+#elif defined(WINDOWS_NATIVE)
 
 #define INPUT_PATH "CONIN$"
 #define OUTPUT_PATH "CONOUT$"
compat/win32.h +1 -1
index 8ce91048..31dd30f7 100644
@@ -2,7 +2,7 @@
 #define WIN32_H
 
 /* common Win32 functions for MinGW and Cygwin */
-#ifndef WIN32         /* Not defined by Cygwin */
+#ifndef WINDOWS_NATIVE	/* Not defined for Cygwin */
 #include <windows.h>
 #endif
 
diff-no-index.c +1 -1
index 74da6593..a0bc9c50 100644
@@ -45,7 +45,7 @@ static int get_mode(const char *path, int *mode)
 
 	if (!path || !strcmp(path, "/dev/null"))
 		*mode = 0;
-#ifdef _WIN32
+#ifdef WINDOWS_NATIVE
 	else if (!strcasecmp(path, "nul"))
 		*mode = 0;
 #endif
git-compat-util.h +2 -1
index e5a4b745..ebbdff53 100644
@@ -85,10 +85,11 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
+#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
 #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
 #include <winsock2.h>
 #include <windows.h>
+#define WINDOWS_NATIVE
 #endif
 
 #include <unistd.h>
help.c +1 -1
index 2a42ec6d..cc1e63f7 100644
@@ -106,7 +106,7 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(WINDOWS_NATIVE) || defined(__CYGWIN__)
 #if defined(__CYGWIN__)
 if ((st.st_mode & S_IXUSR) == 0)
 #endif
run-command.c +5 -5
index 04712191..04ac6181 100644
@@ -72,7 +72,7 @@ static inline void close_pair(int fd[2])
 	close(fd[1]);
 }
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 static inline void dup_devnull(int to)
 {
 	int fd = open("/dev/null", O_RDWR);
@@ -159,7 +159,7 @@ static const char **prepare_shell_cmd(const char **argv)
 		die("BUG: shell command is empty");
 
 	if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 		nargv[nargc++] = SHELL_PATH;
 #else
 		nargv[nargc++] = "sh";
@@ -182,7 +182,7 @@ static const char **prepare_shell_cmd(const char **argv)
 	return nargv;
 }
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 static int execv_shell_cmd(const char **argv)
 {
 	const char **nargv = prepare_shell_cmd(argv);
@@ -193,7 +193,7 @@ static int execv_shell_cmd(const char **argv)
 }
 #endif
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 static int child_err = 2;
 static int child_notifier = -1;
 
@@ -330,7 +330,7 @@ fail_pipe:
 	trace_argv_printf(cmd->argv, "trace: run_command:");
 	fflush(NULL);
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 {
 	int notify_pipe[2];
 	if (pipe(notify_pipe))
test-chmtime.c +1 -1
index 92713d16..803b6055 100644
@@ -87,7 +87,7 @@ int main(int argc, const char *argv[])
 			return -1;
 		}
 
-#ifdef WIN32
+#ifdef WINDOWS_NATIVE
 		if (!(sb.st_mode & S_IWUSR) &&
 				chmod(argv[i], sb.st_mode | S_IWUSR)) {
 			fprintf(stderr, "Could not make user-writable %s: %s",
thread-utils.c +1 -1
index 7f4b76a9..4c4cf2fa 100644
@@ -24,7 +24,7 @@ int online_cpus(void)
 	long ncpus;
 #endif
 
-#ifdef _WIN32
+#ifdef WINDOWS_NATIVE
 	SYSTEM_INFO info;
 	GetSystemInfo(&info);
 
Signature · 1 line
1.8.1.1
#38 lore raw

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

compat/terminal.c

Quoted 15 lines · Jonathan Nieder
abspath.c +1 -1
index 40cdc462..c7d5458e 100644
@@ -216,7 +216,7 @@ const char *absolute_path(const char *path)
  const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
  {
  	static char path[PATH_MAX];
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
  	if (!pfx_len || is_absolute_path(arg))
  		return arg;
  	memcpy(path, pfx, pfx_len);
compat/terminal.c +0 -0
index 9b5e3d1b..136e4a74 100644

Maybe WINDOWS_NATIVE should be defined in config.mak.uname?

Otherwise, I tested the patch and it does build / run on Cygwin, but I cannot run a test suite until next week. I am concerned about subtle changes due to the various WIN32 tests that were not guarded by __CYGWIN__ before, haven't stared at the code enough to see if there could be an issue.

Mark

#39 lore raw

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

In reply to Jonathan Nieder
Quoted 198 lines · Jonathan Nieder

Throughout git, it is assumed that the WIN32 preprocessor symbol is defined on native Windows setups (mingw and msvc) and not on Cygwin. On Cygwin, most of the time git can pretend this is just another Unix machine, and Windows-specific magic is generally counterproductive.

Unfortunately Cygwin *does* define the WIN32 symbol in some headers. Best to rely on a new git-specific symbol NATIVE_WINDOWS instead, defined as follows:

	#if defined(WIN32) && !defined(__CYGWIN__)
	# define NATIVE_WINDOWS
	#endif

After this change, it should be possible to drop the CYGWIN_V15_WIN32API setting without any negative effect.

---

Quoted 5 lines · Eric Blake

Which is why other projects, like gnulib, have

# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__

all over the place.

So, how about this?

Completely untested.

 abspath.c         |  2 +-
 compat/terminal.c |  4 ++--
 compat/win32.h    |  2 +-
 diff-no-index.c   |  2 +-
 git-compat-util.h |  3 ++-
 help.c            |  2 +-
 run-command.c     | 10 +++++-----
 test-chmtime.c    |  2 +-
 thread-utils.c    |  2 +-
 9 files changed, 15 insertions(+), 14 deletions(-)
abspath.c +1 -1
index 40cdc462..c7d5458e 100644
@@ -216,7 +216,7 @@ const char *absolute_path(const char *path)
 const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
 {
 	static char path[PATH_MAX];
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 	if (!pfx_len || is_absolute_path(arg))
 		return arg;
 	memcpy(path, pfx, pfx_len);
compat/terminal.c +2 -2
index 9b5e3d1b..136e4a74 100644
@@ -3,7 +3,7 @@
 #include "sigchain.h"
 #include "strbuf.h"
 
-#if defined(HAVE_DEV_TTY) || defined(WIN32)
+#if defined(HAVE_DEV_TTY) || defined(WINDOWS_NATIVE)
 
 static void restore_term(void);
 
@@ -53,7 +53,7 @@ error:
 	return -1;
 }
 
-#elif defined(WIN32)
+#elif defined(WINDOWS_NATIVE)
 
 #define INPUT_PATH "CONIN$"
 #define OUTPUT_PATH "CONOUT$"
compat/win32.h +1 -1
index 8ce91048..31dd30f7 100644
@@ -2,7 +2,7 @@
 #define WIN32_H
 
 /* common Win32 functions for MinGW and Cygwin */
-#ifndef WIN32         /* Not defined by Cygwin */
+#ifndef WINDOWS_NATIVE	/* Not defined for Cygwin */
 #include <windows.h>
 #endif
 
diff-no-index.c +1 -1
index 74da6593..a0bc9c50 100644
@@ -45,7 +45,7 @@ static int get_mode(const char *path, int *mode)
 
 	if (!path || !strcmp(path, "/dev/null"))
 		*mode = 0;
-#ifdef _WIN32
+#ifdef WINDOWS_NATIVE
 	else if (!strcasecmp(path, "nul"))
 		*mode = 0;
 #endif
git-compat-util.h +2 -1
index e5a4b745..ebbdff53 100644
@@ -85,10 +85,11 @@
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-#ifdef WIN32 /* Both MinGW and MSVC */
+#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
 #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
 #include <winsock2.h>
 #include <windows.h>
+#define WINDOWS_NATIVE
 #endif
 
 #include <unistd.h>
help.c +1 -1
index 2a42ec6d..cc1e63f7 100644
@@ -106,7 +106,7 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(WINDOWS_NATIVE) || defined(__CYGWIN__)
 #if defined(__CYGWIN__)
 if ((st.st_mode & S_IXUSR) == 0)
 #endif
run-command.c +5 -5
index 04712191..04ac6181 100644
@@ -72,7 +72,7 @@ static inline void close_pair(int fd[2])
 	close(fd[1]);
 }
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 static inline void dup_devnull(int to)
 {
 	int fd = open("/dev/null", O_RDWR);
@@ -159,7 +159,7 @@ static const char **prepare_shell_cmd(const char **argv)
 		die("BUG: shell command is empty");
 
 	if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 		nargv[nargc++] = SHELL_PATH;
 #else
 		nargv[nargc++] = "sh";
@@ -182,7 +182,7 @@ static const char **prepare_shell_cmd(const char **argv)
 	return nargv;
 }
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 static int execv_shell_cmd(const char **argv)
 {
 	const char **nargv = prepare_shell_cmd(argv);
@@ -193,7 +193,7 @@ static int execv_shell_cmd(const char **argv)
 }
 #endif
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 static int child_err = 2;
 static int child_notifier = -1;
 
@@ -330,7 +330,7 @@ fail_pipe:
 	trace_argv_printf(cmd->argv, "trace: run_command:");
 	fflush(NULL);
 
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
 {
 	int notify_pipe[2];
 	if (pipe(notify_pipe))
test-chmtime.c +1 -1
index 92713d16..803b6055 100644
@@ -87,7 +87,7 @@ int main(int argc, const char *argv[])
 			return -1;
 		}
 
-#ifdef WIN32
+#ifdef WINDOWS_NATIVE
 		if (!(sb.st_mode & S_IWUSR) &&
 				chmod(argv[i], sb.st_mode | S_IWUSR)) {
 			fprintf(stderr, "Could not make user-writable %s: %s",
thread-utils.c +0 -0
index 7f4b76a9..4c4cf2fa 100644

thread-utils.c int online_cpus(void) · line 30

Quoted 8 lines
thread-utils.c +1 -1
@@ -24,7 +24,7 @@ int online_cpus(void)
 	long ncpus;
 #endif
 
-#ifdef _WIN32
+#ifdef WINDOWS_NATIVE
 	SYSTEM_INFO info;
 	GetSystemInfo(&info);
 

Thanks, that looks good.

I run the test suite under XP, the same test cases are broken as on 1.8.1.1

/Torsten

#40 lore raw

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

In reply to Jonathan Nieder
Quoted 9 lines · Jonathan Nieder

Throughout git, it is assumed that the WIN32 preprocessor symbol is defined on native Windows setups (mingw and msvc) and not on Cygwin. On Cygwin, most of the time git can pretend this is just another Unix machine, and Windows-specific magic is generally counterproductive.

Unfortunately Cygwin *does* define the WIN32 symbol in some headers. Best to rely on a new git-specific symbol NATIVE_WINDOWS instead, defined as follows:

Quoted 8 lines
	#if defined(WIN32) && !defined(__CYGWIN__)
	# define NATIVE_WINDOWS
	#endif

After this change, it should be possible to drop the CYGWIN_V15_WIN32API setting without any negative effect.

If we go with this approach, could we prefix the symbol name with GIT_ in order to reduce the global namespace pollution?

eg GIT_NATIVE_WINDOWS, or GIT_NATIVE_WIN32 or just GIT_WIN32. (Yeah, I'm not good at choosing names!)

ATB,
Ramsay Jones

#41 lore raw

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

Quoted 18 lines · Ramsay Jones
Quoted 16 lines · Jonathan Nieder

Throughout git, it is assumed that the WIN32 preprocessor symbol is defined on native Windows setups (mingw and msvc) and not on Cygwin. On Cygwin, most of the time git can pretend this is just another Unix machine, and Windows-specific magic is generally counterproductive.

Unfortunately Cygwin *does* define the WIN32 symbol in some headers. Best to rely on a new git-specific symbol NATIVE_WINDOWS instead, defined as follows:

	#if defined(WIN32) && !defined(__CYGWIN__)
	# define NATIVE_WINDOWS
	#endif

After this change, it should be possible to drop the CYGWIN_V15_WIN32API setting without any negative effect.

Quoted 7 lines
Quoted 1 line

If we go with this approach, could we prefix the symbol name with GIT_ in order to reduce the global namespace pollution?

eg GIT_NATIVE_WINDOWS, or GIT_NATIVE_WIN32 or just GIT_WIN32. (Yeah, I'm not good at choosing names!)

I was in "find leftover bits" mode today and found this thread hanging.

Has anything come out of this thread, or there is nothing to improve in this area?

#42 lore raw

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

Quoted 1 line · Junio C Hamano

I was in "find leftover bits" mode today and found this thread hanging. Has anything come out of this thread, or there is nothing to improve in this area?

The patch passed my simple tests (build, run a few commands), but I didn't get around to a full test. And of course, I am testing on current Cygwin where git compiles and runs correctly anyway.

Mark

#43 lore raw

Re: [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS

Quoted 6 lines · Mark Levedahl
Quoted 1 line · Junio C Hamano

I was in "find leftover bits" mode today and found this thread hanging. Has anything come out of this thread, or there is nothing to improve in this area?

The patch passed my simple tests (build, run a few commands), but I didn't get around to a full test. And of course, I am testing on current Cygwin where git compiles and runs correctly anyway.

Mark

I run the test suite, and there was 1301 failing (and t0070 ?) which have to do with POSIX permisions.
They are on my TODO stack.
/Torsten

#44 lore raw
In reply to Junio C Hamano
Quoted 8 lines

-----Original Message-----
From: Junio C Hamano
Sent: Monday, January 07, 2013 2:29 AM

Jason Pyeron writes:

[administrivia: please never cull CC list when you respond to a message on this list without a good reason]

Apologies, I just have 4 copies of every message and was trying to save other that pain.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

circumvent the Cygwin API (and by extension, Cygwin project goals).

So, perhaps a better path forward is to disable / remove the above code by default. (Those wanting a native Win32 git should just use the native
Win32 git).

Quoted 8 lines
Quoted 1 line

Or a make option...

It already is a runtime option, isn't it?

I do not have much stake in this personally, but IIRC, the (l)stat workaround was back then found to make Cygwin version from "unusably slow" to "slow but torelable", as our POSIX-y codebase assumes that lstat is fairly efficient, which Cygwin cannot satisify because it

Is there already a set of test cases I can run to validate that this is still true?

Quoted 5 lines

has call many win32 calls to collect bits that we do not even look at, in order to give faithful emulation. It does place extra maintenance burden (e.g. conditional compilation depending on the header file the particular version of Cygwin installation the user has at hand) on us, but as long as it works, the ugly hack is fairly

There seems to be only 2 valid use cases here, with regards to cygwin.

1. Do it the normal posix way, and don’t hack it up.
2. For speed reasons, merge in native windows/non-posix functions.

I would not care about the user's cygwin version because the cygwin supporters won't either. In both cases assume the latest cygwin libraries. If there is a specific user with a use case for an older version of cygwin libraries then we can cross that bridge when (if) we arrive at it.

Quoted 4 lines

isolated and I do not see a reason to unconditionally rip it out, especially if the reasoning behind such move is on "All programs that run in Cygwin environment has to be POSIX only and must not use Win32 API directly, even in a controlled way."

I presently do not care if it stays or goes. But if someone were to bring this to the cygwin mailing list it would be a headache to deal with the "hacked" way. They would likely be more receptive to increasing the efficiency of the lstat than other approaches.

Quoted 6 lines

It is a completely different matter if the direct win32 calls we make, bypassing (l)stat emulation, somehow change the internal state of win32 resources Cygwin controls and violates the invariants Cygwin API implemenation expects, breaking later calls to it. I do not know that is the case here, but I doubt it.

I agree, it is not going to break anything here. Those libraries are just a way of presenting the Windows API without using Microsoft files and making it easier to wrap the POSIX apis to it.