[libvirt] [PATCH] build: silence configure warning if ksh is missing

* configure.ac (lv_cv_wrapper_shell): Fix logic error if candidate shell is not available. Reported by Matthias Bolte. --- On IRC, Matthias reported a noisy configure run: eblake: checking for shell that supports <> redirection... ./configure: line 31581: ksh: command not found Worse, if a shell is missing, it doesn't change the contents of conftest.a, so that missing shell would be selected in the loop. This patch fixes both the noise and the wrong selection. configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 86a864b..7e7f295 100644 --- a/configure.ac +++ b/configure.ac @@ -616,7 +616,7 @@ if test "$with_qemu" = yes; then test $lv_cv_wrapper_shell = none && AC_MSG_ERROR([could not find decent shell]) echo a > conftest.a - $lv_cv_wrapper_shell -c ': 1<>conftest.a' + ($lv_cv_wrapper_shell -c ': 1<>conftest.a') 2>/dev/null && case `cat conftest.a`.$lv_cv_wrapper_shell in a./*) break;; dnl /bin/sh is good enough a.*) dnl bash, ksh, and zsh all understand 'command', use that -- 1.7.2.3

A missing shell was noisy, and the use of command to decipher a shell's absolute path requires "" rather than ''. * configure.ac (lv_cv_wrapper_shell): Fix logic errors if candidate shell is not available. Reported by Matthias Bolte. --- configure.ac | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 86a864b..26c030a 100644 --- a/configure.ac +++ b/configure.ac @@ -616,13 +616,13 @@ if test "$with_qemu" = yes; then test $lv_cv_wrapper_shell = none && AC_MSG_ERROR([could not find decent shell]) echo a > conftest.a - $lv_cv_wrapper_shell -c ': 1<>conftest.a' + ($lv_cv_wrapper_shell -c ': 1<>conftest.a') 2>/dev/null && case `cat conftest.a`.$lv_cv_wrapper_shell in a./*) break;; dnl /bin/sh is good enough a.*) dnl bash, ksh, and zsh all understand 'command', use that dnl to determine the absolute path of the shell lv_cv_wrapper_shell=`$lv_cv_wrapper_shell -c \ - 'command -v $lv_cv_wrapper_shell'` + "command -v $lv_cv_wrapper_shell"` case $lv_cv_wrapper_shell in /*) break;; esac -- 1.7.2.3

A missing shell was noisy, and the use of command to decipher a shell's absolute path requires "" rather than ''. * configure.ac (lv_cv_wrapper_shell): Fix logic errors if candidate shell is not available. Define a C string literal, not raw tokens. Reported by Matthias Bolte. --- Fixed in v3: the AC_DEFINE needs to output a string literal rather than raw text. Fixed in v2: don't call command -v on an empty substitution Actually tested by myself this time rather than relying on others, by manually overriding my /bin/sh with a broken dash, and double-checking the resulting config.h. configure.ac | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 86a864b..d942d3c 100644 --- a/configure.ac +++ b/configure.ac @@ -616,13 +616,13 @@ if test "$with_qemu" = yes; then test $lv_cv_wrapper_shell = none && AC_MSG_ERROR([could not find decent shell]) echo a > conftest.a - $lv_cv_wrapper_shell -c ': 1<>conftest.a' + ($lv_cv_wrapper_shell -c ': 1<>conftest.a') 2>/dev/null && case `cat conftest.a`.$lv_cv_wrapper_shell in a./*) break;; dnl /bin/sh is good enough a.*) dnl bash, ksh, and zsh all understand 'command', use that dnl to determine the absolute path of the shell lv_cv_wrapper_shell=`$lv_cv_wrapper_shell -c \ - 'command -v $lv_cv_wrapper_shell'` + "command -v $lv_cv_wrapper_shell"` case $lv_cv_wrapper_shell in /*) break;; esac @@ -636,7 +636,7 @@ if test "$with_qemu" = yes; then lv_wrapper_shell=$lv_cv_wrapper_shell fi if test "x$lv_wrapper_shell" != x; then - AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], [$lv_wrapper_shell], + AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], ["$lv_wrapper_shell"], [Define to the absolute path of a shell that does not truncate on <> redirection, if /bin/sh does not fit the bill]) fi -- 1.7.2.3

2010/10/26 Eric Blake <eblake@redhat.com>:
A missing shell was noisy, and the use of command to decipher a shell's absolute path requires "" rather than ''.
* configure.ac (lv_cv_wrapper_shell): Fix logic errors if candidate shell is not available. Define a C string literal, not raw tokens. Reported by Matthias Bolte. ---
Fixed in v3: the AC_DEFINE needs to output a string literal rather than raw text.
Fixed in v2: don't call command -v on an empty substitution
Actually tested by myself this time rather than relying on others, by manually overriding my /bin/sh with a broken dash, and double-checking the resulting config.h.
configure.ac | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac index 86a864b..d942d3c 100644 --- a/configure.ac +++ b/configure.ac @@ -616,13 +616,13 @@ if test "$with_qemu" = yes; then test $lv_cv_wrapper_shell = none && AC_MSG_ERROR([could not find decent shell]) echo a > conftest.a - $lv_cv_wrapper_shell -c ': 1<>conftest.a' + ($lv_cv_wrapper_shell -c ': 1<>conftest.a') 2>/dev/null && case `cat conftest.a`.$lv_cv_wrapper_shell in a./*) break;; dnl /bin/sh is good enough a.*) dnl bash, ksh, and zsh all understand 'command', use that dnl to determine the absolute path of the shell lv_cv_wrapper_shell=`$lv_cv_wrapper_shell -c \ - 'command -v $lv_cv_wrapper_shell'` + "command -v $lv_cv_wrapper_shell"` case $lv_cv_wrapper_shell in /*) break;; esac @@ -636,7 +636,7 @@ if test "$with_qemu" = yes; then lv_wrapper_shell=$lv_cv_wrapper_shell fi if test "x$lv_wrapper_shell" != x; then - AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], [$lv_wrapper_shell], + AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], ["$lv_wrapper_shell"], [Define to the absolute path of a shell that does not truncate on <> redirection, if /bin/sh does not fit the bill]) fi -- 1.7.2.3
Tested on Ubuntu 10.04 with broken dash. ACK. Matthias

On 10/26/2010 03:17 PM, Matthias Bolte wrote:
if test "x$lv_wrapper_shell" != x; then - AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], [$lv_wrapper_shell], + AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], ["$lv_wrapper_shell"], [Define to the absolute path of a shell that does not truncate on <> redirection, if /bin/sh does not fit the bill]) fi -- 1.7.2.3
Tested on Ubuntu 10.04 with broken dash.
ACK.
Thanks; pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Matthias Bolte