[Python-apps-team] Bug#813411: cython: Wrong definition of st_dev in posix/stat.pxd on mips64
Nikolaus Rath
Nikolaus at rath.org
Mon Feb 1 17:36:34 UTC 2016
Package: cython
Version: 0.23.2+git16-ga8fbae1-1+b1
Severity: normal
Tags: patch
On mips and mipsel, the st_dev and st_rdev members of struct stat do not
have type dev_t. This breaks POSIX compatibility, but is difficult to fix
(cf. https://sourceware.org/bugzilla/show_bug.cgi?id=17786).
When using Cython, this leads to conversation warnings in the generated
C code.
A workaround is to change the definition of struct stat that is used by Cython
when we are compiling under mips. The drawback is that this requires the Cython
compilation to run under mips, and that the resulting C file will be mips
specific (without the patch, the generated C file is suitable for any
architecture). However, I think this may be less of an issue for the Debian
package, because we are building everything from source on the target
architecture anyway (including regeneration of the C file from Cython code),
and it only happens to mips/mipsel users.
Thoughts on including this patch in the Debian package?
--- a/Includes/posix/stat.pxd
+++ b/Includes/posix/stat.pxd
@@ -16,7 +16,25 @@ cdef extern from "sys/stat.h" nogil:
S_IFMT
S_IFDIR
- struct stat:
+IF UNAME_MACHINE.startswith('mips64'):
+ cdef extern from "sys/stat.h" nogil:
+ struct stat:
+ int st_dev
+ ino_t st_ino
+ mode_t st_mode
+ nlink_t st_nlink
+ uid_t st_uid
+ gid_t st_gid
+ int st_rdev
+ off_t st_size
+ blksize_t st_blksize
+ blkcnt_t st_blocks
+ time_t st_atime
+ time_t st_mtime
+ time_t st_ctime
+ELSE:
+ cdef extern from "sys/stat.h" nogil:
+ struct stat:
dev_t st_dev
ino_t st_ino
mode_t st_mode
More information about the Python-apps-team
mailing list