[Patches] [ python-Patches-1203329 ] workaround deprecated ostat structure in <sys/stat.h>

SourceForge.net noreply at sourceforge.net
Sat May 21 06:57:31 CEST 2005


Patches item #1203329, was opened at 2005-05-17 06:02
Message generated for change (Comment added) made by supercusp
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1203329&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Macintosh
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: J. J. Snitow (supercusp)
Assigned to: Jack Jansen (jackjansen)
Summary: workaround deprecated ostat structure in <sys/stat.h>

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: J. J. Snitow (supercusp)
Date: 2005-05-21 04:57

Message:
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.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2005-05-20 21:09

Message:
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.

----------------------------------------------------------------------

Comment By: J. J. Snitow (supercusp)
Date: 2005-05-19 02:14

Message:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1203329&group_id=5470


More information about the Patches mailing list