[all-commits] [llvm/llvm-project] 9bc346: [lldb] Add support for escaping fish arguments

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Jul 11 16:45:11 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bc34636a50ffd9d417d30af021798b6294a1725
      https://github.com/llvm/llvm-project/commit/9bc34636a50ffd9d417d30af021798b6294a1725
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M lldb/source/Utility/Args.cpp
    M lldb/unittests/Utility/ArgsTest.cpp

  Log Message:
  -----------
  [lldb] Add support for escaping fish arguments

LLDB supports having globbing regexes in the process launch arguments
that will be resolved using the user's shell. This requires that we pass
the launch args to the shell and then read back the expanded arguments
using LLDB's argdumper utility.

As the shell will not just expand the globbing regexes but all special
characters, we need to escape all non-globbing charcters such as $, &,
<, >, etc. as those otherwise are interpreted and removed in the step
where we expand the globbing characters. Also because the special
characters are shell-specific, LLDB needs to maintain a list of all the
characters that need to be escaped for each specific shell.

This patch adds the list of special characters that need to be escaped
for fish. Without this patch on systems where fish is the user's shell
having any of these special characters in your arguments or path to
the binary will cause the process launch to fail. E.g., `lldb -- ./calc
1<2` is failing without this patch. The same happens if the absolute
path to calc is in a directory that contains for example parentheses
or other special characters.

Differential revision: https://reviews.llvm.org/D104635




More information about the All-commits mailing list