You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed #76571
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-01-05.12:03:32.304>created_at=<Date2017-12-20.19:02:31.061>labels= ['build', '3.7']
title='AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed'updated_at=<Date2018-01-05.18:30:02.977>user='https://github.com/aixtools'
current level: commit 4b96593 (HEAD -> master, upstream/master, origin/master, origin/HEAD)
Build message:
michael@x071:[/data/prj/python/git/python3-3.7.X]make
xlc_r -DNDEBUG -O -I/opt/include -O2 -qmaxmem=-1 -qarch=pwr5 -I. -I./Include -I/opt/include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
"./Modules/posixmodule.c", line 5514.11: 1506-131 (W) Explicit dimension specification or initializer required for an auto or static array.
"./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.
Makefile:1765: recipe for target 'Modules/posixmodule.o' failed
make: *** [Modules/posixmodule.o] Error 1
michael@x071:[/data/prj/python/git/python3-3.7.0.a3]xlc_r -DNDEBUG -O -I/opt/include -O2 -qmaxmem=-1 -qarch=pwr5 -I. -I./Include -I/opt/in>
"./Modules/posixmodule.c", line 5514.11: 1506-131 (W) Explicit dimension specification or initializer required for an auto or static array.
"./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.
changed the title [-]AIX (xlc_r) compile error with Modules/posixmodule.c: Explicit dimension specification or initializer required[/-][+]AIX (xlc_r) compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed[/+]on Dec 20, 2017
/* typedef for the File System Identifier (fsid). This must correspond * to the "struct fsid" structure in _ALL_SOURCE below. */typedefstructfsid_t {
#ifdef__64BIT_KERNELunsigned longval[2];
#else/* __64BIT_KERNEL */#ifdef_ALL_SOURCEunsigned intval[2];
#else/* _ALL_SOURCE */unsigned int__val[2];
#endif/* _ALL_SOURCE */#endif/* __64BIT_KERNEL */
} fsid_t;
And, currently I am building in 32-bit mode, with a 64BIT kernel (AIX 6.1) - so I expect it to be 2 unsigned_longs.
However, Iamnotsmartenoughtofindasolution: Itried:
PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong((unsigned long) st.f_fsid));
and PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong((unsigned long *) st.f_fsid));
Both return:
"./Modules/posixmodule.c", line 9328.80: 1506-117 (S) Operand must be a scalar type.
Did some additional research. The code can work asis when _ALL_SOURCE is undefined. Or, in other words - there does not have to be a variable syntax issue or separate code for AIX.
As you read this - please remember that since issue bpo-32143 was 'resolved' AIX cannot compile.
Looking at AIX: /usr/include/sys/types.h - by undefining _ALL_SOURCE the typedefs in the header files are equivalent enough that the new code added for os.statvfs(path) is compiled by both gcc and xlc.
As examples (from Centos)
/usr/include/bits/typesizes.h:72:#define __FSID_T_TYPE struct { int __val[2]; }
And from AIX:
/usr/include/sys/types.h
+360 / * typedef for the File System Identifier (fsid). This must correspond
+361 * to the "struct fsid" structure in _ALL_SOURCE below.
+362 * /
+363 typedef struct fsid_t {
+364 #ifdef __64BIT_KERNEL
+365 unsigned long val[2];
+366 #else / * __64BIT_KERNEL * /
+367 #ifdef _ALL_SOURCE
+368 unsigned int val[2];
+369 #else / * _ALL_SOURCE * /
+370 unsigned int __val[2];
+371 #endif / * _ALL_SOURCE * /
+372 #endif / * __64BIT_KERNEL * /
+373 } fsid_t;
*/
(Note - a variation of the text above was in the pull request #4972. Per reviewer request - this is removed and a discussion is now open here.)
Thank you for your comments.
xdegaye commented on Jan 2, 2018
xdegayemannequin
Mannequin
More actions
Can you please post the definition of the statvfs structure on AIX.
DavidEdelsohn commented on Jan 2, 2018
DavidEdelsohnmannequin
Mannequin
More actions
structstatvfs {
ulong_tf_bsize; /* preferred file system block size */ulong_tf_frsize; /* fundamental file system block size */fsblkcnt_tf_blocks; /* total # of blocks of f_frsize in fs */fsblkcnt_tf_bfree; /* total # of free blocks */fsblkcnt_tf_bavail; /* # of blocks available to non super user */fsfilcnt_tf_files; /* total # of file nodes (inode in JFS) */fsfilcnt_tf_ffree; /* total # of free file nodes */fsfilcnt_tf_favail; /* # of nodes available to non super user */#ifdef_ALL_SOURCEfsid_tf_fsid; /* file system id */#elseulong_tf_fsid; /* file system id */#ifndef__64BIT__ulong_tf_fstype; /* file system type */#endif#endif/* _ALL_SOURCE */charf_basetype[_FSTYPSIZ]; /* Filesystem type name (eg. jfs) */ulong_tf_flag; /* bit mask of flags */ulong_tf_namemax; /* maximum filename length */charf_fstr[32]; /* filesystem-specific string */ulong_tf_filler[16];/* reserved for future use */
};
DavidEdelsohn commented on Jan 2, 2018
DavidEdelsohnmannequin
Mannequin
More actions
/* typedef for the File System Identifier (fsid). This must correspond * to the "struct fsid" structure in _ALL_SOURCE below. */typedefstructfsid_t {
#ifdef__64BIT_KERNELunsigned longval[2];
#else/* __64BIT_KERNEL */#ifdef_ALL_SOURCEunsigned intval[2];
#else/* _ALL_SOURCE */unsigned int__val[2];
#endif/* _ALL_SOURCE */#endif/* __64BIT_KERNEL */
} fsid_t;
#ifdef_KERNELtypedefstructfsid32_t {
unsigned intval[2];
} fsid32_t;
#endif/* __64BIT_KERNEL */typedefstructfsid64_t {
#if defined(_ALL_SOURCE) && (defined(__64BIT__) || defined(_LONG_LONG))
uint64_tval[2];
#else/* _ALL_SOURCE */uint32_t__val[4];
#endif/* _ALL_SOURCE */
} fsid64_t;
/* typedef for the File System Identifier (fsid) */structfsid {
#ifndef__64BIT_KERNELunsigned intval[2];
#elseunsigned longval[2];
#endif
};
xdegaye commented on Jan 3, 2018
xdegayemannequin
Mannequin
More actions
The _ALL_SOURCE feature test macro is set by the AC_USE_SYSTEM_EXTENSIONS macro in configure.ac.
It is not clear why the _ALL_SOURCE macro is currently needed by Python.
_ALL_SOURCE is overkill. It probably is too big a club for this regression. However, the AIX header definition of fsid compatible with the current Python posixmodule.c code is bracketed by _ALL_SOURCE.
AFAICT, the change to posixmodule.c made assumptions about fsid based on Linux and not required by POSIX. This didn't simply introduce a testsuite regression, but broke the build on AIX. The posixmodule.c code should be corrected or should be reverted.
changed the title [-]AIX (xlc_r) compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed[/-][+]AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed[/+]on Jan 3, 2018
xdegaye commented on Jan 3, 2018
xdegayemannequin
Mannequin
More actions
The following patch may be less invasive and more explicit:
_ALL_SOURCE is overkill. It probably is too big a club for this regression.
Maybe. Clearly it is a big club. The documentation - if you can find any
is ancient and/or confusing. For example the xlc compiler reference
quide (v12 is what I referenced, not the latest, but what I found) only
has a single reference to any "_SOURCE" macro (-D_POSIX_SOURCE).
I do not know 'why' AIX and Linux differ in the way they name things. I
do not want to care either - which is why I, personally, am less
concerned about the size of the club. People much more clever than I
decided that many variable names should be without two underscores
(_ALL_SOURCE is defined) while others felt they must have two
underscores (_ALL_SOURCE is undefined).
IMHO: 15+ years ago IBM (AIX) worked to find a method to simplify
porting. And, I hope somewhere someone knows what these all meant. The
practice seems to be to always define _ALL_SOURCE (see configure.ac:
+882 # checks for UNIX variants that set C preprocessor variables
+883 AC_USE_SYSTEM_EXTENSIONS
+884 https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Posix-Variants.html
Here is where I read that _ALL_SOURCE is for AIX3. I can neither deny
nor affirm that that is (still) accurate. But that is what working with
autotools does. Throws a sauce over everything that may, or maynot be
what is needed.
I considered it 'interesting' that <sys/types.h> at least talks a bit
about _POSIX_SOURCE and _ALL_SOURCE.
However, the AIX header definition of fsid compatible with the current Python posixmodule.c code is bracketed by _ALL_SOURCE.
AFAICT, the change to posixmodule.c made assumptions about fsid based on Linux and not required by POSIX. This didn't simply introduce a testsuite regression, but broke the build on AIX. The posixmodule.c code should be corrected or should be reverted.
Maybe reverting the change is better than using the "big club". But,
asis, AIX is dead to development. Was it possible to have AIX included
in the PR test process I would hope that the PR would never have been
merged.
IMHO - this is a spelling issue, going back years. But if you use a
UK-only spelling checker and try and use only US spelling rules - and
v.v. - there will be 'issues'. What is the solution with the most
clarity? Above my pay grade to answer.
In any case the previous issue that saw adding fsid as a solution was
not fully tested across all platforms. Currently AIX is broken. Someone
needs to decide how to restore a supported platform - and where the
discussion on fsid either restarts or continues.
In short - I am just a messenger - you are the experts. :)
----------
nosy: +vstinner
title: AIX (xlc_r) compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed -> AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed
New changeset 502d551 by xdegaye (Michael Felt) in branch 'master': bpo-32390: Fix compilation failure on AIX after f_fsid was added to os.statvfs() (bpo-4972) 502d551
xdegaye commented on Jan 5, 2018
xdegayemannequin
Mannequin
More actions
Thanks Michael for your contribution in fixing this issue.
A compilation error is a blocking bug. It is short and short, it can be
backported to 2.7 and 3.6 no? Is ALL_SOURCE defined vy default?
xdegaye commented on Jan 5, 2018
xdegayemannequin
Mannequin
More actions
The compilation error occurs only on the master branch, bpo-32143 is the enhancement that is the initial cause of this problem. This went unnoticed when bpo-32143 was resolved because the AIX buildbots were already failing at that time for another reason.
DavidEdelsohn commented on Jan 5, 2018
DavidEdelsohnmannequin
Mannequin
More actions
The AIX buildbots has been exhibiting testsuite failures, but not build (compile) failures. The buildbots do not visibly distinguish between the two cases in a strong manner.
We can disable / expect failure for the few, additional testcases on AIX so that the buildbots will report "success" to make new failures more obvious.
Activity
aixtools commentedon Dec 20, 2017
current level: commit 4b96593 (HEAD -> master, upstream/master, origin/master, origin/HEAD)
Build message:
michael@x071:[/data/prj/python/git/python3-3.7.X]make
xlc_r -DNDEBUG -O -I/opt/include -O2 -qmaxmem=-1 -qarch=pwr5 -I. -I./Include -I/opt/include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
"./Modules/posixmodule.c", line 5514.11: 1506-131 (W) Explicit dimension specification or initializer required for an auto or static array.
"./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.
Makefile:1765: recipe for target 'Modules/posixmodule.o' failed
make: *** [Modules/posixmodule.o] Error 1
Details (note rewrite from listing for line 5514)
"./Modules/posixmodule.c", line 5514.11: 1506-131 (W) Explicit dimension specification or initializer required for an auto or static array.
5515 |
5516 | static PyStructSequence_Field sched_param_fields[] = {
5517 | {"sched_priority", "the scheduling priority"},
5518 | {0}
5519 | };
aixtools commentedon Dec 20, 2017
OOps - wrong error!
It is the new fsid variable!
michael@x071:[/data/prj/python/git/python3-3.7.0.a3]xlc_r -DNDEBUG -O -I/opt/include -O2 -qmaxmem=-1 -qarch=pwr5 -I. -I./Include -I/opt/in>
"./Modules/posixmodule.c", line 5514.11: 1506-131 (W) Explicit dimension specification or initializer required for an auto or static array.
"./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.
"./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed
.
9328 | PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong(st.f_fsid));
9328 + (((PyTupleObject *)(v))->ob_item[10] = PyLong_FromUnsignedLong(st.f_fsid));
9329 | if (PyErr_Occurred()) {
9330 | Py_DECREF(v);
9330 + do { PyObject *_py_decref_tmp = (PyObject *)(v); if ( --(_py_decref_tmp)->ob_refcnt != 0) ; else ( ((((PyObject)(_py_d
ecref_tmp))->ob_type)->tp_dealloc)((PyObject *)(_py_decref_tmp))); } while (0);
[-]AIX (xlc_r) compile error with Modules/posixmodule.c: Explicit dimension specification or initializer required[/-][+]AIX (xlc_r) compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed[/+]aixtools commentedon Dec 20, 2017
FYI: from /usr/include/types.h
And, currently I am building in 32-bit mode, with a 64BIT kernel (AIX 6.1) - so I expect it to be 2 unsigned_longs.
and PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong((unsigned long *) st.f_fsid));
Both return:
"./Modules/posixmodule.c", line 9328.80: 1506-117 (S) Operand must be a scalar type.
xdegaye commentedon Dec 20, 2017
The PPC64 AIX 3.x Python buildbot (http://buildbot.python.org/all/#/builders/10) has been failing upon this same error for over a month.
Can you please try with:
Or if statvfs.f_fsid is a pointer to fsid_t, try this instead:
aixtools commentedon Dec 22, 2017
Well, replied via email response - but it did not show up here.
You suggestion worked. I'll start a PR and we can see if your suggestion also works for all the other platforms.
xdegaye commentedon Dec 24, 2017
Michael Felt answered by email:
Right, f_fsid has been added only few days ago by bpo-32143.
aixtools commentedon Jan 1, 2018
Did some additional research. The code can work asis when _ALL_SOURCE is undefined. Or, in other words - there does not have to be a variable syntax issue or separate code for AIX.
As you read this - please remember that since issue bpo-32143 was 'resolved' AIX cannot compile.
describes _ALL_SOURCE as a macro for AIX3.
Looking at AIX: /usr/include/sys/types.h - by undefining _ALL_SOURCE the typedefs in the header files are equivalent enough that the new code added for os.statvfs(path) is compiled by both gcc and xlc.
As examples (from Centos)
/usr/include/bits/typesizes.h:72:#define __FSID_T_TYPE struct { int __val[2]; }
And from AIX:
+360 / * typedef for the File System Identifier (fsid). This must correspond
+361 * to the "struct fsid" structure in _ALL_SOURCE below.
+362 * /
+363 typedef struct fsid_t {
+364 #ifdef __64BIT_KERNEL
+365 unsigned long val[2];
+366 #else / * __64BIT_KERNEL * /
+367 #ifdef _ALL_SOURCE
+368 unsigned int val[2];
+369 #else / * _ALL_SOURCE * /
+370 unsigned int __val[2];
+371 #endif / * _ALL_SOURCE * /
+372 #endif / * __64BIT_KERNEL * /
+373 } fsid_t;
*/
(Note - a variation of the text above was in the pull request #4972. Per reviewer request - this is removed and a discussion is now open here.)
Thank you for your comments.
xdegaye commentedon Jan 2, 2018
Can you please post the definition of the statvfs structure on AIX.
DavidEdelsohn commentedon Jan 2, 2018
DavidEdelsohn commentedon Jan 2, 2018
xdegaye commentedon Jan 3, 2018
The _ALL_SOURCE feature test macro is set by the AC_USE_SYSTEM_EXTENSIONS macro in configure.ac.
It is not clear why the _ALL_SOURCE macro is currently needed by Python.
The _ALL_SOURCE feature test macro is defined here: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/ftms.htm
DavidEdelsohn commentedon Jan 3, 2018
_ALL_SOURCE is overkill. It probably is too big a club for this regression. However, the AIX header definition of fsid compatible with the current Python posixmodule.c code is bracketed by _ALL_SOURCE.
AFAICT, the change to posixmodule.c made assumptions about fsid based on Linux and not required by POSIX. This didn't simply introduce a testsuite regression, but broke the build on AIX. The posixmodule.c code should be corrected or should be reverted.
[-]AIX (xlc_r) compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed[/-][+]AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed[/+]xdegaye commentedon Jan 3, 2018
The following patch may be less invasive and more explicit:
aixtools commentedon Jan 3, 2018
On 03/01/2018 14:41, David Edelsohn wrote:
Maybe. Clearly it is a big club. The documentation - if you can find any
quide (v12 is what I referenced, not the latest, but what I found) only
has a single reference to any "_SOURCE" macro (-D_POSIX_SOURCE).
I do not know 'why' AIX and Linux differ in the way they name things. I
do not want to care either - which is why I, personally, am less
concerned about the size of the club. People much more clever than I
decided that many variable names should be without two underscores
(_ALL_SOURCE is defined) while others felt they must have two
underscores (_ALL_SOURCE is undefined).
IMHO: 15+ years ago IBM (AIX) worked to find a method to simplify
porting. And, I hope somewhere someone knows what these all meant. The
practice seems to be to always define _ALL_SOURCE (see configure.ac:
+882 # checks for UNIX variants that set C preprocessor variables
+883 AC_USE_SYSTEM_EXTENSIONS
+884
https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Posix-Variants.html
Here is where I read that _ALL_SOURCE is for AIX3. I can neither deny
nor affirm that that is (still) accurate. But that is what working with
autotools does. Throws a sauce over everything that may, or maynot be
what is needed.
I considered it 'interesting' that <sys/types.h> at least talks a bit
about _POSIX_SOURCE and _ALL_SOURCE.
Maybe reverting the change is better than using the "big club". But,
asis, AIX is dead to development. Was it possible to have AIX included
in the PR test process I would hope that the PR would never have been
merged.
IMHO - this is a spelling issue, going back years. But if you use a
UK-only spelling checker and try and use only US spelling rules - and
v.v. - there will be 'issues'. What is the solution with the most
clarity? Above my pay grade to answer.
In any case the previous issue that saw adding fsid as a solution was
not fully tested across all platforms. Currently AIX is broken. Someone
needs to decide how to restore a supported platform - and where the
discussion on fsid either restarts or continues.
In short - I am just a messenger - you are the experts. :)
aixtools commentedon Jan 3, 2018
Ignore my last comment - I have a headache. If I could edit/delete it I would.
aka "reset 2018 - here I come!"
aixtools commentedon Jan 3, 2018
On 03/01/2018 18:03, Xavier de Gaye wrote:
xdegaye commentedon Jan 5, 2018
New changeset 502d551 by xdegaye (Michael Felt) in branch 'master':
bpo-32390: Fix compilation failure on AIX after f_fsid was added to os.statvfs() (bpo-4972)
502d551
xdegaye commentedon Jan 5, 2018
Thanks Michael for your contribution in fixing this issue.
vstinner commentedon Jan 5, 2018
A compilation error is a blocking bug. It is short and short, it can be
backported to 2.7 and 3.6 no? Is ALL_SOURCE defined vy default?
xdegaye commentedon Jan 5, 2018
The compilation error occurs only on the master branch, bpo-32143 is the enhancement that is the initial cause of this problem. This went unnoticed when bpo-32143 was resolved because the AIX buildbots were already failing at that time for another reason.
DavidEdelsohn commentedon Jan 5, 2018
The AIX buildbots has been exhibiting testsuite failures, but not build (compile) failures. The buildbots do not visibly distinguish between the two cases in a strong manner.
We can disable / expect failure for the few, additional testcases on AIX so that the buildbots will report "success" to make new failures more obvious.