# recent cygwin breakage

3 messages from 2014-11-22 to 2014-11-23. Participants: Ramsay Jones, Junio C Hamano.
Thread: https://gitlist.dev/t/38027

## Ramsay Jones, 2014-11-22 16:29

Subject: recent cygwin breakage
Message-ID: <5470B9F9.2060008@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/5470B9F9.2060008%40ramsay1.demon.co.uk

```
Hi Junio,

Just a quick heads-up on a recent cygwin breakage.

I updated my (64-bit) cygwin installation yesterday and (along
with many other packages) I noticed a new version of gcc (and
presumably libc) was installed (gcc v4.8.3-5 x86-64).

Unfortunately, this caused new warning to be issued when compiling
git. In particular, warnings about the implicit declaration of the
memmem(), strlcpy() and strcasestr() functions. As an example:

    CC archive.o
archive.c: In function ‘format_subst’:
archive.c:44:3: warning: implicit declaration of function ‘memmem’ [-Wimplicit-function-declaration]
   b = memmem(src, len, "$Format:", 8);
   ^
archive.c:44:5: warning: assignment makes pointer from integer without a cast [enabled by default]
   b = memmem(src, len, "$Format:", 8);
     ^

I haven't spent too long on this, but it appears that the _XOPEN_SOURCE
setting now trumps _GNU_SOURCE and _BSD_SOURCE settings. (I am guessing
that /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include-fixed/sys/cdefs.h was
changed recently to reflect the new priority).

Anyway, based on that quick squint, I changed git-compat-util.h, thus:

    diff --git a/git-compat-util.h b/git-compat-util.h
    index 400e921..cef2691 100644
    --- a/git-compat-util.h
    +++ b/git-compat-util.h
    @@ -75,7 +75,8 @@
     # endif
     #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
           !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
    -      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__)
    +      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
    +      !defined(__CYGWIN__)
     #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
     #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
     #endif

... which fixed up the build for me.

However, I haven't run any tests yet. Also, I would need to check
this out on 32-bit cygwin (I haven't booted that laptop into Win XP
for quite some time!).

Hmm, I don't really know if this is an unintended side-effect of a
recent change to cygwin (or a bug), but I couldn't see any mention
of this on the cygwin mailing list. (I don't intend to report this
to that mailing list; I don't want to subscribe to (yet another)
busy list). :(

ATB,
Ramsay Jones

```

## Junio C Hamano, 2014-11-23 18:13

Subject: Re: recent cygwin breakage
Message-ID: <xmqqr3wtyed6.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqr3wtyed6.fsf%40gitster.dls.corp.google.com
In-Reply-To: <5470B9F9.2060008@ramsay1.demon.co.uk>

```
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Just a quick heads-up on a recent cygwin breakage.
> 
> I updated my (64-bit) cygwin installation yesterday and (along
> with many other packages) I noticed a new version of gcc (and
> presumably libc) was installed (gcc v4.8.3-5 x86-64).
> ...
> However, I haven't run any tests yet. Also, I would need to check
> this out on 32-bit cygwin (I haven't booted that laptop into Win XP
> for quite some time!).
>
> Hmm, I don't really know if this is an unintended side-effect of a
> recent change to cygwin (or a bug), but I couldn't see any mention
> of this on the cygwin mailing list. (I don't intend to report this
> to that mailing list; I don't want to subscribe to (yet another)
> busy list). :(

Thanks.

I wonder if it is safe to unconditionally drop XOPEN_SOURCE; would
it cause problems for older Cygwin to those who have not updated to
the recent one yet?  The proposed change looks trivially correct
otherwise.

```

## Ramsay Jones, 2014-11-23 23:06

Subject: Re: recent cygwin breakage
Message-ID: <54726884.5070902@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/54726884.5070902%40ramsay1.demon.co.uk
In-Reply-To: <xmqqr3wtyed6.fsf@gitster.dls.corp.google.com>

```
On 23/11/14 18:13, Junio C Hamano wrote:
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> 
>> Just a quick heads-up on a recent cygwin breakage.
>>
>> I updated my (64-bit) cygwin installation yesterday and (along
>> with many other packages) I noticed a new version of gcc (and
>> presumably libc) was installed (gcc v4.8.3-5 x86-64).
>> ...
>> However, I haven't run any tests yet. Also, I would need to check
>> this out on 32-bit cygwin (I haven't booted that laptop into Win XP
>> for quite some time!).
>>
>> Hmm, I don't really know if this is an unintended side-effect of a
>> recent change to cygwin (or a bug), but I couldn't see any mention
>> of this on the cygwin mailing list. (I don't intend to report this
>> to that mailing list; I don't want to subscribe to (yet another)
>> busy list). :(
> 
> Thanks.
> 
> I wonder if it is safe to unconditionally drop XOPEN_SOURCE; would
> it cause problems for older Cygwin to those who have not updated to
> the recent one yet?  The proposed change looks trivially correct
> otherwise.

I honestly don't know. I have never attempted to rollback an update
to cygwin. (I guess it is possible, but I really don't know how ...)

However, ...

ATB,
Ramsay Jones

```
