File s390-tools-sles11sp2-zipl_helper_locale.patch of Package s390-tools
Description: zipl: localized scripting output leads to errors
Symptom: zipl is terminated with an error:
"Script could not determine target parameters"
Problem: zipl uses zipl_helper.device-mapper to print zipl parameters
for device mapper devices. This script parses the output
of other programs that might have a locale dependent
output. If so, the script is unable to parse the output.
Solution: Setup and use a standard locale to avoid localized
scripting output.
---
zipl/src/zipl_helper.device-mapper | 6 ++++++
1 file changed, 6 insertions(+)
--- a/zipl/src/zipl_helper.device-mapper
+++ b/zipl/src/zipl_helper.device-mapper
@@ -34,6 +34,7 @@
use strict;
use File::Basename;
+use POSIX qw/locale_h/;
# Required tools
our $dmsetup = "dmsetup";
@@ -113,6 +114,11 @@ my $toolname; # Name of tool
# Start
$toolname = basename($0);
+# Setup and use a standard locale to
+# avoid localized scripting output
+$ENV{LC_ALL} = "C"; # for child processes
+setlocale(LC_ALL, "C"); # for current process
+
# Use alternate code path if called as chreipl helper
if ($toolname eq "chreipl_helper.device-mapper") {
if (!defined($ARGV[0]) || !($ARGV[0] =~ /^\s*(\d+)\s*:\s*(\d+)\s*$/)) {