classification
Title: %zd configure test fails on Linux
Type: Stage:
Components: Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, gvanrossum, hniksic, loewis
Priority: normal Keywords:

Created on 2007-12-16 20:22 by hniksic, last changed 2007-12-18 21:15 by christian.heimes. This issue is now closed.

Files
File name Uploaded Description Edit
patch hniksic, 2007-12-16 20:22
Messages (6)
msg58675 - (view) Author: Hrvoje Nikšić (hniksic) * Date: 2007-12-16 20:22
The printf("%zd", ...) configure test fails on Linux, although it
supports the %zd format.  config.log reveals that the test tests for %zd
with Py_ssize_t, which is (within the test) typedeffed to ssize_t.  But
the appropriate system header is not included by the test, and ssize_t
is not defined.  This results in Py_ssize_t not being correctly defined,
and the test failing.

According to http://tinyurl.com/3dhbbm/, ssize_t is defined in
<sys/types.h>.  Adding #include <sys/types.h> manually to the test fixes
the test for me.  A patch like the one attached should fix the problem.
msg58676 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-16 21:41
I fixed the bug in r59533 trunk with a modified patch:

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

Should it be backported to 2.5? It will be merged into 3.0 automatically.
msg58677 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-12-16 22:51
I think it should be backported.
msg58678 - (view) Author: Hrvoje Nikšić (hniksic) * Date: 2007-12-16 23:04
Thanks for the quick review.  I considered guarding the include with
#ifdef as well, but I concluded it's not necessary for the following
reasons:

1. a large number of existing tests already simply include <sys/types.h>
(the makedev test, sizeof(off_t) test, IPv6-related tests, and various
socket tests);

2. if sys/types.h doesn't exist, the test will fail, and Python will
conclude that %zd is not available.  This conclusion is almost certainly
correct, as I doubt that a system without sys/types.h has a working %zd
format.
msg58762 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-18 20:05
Please backport.
msg58772 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-18 21:15
Backported to 2.5 in r59552
History
Date User Action Args
2007-12-18 21:15:29christian.heimessetstatus: pending -> closed
messages: + msg58772
2007-12-18 20:05:10gvanrossumsetassignee: christian.heimes
messages: + msg58762
nosy: + gvanrossum
2007-12-16 23:04:06hniksicsetmessages: + msg58678
2007-12-16 22:51:16loewissetnosy: + loewis
messages: + msg58677
2007-12-16 21:41:10christian.heimessetstatus: open -> pending
priority: normal
resolution: fixed
messages: + msg58676
nosy: + christian.heimes
2007-12-16 20:22:53hniksiccreate