Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GEF supports Python 3.6+ but uses f-string debugging only introduced in Python 3.8+, breaking compatibility #1091

Closed
1 of 9 tasks
Unactived opened this issue Apr 23, 2024 · 0 comments · Fixed by #1092

Comments

@Unactived
Copy link
Contributor

Unactived commented Apr 23, 2024

GEF+GDB version

Cannot run `version` as `GEF` fails to run because of the bug.

GDB is `GNU gdb (Debian 8.3.1-1) 8.3.1`

GEF is AFAIK latest as of writing, just downloaded from https://gef.blah.cat/py

System version of Python 3 is 3.7.5

Operating System

Kali GNU/Linux Rolling Release 2019.4

Describe the issue you encountered

Hello, I attempted to install and use GEF, with GDB and Python versions matching stated requirements.
However, GEF crashes at startup of GDB and GDB remains vanilla.

The error is a Python SyntaxError: invalid syntax. The culprit line* is using the = specifier for f-strings, which was only added in Python 3.8.

* I allege it is

gef/gef.py

Line 9826 in 8031fda

dbg(f"Loading extra plugins from {directory=}")

Suggested fix is rewriting the culprit line in a retro-compatible manner, e.g. dbg(f"Loading extra plugins from directory={directory}") ; or changing the Minimum Supported Python Version to 3.8.

N.B: There is a second culprit line (2 culprit expressions) which crashes upon fixing the first one:

gef/gef.py

Line 11009 in 8031fda

dbg(f"in __invoke_changed_hooks(\"{name}\"), {setting.value=} -> {new_value=}, changing={bool(setting.value != new_value)}")

Fixing that one as well, it appears GEF starts without issue. I suspect there are no more other issues as the whole file would be parsed at startup.

Do you read the docs and look at previously closed issues/PRs for similar cases?

Yes

Architecture impacted

  • X86
  • X64
  • ARM
  • ARM64
  • MIPS
  • MIPS64
  • PPC
  • PPC64
  • RISCV

Describe your issue. Without a proper reproduction step-by-step, your issue will be ignored.

  • Use a system featuring GDB 8.0+ and Python 3.6 or 3.7
  • Setup source of GEF's Python code as per documentation
wget -O ~/.gdbinit-gef.py -q https://gef.blah.cat/py
echo source ~/.gdbinit-gef.py >> ~/.gdbinit
  • Run gdb -q
  • Observed output:
  File "<fstring>", line 1
    (directory=)
              ^
SyntaxError: invalid syntax
(gdb) 

Minimalist test case

No response

Additional context?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant