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

Aberta Para iniciantes
#161,198 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
60/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
c

Direção de pesquisa

O erro está em _Py_strerror em Python/fileutils.c, onde o bloco do pré-processador perto da linha 3319 escolhe Py_STRERROR_R_GNU ou a variante XSI, e as duas chamadas a strerror_r perto das linhas 3353 e 3373 não compilam no Cygwin. Leia esse bloco de testes de recursos e a condição __CYGWIN__ proposta pelo relator e, em seguida, verifique se o configure.ac já detecta a assinatura de strerror_r. Está concluído quando um build no Cygwin compila sem erros de int-conversion e o ramo GNU é escolhido ali.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
Python
Estrelas
77.8k
Forks
37.7k
Merge médio
17h 2min
PRs com merge (30d)
699

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python/cpython

Todas as issues de python/cpython

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.