unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Vladimir Marek <Vladimir.Marek@Oracle.COM>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH 1/4] Make configure use /bin/bash instead of /bin/sh
Date: Wed, 11 Apr 2012 21:47:32 +0300	[thread overview]
Message-ID: <m2wr5mm7gb.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20120411084342.GL10554@pub.czech.sun.com>

On Wed, Apr 11 2012, Vladimir Marek <Vladimir.Marek@Oracle.COM> 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

  reply	other threads:[~2012-04-11 18:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 10:17 notmuch on Solaris Vladimir.Marek
2012-04-09 10:17 ` [PATCH 1/4] Make configure use /bin/bash instead of /bin/sh Vladimir.Marek
2012-04-09 11:10   ` Jani Nikula
2012-04-09 12:19     ` Vladimir Marek
2012-04-10 17:26       ` Tomi Ollila
2012-04-11  8:43         ` Vladimir Marek
2012-04-11 18:47           ` Tomi Ollila [this message]
2012-04-30 11:58   ` David Bremner
2012-04-30 12:09     ` Tomi Ollila
2012-04-09 10:17 ` [PATCH 2/4] dirent->d_type not available on Soalris Vladimir.Marek
2012-04-09 11:17   ` Jani Nikula
2012-04-09 15:12     ` Vladimir Marek
2012-04-09 15:46       ` Adam Wolfe Gordon
2012-04-09 16:32         ` Vladimir.Marek
2012-04-11 18:57           ` Tomi Ollila
2012-04-11 19:36           ` Austin Clements
2012-04-09 10:17 ` [PATCH 3/4] Private strsep implementation Vladimir.Marek
2012-10-15  5:05   ` Ethan Glasser-Camp
2012-04-09 10:17 ` [PATCH 4/4] Explicitly type void* pointers Vladimir.Marek
2012-04-09 11:04   ` Jani Nikula
2012-04-09 18:15     ` Vladimir Marek
2012-04-09 21:31       ` Jani Nikula
2012-04-10  6:53         ` Vladimir Marek
2012-04-11 21:11         ` Austin Clements
2012-04-12  8:02           ` Jani Nikula
2012-04-12 17:57             ` Austin Clements
2012-04-15 21:05   ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2wr5mm7gb.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=Vladimir.Marek@Oracle.COM \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).