hugsy / gef

GEF (GDB Enhanced Features) - a modern experience for GDB with advanced debugging capabilities for exploit devs & reverse engineers on Linux
https://hugsy.github.io/gef
MIT License
7.05k stars 739 forks source link

[Bug] GEF runs my shell for spawning commands like `clear` #1147

Closed liferooter closed 2 weeks ago

liferooter commented 4 weeks ago

GEF+GDB version

GEF: (Standalone)
Blob Hash(/nix/store/qd13yw7mg6kfcgp5h0vk01byyssmbd3f-gef-2024.06/share/gef/gef.py): c713c62efd950a24413b0834d9e8fd3563ba114f
SHA256(/nix/store/qd13yw7mg6kfcgp5h0vk01byyssmbd3f-gef-2024.06/share/gef/gef.py): 12881b1d42fb490ca72896099daf5c128c7c7382be0779c8f8f7db3a9161ab6f
GDB: 15.1
GDB-Python: 3.12

Operating System

NixOS Linux

Describe the issue you encountered

To clear screen, GEF runs clear command in my SHELL . This behavior is unexpected because

That's because GEF supposes using GDB's shell command to be acceptable, which is obviously invalid, because GDB's shell command runs binary it knows nothing about (which is my shell) as it's Bash, which is invalid behavior by definition, but obviously won't be fixed in near future because it will break backward compatibility of GDB. For running guaranteed POSIX-compatible shell people have their /bin/sh.

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

Yes

Architecture impacted

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

Minimalist test case

Not applicable. The issue is obviously testable with any code.

Additional context?

Nushell's error as a witness that thing broke:

Error: nu::parser::unknown_flag

  × The `clear` command doesn't have flag `-x`.
   ╭─[source:1:8]
 1 │ clear -x
   ·        ┬
   ·        ╰── unknown flag
   ╰────
  help: Available flags: --help(-h), --all(-a). Use `--help` for more information.
hugsy commented 2 weeks ago

@liferooter We've changed the way we clear the screen. The new way is not only more portable, but also more performant, and should work in your case. Feel free to re-open the issue if not