Closed anjalirai-intel closed 1 month ago
Quick summary of the above issue: some OS distros print the first part of GDB's version not as a simple (major version) number, but as a long-ish string: Rocky Linux 10
, Red Hat Enterprise Linux 10
. This breaks the comparison code GDB_VERSION < (13,)
, as we can't compare this string to an integer.
I think this shouldn't be a blocker for the release for two reasons:
@mkow @woju @kailun-qin What do you think? Can we release v1.8 without a fix for this issue?
I think an ad-hoc fix will be like this:
$ git diff
diff --git a/libos/test/regression/test_libos.py b/libos/test/regression/test_libos.py
index 54ed0905..0c9fdd66 100644
--- a/libos/test/regression/test_libos.py
+++ b/libos/test/regression/test_libos.py
@@ -1467,7 +1467,7 @@ class TC_50_GDB(RegressionTestCase):
# uses) non-main threads in the parent process get stuck in "tracing stop"
# state after vfork+execve. This test uses gdb and unfortunately triggers
# the bug.
- @unittest.skipUnless(GDB_VERSION is not None and GDB_VERSION < (13,),
+ @unittest.skipUnless(GDB_VERSION is not None and tuple(int(s) for s in GDB_VERSION[0].split() if s.isdigit()) < (13,),
f'missing or known buggy GDB ({GDB_VERSION=})')
def test_020_gdb_fork_and_access_file_bug(self):
# To run this test manually, use:
diff --git a/python/graminelibos/regression.py b/python/graminelibos/regression.py
index 65b3c832..e8831772 100644
--- a/python/graminelibos/regression.py
+++ b/python/graminelibos/regression.py
@@ -23,7 +23,7 @@ IS_VM = os.environ.get('IS_VM') == '1'
ON_X86 = os.uname().machine in ['x86_64']
USES_MUSL = os.environ.get('GRAMINE_MUSL') == '1'
try:
- GDB_VERSION = tuple(int(i) if i.isdigit() else i for i in subprocess.check_output(
+ GDB_VERSION = tuple(i for i in subprocess.check_output(
['gdb', '-q', '-ex', 'python print(gdb.VERSION)', '-ex', 'q']
).strip().decode('ascii').split('.'))
except (subprocess.SubprocessError, OSError):
(Sorry for terrible Python, I just wanted to make this work.)
I.e., we don't compare the whole GDB_VERSION[0]
string, but we extract the first integer from this string. Should work for all the cases described above.
@dimakuv I think we can split just the last section separated by whitespace. See #2041 for attempted fix.
Description of the problem
GDB_VERSION is not being resolved correctly as expected in the regression.py file on RockyLinux and AlmaLinux systems, causing the libos tests to fail
Steps to reproduce
Code snippet to get GDB_VERSION have been taken from graminelibos/regression.py check_gdb.py:
Ubuntu 24.04:
RockyLinux:
The error occurs because the GDB_VERSION tuple contains strings that cannot be compared with integers, leading to a TypeError.
AlmaLinux:
Expected results
LibOS tests should be running successfully
Actual results
Gramine commit hash
971f1a77556b5215ffffe8eb11dd6e68fba18a87