diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-03-08 12:00:03 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-03-08 16:19:54 +0000 |
commit | 8800292351dcf1f538c47ac6acf834ac2633ce6b (patch) | |
tree | 6ea980d59b57459ff55d6768b05d63e3f8f9b971 /configure.ac | |
parent | bbbd1f1eec7ce078a37bc3a23a7f1e8ec4070634 (diff) |
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@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 49b060739508..20bf399b752c 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 |