7 Bug-Reported-by: Dennis Williamson <dennistwilliamson@gmail.com>
8 Bug-Reference-ID: <AANLkTikDbEV5rnbPc0zOfmZfBcg0xGetzLLzK+KjRiNa@mail.gmail.com>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00147.html
13 Systems that use tzset() to set the local timezone require the TZ variable
14 to be in the environment. Bash must make sure the environment has been
15 modified with any updated value for TZ before calling tzset(). This
16 affects prompt string expansions and the `%T' printf conversion specification
17 on systems that do not allow bash to supply a replacement for getenv(3).
19 Patch (apply with `patch -p0'):
23 @@ -313,6 +313,7 @@ extern void set_func_auto_export __P((co
25 extern void sort_variables __P((SHELL_VAR **));
27 +extern int chkexport __P((char *));
28 extern void maybe_make_export_env __P((void));
29 extern void update_export_env_inplace __P((char *, int, char *));
30 extern void put_command_name_into_env __P((char *));
33 @@ -3653,6 +3653,22 @@ n_shell_variables ()
43 + v = find_variable (name);
46 + array_needs_making = 1;
47 + maybe_make_export_env ();
54 maybe_make_export_env ()
56 @@ -4214,7 +4230,7 @@ static struct name_and_function special_
57 { "TEXTDOMAIN", sv_locale },
58 { "TEXTDOMAINDIR", sv_locale },
60 -#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
61 +#if defined (HAVE_TZSET)
65 @@ -4558,12 +4574,13 @@ sv_histtimefmt (name)
69 -#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
70 +#if defined (HAVE_TZSET)
76 + if (chkexport (name))
83 @@ -5135,6 +5135,9 @@ decode_prompt_string (string)
85 /* Make the current time/date into a string. */
86 (void) time (&the_time);
87 +#if defined (HAVE_TZSET)
88 + sv_tz ("TZ"); /* XXX -- just make sure */
90 tm = localtime (&the_time);
93 --- a/builtins/printf.def
94 +++ b/builtins/printf.def
95 @@ -465,6 +465,9 @@ printf_builtin (list)
96 secs = shell_start_time; /* roughly $SECONDS */
99 +#if defined (HAVE_TZSET)
100 + sv_tz ("TZ"); /* XXX -- just make sure */
102 tm = localtime (&secs);
103 n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
108 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
109 looks for to find the patch level (for the sccs version string). */
111 -#define PATCHLEVEL 4
112 +#define PATCHLEVEL 5
114 #endif /* _PATCHLEVEL_H_ */