Get error messages in the C locale for comparision with make output.
authorPaul Smith <psmith@gnu.org>
Sun, 9 Sep 2012 22:52:50 +0000 (22:52 +0000)
committerPaul Smith <psmith@gnu.org>
Sun, 9 Sep 2012 22:52:50 +0000 (22:52 +0000)
Fixes Savannah bug #35764.

tests/ChangeLog
tests/scripts/functions/file

index cc1724c3b6e87aac534be2951ed2385f2bc1ac50..5e35053e83bb1c151e1e87d7500b4e2328f83fe8 100644 (file)
@@ -1,5 +1,8 @@
 2012-09-09  Paul Smith  <psmith@gnu.org>
 
+       * scripts/functions/file: Get errors in the C locale, not the
+       current locale.  Fixes Savannah bug #35764.
+
        * scripts/features/escape: Check that backslashes before
        non-special characters are not removed.
 
index b994af87f60875c5e71b0b543099cf97eafc1507..9a4cd024a1d5940288d7387549d2c0283f67cf8f 100644 (file)
@@ -35,9 +35,16 @@ touch('file.out');
 chmod(0444, 'file.out');
 
 # Find the error that will be printed
+# This seems complicated, but we need the message from the C locale
+my $loc = undef;
+if ($has_POSIX) {
+    $loc = POSIX::setlocale(POSIX::LC_MESSAGES);
+    POSIX::setlocale(POSIX::LC_MESSAGES, 'C');
+}
 my $e;
 open(my $F, '>', 'file.out') and die "Opened read-only file!\n";
 $e = "$!";
+$loc and POSIX::setlocale(POSIX::LC_MESSAGES, $loc);
 
 run_make_test(q!
 define A