[Lldb-commits] [PATCH] D104635: [lldb] Add support for escaping fish arguments
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 11 16:45:06 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9bc34636a50f: [lldb] Add support for escaping fish arguments (authored by teemperor, committed by JDevlieghere).
Herald added a subscriber: lldb-commits.
Herald added a project: All.
Changed prior to commit:
https://reviews.llvm.org/D104635?vs=353374&id=443786#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104635/new/
https://reviews.llvm.org/D104635
Files:
lldb/source/Utility/Args.cpp
lldb/unittests/Utility/ArgsTest.cpp
Index: lldb/unittests/Utility/ArgsTest.cpp
===================================================================
--- lldb/unittests/Utility/ArgsTest.cpp
+++ lldb/unittests/Utility/ArgsTest.cpp
@@ -348,6 +348,13 @@
// Normal characters and globbing expressions that shouldn't be escaped.
EXPECT_EQ(Args::GetShellSafeArgument(sh, "aA$1*"), "aA$1*");
+ // Test escaping fish special characters.
+ FileSpec fish("/bin/fish", FileSpec::Style::posix);
+ EXPECT_EQ(Args::GetShellSafeArgument(fish, R"( '"<>()&\|;)"),
+ R"(\ \'\"\<\>\(\)\&\\\|\;)");
+ // Normal characters and expressions that shouldn't be escaped.
+ EXPECT_EQ(Args::GetShellSafeArgument(fish, "aA$1*"), "aA$1*");
+
// Try escaping with an unknown shell.
FileSpec unknown_shell("/bin/unknown_shell", FileSpec::Style::posix);
EXPECT_EQ(Args::GetShellSafeArgument(unknown_shell, "a'b"), "a\\'b");
Index: lldb/source/Utility/Args.cpp
===================================================================
--- lldb/source/Utility/Args.cpp
+++ lldb/source/Utility/Args.cpp
@@ -385,6 +385,7 @@
};
static ShellDescriptor g_Shells[] = {{ConstString("bash"), " '\"<>()&;"},
+ {ConstString("fish"), " '\"<>()&\\|;"},
{ConstString("tcsh"), " '\"<>()&;"},
{ConstString("zsh"), " '\"<>()&;\\|"},
{ConstString("sh"), " '\"<>()&;"}};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104635.443786.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220711/30a8ea72/attachment-0001.bin>
More information about the lldb-commits
mailing list