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: workaround deprecated ostat structure in
Type: Stage:
Components: macOS Versions: Python 2.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: jackjansen Nosy List: jackjansen, loewis, supercusp
Priority: normal Keywords: patch

Created on 2005-05-17 06:02 by supercusp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pyport.h.diff supercusp, 2005-05-17 06:02 Patch for pyport.h for Mac OS X.
Messages (5)
msg48357 - (view) Author: J. J. Snitow (supercusp) Date: 2005-05-17 06:02
This is a patch to python/python/dist/src/Include/pyport.h, CVS 
revision 2.70.

On Mac OS X 10.4 (Tiger), the file /usr/include/sys/stat.h  contains 
the ostat structure, which the in-file comments call "XXX So 
deprecated, it would make your head spin".  This structure is not 
used by the kernel and should not be used by user programs (so the 
comments say).

An "#ifndef _POSIX_C_SOURCE" protects #includers of sys/stat.h 
from this horrible struct (which doesn't even compile).  This patch to 
Include/pyport.h makes sure that _POSIX_C_SOURCE is always 
defined before including sys/stat.h.

Notably, this patch enables the stock Darwinports port of PyOpenGL 
(py-opengl) to compile and run just fine on Tiger.
msg48358 - (view) Author: J. J. Snitow (supercusp) Date: 2005-05-19 02:14
Logged In: YES 
user_id=14233

Looking at 1171767,
 http://sourceforge.net/tracker/index.php?
func=detail&aid=1171767&group_id=5470&atid=305470
it appears that the _POSIX_C_SOURCE issue isn't so simple.

Fortunately, my patch here is quite polite, in that it only defines 
_POSIX_C_SOURCE during the inclusion of <sys/stat.h>, where it is 
sorely needed, then promptly gets rid of it if and only if it wasn't defined 
before.  It seems to work nicely.
msg48359 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-05-20 21:09
Logged In: YES 
user_id=21627

I don't understand the purpose of the patch. So sys/stat.h
defines struct ostat. Why is that a problem that Python
needs somehow to deal with?

Turning _POSIX_C_SOURCE on and off temporarily is a bad idea
- this is either meant to be turned on for all translation
units, or turned off for all of them.
msg48360 - (view) Author: J. J. Snitow (supercusp) Date: 2005-05-21 04:57
Logged In: YES 
user_id=14233

Ack. loewis, you may be right. This patch may also be masking other bugs 
elsewhere.  Notably, a dummy .c file with _POSIX_C_SOURCE undefined 
and <sys/stat.h> included compiles without complaint.  Time for more 
investigation on my part.  For the moment, please consider this patch 
withdrawn.
msg48361 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-05-21 21:42
Logged In: YES 
user_id=21627

Ok, rejecting it. Please submit a new patch with a new
analysis if you think something needs to be done.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41991
2005-05-17 06:02:38supercuspcreate