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