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

Mike Eberdt libreme at comcast.net
Mon Jul 18 17:33:56 PDT 2011


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.

>
> (Besides that, configure is created with shebang of /bin/bash here)
>
Hmm. For me, 'configure' begins with #!/bin/sh on Linux as well as on FreeBSD.

ME


More information about the LibreOffice mailing list