[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AS_IF breakage
From: |
Eric Blake |
Subject: |
Re: AS_IF breakage |
Date: |
Tue, 14 Apr 2009 19:09:13 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Ralf Wildenhues on 4/14/2009 11:49 AM:
> Hi Eric,
Hi Ralf,
>> $ zsh -c 'emulate sh; false; $empty; echo $?'
>> 1
>
> Present in zsh 4.3.6, not present in zsh 4.3.4, BTW.
I'm still trying to figure out where best to document this in the manual.
> Here's an idea: let's not be smarter than we can be.
>
>> So, would we rather write:
> [...]
>> or revert today's patch to the simpler
>>
>> m4_define([_AS_IF_ELSE],
>> [m4_ifnblank([$1],
>> [else
>> $1
>> ])])
>
> That is my favorite; along with not promising that we avoid shell syntax
> errors at all costs.
That was my conclusion as well. I'm pushing this, once a full testsuite
run finishes:
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAknlM7kACgkQ84KuGfSFAYANLQCfeRKCh/40p8t8UWfT64fTcHAK
SqQAn1z+OP4uwdDKgArtiHoVsf4hMa6i
=wEUx
-----END PGP SIGNATURE-----
>From f5a63e04f39bdd9ec452dd5332e24c4aad0b45bb Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 14 Apr 2009 19:06:27 -0600
Subject: [PATCH] Fix yesterday's regression in AS_IF.
* lib/m4sugar/m4sh.m4 (_AS_IF_ELSE): Don't corrupt $? in else
branch; the user has to avoid syntax errors.
* tests/m4sh.at (AS@&address@hidden and AS@&address@hidden): Adjust test.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 7 +++++++
lib/m4sugar/m4sh.m4 | 2 +-
tests/m4sh.at | 5 ++++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 68cd416..b6af52a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-14 Eric Blake <address@hidden>
+
+ Fix yesterday's regression in AS_IF.
+ * lib/m4sugar/m4sh.m4 (_AS_IF_ELSE): Don't corrupt $? in else
+ branch; the user has to avoid syntax errors.
+ * tests/m4sh.at (AS@&address@hidden and AS@&address@hidden): Adjust
test.
+
2009-04-14 Ralf Wildenhues <address@hidden>
Add traces for AM_SILENT_RULES.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 052c7eb..3c05201 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -609,7 +609,7 @@ m4_define([_AS_IF],
])
m4_define([_AS_IF_ELSE],
[m4_ifnblank([$1],
-[else :
+[else
$1
])])
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 5f7dc84..065a9dd 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -862,8 +862,11 @@ AS_CASE([foo], [foo], m4_do(AS_CASE([bar], [bar], [echo
sixteen])))
dnl Handle blank arguments.
AS_IF([false], [:], [ ]) && AS_CASE([foo], [foo], []
) && echo seventeen
-m4_define([empty])AS_IF([false], [:], [empty]
+m4_define([empty])AS_IF([:], [empty]
) && AS_CASE([foo], [foo], [empty]) && echo eighteen
+dnl We can't handle AS_IF([false], [:], [empty]) unless m4_expand is
+dnl taught how to handle m4_require. The user is responsible for
+dnl avoiding the syntax error in that case.
# check that require works correctly
m4_for([n], 1, 9, [],
--
1.6.1.2