rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone

Blame SOURCES/bash-4.2-ifs-in-temp-env.patch

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