|
|
ff19ae |
diff --git a/parse.y b/parse.y
|
|
|
ff19ae |
index 12d6def..d4a93a2 100644
|
|
|
ff19ae |
--- a/parse.y
|
|
|
ff19ae |
+++ b/parse.y
|
|
|
ff19ae |
@@ -5103,7 +5103,7 @@ decode_prompt_string (string)
|
|
|
ff19ae |
size_t result_size;
|
|
|
ff19ae |
int result_index;
|
|
|
ff19ae |
int c, n, i;
|
|
|
ff19ae |
- char *temp, octal_string[4];
|
|
|
ff19ae |
+ char *temp, *t_host, octal_string[4];
|
|
|
ff19ae |
struct tm *tm;
|
|
|
ff19ae |
time_t the_time;
|
|
|
ff19ae |
char timebuf[128];
|
|
|
ff19ae |
@@ -5251,7 +5251,11 @@ decode_prompt_string (string)
|
|
|
ff19ae |
|
|
|
ff19ae |
case 's':
|
|
|
ff19ae |
temp = base_pathname (shell_name);
|
|
|
ff19ae |
- temp = savestring (temp);
|
|
|
ff19ae |
+ /* Try to quote anything the user can set in the file system */
|
|
|
ff19ae |
+ if (promptvars || posixly_correct)
|
|
|
ff19ae |
+ temp = sh_backslash_quote_for_double_quotes (temp);
|
|
|
ff19ae |
+ else
|
|
|
ff19ae |
+ temp = savestring (temp);
|
|
|
ff19ae |
goto add_string;
|
|
|
ff19ae |
|
|
|
ff19ae |
case 'v':
|
|
|
ff19ae |
@@ -5337,9 +5341,17 @@ decode_prompt_string (string)
|
|
|
ff19ae |
|
|
|
ff19ae |
case 'h':
|
|
|
ff19ae |
case 'H':
|
|
|
ff19ae |
- temp = savestring (current_host_name);
|
|
|
ff19ae |
- if (c == 'h' && (t = (char *)strchr (temp, '.')))
|
|
|
ff19ae |
+ t_host = savestring (current_host_name);
|
|
|
ff19ae |
+ if (c == 'h' && (t = (char *)strchr (t_host, '.')))
|
|
|
ff19ae |
*t = '\0';
|
|
|
ff19ae |
+ if (promptvars || posixly_correct)
|
|
|
ff19ae |
+ /* Make sure that expand_prompt_string is called with a
|
|
|
ff19ae |
+ second argument of Q_DOUBLE_QUOTES if we use this
|
|
|
ff19ae |
+ function here. */
|
|
|
ff19ae |
+ temp = sh_backslash_quote_for_double_quotes (t_host);
|
|
|
ff19ae |
+ else
|
|
|
ff19ae |
+ temp = savestring (t_host);
|
|
|
ff19ae |
+ free (t_host);
|
|
|
ff19ae |
goto add_string;
|
|
|
ff19ae |
|
|
|
ff19ae |
case '#':
|
|
|
ff19ae |
diff --git a/y.tab.c b/y.tab.c
|
|
|
ff19ae |
index 23b88bc..1c0f5a1 100644
|
|
|
ff19ae |
--- a/y.tab.c
|
|
|
ff19ae |
+++ b/y.tab.c
|
|
|
ff19ae |
@@ -7368,7 +7368,7 @@ decode_prompt_string (string)
|
|
|
ff19ae |
size_t result_size;
|
|
|
ff19ae |
int result_index;
|
|
|
ff19ae |
int c, n, i;
|
|
|
ff19ae |
- char *temp, octal_string[4];
|
|
|
ff19ae |
+ char *temp, *t_host, octal_string[4];
|
|
|
ff19ae |
struct tm *tm;
|
|
|
ff19ae |
time_t the_time;
|
|
|
ff19ae |
char timebuf[128];
|
|
|
ff19ae |
@@ -7513,7 +7513,11 @@ decode_prompt_string (string)
|
|
|
ff19ae |
|
|
|
ff19ae |
case 's':
|
|
|
ff19ae |
temp = base_pathname (shell_name);
|
|
|
ff19ae |
- temp = savestring (temp);
|
|
|
ff19ae |
+ /* Try to quote anything the user can set in the file system */
|
|
|
ff19ae |
+ if (promptvars || posixly_correct)
|
|
|
ff19ae |
+ temp = sh_backslash_quote_for_double_quotes (temp);
|
|
|
ff19ae |
+ else
|
|
|
ff19ae |
+ temp = savestring (temp);
|
|
|
ff19ae |
goto add_string;
|
|
|
ff19ae |
|
|
|
ff19ae |
case 'v':
|
|
|
ff19ae |
@@ -7599,9 +7603,17 @@ decode_prompt_string (string)
|
|
|
ff19ae |
|
|
|
ff19ae |
case 'h':
|
|
|
ff19ae |
case 'H':
|
|
|
ff19ae |
- temp = savestring (current_host_name);
|
|
|
ff19ae |
- if (c == 'h' && (t = (char *)strchr (temp, '.')))
|
|
|
ff19ae |
+ t_host = savestring (current_host_name);
|
|
|
ff19ae |
+ if (c == 'h' && (t = (char *)strchr (t_host, '.')))
|
|
|
ff19ae |
*t = '\0';
|
|
|
ff19ae |
+ if (promptvars || posixly_correct)
|
|
|
ff19ae |
+ /* Make sure that expand_prompt_string is called with a
|
|
|
ff19ae |
+ second argument of Q_DOUBLE_QUOTES if we use this
|
|
|
ff19ae |
+ function here. */
|
|
|
ff19ae |
+ temp = sh_backslash_quote_for_double_quotes (t_host);
|
|
|
ff19ae |
+ else
|
|
|
ff19ae |
+ temp = savestring (t_host);
|
|
|
ff19ae |
+ free (t_host);
|
|
|
ff19ae |
goto add_string;
|
|
|
ff19ae |
|
|
|
ff19ae |
case '#':
|
|
|
ff19ae |
--
|
|
|
ff19ae |
2.9.3
|
|
|
ff19ae |
|