Blame SOURCES/bash42-005

ff19ae
			     BASH PATCH REPORT
ff19ae
			     =================
ff19ae
ff19ae
Bash-Release:	4.2
ff19ae
Patch-ID:	bash42-005
ff19ae
ff19ae
Bug-Reported-by:	Dennis Williamson <dennistwilliamson@gmail.com>
ff19ae
Bug-Reference-ID:	<AANLkTikDbEV5rnbPc0zOfmZfBcg0xGetzLLzK+KjRiNa@mail.gmail.com>
ff19ae
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00147.html
ff19ae
ff19ae
Bug-Description:
ff19ae
ff19ae
Systems that use tzset() to set the local timezone require the TZ variable
ff19ae
to be in the environment.  Bash must make sure the environment has been
ff19ae
modified with any updated value for TZ before calling tzset().  This
ff19ae
affects prompt string expansions and the `%T' printf conversion specification
ff19ae
on systems that do not allow bash to supply a replacement for getenv(3).
ff19ae
ff19ae
Patch (apply with `patch -p0'):
ff19ae
ff19ae
*** ../bash-4.2-patched/variables.h	2010-12-02 20:22:01.000000000 -0500
ff19ae
--- variables.h	2011-02-19 19:57:12.000000000 -0500
ff19ae
***************
ff19ae
*** 314,317 ****
ff19ae
--- 314,318 ----
ff19ae
  extern void sort_variables __P((SHELL_VAR **));
ff19ae
  
ff19ae
+ extern int chkexport __P((char *));
ff19ae
  extern void maybe_make_export_env __P((void));
ff19ae
  extern void update_export_env_inplace __P((char *, int, char *));
ff19ae
*** ../bash-4.2-patched/variables.c	2011-01-24 20:07:48.000000000 -0500
ff19ae
--- variables.c	2011-02-19 20:04:50.000000000 -0500
ff19ae
***************
ff19ae
*** 3654,3657 ****
ff19ae
--- 3654,3673 ----
ff19ae
  }
ff19ae
  
ff19ae
+ int
ff19ae
+ chkexport (name)
ff19ae
+      char *name;
ff19ae
+ {
ff19ae
+   SHELL_VAR *v;
ff19ae
+ 
ff19ae
+   v = find_variable (name);
ff19ae
+   if (exported_p (v))
ff19ae
+     {
ff19ae
+       array_needs_making = 1;
ff19ae
+       maybe_make_export_env ();
ff19ae
+       return 1;
ff19ae
+     }
ff19ae
+   return 0;
ff19ae
+ }
ff19ae
+ 
ff19ae
  void
ff19ae
  maybe_make_export_env ()
ff19ae
***************
ff19ae
*** 4215,4219 ****
ff19ae
    { "TEXTDOMAINDIR", sv_locale },
ff19ae
  
ff19ae
! #if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
ff19ae
    { "TZ", sv_tz },
ff19ae
  #endif
ff19ae
--- 4231,4235 ----
ff19ae
    { "TEXTDOMAINDIR", sv_locale },
ff19ae
  
ff19ae
! #if defined (HAVE_TZSET)
ff19ae
    { "TZ", sv_tz },
ff19ae
  #endif
ff19ae
***************
ff19ae
*** 4559,4568 ****
ff19ae
  #endif /* HISTORY */
ff19ae
  
ff19ae
! #if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
ff19ae
  void
ff19ae
  sv_tz (name)
ff19ae
       char *name;
ff19ae
  {
ff19ae
!   tzset ();
ff19ae
  }
ff19ae
  #endif
ff19ae
--- 4575,4585 ----
ff19ae
  #endif /* HISTORY */
ff19ae
  
ff19ae
! #if defined (HAVE_TZSET)
ff19ae
  void
ff19ae
  sv_tz (name)
ff19ae
       char *name;
ff19ae
  {
ff19ae
!   if (chkexport (name))
ff19ae
!     tzset ();
ff19ae
  }
ff19ae
  #endif
ff19ae
*** ../bash-4.2-patched/parse.y	2011-01-02 15:48:11.000000000 -0500
ff19ae
--- parse.y	2011-02-19 20:05:00.000000000 -0500
ff19ae
***************
ff19ae
*** 5136,5139 ****
ff19ae
--- 5136,5142 ----
ff19ae
  	      /* Make the current time/date into a string. */
ff19ae
  	      (void) time (&the_time);
ff19ae
+ #if defined (HAVE_TZSET)
ff19ae
+ 	      sv_tz ("TZ");		/* XXX -- just make sure */
ff19ae
+ #endif
ff19ae
  	      tm = localtime (&the_time);
ff19ae
  
ff19ae
*** ../bash-4.2-patched/builtins/printf.def	2010-11-23 10:02:55.000000000 -0500
ff19ae
--- builtins/printf.def	2011-02-19 20:05:04.000000000 -0500
ff19ae
***************
ff19ae
*** 466,469 ****
ff19ae
--- 466,472 ----
ff19ae
  		else
ff19ae
  		  secs = arg;
ff19ae
+ #if defined (HAVE_TZSET)
ff19ae
+ 		sv_tz ("TZ");		/* XXX -- just make sure */
ff19ae
+ #endif
ff19ae
  		tm = localtime (&secs;;
ff19ae
  		n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
ff19ae
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
ff19ae
--- patchlevel.h	Thu Feb 24 21:41:34 2011
ff19ae
***************
ff19ae
*** 26,30 ****
ff19ae
     looks for to find the patch level (for the sccs version string). */
ff19ae
  
ff19ae
! #define PATCHLEVEL 4
ff19ae
  
ff19ae
  #endif /* _PATCHLEVEL_H_ */
ff19ae
--- 26,30 ----
ff19ae
     looks for to find the patch level (for the sccs version string). */
ff19ae
  
ff19ae
! #define PATCHLEVEL 5
ff19ae
  
ff19ae
  #endif /* _PATCHLEVEL_H_ */