[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] posix-shell.m4: fix typo that made this test malfunction
From: |
Jim Meyering |
Subject: |
Re: [PATCH] posix-shell.m4: fix typo that made this test malfunction |
Date: |
Thu, 10 Jul 2008 08:43:26 +0200 |
Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> + f () { test $v = "$(printenv v)"; func_return $?; }
>> + v=2 f &&
>
> That doesn't look right to me. I don't think POSIX requires
> that test to succeed.
>
> Hmm, let me find that language-lawyer hat! Here are some quotes:
;-)
...
> So, there's no requirement that function executions be treated like
> ordinary commands as far as the "a=b f" syntax goes. On the contrary,
> it looks more the other way around: if F is a function, "a=b f" looks
> like it is supposed to be executed as if it were "a=b; f".
>
> I fully admit that many real implementations disagree with the
> interpretation of POSIX given in the previous paragraph. (Maybe
> someone should file an interpretation request. :-) Given all the
> real-world problems with this syntax, though, it would seem unwise to
> test or rely on this particular feature.
Given that both dash and Solaris 11's /bin/sh didn't accept it,
I was skeptical that bash's behavior was required by POSIX.
Thanks for confirming.
Here's a proposed work-around:
>From b1a1fcbf578a3d2be1d616b6675a7702c8fde49b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 10 Jul 2008 08:41:28 +0200
Subject: [PATCH] make check: accommodate stricter POSIX-conforming shells
Without this, test-related variable settings were not exported to
the shell_or_perl_ function when using dash or Solaris 11's /bin/sh.
* tests/check.mk (TESTS_ENVIRONMENT): Use an explicit "export",
so as not to rely on non-POSIX behavior of some /bin/sh (e.g.,
bash-based ones).
---
tests/check.mk | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tests/check.mk b/tests/check.mk
index c494da0..4fca283 100644
--- a/tests/check.mk
+++ b/tests/check.mk
@@ -67,6 +67,7 @@ TESTS_ENVIRONMENT = \
$(SHELL) "$$1"; \
fi; \
}; \
+ export \
LOCALE_FR='$(LOCALE_FR)' \
abs_top_builddir='$(abs_top_builddir)' \
abs_top_srcdir='$(abs_top_srcdir)' \
@@ -86,7 +87,7 @@ TESTS_ENVIRONMENT = \
PERL='$(PERL)' \
REPLACE_GETCWD=$(REPLACE_GETCWD) \
PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
- shell_or_perl_
+ ; shell_or_perl_
TEST_LOGS = $(TESTS:=.log)
--
1.5.6.2.257.g3c010