ntfsprogs: obsoleted
[packages.git] / utils / bash / patches / 105-upstream-bash42-005.patch
1                              BASH PATCH REPORT
2                              =================
3
4 Bash-Release:   4.2
5 Patch-ID:       bash42-005
6
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
10
11 Bug-Description:
12
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).
18
19 Patch (apply with `patch -p0'):
20
21 --- a/variables.h
22 +++ b/variables.h
23 @@ -313,6 +313,7 @@ extern void set_func_auto_export __P((co
24  
25  extern void sort_variables __P((SHELL_VAR **));
26  
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 *));
31 --- a/variables.c
32 +++ b/variables.c
33 @@ -3653,6 +3653,22 @@ n_shell_variables ()
34    return n;
35  }
36  
37 +int
38 +chkexport (name)
39 +     char *name;
40 +{
41 +  SHELL_VAR *v;
42 +
43 +  v = find_variable (name);
44 +  if (exported_p (v))
45 +    {
46 +      array_needs_making = 1;
47 +      maybe_make_export_env ();
48 +      return 1;
49 +    }
50 +  return 0;
51 +}
52 +
53  void
54  maybe_make_export_env ()
55  {
56 @@ -4214,7 +4230,7 @@ static struct name_and_function special_
57    { "TEXTDOMAIN", sv_locale },
58    { "TEXTDOMAINDIR", sv_locale },
59  
60 -#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
61 +#if defined (HAVE_TZSET)
62    { "TZ", sv_tz },
63  #endif
64  
65 @@ -4558,12 +4574,13 @@ sv_histtimefmt (name)
66  }
67  #endif /* HISTORY */
68  
69 -#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
70 +#if defined (HAVE_TZSET)
71  void
72  sv_tz (name)
73       char *name;
74  {
75 -  tzset ();
76 +  if (chkexport (name))
77 +    tzset ();
78  }
79  #endif
80  
81 --- a/parse.y
82 +++ b/parse.y
83 @@ -5135,6 +5135,9 @@ decode_prompt_string (string)
84             case 'A':
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 */
89 +#endif
90               tm = localtime (&the_time);
91  
92               if (c == 'd')
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 */
97                 else
98                   secs = arg;
99 +#if defined (HAVE_TZSET)
100 +               sv_tz ("TZ");           /* XXX -- just make sure */
101 +#endif
102                 tm = localtime (&secs);
103                 n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
104                 free (timefmt);
105 --- a/patchlevel.h
106 +++ b/patchlevel.h
107 @@ -25,6 +25,6 @@
108     regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
109     looks for to find the patch level (for the sccs version string). */
110  
111 -#define PATCHLEVEL 4
112 +#define PATCHLEVEL 5
113  
114  #endif /* _PATCHLEVEL_H_ */