[Libreoffice] [PATCH] Work around a bash-ism in configure.in

David Tardon dtardon at redhat.com
Mon Jul 18 22:34:40 PDT 2011


On Mon, Jul 18, 2011 at 05:33:56PM -0700, Mike Eberdt wrote:
> Hi Christian,
> 
> On 07/18/11 04:56, Christian Lohmaier wrote:
> >
> >Hi MIke, *,
> >
> >On Fri, Jul 15, 2011 at 9:34 PM, Mike Eberdt<libreme at comcast.net>  wrote:
> >>
> >>Configure.in eventually gets parsed by /bin/sh, and on Free/Net/OpenBSD
> >>/bin/sh is not synonymous with bash.  Therefore, bash-isms in configure.in
> >>can be problematic.
> >
> Oops, I mistyped; I meant to say that it is 'configure' (not
> 'configure.in') that's getting parsed by /bin/sh.
> 
> >I don't understand your patch then.
> >-if test "$EUID" -eq "0"  -a "z`uname -o 2>/dev/null`" = "zCygwin" ; then
> >+# $EUID is a bash-ism, so we can't assume its existence.
> >[...]
> >+if test "z`uname -o 2>/dev/null`" = "zCygwin"&&  test "$EUID" -eq 0; then
> >
> >So while you converted test "and" link to&&, the $EUID that according
> >to your comment is a bashism still is used. So how does this solve
> >anything?
> >
> While /bin/sh on FreeBSD always evaluates both X and Y in "if test X
> -a Y", it does correctly skip Y when X is false in "if X && Y".  So
> as long as the OS check is first, we don't evaluate $EUID except on
> Cygwin.
> 
> However, the form that Michael Meeks checked in is much better,
> since it avoids the subtlety in the ordering of the 2 tests, while
> still using "test -a" like in the rest of the file.

Why don't we use `id -u` instead of $EUID? That would work even in the
old form (with -a and -eq) and AFAIK it is portable :)

D.


More information about the LibreOffice mailing list