change to how invisible characters in prompt string expansions are escaped

This commit is contained in:
Chet Ramey
2022-03-18 10:23:53 -04:00
parent b6a567e7f1
commit 68ab281e30
8 changed files with 974 additions and 681 deletions
+12 -2
View File
@@ -5742,7 +5742,12 @@ decode_prompt_string (string)
temp = base_pathname (shell_name);
/* Try to quote anything the user can set in the file system */
if (promptvars || posixly_correct)
temp = sh_backslash_quote_for_double_quotes (temp, 1);
{
char *t;
t = sh_strvis (temp);
temp = sh_backslash_quote_for_double_quotes (t, 0);
free (t);
}
else
temp = sh_strvis (temp);
goto add_string;
@@ -5819,7 +5824,12 @@ decode_prompt_string (string)
/* Make sure that expand_prompt_string is called with a
second argument of Q_DOUBLE_QUOTES if we use this
function here. */
temp = sh_backslash_quote_for_double_quotes (t_string, 1);
{
char *t;
t = sh_strvis (t_string);
temp = sh_backslash_quote_for_double_quotes (t, 0);
free (t);
}
else
temp = sh_strvis (t_string);