|
|
ff19ae |
--- bash-4.2/redir.c 2015-04-27 23:03:55.663182162 +0200
|
|
|
ff19ae |
+++ bash-4.2/redir.c 2015-04-27 23:03:13.995181816 +0200
|
|
|
ff19ae |
@@ -63,6 +63,7 @@ int expanding_redir;
|
|
|
ff19ae |
|
|
|
ff19ae |
extern int posixly_correct;
|
|
|
ff19ae |
extern int last_command_exit_value;
|
|
|
ff19ae |
+extern int executing_builtin;
|
|
|
ff19ae |
extern REDIRECT *redirection_undo_list;
|
|
|
ff19ae |
extern REDIRECT *exec_redirection_undo_list;
|
|
|
ff19ae |
|
|
|
ff19ae |
@@ -307,11 +308,23 @@ write_here_string (fd, redirectee)
|
|
|
ff19ae |
WORD_DESC *redirectee;
|
|
|
ff19ae |
{
|
|
|
ff19ae |
char *herestr;
|
|
|
ff19ae |
- int herelen, n, e;
|
|
|
ff19ae |
+ int herelen, n, e, old;
|
|
|
ff19ae |
|
|
|
ff19ae |
expanding_redir = 1;
|
|
|
ff19ae |
+ /* Now that we've changed the variable search order to ignore the temp
|
|
|
ff19ae |
+ environment, see if we need to change the cached IFS values. */
|
|
|
ff19ae |
+ sv_ifs ("IFS");
|
|
|
ff19ae |
herestr = expand_string_to_string (redirectee->word, 0);
|
|
|
ff19ae |
expanding_redir = 0;
|
|
|
ff19ae |
+ /* Now we need to change the variable search order back to include the temp
|
|
|
ff19ae |
+ environment. We force the temp environment search by forcing
|
|
|
ff19ae |
+ executing_builtin to 1. This is what makes `read' get the right values
|
|
|
ff19ae |
+ for the IFS-related cached variables, for example. */
|
|
|
ff19ae |
+ old = executing_builtin;
|
|
|
ff19ae |
+ executing_builtin = 1;
|
|
|
ff19ae |
+ sv_ifs ("IFS");
|
|
|
ff19ae |
+ executing_builtin = old;
|
|
|
ff19ae |
+
|
|
|
ff19ae |
herelen = STRLEN (herestr);
|
|
|
ff19ae |
|
|
|
ff19ae |
n = write (fd, herestr, herelen);
|