rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone

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

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