This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python/dup2.c doesn't compile on (at least) newlib
Type: compile error Stage:
Components: Interpreter Core Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, gvanrossum, loewis, pitrou, torne
Priority: normal Keywords: patch

Created on 2010-06-23 09:51 by torne, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_dup2.patch torne, 2010-06-23 09:51 Patch adding suitable #include
Messages (3)
msg108445 - (view) Author: Torne Wuff (torne) Date: 2010-06-23 09:51
On systems without dup2(), Python tries to compile its own from Python/dup2.c, but this file refers to close() without including unistd.h. This causes it to not compile with newlib (and possibly other C libraries, presumably it was relying on fcntl.h indirectly including it?).

This is probably true of all older versions as well, but Python 2.x doesn't appear to actually bother to compile dup2.c even if the system lacks dup2, so it doesn't actually cause a build error there.

(building python for a semi-freestanding environment is "fun")
msg108451 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-06-23 14:23
(as a sidenote, the last significant changes to dup2.c date back from 1994)
msg118036 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-10-05 22:21
> but Python 2.x doesn't appear to actually bother 
> to compile dup2.c even if the system lacks dup2

Is it sure? The file configure.in has the same command in both versions:
    AC_REPLACE_FUNCS(dup2 getcwd strdup)

Added the #include anyway in r85236, r85237, 85238.
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53306
2010-10-05 22:21:53amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg118036

resolution: fixed
2010-06-23 14:23:30pitrousetnosy: + loewis, gvanrossum, pitrou

messages: + msg108451
versions: + Python 3.2
2010-06-23 09:51:31tornecreate