[PATCH] fix regex in AC_DEFINE_UNQUOTED

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] fix regex in AC_DEFINE_UNQUOTED

Paolo Bonzini-2
From: Paolo Bonzini <[hidden email]>

In commit 527f183f I mistakenly used "|" for alternation
instead of "\|".  Fix this.

* lib/autoconf/general.m4 (_AC_DEFINE_UNQUOTED): Use "|" for
basic regex alteration.
* tests/torture.at (Substitute and define special characters):
Add test case.

Signed-off-by: Paolo Bonzini <[hidden email]>
---
 lib/autoconf/general.m4 | 2 +-
 tests/torture.at        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index f7834046..a72dad9e 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2171,7 +2171,7 @@ m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([_$0], $@)])
 # avoid AS_ECHO if "#" is present to avoid confusing m4 with comments,
 # but quadrigraphs are fine in that case.
 m4_define([_AC_DEFINE_UNQUOTED],
-[m4_if(m4_bregexp([$1], [#\|\\\|`\|\(\$\|@S|@\)\((|{|@{:@\)]), [-1],
+[m4_if(m4_bregexp([$1], [#\|\\\|`\|\(\$\|@S|@\)\((\|{\|@{:@\)]), [-1],
        [AS_ECHO(["AS_ESCAPE([$1], [""])"]) >>confdefs.h],
        [cat >>confdefs.h <<_ACEOF
 [$1]
diff --git a/tests/torture.at b/tests/torture.at
index 683d74af..0306b8ef 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -942,6 +942,7 @@ AC_DEFINE_UNQUOTED([unq4], [${baz+set}], [unquoted, test 4])
 AC_DEFINE_UNQUOTED([unq5], ["${baz+`echo "a "' b'`}"], [unquoted, test 5])
 AC_DEFINE_UNQUOTED([unq6], [`echo hi`], [unquoted, test 6])
 AC_DEFINE_UNQUOTED([unq7], ['\\"'], [unquoted, test 7])
+AC_DEFINE_UNQUOTED([unq8], ["@S|@@{:@echo "a "' b'@:}@"], [unquoted, test 8])
 AC_PROG_AWK
 AC_CONFIG_FILES([Foo Zardoz])]])
 
@@ -976,6 +977,7 @@ X@file@
 #define unq5 "a  b"
 #define unq6 hi
 #define unq7 '\"'
+#define unq8 "a  b"
 ]])
 done
 AT_CLEANUP
--
2.13.5


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] fix regex in AC_DEFINE_UNQUOTED

Eric Blake-3
On 08/14/2017 07:44 PM, Paolo Bonzini wrote:

> From: Paolo Bonzini <[hidden email]>
>
> In commit 527f183f I mistakenly used "|" for alternation
> instead of "\|".  Fix this.
>
> * lib/autoconf/general.m4 (_AC_DEFINE_UNQUOTED): Use "|" for
> basic regex alteration.
> * tests/torture.at (Substitute and define special characters):
> Add test case.
>
> Signed-off-by: Paolo Bonzini <[hidden email]>
> ---
>  lib/autoconf/general.m4 | 2 +-
>  tests/torture.at        | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
ACK

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


signature.asc (632 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] fix regex in AC_DEFINE_UNQUOTED

Paolo Bonzini-2
On 15/08/2017 17:13, Eric Blake wrote:

> On 08/14/2017 07:44 PM, Paolo Bonzini wrote:
>> From: Paolo Bonzini <[hidden email]>
>>
>> In commit 527f183f I mistakenly used "|" for alternation
>> instead of "\|".  Fix this.
>>
>> * lib/autoconf/general.m4 (_AC_DEFINE_UNQUOTED): Use "|" for
>> basic regex alteration.
>> * tests/torture.at (Substitute and define special characters):
>> Add test case.
>>
>> Signed-off-by: Paolo Bonzini <[hidden email]>
>> ---
>>  lib/autoconf/general.m4 | 2 +-
>>  tests/torture.at        | 2 ++
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> ACK
>

I don't have commit access. :)

Paolo