usr/src/cmd/bash/Patches-4.0/bash40-029
branchoi_151a
changeset 254 9c2a4ac793f0
equal deleted inserted replaced
253:702bbe36863b 254:9c2a4ac793f0
       
     1 			     BASH PATCH REPORT
       
     2 			     =================
       
     3 
       
     4 Bash-Release: 4.0
       
     5 Patch-ID: bash40-029
       
     6 
       
     7 Bug-Reported-by:	Christian Krause <[email protected]>
       
     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
       
    10 
       
    11 Bug-Description:
       
    12 
       
    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.
       
    17 
       
    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.
       
    21 
       
    22 This patch makes bash continue to ignore the invalid names, but pass
       
    23 them to child processes in the export environment.
       
    24 
       
    25 Patch:
       
    26 
       
    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
       
    29 ***************
       
    30 *** 253,256 ****
       
    31 --- 255,259 ----
       
    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 *));
       
    37 ***************
       
    38 *** 376,383 ****
       
    39   #  endif
       
    40   #endif
       
    41         else if (legal_identifier (name))
       
    42   	{
       
    43   	  temp_var = bind_variable (name, string, 0);
       
    44 ! 	  VSETATTR (temp_var, (att_exported | att_imported));
       
    45   	  array_needs_making = 1;
       
    46   	}
       
    47 --- 379,393 ----
       
    48   #  endif
       
    49   #endif
       
    50 + #if 0
       
    51         else if (legal_identifier (name))
       
    52 + #else
       
    53 +       else
       
    54 + #endif
       
    55   	{
       
    56   	  temp_var = bind_variable (name, string, 0);
       
    57 ! 	  if (legal_identifier (name))
       
    58 ! 	    VSETATTR (temp_var, (att_exported | att_imported));
       
    59 ! 	  else
       
    60 ! 	    VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
       
    61   	  array_needs_making = 1;
       
    62   	}
       
    63 ***************
       
    64 *** 3083,3086 ****
       
    65 --- 3098,3111 ----
       
    66   }
       
    67   
       
    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. */
       
    71 + static int
       
    72 + export_environment_candidate (var)
       
    73 +      SHELL_VAR *var;
       
    74 + {
       
    75 +   return (exported_p (var) && (invisible_p (var) == 0 || imported_p (var)));
       
    76 + }
       
    77 + 
       
    78   /* Return non-zero if VAR is a local variable in the current context and
       
    79      is exported. */
       
    80 ***************
       
    81 *** 3439,3443 ****
       
    82 --- 3464,3472 ----
       
    83     SHELL_VAR **vars;
       
    84   
       
    85 + #if 0
       
    86     vars = map_over (visible_and_exported, vcxt);
       
    87 + #else
       
    88 +   vars = map_over (export_environment_candidate, vcxt);
       
    89 + #endif
       
    90   
       
    91     if (vars == 0)
       
    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
       
    94 ***************
       
    95 *** 26,30 ****
       
    96      looks for to find the patch level (for the sccs version string). */
       
    97   
       
    98 ! #define PATCHLEVEL 28
       
    99   
       
   100   #endif /* _PATCHLEVEL_H_ */
       
   101 --- 26,30 ----
       
   102      looks for to find the patch level (for the sccs version string). */
       
   103   
       
   104 ! #define PATCHLEVEL 29
       
   105   
       
   106   #endif /* _PATCHLEVEL_H_ */