[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: init.sh: fix EXEEXT shims to work also for names like test-prog
From: |
Jim Meyering |
Subject: |
Re: init.sh: fix EXEEXT shims to work also for names like test-prog |
Date: |
Sun, 21 Feb 2010 17:59:04 +0100 |
Jim Meyering wrote:
> Per discussion last week, here's a patch for init.sh.
> The main goal is to allow the EXEEXT shim business to work
> also for program names like test-program, (containing a hyphen).
>
> I would have liked to skip the invocation of $re_shell_ -c ...
> if the current shell is deemed adequate, but determining that is
> a rats nest, since it would require use of eval, and Solaris'
> /bin/sh handles failing "eval" very poorly. If someone knows how to
> make that more efficient (yet still clean and reliable) for common,
> working shells like dash-or-bash-as-/bin/sh, I'd welcome the tip.
>
> I suppose it could test e.g., $BASH_VERSION, if bash has supported
> the desired features for long enough, or even do version number comparisons,
> but the latter seems not worthwhile.
>
>>From 63509688315d9a8c8e60d8e776736b454f3019f5 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Sun, 21 Feb 2010 17:47:43 +0100
> Subject: [PATCH] init.sh: fix EXEEXT shims to work also for names like
> test-prog
>
> * tests/init.sh: Re-exec a better shell, when needed.
> If the current shell lacks support for posix $(...), an init.sh-using
> test will now try to find a shell that supports that. If EXEEXT is
> nonempty, we also require support for hyphen-in-alias-name and shell
> substitutions like ${var#glob}. Failure to find such a shell results
> in a skipped test.
Whoops.
I'd written this change, but hadn't amended it in yet:
diff --git a/tests/init.sh b/tests/init.sh
index 4debc65..0c84d7b 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -87,6 +87,8 @@ else
done
fi
+shopt -s expand_aliases
+
# We use a trap below for cleanup. This requires us to go through
# hoops to get the right exit status transported through the handler.
# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.