Skip to content

Commit 7a92bee

Browse files
bpo-43666: Lib/_aix_support.py routines may fail in a WPAR environment (GH-25095) (#25880)
Since WPAR and LPAR both have a builddate for teh fileset bos.rte The name of the fileset checked is modified. To prevent a similiar situation (no builddate in ODM) a value sufficient for pep425 activity if retrieved buildate is zero or NULL Patch by M Felt. (cherry picked from commit 5017cde) Co-authored-by: Michael Felt <[email protected]>
1 parent 7ec94cd commit 7a92bee

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

Lib/_aix_support.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ def _aix_tag(vrtl, bd):
1515
# type: (List[int], int) -> str
1616
# Infer the ABI bitwidth from maxsize (assuming 64 bit as the default)
1717
_sz = 32 if sys.maxsize == (2**31-1) else 64
18+
_bd = bd if bd != 0 else 9988
1819
# vrtl[version, release, technology_level]
19-
return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], bd, _sz)
20+
return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], _bd, _sz)
2021

2122

2223
# extract version, release and technology level from a VRMF string
@@ -26,19 +27,20 @@ def _aix_vrtl(vrmf):
2627
return [int(v[-1]), int(r), int(tl)]
2728

2829

29-
def _aix_bosmp64():
30+
def _aix_bos_rte():
3031
# type: () -> Tuple[str, int]
3132
"""
3233
Return a Tuple[str, int] e.g., ['7.1.4.34', 1806]
33-
The fileset bos.mp64 is the AIX kernel. It's VRMF and builddate
34-
reflect the current ABI levels of the runtime environment.
34+
The fileset bos.rte represents the current AIX run-time level. It's VRMF and
35+
builddate reflect the current ABI levels of the runtime environment.
36+
If no builddate is found give a value that will satisfy pep425 related queries
3537
"""
36-
# We expect all AIX systems to have lslpp installed in this location
37-
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.mp64"])
38+
# All AIX systems to have lslpp installed in this location
39+
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.rte"])
3840
out = out.decode("utf-8")
3941
out = out.strip().split(":") # type: ignore
40-
# Use str() and int() to help mypy see types
41-
return (str(out[2]), int(out[-1]))
42+
_bd = int(out[-1]) if out[-1] != '' else 9988
43+
return (str(out[2]), _bd)
4244

4345

4446
def aix_platform():
@@ -47,11 +49,11 @@ def aix_platform():
4749
AIX filesets are identified by four decimal values: V.R.M.F.
4850
V (version) and R (release) can be retreived using ``uname``
4951
Since 2007, starting with AIX 5.3 TL7, the M value has been
50-
included with the fileset bos.mp64 and represents the Technology
52+
included with the fileset bos.rte and represents the Technology
5153
Level (TL) of AIX. The F (Fix) value also increases, but is not
5254
relevant for comparing releases and binary compatibility.
5355
For binary compatibility the so-called builddate is needed.
54-
Again, the builddate of an AIX release is associated with bos.mp64.
56+
Again, the builddate of an AIX release is associated with bos.rte.
5557
AIX ABI compatibility is described as guaranteed at: https://www.ibm.com/\
5658
support/knowledgecenter/en/ssw_aix_72/install/binary_compatability.html
5759
@@ -60,7 +62,7 @@ def aix_platform():
6062
e.g., "aix-6107-1415-32" for AIX 6.1 TL7 bd 1415, 32-bit
6163
and, "aix-6107-1415-64" for AIX 6.1 TL7 bd 1415, 64-bit
6264
"""
63-
vrmf, bd = _aix_bosmp64()
65+
vrmf, bd = _aix_bos_rte()
6466
return _aix_tag(_aix_vrtl(vrmf), bd)
6567

6668

@@ -79,7 +81,7 @@ def aix_buildtag():
7981
Return the platform_tag of the system Python was built on.
8082
"""
8183
# AIX_BUILDDATE is defined by configure with:
82-
# lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }'
84+
# lslpp -Lcq bos.rte | awk -F: '{ print $NF }'
8385
build_date = sysconfig.get_config_var("AIX_BUILDDATE")
8486
try:
8587
build_date = int(build_date)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AIX: `Lib/_aix_support.get_platform()` may fail in an AIX WPAR.
2+
The fileset bos.rte appears to have a builddate in both LPAR and WPAR
3+
so this fileset is queried rather than bos.mp64.
4+
To prevent a similiar situation (no builddate in ODM) a value (9988)
5+
sufficient for completing a build is provided.
6+
Patch by M Felt.

0 commit comments

Comments
 (0)