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

Aperta Adatta ai principianti
#161,198 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
60/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Il bug si trova in _Py_strerror in Python/fileutils.c, dove il blocco del preprocessore vicino alla riga 3319 sceglie Py_STRERROR_R_GNU o la variante XSI, e le due chiamate a strerror_r vicino alle righe 3353 e 3373 non compilano su Cygwin. Leggi quel blocco di test delle funzionalità e la condizione __CYGWIN__ proposta da chi ha segnalato il problema, poi verifica se configure.ac rileva già la firma di strerror_r. È completato quando una build su Cygwin compila senza errori int-conversion e viene scelto il ramo GNU.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

build OS-unsupported OS-windows type-bug
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

Lingua principale
Python
Stelle
77.8k
Fork
37.7k
Merge medio
17h 2m
PR unite (30g)
699

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python/cpython

Tutte le issue di python/cpython

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.