From d14ef7968c9fe9ca655e9dcd974c314a865a983e Mon Sep 17 00:00:00 2001 From: Gordon Messmer Date: Wed, 3 Sep 2025 21:53:07 -0700 Subject: [PATCH 1/2] Replace ByteString with Buffer --- gdb-gef.spec | 3 ++- gef-buffer.patch | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gef-buffer.patch diff --git a/gdb-gef.spec b/gdb-gef.spec index 4ab2330..d846f68 100644 --- a/gdb-gef.spec +++ b/gdb-gef.spec @@ -18,6 +18,7 @@ Source1: gdb-gef # https://github.com/hugsy/gef/pull/1094 Patch0: gef-got-audit.patch Patch1: gef-gcc15.patch +Patch2: gef-buffer.patch BuildArch: noarch ExclusiveArch: x86_64 @@ -35,7 +36,6 @@ BuildRequires: file BuildRequires: binutils BuildRequires: procps-ng BuildRequires: python3 -BuildRequires: python3-pylint BuildRequires: python3-pytest BuildRequires: python3-pytest-benchmark BuildRequires: python3-pytest-cov @@ -67,6 +67,7 @@ the relevant information from the debugging runtime. %forgesetup %patch 0 -p1 %patch 1 -p1 +%patch 2 -p1 %build diff --git a/gef-buffer.patch b/gef-buffer.patch new file mode 100644 index 0000000..d423cfe --- /dev/null +++ b/gef-buffer.patch @@ -0,0 +1,18 @@ +diff --git a/gef.py b/gef.py +index 7ce988f..61a75f5 100644 +--- a/gef.py ++++ b/gef.py +@@ -82,8 +82,12 @@ import warnings + from functools import lru_cache + from io import StringIO, TextIOWrapper + from types import ModuleType +-from typing import (Any, ByteString, Callable, Generator, Iterable, Iterator, ++from typing import (Any, Callable, Generator, Iterable, Iterator, + NoReturn, Sequence, Type, TypeVar, cast) ++try: ++ from typing import ByteString ++except ImportError: ++ from collections.abc import Buffer as ByteString + from urllib.request import urlopen + + From 95a5bc6459b24a293989266c4fb2040657e2b3b8 Mon Sep 17 00:00:00 2001 From: Gordon Messmer Date: Wed, 3 Sep 2025 22:32:51 -0700 Subject: [PATCH 2/2] Temporarily disable tcache tests --- gdb-gef.spec | 4 +++- gef-tcache-tests.patch | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gef-tcache-tests.patch diff --git a/gdb-gef.spec b/gdb-gef.spec index d846f68..9d5e16e 100644 --- a/gdb-gef.spec +++ b/gdb-gef.spec @@ -19,6 +19,7 @@ Source1: gdb-gef Patch0: gef-got-audit.patch Patch1: gef-gcc15.patch Patch2: gef-buffer.patch +Patch3: gef-tcache-tests.patch BuildArch: noarch ExclusiveArch: x86_64 @@ -68,6 +69,7 @@ the relevant information from the debugging runtime. %patch 0 -p1 %patch 1 -p1 %patch 2 -p1 +%patch 3 -p1 %build @@ -85,7 +87,7 @@ install -m 0755 %{SOURCE1}.sh %{buildroot}/%{_bindir}/gdb-gef %if %{with check} %check make -C tests/binaries -python3 -m pytest -v -m "not benchmark" -m "not online" tests/ +python3 -m pytest -v -m "not benchmark and not online and not tcache" tests/ %endif diff --git a/gef-tcache-tests.patch b/gef-tcache-tests.patch new file mode 100644 index 0000000..8b39af1 --- /dev/null +++ b/gef-tcache-tests.patch @@ -0,0 +1,38 @@ +diff --git a/tests/commands/heap.py b/tests/commands/heap.py +index b3bce6f..49226ba 100644 +--- a/tests/commands/heap.py ++++ b/tests/commands/heap.py +@@ -2,6 +2,8 @@ + Heap commands test module + """ + ++import pytest ++ + from tests.base import RemoteGefUnitTestGeneric + from tests.utils import ( + ARCH, +@@ -179,6 +181,7 @@ class HeapCommandNonMain(RemoteGefUnitTestGeneric): + res = gdb.execute(cmd, to_string=True) + self.assertIn("size=0x20", res) + ++ @pytest.mark.tcache + def test_cmd_heap_bins_tcache(self): + gdb = self._gdb + gdb.execute("run") +@@ -292,6 +295,7 @@ class HeapCommandTcache(RemoteGefUnitTestGeneric): + self.expected_tcache_bin_size = 0x20 if ARCH == "i686" or is_64b() else 0x18 + return super().setUp() + ++ @pytest.mark.tcache + def test_cmd_heap_bins_tcache_all(self): + gdb = self._gdb + gdb.execute("run") +diff --git a/tests/pytest.ini b/tests/pytest.ini +index 726db8e..7b86b98 100644 +--- a/tests/pytest.ini ++++ b/tests/pytest.ini +@@ -14,3 +14,4 @@ testpaths = + markers = + slow: flag test as slow (deselect with '-m "not slow"') + online: flag test as requiring internet to work (deselect with '-m "not online"') ++ tcache: flag test as checking glibc tcache (deselect with '-m "not tcache"')