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"), " '\"<>()&;"}};
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"), " '\"<>()&;"}};
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits