aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-09-21 23:34:49 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-09-21 23:35:19 -0700
commit7d7a636f2497dae736c7dc7b2378a7d51e28fd92 (patch)
tree2a31ffc26c05f6a683ac850f40cae8de889b5255
parent2450d00693358bf6466621377f56bb815d44374a (diff)
Allow running executables with $ in their name.
Fixes #1686
-rw-r--r--fish_tests.cpp7
-rw-r--r--parse_util.cpp7
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<completion_t> 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)
{