From 7d7a636f2497dae736c7dc7b2378a7d51e28fd92 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 21 Sep 2014 23:34:49 -0700 Subject: Allow running executables with $ in their name. Fixes #1686 --- fish_tests.cpp | 7 ++++++- parse_util.cpp | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fish_tests.cpp b/fish_tests.cpp index 7222065f..8d30d5f4 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -1303,7 +1303,7 @@ static void test_lru(void) \param flags the flags to send to expand_string */ -static int expand_test(const wchar_t *in, int flags, ...) +static int expand_test(const wchar_t *in, expand_flags_t flags, ...) { std::vector output; va_list va; @@ -1379,6 +1379,11 @@ static void test_expand() err(L"Failed to handle null escape in expansion"); } + if (!expand_test(L"foo\\$bar", EXPAND_SKIP_VARIABLES, L"foo$bar", 0)) + { + err(L"Failed to handle dollar sign in variable-skipping expansion"); + } + if (system("mkdir -p /tmp/fish_expand_test/")) err(L"mkdir failed"); if (system("touch /tmp/fish_expand_test/.foo")) err(L"touch failed"); if (system("touch /tmp/fish_expand_test/bar")) err(L"touch failed"); diff --git a/parse_util.cpp b/parse_util.cpp index 65cf77b2..13eca166 100644 --- a/parse_util.cpp +++ b/parse_util.cpp @@ -1318,13 +1318,6 @@ parser_test_error_bits_t parse_util_detect_errors(const wcstring &buff_src, pars errored = append_syntax_error(&parse_errors, node, ILLEGAL_CMD_ERR_MSG, command.c_str()); } - // Check that it doesn't contain a variable - // Note this check is clumsy (it doesn't allow for escaping) but it matches what we do in parse_execution - if (command.find(L'$') != wcstring::npos) - { - errored = append_syntax_error(&parse_errors, node, ILLEGAL_CMD_ERR_MSG, command.c_str()); - } - // Check that pipes are sound if (! errored && parser_is_pipe_forbidden(command) && is_in_pipeline) { -- cgit v1.2.3