[lldb] Expand $ when using tcsh
Unlike for any of the other shells, we were escaping $ when using tcsh. There's nothing special about $ in tcsh and this prevents you from expanding shell variables, one of the main reasons this functionality exists in the first place. Differential revision: https://reviews.llvm.org/D123690
This commit is contained in:
		
							parent
							
								
									2f98c5febc
								
							
						
					
					
						commit
						acc56e55fe
					
				| 
						 | 
				
			
			@ -385,7 +385,7 @@ std::string Args::GetShellSafeArgument(const FileSpec &shell,
 | 
			
		|||
  };
 | 
			
		||||
 | 
			
		||||
  static ShellDescriptor g_Shells[] = {{ConstString("bash"), " '\"<>()&;"},
 | 
			
		||||
                                       {ConstString("tcsh"), " '\"<>()&$;"},
 | 
			
		||||
                                       {ConstString("tcsh"), " '\"<>()&;"},
 | 
			
		||||
                                       {ConstString("zsh"), " '\"<>()&;\\|"},
 | 
			
		||||
                                       {ConstString("sh"), " '\"<>()&;"}};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char **argv) {
 | 
			
		||||
  for (int i = 0; i < argc; ++i)
 | 
			
		||||
    printf("%s\n", argv[i]);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
REQUIRES: shell, system-darwin
 | 
			
		||||
RUN: %clang_host %p/Inputs/echo.c -o %t.out
 | 
			
		||||
 | 
			
		||||
RUN: not %lldb %t.out -b -o 'process launch --shell=tcsh -- $NO_SUCH_SHELL_VARIABLE' 2>&1 | FileCheck --check-prefix=FAILURE %s
 | 
			
		||||
RUN: %lldb %t.out -b -o 'process launch --shell=tcsh -- $HOME' 2>&1 | FileCheck --check-prefix=SUCCESS %s
 | 
			
		||||
 | 
			
		||||
FAILURE: exited with status 1
 | 
			
		||||
SUCCESS: exited with status = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -336,8 +336,8 @@ TEST(ArgsTest, GetShellSafeArgument) {
 | 
			
		|||
 | 
			
		||||
  // Test escaping tcsh special characters.
 | 
			
		||||
  FileSpec tcsh("/bin/tcsh", FileSpec::Style::posix);
 | 
			
		||||
  EXPECT_EQ(Args::GetShellSafeArgument(tcsh, R"( '"<>()&$;)"),
 | 
			
		||||
            R"(\ \'\"\<\>\(\)\&\$\;)");
 | 
			
		||||
  EXPECT_EQ(Args::GetShellSafeArgument(tcsh, R"( '"<>()&;)"),
 | 
			
		||||
            R"(\ \'\"\<\>\(\)\&\;)");
 | 
			
		||||
  // Normal characters and globbing expressions that shouldn't be escaped.
 | 
			
		||||
  EXPECT_EQ(Args::GetShellSafeArgument(tcsh, "aA1*"), "aA1*");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue