From 514ed59845d7ff2f9e718f718fb8c324c9c30225 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Wed, 11 Apr 2012 21:47:32 +0300 Subject: [PATCH] Re: [PATCH 1/4] Make configure use /bin/bash instead of /bin/sh --- 30/25bd4b41b70af53c58a4e749500d397db051b8 | 148 ++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 30/25bd4b41b70af53c58a4e749500d397db051b8 diff --git a/30/25bd4b41b70af53c58a4e749500d397db051b8 b/30/25bd4b41b70af53c58a4e749500d397db051b8 new file mode 100644 index 000000000..0810b1add --- /dev/null +++ b/30/25bd4b41b70af53c58a4e749500d397db051b8 @@ -0,0 +1,148 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 6AE89431FAF + for ; Wed, 11 Apr 2012 11:47:38 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ObFShJJbQywQ for ; + Wed, 11 Apr 2012 11:47:37 -0700 (PDT) +Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) + by olra.theworths.org (Postfix) with ESMTP id 31974431FAE + for ; Wed, 11 Apr 2012 11:47:37 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id B744F68055; Wed, 11 Apr 2012 21:47:32 +0300 (EEST) +From: Tomi Ollila +To: Vladimir Marek , + Notmuch Mail +Subject: Re: [PATCH 1/4] Make configure use /bin/bash instead of /bin/sh +In-Reply-To: <20120411084342.GL10554@pub.czech.sun.com> +References: <1333966665-10469-1-git-send-email-Vladimir.Marek@oracle.com> + <1333966665-10469-2-git-send-email-Vladimir.Marek@oracle.com> + + <20120409121930.GA10554@pub.czech.sun.com> + + <20120411084342.GL10554@pub.czech.sun.com>User-Agent: + Notmuch/0.12+77~gee11800 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 11 Apr 2012 18:47:38 -0000 + +On Wed, Apr 11 2012, Vladimir Marek wrote: + +> Hi, +> + +[ ... ] + +> +>> Does the configure script work if you replace /bin/sh with /bin/ksh +>> in your Solaris box +> +> yes, it does work if executed by /bin/bash or /bin/ksh +> +> +>> If yes, something like the following could be added to the beginning +>> of 'configure' +>> +>> option=option=value +>> if test ! x"${option$*=}" = x"value" 2>/dev/null; then +>> if test x"${PREVENT_LOOPING-}" = x; then +>> PREVENT_LOOPING=true; export PREVENT_LOOPING +>> test ! -x /bin/ksh || exec /bin/ksh "$0" "$@" +>> test ! -x /bin/bash || exec /bin/bash "$0" "$@" +>> fi +>> echo "Cannot find compatible shell for '$0'" >&2 +>> exit 1 +>> fi +> +> Unfortunately, no. The /bin/sh says "bad substitution" and does not run +> the script at all. I also tried +> +> eval 'echo ${A%%1}'; echo ok +> +> but that does not run the 'echo ok' and fails also. + +You're right! I tested this stuff using heirloom-sh +from http://heirloom.sourceforge.net/sh.html + +It is interesting that the shell stops executing when +it finds this syntax (instead of contnuing, even without -e) + +> I can see three possible solutions +> +> 1) use bash or ksh in the shebang line + +Cannot do there are systems lacking /bin/bash & /bin/ksh + +> 2) rewrite the script as I gave the overview + +Some work todo; case construct can do option key matching to get +identical interface and then cut or sed to get just option value. + +> 3) declare that solaris 10 /bin/sh is not compatible with configure +> script +> +> Frankly even 3) is viable option, one just have to remember to run +> 'bash configure'. If everything else would work, I would be happy :) + +Option 4) use the following heuristics: + +case ~ in '~') + if test x"${PREVENT_LOOPING-}" = x; then + PREVENT_LOOPING=true; export PREVENT_LOOPING + for x in /bin/ksh /bin/bash /usr/bin/bash + do test ! -x "$x" || exec "$x" "$0" "$@" + done + fi + echo "Cannot find compatible shell for '$0'" >&2 + exit 1 +esac + +i.e. if tilde expansion is not done guess this shell is not +compatible enough + +Option 5) do substitution check in subshell: + +( option=option=value; : ${option$*=} ) 2>/dev/null || { + if test x"${PREVENT_LOOPING-}" = x; then + PREVENT_LOOPING=true; export PREVENT_LOOPING + for x in /bin/ksh /bin/bash /usr/bin/bash + do test ! -x "$x" || exec "$x" "$0" "$@" + done + fi + echo "Cannot find compatible shell for '$0'" >&2 + exit 1 +} + +> +> Thank you +> -- +> Vlad + +Tomi -- 2.26.2