]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-4.2 patch 5
authorChet Ramey <chet.ramey@case.edu>
Wed, 23 Nov 2011 01:00:19 +0000 (20:00 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 23 Nov 2011 01:00:19 +0000 (20:00 -0500)
builtins/printf.def
parse.y
patchlevel.h
variables.c
variables.h

index 7892cb5a0940acb0ecb11a1348abe3fd8de349df..9eca2152147a9ac33fd3111d43498a1bed41a3a9 100644 (file)
@@ -465,6 +465,9 @@ printf_builtin (list)
                  secs = shell_start_time;      /* roughly $SECONDS */
                else
                  secs = arg;
+#if defined (HAVE_TZSET)
+               sv_tz ("TZ");           /* XXX -- just make sure */
+#endif
                tm = localtime (&secs);
                n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
                free (timefmt);
diff --git a/parse.y b/parse.y
index b5c94e7a8ca4cb05c176a304fcdfb0b9a2534d30..65ec86aaeb8f9e330b83e448f371a76b14f112af 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -5135,6 +5135,9 @@ decode_prompt_string (string)
            case 'A':
              /* Make the current time/date into a string. */
              (void) time (&the_time);
+#if defined (HAVE_TZSET)
+             sv_tz ("TZ");             /* XXX -- just make sure */
+#endif
              tm = localtime (&the_time);
 
              if (c == 'd')
index 2b93e977ae10c0032b3cc2725c8514fe6284ca0e..5cca30b8b9e60cfbc6415d3984cf5e6195186ec7 100644 (file)
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 4
+#define PATCHLEVEL 5
 
 #endif /* _PATCHLEVEL_H_ */
index 3c20c3c00bd475b1396c1446e70d5521d14b3182..daacdbf0ecb8f78d4c2fa3bf93a9e760f1fd68b9 100644 (file)
@@ -3653,6 +3653,22 @@ n_shell_variables ()
   return n;
 }
 
+int
+chkexport (name)
+     char *name;
+{
+  SHELL_VAR *v;
+
+  v = find_variable (name);
+  if (exported_p (v))
+    {
+      array_needs_making = 1;
+      maybe_make_export_env ();
+      return 1;
+    }
+  return 0;
+}
+
 void
 maybe_make_export_env ()
 {
@@ -4214,7 +4230,7 @@ static struct name_and_function special_vars[] = {
   { "TEXTDOMAIN", sv_locale },
   { "TEXTDOMAINDIR", sv_locale },
 
-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
+#if defined (HAVE_TZSET)
   { "TZ", sv_tz },
 #endif
 
@@ -4558,12 +4574,13 @@ sv_histtimefmt (name)
 }
 #endif /* HISTORY */
 
-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
+#if defined (HAVE_TZSET)
 void
 sv_tz (name)
      char *name;
 {
-  tzset ();
+  if (chkexport (name))
+    tzset ();
 }
 #endif
 
index 7041ca94d562a6ce1238be78c45a7e09668eaa69..84e92bbf9ec362a79110f5653a1b3414e6a19bb4 100644 (file)
@@ -313,6 +313,7 @@ extern void set_func_auto_export __P((const char *));
 
 extern void sort_variables __P((SHELL_VAR **));
 
+extern int chkexport __P((char *));
 extern void maybe_make_export_env __P((void));
 extern void update_export_env_inplace __P((char *, int, char *));
 extern void put_command_name_into_env __P((char *));