7 Bug-Reported-by: Christian Krause <chkr@plauener.de>
8 Bug-Reference-ID: Thu, 25 Jun 2009 21:47:59 +0200
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-06/msg00078.html
13 Previous versions of bash accepted strings in the initial environment
14 that were not valid shell variable assignments, usually because the
15 names were invalid, but still created shell variables from them and
16 passed them to child processes in the environment.
18 Bash-4.0 ignores those names and does not pass them to child processes.
19 Some users and automated processes depend on invalid variables being
20 ignored and passed to child processes.
22 This patch makes bash continue to ignore the invalid names, but pass
23 them to child processes in the export environment.
27 *** ../bash-4.0-patched/variables.c 2009-01-04 14:32:46.000000000 -0500
28 --- variables.c 2009-06-29 09:17:20.000000000 -0400
32 static int visible_var __P((SHELL_VAR *));
33 static int visible_and_exported __P((SHELL_VAR *));
34 + static int export_environment_candidate __P((SHELL_VAR *));
35 static int local_and_exported __P((SHELL_VAR *));
36 static int variable_in_context __P((SHELL_VAR *));
41 else if (legal_identifier (name))
43 temp_var = bind_variable (name, string, 0);
44 ! VSETATTR (temp_var, (att_exported | att_imported));
45 array_needs_making = 1;
51 else if (legal_identifier (name))
56 temp_var = bind_variable (name, string, 0);
57 ! if (legal_identifier (name))
58 ! VSETATTR (temp_var, (att_exported | att_imported));
60 ! VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
61 array_needs_making = 1;
68 + /* Candidate variables for the export environment are either valid variables
69 + with the export attribute or invalid variables inherited from the initial
70 + environment and simply passed through. */
72 + export_environment_candidate (var)
75 + return (exported_p (var) && (invisible_p (var) == 0 || imported_p (var)));
78 /* Return non-zero if VAR is a local variable in the current context and
86 vars = map_over (visible_and_exported, vcxt);
88 + vars = map_over (export_environment_candidate, vcxt);
92 *** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
93 --- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
96 looks for to find the patch level (for the sccs version string). */
98 ! #define PATCHLEVEL 28
100 #endif /* _PATCHLEVEL_H_ */
102 looks for to find the patch level (for the sccs version string). */
104 ! #define PATCHLEVEL 29
106 #endif /* _PATCHLEVEL_H_ */