]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Avoid re-exec-self in bug-setlocale1.
authorRoland McGrath <roland@hack.frob.com>
Thu, 5 Mar 2015 20:58:49 +0000 (12:58 -0800)
committerRoland McGrath <roland@hack.frob.com>
Thu, 5 Mar 2015 20:58:49 +0000 (12:58 -0800)
ChangeLog
Makeconfig
Rules
localedata/ChangeLog
localedata/Makefile
localedata/bug-setlocale1.c

index 2a2c866d0b21e0904df786deaaf86aad33cf9fbf..b9cf4583b67c56fe32617fe0be0e319494aab578 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-05  Roland McGrath  <roland@hack.frob.com>
+
+       * Makeconfig (test-wrapper-env-only): New variable.
+       * Rules (make-test-out): If variable $*-ENV-only is nonempty,
+       then use that with $(test-wrapper-env-only) rather than using
+       $(test-wrapper-env) $(run-program-env) $($*-ENV).
+
 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
 
        [BZ #18082]
index 509b5bd3df241f146d608b38c235a0c278beb5aa..4e336a4ed8537d759847a02312fdb123f7f02868 100644 (file)
@@ -611,6 +611,11 @@ endif
 ifndef test-wrapper-env
 test-wrapper-env = $(test-wrapper) env
 endif
+# Likewise, but the program's environment will be empty except for any
+# explicit <variable>=<value> assignments preceding the program name.
+ifndef test-wrapper-env-only
+test-wrapper-env-only = $(test-wrapper) env -i
+endif
 
 # Whether to run test programs built for the library's host system.
 ifndef run-built-tests
diff --git a/Rules b/Rules
index cb4e1fb76738ad06ef4dd47ae92d9a2c3d01ec0f..829beac4874135fb15da050010eab16864874788 100644 (file)
--- a/Rules
+++ b/Rules
@@ -186,9 +186,11 @@ ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
 # These are the implicit rules for making test outputs
 # from the test programs and whatever input files are present.
 
-make-test-out = $(test-wrapper-env) \
-               $(run-program-env) \
-               $($*-ENV) $(host-test-program-cmd) $($*-ARGS)
+define make-test-out
+$(if $($*-ENV-only),$(test-wrapper-env-only) $($*-ENV-only),\
+     $(test-wrapper-env) $(run-program-env) $($*-ENV)) \
+$(host-test-program-cmd) $($*-ARGS)
+endef
 $(objpfx)%.out: %.input $(objpfx)%
        $(make-test-out) > $@ < $(word 1,$^); \
        $(evaluate-test)
index ceb373f1be36dc6dd55e1ca3d7e14420a9f037ba..61857f57a2b1bdceb02d020b7b00aad03714ec8a 100644 (file)
@@ -1,3 +1,14 @@
+2015-03-04  Roland McGrath  <roland@hack.frob.com>
+
+       * bug-setlocale1.c (do_test): Remove argument handling and
+       self-exec'ing logic.  Just expect to be run with the right
+       variables (and nothing else) directly in the environment instead.
+       (TEST_FUNCTION): Don't pass arguments to do_test.
+       * Makefile (bug-setlocale1-ARGS, bug-setlocale1-static-ARGS):
+       Variables removed.
+       (bug-setlocale1-ENV-only, bug-setlocale1-static-ENV-only):
+       New variables.
+
 2015-02-23  Alexandre Oliva <aoliva@redhat.com>
 
        * unicode-gen/ctype_compatibility.py: Use date ranges in
index d1218f57841f22429db5fbfed4b07b1ec89bcdeb..0f6772580026f457733e057a4bcba641c652046b 100644 (file)
@@ -237,8 +237,8 @@ $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
        $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
        $(evaluate-test)
 
-bug-setlocale1-ARGS = -- $(host-test-program-cmd)
-bug-setlocale1-static-ARGS = $(bug-setlocale1-ARGS)
+bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
+bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
 
 $(objdir)/iconvdata/gconv-modules:
        $(MAKE) -C ../iconvdata subdir=iconvdata $@
index dc7f6f3f081ed8e20de05a168e9df72125724a22..546ea7beb8116728ca7c74ce82a187f57d426db3 100644 (file)
@@ -7,44 +7,8 @@
 
 
 static int
-do_test (int argc, char *argv[])
+do_test (void)
 {
-  if (argc > 1)
-    {
-      char *newargv[5];
-      int i;
-      if (argc != 2 && argc != 5)
-       {
-         printf ("wrong number of arguments (%d)\n", argc);
-         return 1;
-       }
-
-      for (i = 0; i < (argc == 5 ? 4 : 1); i++)
-       newargv[i] = argv[i + 1];
-      newargv[i] = NULL;
-
-      char *env[3];
-      env[0] = (char *) "LC_CTYPE=de_DE.UTF-8";
-      char *loc = getenv ("LOCPATH");
-      if (loc == NULL || loc[0] == '\0')
-       {
-         puts ("LOCPATH not set");
-         return 1;
-       }
-      asprintf (&env[1], "LOCPATH=%s", loc);
-      if (env[1] == NULL)
-       {
-         puts ("asprintf failed");
-         return 1;
-       }
-      env[2] = NULL;
-
-      execve (newargv[0], newargv, env);
-
-      puts ("execve returned");
-      return 1;
-    }
-
   int result = 0;
 
   char *a = setlocale (LC_ALL, "");
@@ -128,5 +92,5 @@ do_test (int argc, char *argv[])
   return result;
 }
 
-#define TEST_FUNCTION do_test (argc, argv)
+#define TEST_FUNCTION do_test ()
 #include "../test-skeleton.c"