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