1 # DP: bash-4.2 upstream patch 005
9 Bug-Reported-by: Dennis Williamson <dennistwilliamson@gmail.com>
10 Bug-Reference-ID: <AANLkTikDbEV5rnbPc0zOfmZfBcg0xGetzLLzK+KjRiNa@mail.gmail.com>
11 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00147.html
15 Systems that use tzset() to set the local timezone require the TZ variable
16 to be in the environment. Bash must make sure the environment has been
17 modified with any updated value for TZ before calling tzset(). This
18 affects prompt string expansions and the `%T' printf conversion specification
19 on systems that do not allow bash to supply a replacement for getenv(3).
21 Patch (apply with `patch -p0'):
23 --- a/bash/builtins/printf.def
24 +++ b/bash/builtins/printf.def
26 secs = shell_start_time; /* roughly $SECONDS */
29 +#if defined (HAVE_TZSET)
30 + sv_tz ("TZ"); /* XXX -- just make sure */
32 tm = localtime (&secs);
33 n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
39 /* Make the current time/date into a string. */
40 (void) time (&the_time);
41 +#if defined (HAVE_TZSET)
42 + sv_tz ("TZ"); /* XXX -- just make sure */
44 tm = localtime (&the_time);
47 --- a/bash/patchlevel.h
48 +++ b/bash/patchlevel.h
50 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
51 looks for to find the patch level (for the sccs version string). */
56 #endif /* _PATCHLEVEL_H_ */
57 --- a/bash/variables.c
58 +++ b/bash/variables.c
59 @@ -3653,6 +3653,22 @@
69 + v = find_variable (name);
72 + array_needs_making = 1;
73 + maybe_make_export_env ();
80 maybe_make_export_env ()
83 { "TEXTDOMAIN", sv_locale },
84 { "TEXTDOMAINDIR", sv_locale },
86 -#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
87 +#if defined (HAVE_TZSET)
91 @@ -4558,12 +4574,13 @@
95 -#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
96 +#if defined (HAVE_TZSET)
102 + if (chkexport (name))
107 --- a/bash/variables.h
108 +++ b/bash/variables.h
111 extern void sort_variables __P((SHELL_VAR **));
113 +extern int chkexport __P((char *));
114 extern void maybe_make_export_env __P((void));
115 extern void update_export_env_inplace __P((char *, int, char *));
116 extern void put_command_name_into_env __P((char *));