Allow running executables with $ in their name.

Fixes #1686
This commit is contained in:
ridiculousfish 2014-09-21 23:34:49 -07:00
parent 2450d00693
commit 7d7a636f24
2 changed files with 6 additions and 8 deletions

View file

@ -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");

View file

@ -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)
{