Skip to content

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

@liferooter

Description

@liferooter

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

  • clear that is expects is a binary from ncurses and can be looked up from PATH without involving my shell
  • nobody guarantees GEF that my shell is POSIX-compatible and things it do with my shell will work
  • nobody guarantees GEF that clear command from my shell with my random environment is clear it expects. In my case it's Nushell's built-in which has different set of flags, so GEF breaks trying to run it.

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

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

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

  • Install Nushell as your default shell
  • Run GEF
  • Setup any layout with views. In my case it was done by gef config context.layout "regs code" and running the program.
  • Encounter the issue because clear in Nushell doesn't have -x flag

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.

Metadata

Metadata

Assignees

Labels

buglow-priorityuiAnything related to GEF's appearance

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions