Skip to content

CYGWIN: Python-3.16.0a1 doesn't select correct strerror_r() #161198

Open

Description

@carlo-bramini

Bug report

Python-3.16.0a1 has been released, so I tried to build it on Cygwin.
Unfortunately, this error happens:

Python-3.16.0a1/Python/fileutils.c: In function ‘_Py_strerror’:
Python-3.16.0a1/Python/fileutils.c:3353:15: error: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
 3353 |     int len = strerror_r(code, small_buffer, buflen);
      |               ^~~~~~~~~~
Python-3.16.0a1/Python/fileutils.c:3373:17: error: assignment to ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
 3373 |             len = strerror_r(code, buffer, buflen);
      |                 ^
make: *** [Makefile:3361: Python/fileutils.o] Error 1

I'm thinking that this error comes from a recent change because I had not it in the past builds.
Evidently, Cygwin is also using the GNU version of strerror_r() but the current code doesn't take care of it.
At the moment, I fixed the error with this change:

--- origsrc/Python-3.16.0a1/Python/fileutils.c	2026-10-13 17:05:54.000000000 +0200
+++ src/Python-3.16.0a1/Python/fileutils.c	2026-11-02 13:13:18.366198700 +0100
@@ -3319,7 +3319,7 @@ _Py_strerror(int code)
    // Check which strerror_r() API is used
 #  if defined(__GLIBC__) && !((_POSIX_C_SOURCE >= 200112L) && !defined(_GNU_SOURCE))
 #    define Py_STRERROR_R_GNU
-#  elif defined(__ANDROID__) && defined(_GNU_SOURCE)
+#  elif (defined(__ANDROID__) || defined(__CYGWIN__)) && defined(_GNU_SOURCE)
 #    define Py_STRERROR_R_GNU
 #  endif
 #endif

However, is there a special reason because this test is not done at configure time?
Any comments?
See also issue #149879 "Enhance Cygwin support".

CPython versions tested on:

3.16

Operating systems tested on:

Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions