[Libreoffice-commits] core.git: configure.ac

Jan-Marek Glogowski glogow at fbihome.de
Wed Mar 8 16:20:37 UTC 2017


 configure.ac |   30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

New commits:
commit 8800292351dcf1f538c47ac6acf834ac2633ce6b
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Mar 8 12:00:03 2017 +0100

    Stop bash complaining about \0 bytes in input
    
    Reading Windows registry entries via "/proc/registry*" lets current
    bash complain about "command substitution: ignored null byte in input".
    This happens, because Cygwin '\0'-terminates all registry values.
    
    To quieten bash, directly strip the registry values of '\0' using tr.
    
    Change-Id: Ibb38761587691ef20911f025c711553426b1a222
    Reviewed-on: https://gerrit.libreoffice.org/34969
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/configure.ac b/configure.ac
index 49b0607..20bf399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3173,28 +3173,32 @@ dnl ===================================================================
 dnl Windows specific tests and stuff
 dnl ===================================================================
 
-# Get a value from the 32-bit side of the Registry
-reg_get_value_32()
+reg_get_value()
 {
     # Return value: $regvalue
     unset regvalue
-    _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
 
-    if test $? -eq 0; then
-        regvalue=$_regvalue
+    local _regentry="/proc/registry${1}/${2}"
+    if test -f "$_regentry"; then
+        # Stop bash complaining about \0 bytes in input, as it can't handle them.
+        # Registry keys read via /proc/registry* are always \0 terminated!
+        local _regvalue=$(tr -d '\0' < "$_regentry")
+        if test $? -eq 0; then
+            regvalue=$_regvalue
+        fi
     fi
 }
 
+# Get a value from the 32-bit side of the Registry
+reg_get_value_32()
+{
+    reg_get_value "32" "$1"
+}
+
 # Get a value from the 64-bit side of the Registry
 reg_get_value_64()
 {
-    # Return value: $regvalue
-    unset regvalue
-    _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
-
-    if test $? -eq 0; then
-        regvalue=$_regvalue
-    fi
+    reg_get_value "64" "$1"
 }
 
 if test "$_os" = "WINNT"; then
@@ -6670,7 +6674,7 @@ if test "$ENABLE_JAVA" != ""; then
 
         if test -z "$with_jdk_home"; then
             for ver in 1.8 1.7 1.6; do
-                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
+                reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
                 if test -n "$regvalue"; then
                     _jdk_home=$regvalue
                     break


More information about the Libreoffice-commits mailing list