[Lldb-commits] [PATCH] D104627: [lldb] Add support for escaping zsh arguments
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 21 10:47:33 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc197cddb16b3: [lldb] Add support for escaping zsh arguments (authored by teemperor).
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104627/new/
https://reviews.llvm.org/D104627
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
@@ -322,6 +322,12 @@
EXPECT_EQ(Args::GetShellSafeArgument(bash, "a\""), "a\\\"");
EXPECT_EQ(Args::GetShellSafeArgument(bash, "a\"b"), "a\\\"b");
+ FileSpec zsh("/bin/zsh", FileSpec::Style::posix);
+ EXPECT_EQ(Args::GetShellSafeArgument(zsh, R"('";()<>&|\)"),
+ R"(\'\"\;\(\)\<\>\&\|\\)");
+ // Normal characters and expressions that shouldn't be escaped.
+ EXPECT_EQ(Args::GetShellSafeArgument(zsh, "aA$1*"), "aA$1*");
+
// String that doesn't need to be escaped
EXPECT_EQ(Args::GetShellSafeArgument(bash, "a"), "a");
Index: lldb/source/Utility/Args.cpp
===================================================================
--- lldb/source/Utility/Args.cpp
+++ lldb/source/Utility/Args.cpp
@@ -386,6 +386,7 @@
static ShellDescriptor g_Shells[] = {{ConstString("bash"), " '\"<>()&"},
{ConstString("tcsh"), " '\"<>()&$"},
+ {ConstString("zsh"), " '\"<>()&;\\|"},
{ConstString("sh"), " '\"<>()&"}};
// safe minimal set
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104627.353420.patch
Type: text/x-patch
Size: 1264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210621/72bafd9b/attachment-0001.bin>
More information about the lldb-commits
mailing list